only validate and process ip-list if given at all

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2019-06-04 15:14:51 +02:00
parent b7a10fdeda
commit 13086d91d8

View File

@@ -88,6 +88,7 @@ if ($action == 'delete') {
$valid_until = isset($_POST['valid_until']) ? (int) $_POST['valid_until'] : - 1; $valid_until = isset($_POST['valid_until']) ? (int) $_POST['valid_until'] : - 1;
// validate allowed_from // validate allowed_from
if (! empty($allowed_from)) {
$ip_list = array_map('trim', explode(",", $allowed_from)); $ip_list = array_map('trim', explode(",", $allowed_from));
$_check_list = $ip_list; $_check_list = $ip_list;
foreach ($_check_list as $idx => $ip) { foreach ($_check_list as $idx => $ip) {
@@ -97,6 +98,7 @@ if ($action == 'delete') {
} }
$ip_list = array_map('inet_ntop', array_map('inet_pton', $ip_list)); $ip_list = array_map('inet_ntop', array_map('inet_pton', $ip_list));
$allowed_from = implode(",", array_unique($ip_list)); $allowed_from = implode(",", array_unique($ip_list));
}
if ($valid_until <= 0 || ! is_numeric($valid_until)) { if ($valid_until <= 0 || ! is_numeric($valid_until)) {
$valid_until = - 1; $valid_until = - 1;