diff --git a/Netdisco/Changes b/Netdisco/Changes index 56204e7b..03a77bfe 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -12,9 +12,10 @@ * Use Path::Class for path and file name construction consistently * Avoid use of DNS when looking up devices in DB by IP - [BIG FIXES] + [BUG FIXES] * Search by device port MAC no longer fatal + * URI and HTML escape template variables 2.005000_002 - 2013-02-10 diff --git a/Netdisco/share/views/ajax/device/addresses.tt b/Netdisco/share/views/ajax/device/addresses.tt index 8fba4a97..5c54aa64 100644 --- a/Netdisco/share/views/ajax/device/addresses.tt +++ b/Netdisco/share/views/ajax/device/addresses.tt @@ -11,13 +11,13 @@ [% WHILE (row = results.next) %] - [% row.alias %] - [% row.dns %] + [% row.alias | html_entity %] + [% row.dns | html_entity %] [% row.port %] - [% row.device_port.name %] + href="[% device_ports %]&q=[% params.q | uri %]&f=[% row.port | uri %]">[% row.port | html_entity %] + [% row.device_port.name | html_entity %] [% row.subnet %] + href="[% search_device %]&ip=[% row.subnet | uri %]">[% row.subnet | html_entity %] [% END %] diff --git a/Netdisco/share/views/ajax/device/details.tt b/Netdisco/share/views/ajax/device/details.tt index 11d49860..2bd1a0f1 100644 --- a/Netdisco/share/views/ajax/device/details.tt +++ b/Netdisco/share/views/ajax/device/details.tt @@ -13,12 +13,12 @@ [% IF vars.user.port_control %] - [% d.location %] + [% d.location | html_entity %] [% ELSE %] [% d.location %] + href="[% search_device %]&location=[% d.location | uri %]">[% d.location | html_entity %] [% END %] @@ -30,68 +30,68 @@ [% IF vars.user.port_control %] - [% d.contact %] + data-field="contact" data-for-device="[% d.ip | html_entity %]"> + [% d.contact | html_entity %] [% ELSE %] - [% d.contact %] + [% d.contact | html_entity %] [% END %] Vendor / Model [% d.vendor %] + href="[% search_device %]&vendor=[% d.vendor | uri %]">[% d.vendor | html_entity %] / [% d.model %] + href="[% search_device %]&model=[% d.model | uri %]">[% d.model | html_entity %] OS / Version - [% d.os %] / + [% d.os | html_entity %] / [% d.os_ver %] + href="[% search_device %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver | html_entity %] Serial Number - [% d.serial %] + [% d.serial | html_entity %] Description - [% d.description.replace(', ',",
") %] + [% d.description | html_entity | html_line_break %] Uptime - [% d.uptime_age %] + [% d.uptime_age | html_entity %] Last Discover - [% d.last_discover_stamp %] + [% d.last_discover_stamp | html_entity %] Last Arpnip - [% d.last_arpnip_stamp %] + [% d.last_arpnip_stamp | html_entity %] Last Macsuck - [% d.last_macsuck_stamp %] + [% d.last_macsuck_stamp | html_entity %] Hardware Status - Fan: [% d.fan %] -
PS1 [[% d.ps1_type %]]: [% d.ps1_status %] -
PS2 [[% d.ps2_type %]]: [% d.ps2_status %] + Fan: [% d.fan | html_entity %] +
PS1 [[% d.ps1_type | html_entity %]]: [% d.ps1_status | html_entity %] +
PS2 [[% d.ps2_type | html_entity %]]: [% d.ps2_status | html_entity %] MAC Address - [% d.mac %] + [% d.mac | html_entity %] VTP Domain - [% d.vtp_domain %] + [% d.vtp_domain | html_entity %] diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index fb6a27ee..c854ea72 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -6,7 +6,7 @@ [% NEXT IF item.name == 'c_admin' %] [% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %] [% NEXT UNLESS params.${item.name} %] - [% item.label %] + [% item.label | html_entity %] [% END %] @@ -29,13 +29,13 @@ [% IF vars.user.port_control AND params.c_admin %] [% IF row.up_admin == 'up' %] + data-field="c_port" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]"> [% ELSE %] + data-field="c_port" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]"> @@ -72,7 +72,7 @@ [% IF params.c_name %] [% IF vars.user.port_control AND params.c_admin %] + data-field="c_name" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]"> [% ELSE %] @@ -98,7 +98,7 @@ [% IF params.c_vlan %] [% IF vars.user.port_control AND params.c_admin %] + data-field="c_vlan" data-for-device="[% device | html_entity %]" data-for-port="[% row.port | html_entity %]">
[% IF row.vlan %][% row.vlan | html_entity %][% END %] @@ -140,7 +140,7 @@ [% IF row.power.admin == 'true' %] [% IF vars.user.port_control AND params.c_admin %] [% IF row.power.power > 0 %] - [% row.power.power %] mW + [% row.power.power | html_entity %] mW [% ELSE %] - ([% row.power.status %]) + ([% row.power.status | html_entity %]) [% END %] [% ELSE %] [% IF vars.user.port_control AND params.c_admin %] - [% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %] + [% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip | html_entity %] ([% row.remote_port | html_entity %]) [% ELSE %] N - [% row.remote_ip %] (port: [% row.remote_port %] - id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id %]) + [% row.remote_ip | html_entity %] (port: [% row.remote_port | html_entity %] + id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id | html_entity %]) [% END %] [% END %] [% IF params.c_nodes %] [% FOREACH node IN row.$nodes %] [% '
' IF row.remote_ip OR NOT loop.first %] [% 'A  ' IF NOT node.active %] - [% node.mac %] + [% node.mac | html_entity %] [% ' (' _ node.time_last_age _ ')' IF params.n_age %] [% IF params.n_ip %] [% FOREACH ip IN node.ips %]
  [% 'A  ' IF NOT ip.active %] [% SET dns = ip.dns %] [% IF dns %] - [% dns %] ([% ip.ip %]) + [% dns %] ([% ip.ip | html_entity %]) [% ELSE %] - [% ip.ip %] + [% ip.ip | html_entity %] [% END %] [% END %] [% END %] diff --git a/Netdisco/share/views/ajax/search/device.tt b/Netdisco/share/views/ajax/search/device.tt index f9315b65..10e3f560 100644 --- a/Netdisco/share/views/ajax/search/device.tt +++ b/Netdisco/share/views/ajax/search/device.tt @@ -14,15 +14,14 @@ [% WHILE (row = results.next) %] - [% row.dns || row.ip %] - [% row.contact %] - [% row.location %] - [% row.name %] - - [% row.model %] - [% row.os_ver %] - [% row.ip %] - [% row.serial %] + [% row.dns || row.ip | html_entity %] + [% row.contact | html_entity %] + [% row.location | html_entity %] + [% row.name | html_entity %] + [% row.model | html_entity %] + [% row.os_ver | html_entity %] + [% row.ip | html_entity %] + [% row.serial | html_entity %] [% END %] diff --git a/Netdisco/share/views/ajax/search/node_by_ip.tt b/Netdisco/share/views/ajax/search/node_by_ip.tt index b4794be1..896ab5a9 100644 --- a/Netdisco/share/views/ajax/search/node_by_ip.tt +++ b/Netdisco/share/views/ajax/search/node_by_ip.tt @@ -17,18 +17,18 @@ [% WHILE (row = macs.next) %] [% row.mac %] + href="[% search_node %]&q=[% row.mac | uri %]">[% row.mac | html_entity %] [% IF params.vendor %] - [% row.oui.company %] + [% row.oui.company | html_entity %] [% END %] IP → MAC - [% row.ip %] + [% row.ip | html_entity %] [% ' A' IF NOT row.active %] [% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %] [% IF params.stamps %] - [% row.time_first_stamp %] - [% row.time_last_stamp %] + [% row.time_first_stamp | html_entity %] + [% row.time_last_stamp | html_entity %] [% END %] [% FOREACH node IN row.node_sightings(archive_filter) %] @@ -39,16 +39,16 @@ [% END %] Switch Port - [% node.switch %] - [% node.port %] + href="[% device_ports %]&q=[% node.device.dns || node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> + [% node.switch | html_entity %] - [% node.port | html_entity %] [% ' A' IF NOT node.active %] [% IF node.device.dns AND node.device_port AND node.device_port.name %] - ([% node.device.dns %] - [% node.device_port.name %]) + ([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %]) [% END %] [% IF params.stamps %] - [% node.time_first_stamp %] - [% node.time_last_stamp %] + [% node.time_first_stamp | html_entity %] + [% node.time_last_stamp | html_entity %] [% END %] [% END %] @@ -59,13 +59,13 @@   [% END %] MAC → IP - [% nodeip.ip %] + [% nodeip.ip | html_entity %] [% ' A' IF NOT nodeip.active %] [% ' (' _ nodeip.dns.remove(settings.domain_suffix) _ ')' IF nodeip.dns %] [% IF params.stamps %] - [% nodeip.time_first_stamp %] - [% nodeip.time_last_stamp %] + [% nodeip.time_first_stamp | html_entity %] + [% nodeip.time_last_stamp | html_entity %] [% END %] [% END %] diff --git a/Netdisco/share/views/ajax/search/node_by_mac.tt b/Netdisco/share/views/ajax/search/node_by_mac.tt index c9463bce..63638d80 100644 --- a/Netdisco/share/views/ajax/search/node_by_mac.tt +++ b/Netdisco/share/views/ajax/search/node_by_mac.tt @@ -20,7 +20,7 @@ [% IF first_row %] [% row.mac %] + href="[% search_node %]&q=[% row.mac | uri %]">[% row.mac | html_entity %] [% ELSE %]   [% END %] @@ -28,20 +28,20 @@ [% IF params.vendor %] [% IF first_row %] - [% row.oui.company %] + [% row.oui.company | html_entity %] [% ELSE %]   [% END %] [% END %] MAC → IP - [% row.ip %] + [% row.ip | html_entity %] [% ' A' IF NOT row.active %] [% ' (' _ row.dns.remove(settings.domain_suffix) _ ')' IF row.dns %] [% IF params.stamps %] - [% row.time_first_stamp %] - [% row.time_last_stamp %] + [% row.time_first_stamp | html_entity %] + [% row.time_last_stamp | html_entity %] [% END %] [% SET first_row = 0 %] @@ -51,7 +51,7 @@ [% IF first_row %] [% node.mac %] + href="[% search_node %]&q=[% node.mac | uri %]">[% node.mac | html_entity %] [% ELSE %]   [% END %] @@ -59,7 +59,7 @@ [% IF params.vendor %] [% IF first_row %] - [% node.oui.company %] + [% node.oui.company | html_entity %] [% ELSE %]   [% END %] @@ -67,16 +67,16 @@ [% END %] Switch Port - [% node.switch %] - [% node.port %] + href="[% device_ports %]&q=[% node.device.dns || node.switch | uri %]&f=[% node.port | uri %]&c_nodes=on&c_neighbors=on"> + [% node.switch | html_entity %] - [% node.port | html_entity %] [% ' A' IF NOT node.active %] [% IF node.device.dns AND node.device_port AND node.device_port.name %] - ([% node.device.dns %] - [% node.device_port.name %]) + ([% node.device.dns | html_entity %] - [% node.device_port.name | html_entity %]) [% END %] [% IF params.stamps %] - [% node.time_first_stamp %] - [% node.time_last_stamp %] + [% node.time_first_stamp | html_entity %] + [% node.time_last_stamp | html_entity %] [% END %] [% SET first_row = 0 %] @@ -86,7 +86,7 @@ [% IF first_row %] [% port.mac %] + href="[% search_node %]&q=[% port.mac | uri %]">[% port.mac | html_entity %] [% ELSE %]   [% END %] @@ -94,7 +94,7 @@ [% IF params.vendor %] [% IF first_row %] - [% port.oui.company %] + [% port.oui.company | html_entity %] [% ELSE %]   [% END %] @@ -102,15 +102,15 @@ [% END %] Switch Port - [% port.ip %] - [% port.descr %] + href="[% device_ports %]&q=[% port.device.dns || port.ip | uri %]&f=[% port.port | uri %]&c_mac=on&c_nodes=on&c_neighbors=on"> + [% port.ip | html_entity %] - [% port.descr | html_entity %] [% IF port.device.dns AND port.name %] - ([% port.device.dns %] - [% port.name %]) + ([% port.device.dns | html_entity %] - [% port.name | html_entity %]) [% END %] [% IF params.stamps %] - [% port.creation %] - [% port.creation %] + [% port.creation | html_entity %] + [% port.creation | html_entity %] [% END %] [% SET first_row = 0 %] diff --git a/Netdisco/share/views/ajax/search/port.tt b/Netdisco/share/views/ajax/search/port.tt index cfec8d08..5d0acef7 100644 --- a/Netdisco/share/views/ajax/search/port.tt +++ b/Netdisco/share/views/ajax/search/port.tt @@ -10,12 +10,13 @@ [% WHILE (row = results.next) %] - [% row.name %] - [% row.ip %] [ [% row.port %] ] + [% row.name | html_entity %] + + [% row.ip | html_entity %] [ [% row.port | html_entity %] ] [% ' (' _ row.device.dns _ ')' IF row.device.dns %] - [% row.descr %] - [% row.vlan %] + [% row.descr | html_entity %] + [% row.vlan | html_entity %] [% END %] diff --git a/Netdisco/share/views/ajax/search/vlan.tt b/Netdisco/share/views/ajax/search/vlan.tt index 262308e5..1e6e663a 100644 --- a/Netdisco/share/views/ajax/search/vlan.tt +++ b/Netdisco/share/views/ajax/search/vlan.tt @@ -13,17 +13,17 @@ [% WHILE (row = results.next) %] [% row.vlan.vlan %] + href="[% device_ports %]&q=[% row.dns || row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.vlan.vlan | html_entity %] [% row.dns || row.ip %] + href="[% device_ports %]&q=[% row.dns || row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.dns || row.ip | html_entity %] [% row.vlan.description %] + href="[% device_ports %]&q=[% row.dns || row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.vlan.description | html_entity %] [% row.model %] + href="[% device_ports %]&q=[% row.dns || row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.model | html_entity %] [% row.os %] + href="[% device_ports %]&q=[% row.dns || row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.os | html_entity %] [% row.vendor %] + href="[% device_ports %]&q=[% row.dns || row.ip | uri %]&f=[% row.vlan.vlan | uri %]">[% row.vendor | html_entity %] [% END %] diff --git a/Netdisco/share/views/device.tt b/Netdisco/share/views/device.tt index 08da8cba..18584a61 100644 --- a/Netdisco/share/views/device.tt +++ b/Netdisco/share/views/device.tt @@ -29,8 +29,8 @@ [% CATCH %] - - + + [% END %] @@ -45,7 +45,7 @@ [% FOREACH tab IN settings.device_tabs %] [% tab.label %] [% END %] - [% d.dns || d.name %] + [% d.dns || d.name | html_entity %]
[% FOREACH tab IN settings.device_tabs %] diff --git a/Netdisco/share/views/index.tt b/Netdisco/share/views/index.tt index 640b2a6b..cbf034c2 100644 --- a/Netdisco/share/views/index.tt +++ b/Netdisco/share/views/index.tt @@ -37,7 +37,7 @@
[% IF vars.requested_path %] - + [% END %] [% ELSE %] diff --git a/Netdisco/share/views/inventory.tt b/Netdisco/share/views/inventory.tt index 8f3fc9c4..41f379c7 100644 --- a/Netdisco/share/views/inventory.tt +++ b/Netdisco/share/views/inventory.tt @@ -17,15 +17,15 @@ - [% platform.vendor %] + href="[% search_device %]&vendor=[% platform.vendor | uri %]"> + [% platform.vendor | html_entity %] - [% platform.model %] + href="[% search_device %]&model=[% platform.model | uri %]"> + [% platform.model | html_entity %] - [% platform.get_column('count') %] + [% platform.get_column('count') | html_entity %] [% END %] @@ -45,13 +45,13 @@ [% FOREACH release IN releases.all %] [% NEXT UNLESS (release.os AND release.os_ver) %] - [% release.os %] + [% release.os | html_entity %] - [% release.os_ver %] + href="[% search_device %]&os_ver=[% release.os_ver | uri %]"> + [% release.os_ver | html_entity %] - [% release.get_column('count') %] + [% release.get_column('count') | html_entity %] [% END %] diff --git a/Netdisco/share/views/layouts/main.tt b/Netdisco/share/views/layouts/main.tt index 8a1dee70..2d4f1725 100644 --- a/Netdisco/share/views/layouts/main.tt +++ b/Netdisco/share/views/layouts/main.tt @@ -2,7 +2,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> - + Netdisco @@ -54,7 +54,7 @@
diff --git a/Netdisco/share/views/sidebar/search/node.tt b/Netdisco/share/views/sidebar/search/node.tt index 4aac3142..58f32eb4 100644 --- a/Netdisco/share/views/sidebar/search/node.tt +++ b/Netdisco/share/views/sidebar/search/node.tt @@ -1,6 +1,6 @@

Node Search Options

- +