summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/etc/inc/smtp.inc6
-rw-r--r--src/etc/inc/upgrade_config.inc2
-rw-r--r--src/etc/inc/util.inc54
-rw-r--r--src/usr/local/www/edit.php55
-rwxr-xr-xsrc/usr/local/www/firewall_aliases_edit.php8
-rw-r--r--src/usr/local/www/index.php9
6 files changed, 103 insertions, 31 deletions
diff --git a/src/etc/inc/smtp.inc b/src/etc/inc/smtp.inc
index 54aa8cf..2cae8dd 100644
--- a/src/etc/inc/smtp.inc
+++ b/src/etc/inc/smtp.inc
@@ -1265,12 +1265,14 @@ class smtp_class
elseif($success = ($this->PutLine('STARTTLS')
&& $this->VerifyResultLines('220',$responses)>0))
{
- $this->OutputDebug('Starting TLS cryptograpic protocol');
+ if($this->debug)
+ $this->OutputDebug('Starting TLS cryptograpic protocol');
if(!($success = @stream_socket_enable_crypto($this->connection, 1, STREAM_CRYPTO_METHOD_TLS_CLIENT)))
$this->error = 'could not start TLS connection encryption protocol';
else
{
- $this->OutputDebug('TLS started');
+ if($this->debug)
+ $this->OutputDebug('TLS started');
$success = $this->StartSMTP($localhost);
}
}
diff --git a/src/etc/inc/upgrade_config.inc b/src/etc/inc/upgrade_config.inc
index dedab7c..d627f11 100644
--- a/src/etc/inc/upgrade_config.inc
+++ b/src/etc/inc/upgrade_config.inc
@@ -654,7 +654,7 @@ function upgrade_039_to_040() {
$config['system']['user'][0]['priv'][2]['descr'] = gettext("Indicates whether this user is able to login for example via SSH.");
$config['system']['user'][0]['priv'][3]['id'] = "copyfiles";
$config['system']['user'][0]['priv'][3]['name'] = "Is allowed to copy files";
- $config['system']['user'][0]['priv'][3]['descr'] = sprintf(gettext("Indicates whether this user is allowed to copy files onto the %s appliance via SCP/SFTP. If you are going to use this privilege, you must install scponly on the appliance (Hint: pkg_add -r scponly)."), $g['product_name']);
+ $config['system']['user'][0]['priv'][3]['descr'] = sprintf(gettext("Indicates whether this user is allowed to copy files onto the %s appliance via SCP/SFTP."), $g['product_name']);
$config['system']['user'][0]['priv'][4]['id'] = "isroot";
$config['system']['user'][0]['priv'][4]['name'] = "Is root user";
$config['system']['user'][0]['priv'][4]['descr'] = gettext("This user is associated with the UNIX root user (you should associate this privilege only with one single user).");
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index b542566..c767f25 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -847,36 +847,44 @@ function subnetv4_expand($subnet) {
return $result;
}
-/* find out whether two subnets overlap */
+/* find out whether two IPv4/IPv6 CIDR subnets overlap.
+ Note: CIDR overlap implies one is identical or included so largest sn will be the same */
function check_subnets_overlap($subnet1, $bits1, $subnet2, $bits2) {
-
- if (!is_numeric($bits1)) {
- $bits1 = 32;
- }
- if (!is_numeric($bits2)) {
- $bits2 = 32;
- }
-
- if ($bits1 < $bits2) {
- $relbits = $bits1;
+ if (is_ipaddrv4($subnet1)) {
+ return check_subnetsv4_overlap($subnet1, $bits1, $subnet2, $bits2);
} else {
- $relbits = $bits2;
+ return check_subnetsv6_overlap($subnet1, $bits1, $subnet2, $bits2);
}
+}
- $sn1 = gen_subnet_mask_long($relbits) & ip2long($subnet1);
- $sn2 = gen_subnet_mask_long($relbits) & ip2long($subnet2);
-
- return ($sn1 == $sn2);
+/* find out whether two IPv4 CIDR subnets overlap.
+ Note: CIDR overlap means sn1/sn2 are identical or one is included in other. So sn using largest $bits will be the same */
+function check_subnetsv4_overlap($subnet1, $bits1, $subnet2, $bits2) {
+ $largest_sn = min($bits1, $bits2);
+ $subnetv4_start1 = gen_subnetv4($subnet1, $largest_sn);
+ $subnetv4_start2 = gen_subnetv4($subnet2, $largest_sn);
+
+ if($subnetv4_start1 == '' || $subnetv4_start2 == '') {
+ // One or both args is not a valid IPv4 subnet
+ //FIXME: needs to return "bad data" not true/false if bad. For now return false, best we can do until fixed
+ return false;
+ }
+ return ($subnetv4_start1 == $subnetv4_start2);
}
-/* find out whether two IPv6 subnets overlap */
+/* find out whether two IPv6 CIDR subnets overlap.
+ Note: CIDR overlap means sn1/sn2 are identical or one is included in other. So sn using largest $bits will be the same */
function check_subnetsv6_overlap($subnet1, $bits1, $subnet2, $bits2) {
- $sub1_min = gen_subnetv6($subnet1, $bits1);
- $sub1_max = gen_subnetv6_max($subnet1, $bits1);
- $sub2_min = gen_subnetv6($subnet2, $bits2);
- $sub2_max = gen_subnetv6_max($subnet2, $bits2);
-
- return (is_inrange_v6($sub1_min, $sub2_min, $sub2_max) || is_inrange_v6($sub1_max, $sub2_min, $sub2_max) || is_inrange_v6($sub2_min, $sub1_min, $sub1_max));
+ $largest_sn = min($bits1, $bits2);
+ $subnetv6_start1 = gen_subnetv6($subnet1, $largest_sn);
+ $subnetv6_start2 = gen_subnetv6($subnet2, $largest_sn);
+
+ if($subnetv6_start1 == '' || $subnetv6_start2 == '') {
+ // One or both args is not a valid IPv6 subnet
+ //FIXME: needs to return "bad data" not true/false if bad. For now return false, best we can do until fixed
+ return false;
+ }
+ return ($subnetv6_start1 == $subnetv6_start2);
}
/* return true if $addr is in $subnet, false if not */
diff --git a/src/usr/local/www/edit.php b/src/usr/local/www/edit.php
index fe15105..45fa6c1 100644
--- a/src/usr/local/www/edit.php
+++ b/src/usr/local/www/edit.php
@@ -128,6 +128,9 @@ require("head.inc");
<input type="button" class="btn btn-default btn-sm" onclick="loadFile();" value="<?=gettext('Load')?>" />
<input type="button" class="btn btn-default btn-sm" id="fbOpen" value="<?=gettext('Browse')?>" />
<input type="button" class="btn btn-default btn-sm" onclick="saveFile();" value="<?=gettext('Save')?>" />
+ <span class="pull-right">
+ <button id="btngoto" class="btn btn-default btn-sm"><?=gettext("GoTo Line #")?></button> <input type="number" id="gotoline" width="6"></input>
+ </span>
</form>
<div id="fbBrowser" style="display:none; border:1px dashed gray; width:98%;"></div>
@@ -148,6 +151,58 @@ require("head.inc");
<script type="text/javascript">
//<![CDATA[
+ events.push(function(){
+
+ function showLine(tarea, lineNum) {
+
+ lineNum--; // array starts at 0
+ var lines = tarea.value.split("\n");
+
+ // calculate start/end
+ var startPos = 0, endPos = tarea.value.length;
+ for(var x = 0; x < lines.length; x++) {
+ if(x == lineNum) {
+ break;
+ }
+ startPos += (lines[x].length+1);
+
+ }
+
+ var endPos = lines[lineNum].length+startPos;
+
+ // do selection
+ // Chrome / Firefox
+
+ if(typeof(tarea.selectionStart) != "undefined") {
+ tarea.focus();
+ tarea.selectionStart = startPos;
+ tarea.selectionEnd = endPos;
+ return true;
+ }
+
+ // IE
+ if (document.selection && document.selection.createRange) {
+ tarea.focus();
+ tarea.select();
+ var range = document.selection.createRange();
+ range.collapse(true);
+ range.moveEnd("character", endPos);
+ range.moveStart("character", startPos);
+ range.select();
+ return true;
+ }
+
+ return false;
+ }
+
+ $("#btngoto").prop('type','button');
+
+ $('#btngoto').click(function() {
+ var tarea = document.getElementById("fileContent");
+ showLine(tarea, $('#gotoline').val());
+ });
+ });
+
function loadFile() {
jQuery("#fileStatus").html("");
jQuery("#fileStatusBox").show(500);
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php
index 58717ee..128335d 100755
--- a/src/usr/local/www/firewall_aliases_edit.php
+++ b/src/usr/local/www/firewall_aliases_edit.php
@@ -714,7 +714,13 @@ while ($counter < count($addresses)) {
list($address, $address_subnet) = explode("/", $addresses[$counter]);
} else {
$address = $addresses[$counter];
- $address_subnet = "";
+ if (isset($pconfig['updatefreq'])) {
+ // Note: There is only 1 updatefreq possible.
+ // The alias types that use updatefreq only allow a single entry.
+ $address_subnet = $pconfig['updatefreq'];
+ } else {
+ $address_subnet = "";
+ }
}
$group = new Form_Group($counter == 0 ? $label_str[$tab]:'');
diff --git a/src/usr/local/www/index.php b/src/usr/local/www/index.php
index 7c4c0f7..3816c0a 100644
--- a/src/usr/local/www/index.php
+++ b/src/usr/local/www/index.php
@@ -328,11 +328,12 @@ pfSense_handle_custom_code("/usr/local/pkg/dashboard/pre_dashboard");
<?php
// Build the Available Widgets table using a sorted copy of the $widgets array
-// Can't just ksort because the "Firewall Logs" widget has a key of "logs"
+function wgtcmp($a, $b) {
+ return(strtolower($a['name']) > strtolower($b['name']));
+}
+
$available = $widgets;
-$values = array_values($available);
-$keys = array_keys($available);
-array_multisort($values, SORT_ASC, $keys, SORT_ASC, $available);
+uasort($available, 'wgtcmp');
foreach ($available as $widgetname => $widgetconfig):
if ($widgetconfig['display'] == 'none'):
OpenPOWER on IntegriCloud