Commit 70588a21 authored by Ad Schellevis's avatar Ad Schellevis Committed by Franco Fichtner

(firewall) some missing alias options, spotted by @jschellevis

(cherry picked from commit 18c49439)
parent 8060cea0
...@@ -394,7 +394,7 @@ $( document ).ready(function() { ...@@ -394,7 +394,7 @@ $( document ).ready(function() {
$localport .= '-' . $localendport; $localport .= '-' . $localendport;
} }
?> ?>
<?php if (isset($natent['destination']['port']) && is_alias($natent['destination']['port'])): ?> <?php if (isset($natent['local-port']) && is_alias($natent['local-port'])): ?>
<span title="<?=htmlspecialchars(get_alias_description($localport));?>" data-toggle="tooltip"> <span title="<?=htmlspecialchars(get_alias_description($localport));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_port($localport));?>&nbsp; <?=htmlspecialchars(pprint_port($localport));?>&nbsp;
</span> </span>
......
...@@ -385,7 +385,23 @@ include("head.inc"); ...@@ -385,7 +385,23 @@ include("head.inc");
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?> <?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?>
<?=!empty($natent['sourceport']) ? $natent['sourceport'] : "*"; ?> <?php
if (empty($natent['sourceport'])):?>
*
<?php
elseif (isset($natent['sourceport']) && is_alias($natent['sourceport'])):?>
<span title="<?=htmlspecialchars(get_alias_description($natent['sourceport']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_port($natent['sourceport'])); ?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['sourceport']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php
else:?>
<?=htmlspecialchars($natent['sourceport'])?>
<?php
endif;?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=isset($natent['destination']['not']) ? "!&nbsp;" :"";?> <?=isset($natent['destination']['not']) ? "!&nbsp;" :"";?>
...@@ -403,7 +419,23 @@ include("head.inc"); ...@@ -403,7 +419,23 @@ include("head.inc");
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?> <?=!empty($natent['protocol']) ? $natent['protocol'] . '/' : "" ;?>
<?=empty($natent['dstport']) ? "*" : $natent['dstport'] ;?> <?php
if (empty($natent['dstport'])):?>
*
<?php
elseif (isset($natent['dstport']) && is_alias($natent['dstport'])):?>
<span title="<?=htmlspecialchars(get_alias_description($natent['dstport']));?>" data-toggle="tooltip">
<?=htmlspecialchars(pprint_port($natent['dstport'])); ?>&nbsp;
</span>
<a href="/firewall_aliases_edit.php?name=<?=htmlspecialchars($natent['dstport']);?>"
title="<?=gettext("edit alias");?>" data-toggle="tooltip">
<i class="fa fa-list"></i>
</a>
<?php
else:?>
<?=htmlspecialchars($natent['dstport'])?>
<?php
endif;?>
</td> </td>
<td class="hidden-xs hidden-sm"> <td class="hidden-xs hidden-sm">
<?php <?php
......
...@@ -164,8 +164,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { ...@@ -164,8 +164,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if(!empty($pconfig['dstport']) && !is_portoralias($pconfig['dstport'])) if(!empty($pconfig['dstport']) && !is_portoralias($pconfig['dstport']))
$input_errors[] = gettext("You must supply either a valid port or port alias for the destination port entry."); $input_errors[] = gettext("You must supply either a valid port or port alias for the destination port entry.");
if(!empty($pconfig['natport']) && !is_port($pconfig['natport']) && empty($pconfig['nonat'])) if (!empty($pconfig['natport']) && !is_port($pconfig['natport']) && empty($pconfig['nonat'])) {
$input_errors[] = gettext("You must supply a valid port for the NAT port entry."); $input_errors[] = gettext("You must supply a valid port for the NAT port entry.");
}
} }
if (!(in_array($pconfig['source'], array("any","(self)")) || is_ipaddroralias($pconfig['source']))) { if (!(in_array($pconfig['source'], array("any","(self)")) || is_ipaddroralias($pconfig['source']))) {
...@@ -507,7 +508,34 @@ include("head.inc"); ...@@ -507,7 +508,34 @@ include("head.inc");
<tr> <tr>
<td><a id="help_for_src_port" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Source port:");?></td> <td><a id="help_for_src_port" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Source port:");?></td>
<td> <td>
<input name="sourceport" type="text" value="<?=$pconfig['sourceport'];?>" /> <table class="table table-condensed">
<tbody>
<tr>
<td>
<select id="sourceport" name="sourceport" class="selectpicker" data-live-search="true" data-size="5" data-width="auto">
<option data-other=true value="<?=$pconfig['sourceport'];?>">(<?=gettext("other"); ?>)</option>
<optgroup label="<?=gettext("Aliases");?>">
<?php foreach (legacy_list_aliases("port") as $alias):
?>
<option value="<?=$alias['name'];?>" <?= $pconfig['sourceport'] == $alias['name'] ? "selected=\"selected\"" : ""; ?> ><?=htmlspecialchars($alias['name']);?> </option>
<?php endforeach; ?>
</optgroup>
<optgroup label="<?=gettext("Well-known ports");?>">
<option value="" <?= $pconfig['sourceport'] == "" ? "selected=\"selected\"" : ""; ?>><?=gettext("any"); ?></option>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?= $wkport == $pconfig['sourceport'] ? "selected=\"selected\"" : "" ;?>><?=htmlspecialchars($wkportdesc);?></option>
<?php endforeach; ?>
</optgroup>
</select>
</td>
</tr>
<tr>
<td>
<input type="text" value="<?=$pconfig['sourceport'];?>" for="sourceport"> <!-- updates to "other" option in localbeginport -->
</td>
</tr>
</tbody>
</table>
<div class="hidden" for="help_for_src_port"> <div class="hidden" for="help_for_src_port">
<?=gettext("(leave blank for any)");?> <?=gettext("(leave blank for any)");?>
</div> </div>
...@@ -562,7 +590,34 @@ include("head.inc"); ...@@ -562,7 +590,34 @@ include("head.inc");
<tr> <tr>
<td><a id="help_for_dstport" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Destination port:");?></td> <td><a id="help_for_dstport" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Destination port:");?></td>
<td> <td>
<input name="dstport" type="text" value="<?=$pconfig['dstport'];?>" /> <table class="table table-condensed">
<tbody>
<tr>
<td>
<select id="dstport" name="dstport" class="selectpicker" data-live-search="true" data-size="5" data-width="auto">
<option data-other=true value="<?=$pconfig['dstport'];?>">(<?=gettext("other"); ?>)</option>
<optgroup label="<?=gettext("Aliases");?>">
<?php foreach (legacy_list_aliases("port") as $alias):
?>
<option value="<?=$alias['name'];?>" <?= $pconfig['dstport'] == $alias['name'] ? "selected=\"selected\"" : ""; ?> ><?=htmlspecialchars($alias['name']);?> </option>
<?php endforeach; ?>
</optgroup>
<optgroup label="<?=gettext("Well-known ports");?>">
<option value="" <?= $pconfig['dstport'] == "" ? "selected=\"selected\"" : ""; ?>><?=gettext("any"); ?></option>
<?php foreach ($wkports as $wkport => $wkportdesc): ?>
<option value="<?=$wkport;?>" <?= $wkport == $pconfig['dstport'] ? "selected=\"selected\"" : "" ;?>><?=htmlspecialchars($wkportdesc);?></option>
<?php endforeach; ?>
</optgroup>
</select>
</td>
</tr>
<tr>
<td>
<input type="text" value="<?=$pconfig['dstport'];?>" for="dstport"> <!-- updates to "other" option in localbeginport -->
</td>
</tr>
</tbody>
</table>
<div class="hidden" for="help_for_dstport"> <div class="hidden" for="help_for_dstport">
<?=gettext("(leave blank for any)");?> <?=gettext("(leave blank for any)");?>
</div> </div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment