hi,<br> I am using free Radius <a href="http://2.0.3.">2.0.3.</a> I m configured my AAA through rlm_perl. I need to do the authorization by using the following attributes. <br><br>Digest-Realm<br>Digest-Method<br>Digest-Uri<br>
Digest-Nonce<br>Digest-Nonce<br>Digest-Response<br><br>Unfortunately i did not get any value from these attributes when i called using $RAD_REQUEST. Please tell me any idea to get these values.<br>Here is the piece of authorization code that i've used.<br>
<br><br>sub authorize <br> {<br>my $nasuser1;<br>my $nasuser;<br>my $naspass;<br>my $dUserName;<br>my $dRealm;<br>my $dMethod;<br>my $dUri;<br>my $dNonce;<br>my $nameindex;<br>my $dResponse;<br><br> $nasuser = $RAD_REQUEST{'User-Name'};<br>
$naspass = $RAD_REQUEST{'User-Password'};<br> $dUserName= $RAD_REQUEST{'Digest-User-Name'};<br> $dRealm= $RAD_REQUEST{'Digest-Realm'};<br> $dMethod = $RAD_REQUEST{'Digest-Method'};<br>
$dUri= $RAD_REQUEST{'Digest-URI'};<br> $dNonce=$RAD_REQUEST{'Digest-Nonce'};<br> $dResponse=$RAD_REQUEST{'Digest-Response'};<br><br>my $dPassword;<br>my $ha1;<br>my $ha2;<br>my $a1;<br>
my $a2;<br>my $a;<br>my $sqltest;<br>my $sthtest;<br><br><br>my $user = "user";<br>my $password = "password";<br>my $dbhtest=DBI->connect('dbi:ODBC:MSSQLDSN',$user,$password,{PrintError=>0,RaiseError=>0});<br>
my $dbh = DBI-> connect('dbi:ODBC:MSSQLDSN', $user, $password, {PrintError =>0, RaiseError =>0});<br>my $sql = qq/select * from testing where UserName = '$nasuser'/;<br>my $sth=$dbh->prepare($sql);<br>
<br>if($dbh)<br> {<br> $sth->execute();<br><br><br><br> if(my $row = $sth->fetchrow_hashref)<br> {<br><br> #password from database against the username <br> $dPassword=$row->{UserPassword};<br>
<br> <br> $a1=$dUserName.':'.$dRealm.':'.$dPassword;<br><br> #first part of the hash calculated.<br> $ha1=md5($a1);<br> $a2=$dMethod.':'.$dUri;<br> <br> #second part of the hash calculated.<br>
$ha2=md5($a2);<br> <br> #final string to be hashed.<br> $a=$ha1.':'.$dNonce.':'.$ha2;<br> <br> #final response to be checked with the digest-response<br><br> $a=md5($a);<br>
<br> <br> if($a eq $dResponse)<br> {<br> $RAD_REPLY{'Reply-Message'} = "Accepting Users";<br> <br> return RLM_MODULE_OK;<br> }<br> else<br> {<br>
$RAD_REPLY{'Reply-Message'} = "Incorrect Password";<br> <br> return RLM_MODULE_REJECT;<br> }<br> }#End of row fetch<br> else <br> {<br> $RAD_REPLY{'Reply-Message'} = "Incorrect Username";<br>
#$RAD_REPLY{'Reply-Message'} = $nasuser;<br> return RLM_MODULE_REJECT;<br> }#End of else<br> }#end of if database connection<br>else<br> {<br> $RAD_REPLY{'Reply-Message'} = "Cannot connect to database";<br>
<br> }<br>}#End of authorization subsection<br><br><br>With Regards <br>Elangbam Johnson <br>