summaryrefslogtreecommitdiffstats
path: root/usr/local/www/diag_testport.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-01-02 16:34:30 +0545
committerPhil Davis <phil.davis@inf.org>2015-01-02 16:34:30 +0545
commita3c9510c684bcef9f6f5bc54f38b187d2ebc748c (patch)
tree81024230c26adb8e87cee2e7088df413ae90fe19 /usr/local/www/diag_testport.php
parent0e25a6b9673d56be82845c664f740b127bd76ec3 (diff)
downloadpfsense-a3c9510c684bcef9f6f5bc54f38b187d2ebc748c.zip
pfsense-a3c9510c684bcef9f6f5bc54f38b187d2ebc748c.tar.gz
Allow blank source port in diag_testport
Reported by forum https://forum.pfsense.org/index.php?topic=86146.0 Also, if there are input validation errors, save the user-entered data and re-display it, making it easier for the user to just correct the data in error and press Test again. It was blanking out all the entered data.
Diffstat (limited to 'usr/local/www/diag_testport.php')
-rw-r--r--usr/local/www/diag_testport.php25
1 files changed, 10 insertions, 15 deletions
diff --git a/usr/local/www/diag_testport.php b/usr/local/www/diag_testport.php
index 62862f0..7fda3a0 100644
--- a/usr/local/www/diag_testport.php
+++ b/usr/local/www/diag_testport.php
@@ -50,10 +50,10 @@ $pgtitle = array(gettext("Diagnostics"), gettext("Test Port"));
require("guiconfig.inc");
define('NC_TIMEOUT', 10);
+$do_testport = false;
if ($_POST || $_REQUEST['host']) {
unset($input_errors);
- unset($do_testport);
/* input validation */
$reqdfields = explode(" ", "host port");
@@ -68,7 +68,7 @@ if ($_POST || $_REQUEST['host']) {
$input_errors[] = gettext("Please enter a valid port number.");
}
- if (!is_numeric($_REQUEST['srcport']) || !is_port($_REQUEST['srcport'])) {
+ if (($_REQUEST['srcport'] != "") && (!is_numeric($_REQUEST['srcport']) || !is_port($_REQUEST['srcport']))) {
$input_errors[] = gettext("Please enter a valid source port number, or leave the field blank.");
}
@@ -81,21 +81,16 @@ if ($_POST || $_REQUEST['host']) {
if (!$input_errors) {
$do_testport = true;
- $host = $_REQUEST['host'];
- $sourceip = $_REQUEST['sourceip'];
- $port = $_REQUEST['port'];
- $srcport = $_REQUEST['srcport'];
- $showtext = isset($_REQUEST['showtext']);
- $ipprotocol = $_REQUEST['ipprotocol'];
$timeout = NC_TIMEOUT;
}
-}
-if (!isset($do_testport)) {
- $do_testport = false;
- $host = '';
- $port = '';
- $srcport = '';
- unset($showtext);
+
+ /* Save these request vars even if there were input errors. Then the fields are refilled for the user to correct. */
+ $host = $_REQUEST['host'];
+ $sourceip = $_REQUEST['sourceip'];
+ $port = $_REQUEST['port'];
+ $srcport = $_REQUEST['srcport'];
+ $showtext = isset($_REQUEST['showtext']);
+ $ipprotocol = $_REQUEST['ipprotocol'];
}
include("head.inc"); ?>
OpenPOWER on IntegriCloud