From 065bd33d2ef1967d976e40842f4eb34f9a487a5f Mon Sep 17 00:00:00 2001 From: Chris Rowe Date: Sun, 12 Feb 2017 03:46:46 +0000 Subject: [PATCH 01/55] Fix incorrect sorting for various dropdown lists. --- src/etc/inc/gwlb.inc | 3 +++ src/etc/inc/util.inc | 3 ++- src/usr/local/www/firewall_nat_edit.php | 15 +++++++++++---- src/usr/local/www/firewall_nat_out_edit.php | 12 +++++++++--- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/src/etc/inc/gwlb.inc b/src/etc/inc/gwlb.inc index f3e7904989..d7cecc03be 100644 --- a/src/etc/inc/gwlb.inc +++ b/src/etc/inc/gwlb.inc @@ -630,6 +630,9 @@ function return_gateways_array($disabled = false, $localhost = false, $inactive } } unset($gateway); + + //Sort the array by GW name before moving on. + ksort($gateways_arr, SORT_STRING | SORT_FLAG_CASE); /* Loop through all interfaces with a gateway and add it to a array */ if ($disabled == false) { diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 937f8999cf..2191f8476a 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1420,7 +1420,8 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled = } } } - + + asort($iflist); return $iflist; } diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php index ba6d86be4c..ad8b8624b1 100644 --- a/src/usr/local/www/firewall_nat_edit.php +++ b/src/usr/local/www/firewall_nat_edit.php @@ -583,14 +583,16 @@ function build_dsttype_list() { $list[$ifent . 'ip'] = $ifdesc . ' address'; } } - + + //Temporary array so we can sort IPs + $templist = array(); if (is_array($config['virtualip']['vip'])) { foreach ($config['virtualip']['vip'] as $sn) { if (is_ipaddrv6($sn['subnet'])) { continue; } if (($sn['mode'] == "proxyarp" || $sn['mode'] == "other") && $sn['type'] == "network") { - $list[$sn['subnet'] . '/' . $sn['subnet_bits']] = 'Subnet: ' . $sn['subnet'] . '/' . $sn['subnet_bits'] . ' (' . $sn['descr'] . ')'; + $templist[$sn['subnet'] . '/' . $sn['subnet_bits']] = 'Subnet: ' . $sn['subnet'] . '/' . $sn['subnet_bits'] . ' (' . $sn['descr'] . ')'; if (isset($sn['noexpand'])) { continue; } @@ -601,13 +603,18 @@ function build_dsttype_list() { for ($i = 0; $i <= $len; $i++) { $snip = long2ip32($start+$i); - $list[$snip] = $snip . ' (' . $sn['descr'] . ')'; + $templist[$snip] = $snip . ' (' . $sn['descr'] . ')'; } } else { - $list[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')'; + $templist[$sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')'; } } } + + //Sort temp IP array and append onto main array + asort($templist); + $list = array_merge($list, $templist); + unset($templist); return($list); } diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 3f182ca5b5..8ff7f96ae5 100644 --- a/src/usr/local/www/firewall_nat_out_edit.php +++ b/src/usr/local/www/firewall_nat_out_edit.php @@ -406,10 +406,12 @@ function build_target_list() { $list[""] = gettext('Interface Address'); + //Temporary array so we can sort IPs + $templist = array(); if (is_array($config['virtualip']['vip'])) { foreach ($config['virtualip']['vip'] as $sn) { if (($sn['mode'] == "proxyarp" || $sn['mode'] == "other") && $sn['type'] == "network") { - $list['S' . $sn['subnet'] . '/' . $sn['subnet_bits']] = gettext('Subnet: ') . $sn['subnet'] . '/' . $sn['subnet_bits'] . ' (' . $sn['descr'] . ')'; + $templist['S' . $sn['subnet'] . '/' . $sn['subnet_bits']] = gettext('Subnet: ') . $sn['subnet'] . '/' . $sn['subnet_bits'] . ' (' . $sn['descr'] . ')'; if (isset($sn['noexpand'])) { continue; } @@ -419,13 +421,17 @@ function build_target_list() { for ($i = 0; $i <= $len; $i++) { $snip = long2ip32($start+$i); - $list['I' . $snip] = $snip . ' (' . $sn['descr'] . ')'; + $templist['I' . $snip] = $snip . ' (' . $sn['descr'] . ')'; } } else { - $list['I' . $sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')'; + $templist['I' . $sn['subnet']] = $sn['subnet'] . ' (' . $sn['descr'] . ')'; } } } + asort($templist); + //Append sorted IP array onto main array + $list = array_merge($list, $templist); + unset($templist); foreach ($a_aliases as $alias) { if ($alias['type'] != "host") { From f19813740ffc1c6ce1566415210bffa6bcc1dc6c Mon Sep 17 00:00:00 2001 From: NOYB Date: Tue, 21 Feb 2017 00:19:27 -0800 Subject: [PATCH 02/55] GitSync - Remove your personalizations --- src/etc/phpshellsessions/gitsync | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/etc/phpshellsessions/gitsync b/src/etc/phpshellsessions/gitsync index 26874c75ba..0ac9479b36 100644 --- a/src/etc/phpshellsessions/gitsync +++ b/src/etc/phpshellsessions/gitsync @@ -512,8 +512,8 @@ if (!$upgrading) { echo "===> Checkout complete.\n"; echo "\n"; if (!$upgrading) { - echo "Your system is now sync'd and PHP and nginx will be restarted in 5 seconds.\n\n"; + echo "The system is now sync'd and PHP and nginx will be restarted in 5 seconds.\n\n"; } else { - echo "Your system is now sync'd.\n\n"; + echo "The system is now sync'd.\n\n"; } From 7d1b5bd3c782d419b8c51dbad92aac932e4dc9f6 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sun, 26 Feb 2017 20:33:46 +0100 Subject: [PATCH 03/55] Reduce numeric precision in gateways widget to single decimal place (Feature #6841) --- src/usr/local/www/widgets/widgets/gateways.widget.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/usr/local/www/widgets/widgets/gateways.widget.php b/src/usr/local/www/widgets/widgets/gateways.widget.php index c854df5be1..7b9b13d588 100644 --- a/src/usr/local/www/widgets/widgets/gateways.widget.php +++ b/src/usr/local/www/widgets/widgets/gateways.widget.php @@ -310,8 +310,8 @@ function compose_table_body_contents() { $bgcolor = "info"; // lightblue } - $rtnstr .= "" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['delay']) : gettext("Pending")) . "\n"; - $rtnstr .= "" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['stddev']) : gettext("Pending")) . "\n"; + $rtnstr .= "" . ($gateways_status[$gname] ? ($gateways_status[$gname]['delay'] ? htmlspecialchars(number_format((float)rtrim($gateways_status[$gname]['delay'], "ms"), 1)) . "ms" : '') : gettext("Pending")) . "\n"; + $rtnstr .= "" . ($gateways_status[$gname] ? ($gateways_status[$gname]['stddev'] ? htmlspecialchars(number_format((float)rtrim($gateways_status[$gname]['stddev'], "ms"), 1)) . "ms" : '') : gettext("Pending")) . "\n"; $rtnstr .= "" . ($gateways_status[$gname] ? htmlspecialchars($gateways_status[$gname]['loss']) : gettext("Pending")) . "\n"; $rtnstr .= '' . $online . "\n"; $rtnstr .= "\n"; From 1008f6fd833a9e8693f2b4dd8c605896c3dd3b08 Mon Sep 17 00:00:00 2001 From: doktornotor Date: Fri, 3 Mar 2017 11:15:01 +0100 Subject: [PATCH 04/55] Sanitize linebreaks for textarea fields in packages on save (Bug #5306) --- src/usr/local/www/pkg_edit.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/usr/local/www/pkg_edit.php b/src/usr/local/www/pkg_edit.php index 559645b07e..f2603e5e3b 100644 --- a/src/usr/local/www/pkg_edit.php +++ b/src/usr/local/www/pkg_edit.php @@ -33,6 +33,7 @@ require_once("functions.inc"); require_once("filter.inc"); require_once("shaper.inc"); require_once("pkg-utils.inc"); +require_once("util.inc"); /* dummy stubs needed by some code that was MFC'd */ function pfSenseHeader($location) { @@ -159,7 +160,6 @@ if ($_POST) { } } - // donotsave is enabled. lets simply exit. if (empty($pkg['donotsave'])) { // store values in xml configuration file. @@ -175,11 +175,24 @@ if ($_POST) { foreach ($_POST as $key => $value) { $matches = array(); if (preg_match("/^{$rowhelperfield['fieldname']}(\d+)$/", $key, $matches)) { - $pkgarr[$rowhelpername][$matches[1]][$rowhelperfield['fieldname']] = $value; + if ($rowhelperfield['type'] == "textarea") { + $pkgarr[$rowhelpername][$matches[1]][$rowhelperfield['fieldname']] = unixnewlines($value); + } else { + $pkgarr[$rowhelpername][$matches[1]][$rowhelperfield['fieldname']] = $value; + } } } } break; + case "textarea": + $fieldname = $fields['fieldname']; + $fieldvalue = unixnewlines(trim($_POST[$fieldname])); + if ($fields['encoding'] == 'base64') { + $fieldvalue = base64_encode($fieldvalue); + } + if ($fieldname) { + $pkgarr[$fieldname] = $fieldvalue; + } default: $fieldname = $fields['fieldname']; if ($fieldname == "interface_array") { @@ -243,6 +256,7 @@ if ($_POST) { $get_from_post = true; } } elseif (!$input_errors) { + // donotsave is enabled. lets simply exit. exit; } } From 638a79478ea54a2ffb4554368b3b9ac994985ed7 Mon Sep 17 00:00:00 2001 From: stilez Date: Sun, 5 Mar 2017 10:42:18 +0000 Subject: [PATCH 05/55] Clearer narrative for domain override edit page --- .../local/www/services_unbound_domainoverride_edit.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/usr/local/www/services_unbound_domainoverride_edit.php b/src/usr/local/www/services_unbound_domainoverride_edit.php index e87122bd21..586131bfc5 100644 --- a/src/usr/local/www/services_unbound_domainoverride_edit.php +++ b/src/usr/local/www/services_unbound_domainoverride_edit.php @@ -114,14 +114,14 @@ if ($input_errors) { $form = new Form(); -$section = new Form_Section('Domain Override'); +$section = new Form_Section('Domains to Override with Custom Lookup Servers'); $section->addInput(new Form_Input( 'domain', '*Domain', 'text', $pconfig['domain'] -))->setHelp('Domain to override (NOTE: this does not have to be a valid TLD!) e.g.: test or mycompany.localdomain or 1.168.192.in-addr.arpa'); +))->setHelp('Domain whose lookups will be directed to a user-specified DNS lookup server.'); $section->addInput(new Form_IpAddress( 'ip', @@ -146,6 +146,12 @@ if (isset($id) && $a_domainOverrides[$id]) { )); } +$section->setHelp("This page is used to specify domains for which the resolver's standard DNS lookup process will be overridden, " . +"and the resolver will query a different (non-standard) lookup server instead. It is possible to enter \'non-standard\', 'invalid' " . +"and 'local' domains such as 'test', 'mycompany.localdomain', or '1.168.192.in-addr.arpa', as well as usual publicly resolvable " . +"domains such as 'org', 'info', or 'google.co.uk'. The IP entered will be treated as the IP of an authoritative lookup server for " . +"the domain (including all of its subdomains), and other lookup servers will not be queried."); + $form->add($section); print $form; From 1eb759abbf2fa3a24981e986bfe12c454963ee35 Mon Sep 17 00:00:00 2001 From: stilez Date: Sun, 5 Mar 2017 10:50:16 +0000 Subject: [PATCH 06/55] Clearer narrative for domain override on main resolver config page --- src/usr/local/www/services_unbound.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/usr/local/www/services_unbound.php b/src/usr/local/www/services_unbound.php index e0000573c6..471bc7ac28 100644 --- a/src/usr/local/www/services_unbound.php +++ b/src/usr/local/www/services_unbound.php @@ -553,6 +553,13 @@ endforeach; + + Enter any domains for which the resolver's standard DNS lookup process should be overridden and a different (non-standard) + lookup server should be queried instead. Non-standard, 'invalid' and local domains, and subdomains, can also be entered, + such as 'test', 'mycompany.localdomain', '1.168.192.in-addr.arpa', or 'somesite.com'. The IP address is treated as the + authoritative lookup server for the domain (including all of its subdomains), and other lookup servers will not be queried. + +