diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2008-06-20 19:03:54 +0000 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2008-06-20 19:03:54 +0000 |
commit | 23956e222619d1c34ea765ab6902c8fe0c715f65 (patch) | |
tree | 110d0b98ce8367ed73ec348d33277da4ba21060b /usr | |
parent | af54374fc61317418f6695fbc0637a1515cde81a (diff) | |
download | pfsense-23956e222619d1c34ea765ab6902c8fe0c715f65.zip pfsense-23956e222619d1c34ea765ab6902c8fe0c715f65.tar.gz |
Attempt to perform better input validation
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/system_gateways_edit.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/usr/local/www/system_gateways_edit.php b/usr/local/www/system_gateways_edit.php index 5355bcd..9c1122f 100755 --- a/usr/local/www/system_gateways_edit.php +++ b/usr/local/www/system_gateways_edit.php @@ -73,7 +73,7 @@ if ($_POST) { if (($_POST['gateway'] && !is_ipaddr($_POST['gateway']))) { $input_errors[] = "A valid gateway IP address must be specified."; } - if (($_POST['monitor'] && !is_ipaddr($_POST['monitor']))) { + if ((($_POST['monitor'] <> "") && !is_ipaddr($_POST['monitor']))) { $input_errors[] = "A valid monitor IP address must be specified."; } @@ -102,16 +102,16 @@ if ($_POST) { if (isset($id) && ($a_gateways[$id]) && ($a_gateways[$id] === $gateway)) continue; - if ($gateway['name'] == $_POST['name']) { - $input_errors[] = "A gateway with this name \"{$_POST['name']}\" already exists."; + if (($gateway['name'] <> "") && (in_array($gateway, $_POST['name']))) { + $input_errors[] = "The name \"{$_POST['name']}\" already exists."; break; } - if ($gateway['gateway'] == $_POST['gateway']) { - $input_errors[] = "A gateway with the IP address \"{$_POST['gateway']}\" already exists."; + if (($gateway['gateway'] <> "") && (in_array($gateway, $_POST['gateway']))) { + $input_errors[] = "The IP address \"{$_POST['gateway']}\" already exists."; break; } - if ($gateway['monitor'] == $_POST['monitor']) { - $input_errors[] = "A monitor with the IP address \"{$_POST['monitor']}\" already exists."; + if (($gateway['monitor'] <> "") && (in_array($gateway, $gateway['monitor']))) { + $input_errors[] = "The IP address \"{$_POST['monitor']}\" already exists."; break; } } |