X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/7578ca7e1deb95bef18bb64c3b49d83d78fc3891..f07477cb289eb839af7255b25188765d5e49ad94:/lib/functions.php?ds=sidebyside 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) {