Populate an array with several accounts from radcheck.

Alexander Silveröhrt Alexander.Silverohrt at itux.se
Sat Nov 9 14:48:35 CET 2013


Hiya,

I have a problem with the time it takes to initiate the DBI connection in a pre_auth script hook using rlm_perl.

This is the time recorded for some parts in the code.
rlm_perl: DEBUG: Time between DBI initialization start and DBI initialization stop was: 0.013145!
rlm_perl: DEBUG: Time between SQL Query LIKE start and SQL Query LIKE stop was: 0.001079!
rlm_perl: DEBUG: Time between SCRIPT start and SCRIPT stop was: 0.014898!

I was hoping to be able to cut off a lot of time by using freeradius already open MYSQL connection and make a SQL QUERY in ulang and populate an ARRAY with the result from a SQL LIKE query. And from that QUERY then use the SQL result in the ARRAY attribute inside the perl script instead of letting the script do a database query?

Today in the perl hook the query is and it should be the same when using ulang.

$sth = $dbh->prepare("SELECT DISTINCT username FROM radcheck where username LIKE '$SUBSCRIBER_ACCOUNT%'");
where $SUBSCRIBER_ACCOUNT% is the received USERNAME.  The SQL result could be anything from 1 account to 8 accounts
for instance
+----+----------------------------------------+-----------+----+--------+
| id | username                               | attribute | op | value  |
+----+----------------------------------------+-----------+----+--------+
| 17 | 10.33.1.4_GigabitEthernet0/0/2 CH_VoIP | Auth-Type | := | Accept |
| 18 | 10.33.1.4_GigabitEthernet0/0/2 CH_IPTV | Auth-Type | := | Accept |
| 19 | 10.33.1.4_GigabitEthernet0/0/2         | Auth-Type | := | Accept |
+----+----------------------------------------+-----------+----+--------+

We have tried several ways and tried to find any references in the manual to populate ARRAYs to be able to do this but when we try the resulting variable only contains one account? And also where should we put the query to be able to use the SQL result in the pre-auth script.? Should it be in servers sites-available/sitename before the perl call?

I hope someone can help.

Thanks
Alex

********* DISCLAIMER *********

This message and any attachment are confidential and may be privileged or otherwise protected from disclosure and may include proprietary information. If you are not the intended recipient, please telephone or email the sender and delete this message and any attachment from your system. If you are not the intended recipient you must not copy this message or attachment or disclose the contents to any other person


More information about the Freeradius-Users mailing list