From 2dbe71047ffbaa6311ecd08fab96d3b1c2123ba5 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Sat, 28 Dec 2013 22:02:57 +0000 Subject: [PATCH] Provisioning, Only check the CIDR if its provided. --- app/provision/index.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/provision/index.php b/app/provision/index.php index e55d0034e9..67910a2bb0 100644 --- a/app/provision/index.php +++ b/app/provision/index.php @@ -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