Skip to content
Snippets Groups Projects
Commit 836a1846 authored by Robert Anderson's avatar Robert Anderson
Browse files

Compare with User-Password

parent 4e3d8c04
No related branches found
No related tags found
No related merge requests found
...@@ -26,10 +26,9 @@ use warnings; ...@@ -26,10 +26,9 @@ use warnings;
# Modules we need # Modules we need
use smradius::constants; use smradius::constants;
use smradius::logging;
use Digest::MD5; use Digest::MD5;
use Data::Dumper;
# Exporter stuff # Exporter stuff
...@@ -82,22 +81,32 @@ sub authenticate ...@@ -82,22 +81,32 @@ sub authenticate
# Check if this is PAP authentication # Check if this is PAP authentication
return MOD_RES_SKIP if (!defined($encPassword)); return MOD_RES_SKIP if (!defined($encPassword));
print(STDERR "RECEIVED\n"); # print(STDERR "RECEIVED\n");
print(STDERR "User-Pass: len = ".length($encPassword).", hex = ".unpack("H*",$encPassword)."\n"); # print(STDERR "User-Pass: len = ".length($encPassword).", hex = ".unpack("H*",$encPassword)."\n");
print(STDERR "\n\n"); # print(STDERR "\n\n");
# FIXME - test is the radius secret, must pull it from the configuration attributes??
my $clearPassword = $packet->password("test","User-Password"); my $clearPassword = $packet->password("test","User-Password");
print(STDERR "CALC\n"); # print(STDERR "CALC\n");
print(STDERR "Result : len = ".length($clearPassword).", hex = ".unpack("H*",$clearPassword).", password = $clearPassword\n"); # print(STDERR "Result : len = ".length($clearPassword).", hex = ".unpack("H*",$clearPassword).", password = $clearPassword\n");
# Compare passwords # Compare passwords
if ($user->{'ClearPassword'} eq $clearPassword) { if (defined($user->{'Attributes'}->{'User-Password'})) {
return MOD_RES_ACK; # Operator: ==
if (defined($user->{'Attributes'}->{'User-Password'}->{'=='})) {
# Compare
if ($user->{'Attributes'}->{'User-Password'}->{'=='}->{'Value'} eq $clearPassword) {
return MOD_RES_ACK;
}
} else {
$server->log(LOG_NOTICE,"[MOD_AUTH_PAP] No valid operators for attribute 'User-Password', supported operators are: ==");
}
} else {
$server->log(LOG_NOTICE,"[MOD_AUTH_PAP] No 'User-Password' attribute, cannot authenticate");
} }
return MOD_RES_NACK; return MOD_RES_NACK;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment