Hello, I don't understand why radreply table is not queried whereas radgroupreply is queried : (0) authorize { (0) [preprocess] = ok (0) sql: EXPAND %{User-Name} (0) sql: --> john (0) sql: SQL-User-Name set to 'john' rlm_sql (sql): Reserved connection (0) (0) sql: EXPAND SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id (0) sql: --> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'john' ORDER BY id (0) sql: Executing select query: SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'john' ORDER BY id (0) sql: EXPAND SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority (0) sql: --> SELECT groupname FROM radusergroup WHERE username = 'john' ORDER BY priority (0) sql: Executing select query: SELECT groupname FROM radusergroup WHERE username = 'john' ORDER BY priority (0) sql: User found in the group table (0) sql: EXPAND SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = '%{sql-SQL-Group}' ORDER BY id (0) sql: --> SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'common' ORDER BY id (0) sql: Executing select query: SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'common' ORDER BY id (0) sql: Group "common": Conditional check items matched (0) sql: Group "common": Merging assignment check items (0) sql: EXPAND SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = '%{sql-SQL-Group}' ORDER BY id (0) sql: --> SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'common' ORDER BY id (0) sql: Executing select query: SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'common' ORDER BY id (0) sql: Group "common": Merging reply items Thank for your help Charly
I found the problem, if the user is not found in radcheck, radreply is not used I would like to do this : if (notfound) { update reply { Cisco-AVPair += "%{sql-vpn:SELECT value FROM radreply WHERE username = '%{User-Name}' AND attribute = 'Cisco-AVPair' ORDER BY id}" } } But because the user is found in group table, i got : (0) [sql] = ok How to know if user is not found ? Le 26/04/2018 à 17:15, Charly a écrit :
Hello,
I don't understand why radreply table is not queried whereas radgroupreply is queried :
(0) authorize { (0) [preprocess] = ok (0) sql: EXPAND %{User-Name} (0) sql: --> john (0) sql: SQL-User-Name set to 'john' rlm_sql (sql): Reserved connection (0) (0) sql: EXPAND SELECT id, username, attribute, value, op FROM radcheck WHERE username = '%{SQL-User-Name}' ORDER BY id (0) sql: --> SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'john' ORDER BY id (0) sql: Executing select query: SELECT id, username, attribute, value, op FROM radcheck WHERE username = 'john' ORDER BY id (0) sql: EXPAND SELECT groupname FROM radusergroup WHERE username = '%{SQL-User-Name}' ORDER BY priority (0) sql: --> SELECT groupname FROM radusergroup WHERE username = 'john' ORDER BY priority (0) sql: Executing select query: SELECT groupname FROM radusergroup WHERE username = 'john' ORDER BY priority (0) sql: User found in the group table (0) sql: EXPAND SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = '%{sql-SQL-Group}' ORDER BY id (0) sql: --> SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'common' ORDER BY id (0) sql: Executing select query: SELECT id, groupname, attribute, Value, op FROM radgroupcheck WHERE groupname = 'common' ORDER BY id (0) sql: Group "common": Conditional check items matched (0) sql: Group "common": Merging assignment check items (0) sql: EXPAND SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = '%{sql-SQL-Group}' ORDER BY id (0) sql: --> SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'common' ORDER BY id (0) sql: Executing select query: SELECT id, groupname, attribute, value, op FROM radgroupreply WHERE groupname = 'common' ORDER BY id (0) sql: Group "common": Merging reply items
Thank for your help
Charly - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
On Apr 26, 2018, at 12:58 PM, Charly <netflow@geosciences.ensmp.fr> wrote:
I found the problem, if the user is not found in radcheck, radreply is not used
See the wiki, and rlm_sql. This is documented.
I would like to do this :
if (notfound) { update reply { Cisco-AVPair += "%{sql-vpn:SELECT value FROM radreply WHERE username = '%{User-Name}' AND attribute = 'Cisco-AVPair' ORDER BY id}" } }
But because the user is found in group table, i got :
(0) [sql] = ok
How to know if user is not found ?
You don't. Add a check item for the user. It doesn't have to be anything in particular. Just something which will always match. Alan DeKok.
participants (2)
-
Alan DeKok -
Charly