X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/4e0365d789b224bb0cf31e7a92162e05d08c79f3..f07477cb289eb839af7255b25188765d5e49ad94:/lib/functions.php 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) {