summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2006-09-04 22:03:35 +0000
committerScott Ullrich <sullrich@pfsense.org>2006-09-04 22:03:35 +0000
commite2705d6797e310a892c59e7ec7d6acc0ee6f2d22 (patch)
tree50829043f39562877b706c39929164a41c2b9673
parentcedeafc0152438bab0d25efb45be9c77a35e1c95 (diff)
downloadpfsense-e2705d6797e310a892c59e7ec7d6acc0ee6f2d22.zip
pfsense-e2705d6797e310a892c59e7ec7d6acc0ee6f2d22.tar.gz
When a External port range item is an alias, disallow the entry of Local port.
In-discussion-with: BillM Bug-reported-by: ChrisB
-rwxr-xr-xusr/local/www/firewall_nat_edit.php14
-rw-r--r--usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js43
2 files changed, 47 insertions, 10 deletions
diff --git a/usr/local/www/firewall_nat_edit.php b/usr/local/www/firewall_nat_edit.php
index 0f1ecc4..d63d697 100755
--- a/usr/local/www/firewall_nat_edit.php
+++ b/usr/local/www/firewall_nat_edit.php
@@ -298,7 +298,7 @@ include("fbegin.inc"); ?>
<tr>
<td width="22%" valign="top" class="vncellreq">Protocol</td>
<td width="78%" class="vtable">
- <select name="proto" class="formfld" onChange="proto_change();">
+ <select name="proto" class="formfld" onChange="proto_change(); check_for_aliases();">
<?php $protocols = explode(" ", "TCP UDP TCP/UDP GRE ESP"); foreach ($protocols as $proto): ?>
<option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['proto']) echo "selected"; ?>><?=htmlspecialchars($proto);?></option>
<?php endforeach; ?>
@@ -313,7 +313,7 @@ include("fbegin.inc"); ?>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>from:&nbsp;&nbsp;</td>
- <td><select name="beginport" class="formfld" onChange="ext_rep_change();ext_change()">
+ <td><select name="beginport" class="formfld" onChange="ext_rep_change(); ext_change(); check_for_aliases();">
<option value="">(other)</option>
<?php $bfound = 0; foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['beginport']) {
@@ -323,11 +323,11 @@ include("fbegin.inc"); ?>
<?=htmlspecialchars($wkportdesc);?>
</option>
<?php endforeach; ?>
- </select> <input autocomplete='off' class="formfldalias" name="beginport_cust" id="beginport_cust" type="text" size="5" value="<?php if (!$bfound) echo $pconfig['beginport']; ?>"></td>
+ </select> <input onChange="check_for_aliases();" autocomplete='off' class="formfldalias" name="beginport_cust" id="beginport_cust" type="text" size="5" value="<?php if (!$bfound) echo $pconfig['beginport']; ?>"></td>
</tr>
<tr>
<td>to:</td>
- <td><select name="endport" class="formfld" onChange="ext_change()">
+ <td><select name="endport" class="formfld" onChange="ext_change(); check_for_aliases();">
<option value="">(other)</option>
<?php $bfound = 0; foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['endport']) {
@@ -337,7 +337,7 @@ include("fbegin.inc"); ?>
<?=htmlspecialchars($wkportdesc);?>
</option>
<?php endforeach; ?>
- </select> <input class="formfldalias" autocomplete='off' name="endport_cust" id="endport_cust" type="text" size="5" value="<?php if (!$bfound) echo $pconfig['endport']; ?>"></td>
+ </select> <input onChange="check_for_aliases();" class="formfldalias" autocomplete='off' name="endport_cust" id="endport_cust" type="text" size="5" value="<?php if (!$bfound) echo $pconfig['endport']; ?>"></td>
</tr>
</table>
<br> <span class="vexpl">Specify the port or port range on
@@ -356,7 +356,7 @@ include("fbegin.inc"); ?>
<tr>
<td width="22%" valign="top" class="vncellreq">Local port</td>
<td width="78%" class="vtable">
- <select name="localbeginport" class="formfld" onChange="ext_change()">
+ <select name="localbeginport" class="formfld" onChange="ext_change();check_for_aliases();">
<option value="">(other)</option>
<?php $bfound = 0; foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?php if ($wkport == $pconfig['localbeginport']) {
@@ -366,7 +366,7 @@ include("fbegin.inc"); ?>
<?=htmlspecialchars($wkportdesc);?>
</option>
<?php endforeach; ?>
- </select> <input autocomplete='off' class="formfldalias" name="localbeginport_cust" id="localbeginport_cust" type="text" size="5" value="<?php if (!$bfound) echo $pconfig['localbeginport']; ?>">
+ </select> <input onChange="check_for_aliases();" autocomplete='off' class="formfldalias" name="localbeginport_cust" id="localbeginport_cust" type="text" size="5" value="<?php if (!$bfound) echo $pconfig['localbeginport']; ?>">
<br>
<span class="vexpl">Specify the port on the machine with the
IP address entered above. In case of a port range, specify
diff --git a/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js b/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js
index 91e131d..435071b 100644
--- a/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js
+++ b/usr/local/www/javascript/firewall_nat_edit/firewall_nat_edit.js
@@ -25,6 +25,44 @@ function ext_rep_change() {
document.iform.localbeginport.selectedIndex = document.iform.beginport.selectedIndex;
}
+function check_for_aliases() {
+ /* if External port range is an alias, then disallow
+ * entry of Local port
+ */
+ document.iform.endport_cust.disabled = 0;
+ document.iform.localbeginport.disabled = 0;
+ for(i=0; i<customarray.length; i++) {
+ if(document.iform.beginport_cust.value == customarray[i]) {
+ alert(customarray[i]);
+ document.iform.endport_cust.value = "";
+ document.iform.endport_cust.disabled = 1;
+ document.iform.localbeginport_cust.value = "";
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ }
+ if(document.iform.beginport.value == customarray[i]) {
+ document.iform.endport_cust.value = "";
+ document.iform.endport_cust.disabled = 1;
+ document.iform.localbeginport_cust.value = "";
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ }
+ if(document.iform.endport_cust.value == customarray[i]) {
+ document.iform.endport_cust.value = "";
+ document.iform.endport_cust.disabled = 1;
+ document.iform.localbeginport_cust.value = "";
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ }
+ if(document.iform.endport.value == customarray[i]) {
+ document.iform.endport_cust.value = "";
+ document.iform.endport_cust.disabled = 1;
+ document.iform.localbeginport_cust.value = "";
+ document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport_cust.disabled = 1;
+ }
+ }
+}
function proto_change() {
if(document.iform.proto.selectedIndex > 2) {
@@ -33,16 +71,15 @@ function proto_change() {
document.iform.beginport.disabled = 1;
document.iform.endport.disabled = 1;
document.iform.localbeginport_cust.disabled = 1;
- document.iform.localbeginport.disabled = 1;
+ document.iform.localbeginport.disabled = 1;
} else {
document.iform.beginport_cust.disabled = 0;
document.iform.endport_cust.disabled = 0;
document.iform.beginport.disabled = 0;
document.iform.endport.disabled = 0;
document.iform.localbeginport_cust.disabled = 0;
- document.iform.localbeginport.disabled = 0;
+ document.iform.localbeginport.disabled = 0;
}
-
}
window.onload = function () {
OpenPOWER on IntegriCloud