Ugh, even if your script was working user still can't make it.
rad_recv: Access-Request packet from host 202.xx.xx.xx:52743, id=81, length=151 NAS-Identifier = "pppoe-test.lumbininet.com.np" NAS-Port = 12 NAS-Port-Type = Ethernet Service-Type = Framed-User Framed-Protocol = PPP Calling-Station-Id = "001a4daf4ead" Called-Station-Id = "WIFITEST" User-Name = "mobile" CHAP-Password = 0x0102e814e5d756effb7319a534e354dcd2 CHAP-Challenge = 0xbb1e687616119cbcd0156169c9b45cb65bd4ce0daf99b5788e
But you have hacked configuration to make sure that user can't connect:
authorize {
checkval dailycounter monthlycounter noresetcounter perl }
How are you going to do chap if you remove chap module from the configuration? Don't make changes to default configuration unless you know what you are doing. Default configuration *works*. Add perl but dont remove things that might turn out to be essential.
my $sql = $dbh->prepare( "SELECT Usemac FROM radcheck WHERE UserName='$username' AND Attribute='Expiration' ");
This is wrong. I have told you to use $query and print it out to see what is your query string. Perhaps then you will notice the difference between variable name and variable value. Your string will have $username in it and not the value of User-Name attribute from the request (ie. mobile). Same applies to $sql3. Also I would use == instead of += as the operator there. You had pointers about using authoruze function from others. Ivan Kalik Kalik Informatika ISP