Skip to content

Commit

Permalink
Fix MAC validation in new user (requires PHP v5.5). (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiguelVis authored Feb 15, 2021
1 parent 3967331 commit 6adcbae
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions mng-new.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')";
Expand Down

0 comments on commit 6adcbae

Please sign in to comment.