From ff60fe9cb394d7d0872b2652ff0b3f6e4a153a0c Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 12 Apr 2018 22:50:36 +0200 Subject: [PATCH] system: add/update valiation for #2340 --- src/www/system_advanced_admin.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/www/system_advanced_admin.php b/src/www/system_advanced_admin.php index 1f8e92f78..2f7f531a8 100644 --- a/src/www/system_advanced_admin.php +++ b/src/www/system_advanced_admin.php @@ -69,11 +69,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { $input_errors = array(); $pconfig = $_POST; - /* input validation */ - if (!empty($pconfig['webguiport'])) { - if (!is_port($pconfig['webguiport'])) { - $input_errors[] = gettext('You must specify a valid web GUI port number'); - } + if (!empty($pconfig['webguiport']) && !is_port($pconfig['webguiport'])) { + $input_errors[] = gettext('You must specify a valid web GUI port number.'); + } + + if (empty($pconfig['webguiproto']) || !in_array($pconfig['webguiproto'], array('http', 'https'))) { + $input_errors[] = gettext('You must specify a valid web GUI protocol.'); } if (!empty($pconfig['althostnames'])) { @@ -85,10 +86,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { } } - if (!empty($pconfig['sshport'])) { - if (!is_port($pconfig['sshport'])) { - $input_errors[] = gettext("You must specify a valid port number"); - } + if (!empty($pconfig['sshport']) && !is_port($pconfig['sshport'])) { + $input_errors[] = gettext('You must specify a valid SSH port number.'); } if (count($input_errors) == 0) {