diff --git a/ChangeLog b/ChangeLog index ecff8b2e6..978d3c6fb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ - dockerfile-freeradius and init-freeradius.sh - fix regex query for rollback - fix mysql directory in dockerfile + - fix MAC validation in new user (requires PHP v5.5) release 1.1-2 - 08 Aug 2019 - syntax fix in language translations diff --git a/README.md b/README.md index 2bff0ed2d..0f7018db6 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Thanks goes to these wonderful people : # Requirements * Apache. - * PHP v5 or higher. + * PHP v5.5 or higher. * MySQL v4.1 or higher. * [PEAR](https://pear.php.net/) PHP extension. * PEAR package DB in order to access the database. To install it, execute at the command line: diff --git a/mng-new.php b/mng-new.php index a3a510a6b..7d44ba190 100644 --- a/mng-new.php +++ b/mng-new.php @@ -461,9 +461,10 @@ function addAttributes($dbSocket, $username) { } elseif ($authType == "macAuth") { - $macaddress = preg_replace("/:|\.|\-/", "", trim($macaddress)); + $macaddress = trim($macaddress); - if (preg_match('/[a-fA-F0-9]/', $macaddress) == 1 && strlen($macaddress) == 12){ + if (filter_var($macaddress, FILTER_VALIDATE_MAC)) { + // insert username/password $sql = "INSERT INTO ".$configValues['CONFIG_DB_TBL_RADCHECK']." (id,Username,Attribute,op,Value) ". " VALUES (0, '".$dbSocket->escapeSimple($macaddress)."', 'Auth-Type', ':=', 'Accept')";