SQL SELECT statement

Charly netflow at geosciences.ensmp.fr
Mon May 18 17:50:20 CEST 2020


For user authentication, i use SQL and LDAP modules but Cisco-AVPair 
values are only stored in SQL.  My config is :

         sql

         update control {
                 SQL-Test = "%{%{sql:SELECT id FROM radcheck WHERE 
username = '%{User-Name}'}:-notfound}"
         }

         if (&control:SQL-Test == "notfound") {
                 update reply {
                         Cisco-AVPair += "%{sql:SELECT value FROM 
radreply WHERE username = '%{User-Name}' AND attribute = 'Cisco-AVPair' 
ORDER BY id}"
                 }

                 #
                 #  The ldap module reads passwords from the LDAP database.
                 LDAP

                 if ((ok || updated) && User-Password) {
                         update control {
                                 Auth-Type := LDAP
                         }
                 }
         }

Maybe it exists another way to do it ?


Le 18/05/2020 à 17:26, Alan DeKok a écrit :
>
>> On May 18, 2020, at 11:23 AM, Charly <netflow at geosciences.ensmp.fr> wrote:
>>
>> Thank you Alan. Do you know if i can use another way to do it ?
>    If you're using the standard schema, why not just use the standard SQL qeuries?  i.e. use the SQL module the way it's designed.
>
>    Alan DeKok.
>
>
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html



More information about the Freeradius-Users mailing list