Execute SQL command after Authentication

Marcelo Santoro santoro.ice at gmail.com
Fri Jan 9 13:55:27 CET 2015


Hi friends… i am facing a problem here….

post-auth {
 . . . . . . . . . . . . . . . . 
update request {
                Tmp-Integer-0 := "%{sql: UPDATE acess set con_id = (select con_id from mynastable where con_ip = '%{Nas-IP-Address}'), ace_last_ip = '%{Framed-IP-Address}' where ace_login = '%{SQL-User-Name}'}"
        }
}

ace_last_ip = ‘%{Framed-IP-Address}’ - "is always Null…."

i am executing this call in post-auth section in file: freeradius/sites-enabled/default

this is my last line inside post-auth block.

and also… i am getting a log error after any login:
Fri Jan  9 10:49:45 2015 : Auth: Login OK: [teste1] (from client Auth_PPPOE_T1 port 15728650 cli C4:6E:1F:98:1D:4F)
Fri Jan  9 10:49:45 2015 : Info: rlm_sql (sql): Attempting to connect rlm_sql_mysql #118
Fri Jan  9 10:49:45 2015 : Info: rlm_sql_mysql: Starting connect to MySQL server for #118
Fri Jan  9 10:49:45 2015 : Info: rlm_sql (sql): Connected new DB handle, #118
Fri Jan  9 10:49:45 2015 : Info: Allocated IP: 131.0.120.0 from db_pool   (did pppoe-1 cli C4:6E:1F:98:1D:4F port 15728650 user teste1)
Fri Jan  9 10:49:45 2015 : Info: rlm_sql (sql): Attempting to connect rlm_sql_mysql #117
Fri Jan  9 10:49:45 2015 : Info: rlm_sql_mysql: Starting connect to MySQL server for #117
Fri Jan  9 10:49:45 2015 : Info: rlm_sql (sql): Connected new DB handle, #117
Fri Jan  9 10:49:45 2015 : Info: rlm_sql (sql): Attempting to connect rlm_sql_mysql #116
Fri Jan  9 10:49:45 2015 : Info: rlm_sql_mysql: Starting connect to MySQL server for #116
Fri Jan  9 10:49:45 2015 : Info: rlm_sql (sql): Connected new DB handle, #116
Fri Jan  9 10:49:45 2015 : Error: rlm_sql_mysql: MYSQL Error: No Fields
Fri Jan  9 10:49:45 2015 : Error: rlm_sql_mysql: MYSQL error: 

MYSQL ERROR: No Fields ——— What is it ? 


Tks for your support !!!

> Em 02/01/2015, à(s) 17:15, Arran Cudbard-Bell <a.cudbardb at freeradius.org> escreveu:
> 
> 
>> On 2 Jan 2015, at 13:55, Marcelo Santoro <santoro.ice at gmail.com> wrote:
>> 
>> Hi Friends… 
>> 
>> i Would like to know, how to execute a SQL UPDATE command after my client Authenticate for example.
>> 
>> After client Authenticate… i want to execute a UPDATE command to my database sending the NAS where the client is connected… i know that this information exist in radacct, but i need this information in another table… 
>> 
>> My RadAcct table has more than 9 millions of registers… and i don`t want to make SELECTs in this table.
> 
> post-auth {
> 	update request {
> 		Tmp-Integer-0 := "%{sql:UPDATE foo bar}"
> 	}
> }
> 
> Arran Cudbard-Bell <a.cudbardb at freeradius.org>
> FreeRADIUS development team
> 
> FD31 3077 42EC 7FCD 32FE 5EE2 56CF 27F9 30A8 CAA2
> 
> -
> List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeradius.org/pipermail/freeradius-users/attachments/20150109/fae77e52/attachment.html>


More information about the Freeradius-Users mailing list