freeradius 3 sqlcounter not expanding and executing sql query
Hi all, a big thanks to all developers for freeradius 3! Having successfully set it up with mysql, I try hard to get sqlcouter going. It is always returning 'noop' because the configured query is not being expanded and executed: the only one entry in sqlcounter.conf: sqlcounter expire_on_firstuse { sql_module_instance = sql counter_name = Expire-After-Initial-Login check_name = Expire-After reply_name = Session-Timeout key = User-Name reset = never query = "SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='%{${key}}' ORDER BY acctstarttime LIMIT 1" } dictionary.local: ATTRIBUTE Expire-After 3004 integer debug output: (0) expire_on_firstuse : Entering module authorize code (0) expire_on_firstuse : expand: "%{sql:%{sql:}" -> '' (0) expire_on_firstuse : No integer found in string "" (0) [expire_on_firstuse] = noop should look like: (0) expire_on_firstuse : expand: "%{sql:SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='testuser' ORDER BY acctstarttime LIMIT 1" -> '1234' The query from the configfile with a correct username works as expected at the mysql console and returns an integer. Any ideas what is going wrong??? Thanks and Regards, Heinz
Heinz Ketchup wrote:
debug output: (0) expire_on_firstuse : Entering module authorize code (0) expire_on_firstuse : expand: "%{sql:%{sql:}" -> ''
Well, fix that. That query doesn't exist in the default configuration. So it's only there because you edited the config files to add it in.
Any ideas what is going wrong???
The query in the config file is wrong. Alan DeKok.
Thank you Alan, but this query *does* exist in the default raddb/mods-config/sql/counter/mysql/queries.conf. I only renamed the counter name itself from expire_on_login to expire_on_firstuse. To make sure I also tried with the completely original "dailycounter" with exactly same result. expand: "%{sql:%{sql:}" -> '' Can I or will you do something about it in the code? Thank you! Heinz Am 01.11.2013 um 18:32 schrieb Alan DeKok:
Heinz Ketchup wrote:
debug output: (0) expire_on_firstuse : Entering module authorize code (0) expire_on_firstuse : expand: "%{sql:%{sql:}" -> ''
Well, fix that. That query doesn't exist in the default configuration. So it's only there because you edited the config files to add it in.
Any ideas what is going wrong???
The query in the config file is wrong.
Heinz Ketchup wrote:
but this query *does* exist in the default raddb/mods-config/sql/counter/mysql/queries.conf.
No. The "%{sql:%{sql:}" string does NOT appear in that file.
To make sure I also tried with the completely original "dailycounter" with exactly same result. expand: "%{sql:%{sql:}" -> ''
Then you have some configuration somewhere which adds that. Look at the debug output to see where.
Can I or will you do something about it in the code?
I'm telling you what you need to do. You're not listening. Alan DeKok.
participants (2)
-
Alan DeKok -
Heinz Ketchup