R: R: SQL.conf new query

Rich Marriner richard at maingear.net
Fri Jan 27 19:52:23 CET 2006


Would seperating the queries with a semicolon work, but keeping both 
queries under postauth_query? SQL should distinguish it as a seperate 
query. I haven't tried this so I am not sure if it would work or not.

How about something like this?

postauth_query = "INSERT into ${postauth_table} (id, user, pass, reply, 
date) values ('', '%{User-Name}', '%{User-Password:-Chap-Password}', 
'%{reply:Packet-Type}', NOW()) ; INSERT into ${authcheck_table} 
(UserName, Attribute, op, Value) VALUES ('%{SQL-User-Name}'', 
'Calling-Station-Id', ':=', '%{Calling-Station-Id}')"

It seems a lot easier than changing the source code and recompiling...

Hope this helps!
Richard



Carlo Prestopino wrote:

> Thank you Alan for your reply.
>
> As written by Paolo, we simply added a query (postauth_mac_query) to 
> sql.conf file that gives back user’s MAC address:
>
> ...........
>
> ...........
>
> postauth_query = "INSERT into ${postauth_table} (id, user, pass,
>
> reply, date) values ('', '%{User-Name}', 
> '%{User-Password:-Chap-Password}',
>
> '%{reply:Packet-Type}', NOW())"
>
> postauth_mac_query = "INSERT into ${authcheck_table} (UserName,
>
> Attribute, op, Value) VALUES ('%{SQL-User-Name}'', 'Calling-Station-Id',
>
> ':=', '%{Calling-Station-Id}')"
>
> The query was build on the model of the postauth_query one, so no 
> problems should arise about its syntax. In fact, if we change the 
> content of postauth_query with the one of post_mac_query, it works 
> fine (MAC address is inserted into radcheck table).
>
> The problem is that it seems that freeRADIUS does not recognize the 
> new defined query (postauth_mac_query) in fact, looking at debug 
> output, we can see calls to all other queries but not to the new one.
>
> So the question is: how let freeRADIUS understand when to call each 
> single query defined into sql.conf file?
>
> Any advice?
>
> Regadrs,
>
> Carlo
>
> -----Messaggio originale-----
> Da: 
> freeradius-users-bounces+c.prestopino=waitalia.com at lists.freeradius.org 
> [mailto:freeradius-users-bounces+c.prestopino=waitalia.com at lists.freeradius.org] 
> Per conto di Paolo Pellicori
> Inviato: venerdì 27 gennaio 2006 10.12
> A: 'FreeRadius users mailing list'
> Oggetto: R: R: SQL.conf new query
>
> I have append the query to the existing ones, but without it turns out to
>
> you.
>
> postauth_mac_query = "INSERT into ${authcheck_table} (UserName,
>
> Attribute, op, Value) VALUES ('%{SQL-User-Name}'', 'Calling-Station-Id',
>
> ':=', '%{Calling-Station-Id}')"
>
> postauth_query = "INSERT into ${postauth_table} (id, user, pass,
>
> reply, date) values ('', '%{User-Name}', 
> '%{User-Password:-Chap-Password}',
>
> '%{reply:Packet-Type}', NOW())"
>
> in the log of start you come only loaded the postauth_query:
>
> sql: group_membership_query = "SELECT GroupName FROM usergroup WHERE
>
> UserName='%{SQL-User-Name}'"
>
> sql: connect_failure_retry_delay = 60
>
> sql: simul_count_query = ""
>
> sql: simul_verify_query = "SELECT RadAcctId, AcctSessionId, UserName,
>
> NASIPAddress, NASPortId, FramedIPAddress, CallingStationId, FramedProtocol
>
> FROM radacct WHERE UserName='%{SQL-User-Name}' AND AcctStopTime = 0"
>
> sql: postauth_table = "radpostauth"
>
> sql: postauth_query = "INSERT into radpostauth (id, user, pass, reply,
>
> date) values ('', '%{User-Name}', '%{User-Password:-Chap-Password}',
>
> '%{reply:Packet-Type}', NOW())"
>
> it does not appear and consequently it does not work: (
>
> Solutions?
>
> Regards
>
> Inviato: giovedì 26 gennaio 2006 18.41
>
> A: FreeRadius users mailing list
>
> Oggetto: Re: R: SQL.conf new query
>
>> I would like to build a new query to insert
>
>> user's MAC address into radcheck table, as users log-out (accounting-stop
>
>> packet).
>
> Just append the query to the existing ones.
>
> Alan DeKok.
>
> -
>
> List info/subscribe/unsubscribe? See
>
> http://www.freeradius.org/list/users.html
>
> -
>
> List info/subscribe/unsubscribe? See 
> http://www.freeradius.org/list/users.html
>
> __________ NOD32 1.1381 (20060126) Information __________
>
> This message was checked by NOD32 antivirus system.
>
> http://www.eset.com
>
>------------------------------------------------------------------------
>
>- 
>List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html
>

-- 
Richard Marriner II                Maingear.Net
Sr. Network Consultant          I.T. Consulting
richard at maingear.net           www.maingear.net




More information about the Freeradius-Users mailing list