mirror of
https://github.com/fusionpbx/fusionpbx.git
synced 2026-01-04 18:53:49 +00:00
Provisioning, Only check the CIDR if its provided.
This commit is contained in:
@@ -309,13 +309,15 @@ include "resources/classes/template.php";
|
||||
unset ($prep_statement);
|
||||
|
||||
//check to see if the IP address is in the CIDR range
|
||||
function check_cidr ($cidr,$ip_address) {
|
||||
list ($subnet, $mask) = explode ('/', $cidr);
|
||||
return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet);
|
||||
}
|
||||
if (!check_cidr($provision["cidr"], $_SERVER['REMOTE_ADDR'])) {
|
||||
echo "access denied";
|
||||
exit;
|
||||
if (strlen($provision["cidr"]) > 0) {
|
||||
function check_cidr ($cidr,$ip_address) {
|
||||
list ($subnet, $mask) = explode ('/', $cidr);
|
||||
return ( ip2long ($ip_address) & ~((1 << (32 - $mask)) - 1) ) == ip2long ($subnet);
|
||||
}
|
||||
if (!check_cidr($provision["cidr"], $_SERVER['REMOTE_ADDR'])) {
|
||||
echo "access denied";
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
//if the domain name directory exists then only use templates from it
|
||||
|
||||
Reference in New Issue
Block a user