From f07477cb289eb839af7255b25188765d5e49ad94 Mon Sep 17 00:00:00 2001 From: Matthieu Schneider Date: Tue, 31 Oct 2017 16:43:37 +0300 Subject: [PATCH] [FEATURE] Add check ip_nopassword in challenge_upload function --- lib/functions.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/functions.php b/lib/functions.php index cf6b913..2817aa1 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -1108,6 +1108,21 @@ function jirafeau_challenge_upload ($cfg, $ip, $password) return true; } + // Allow if ip is in array (no password) + foreach ($cfg['upload_ip_nopassword'] as $i) { + if ($i == $ip) { + return true; + } + // CIDR test for IPv4 only. + if (strpos ($i, '/') !== false) + { + list ($subnet, $mask) = explode('/', $i); + if ((ip2long ($ip) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet)) { + return true; + } + } + } + // Allow if ip is in array foreach ($cfg['upload_ip'] as $i) { if ($i == $ip) { -- 2.34.1