On Sat, Nov 12, 2011 at 7:49 PM, JennyBlunt <jennyshoehorn@me.com> wrote:
Thanks for the help, that's very useful. I can get the time in there now but have a question about getting our access-period out.
In post-auth, I've tried this query to get the access-period out:
if (! "%{control.Tmp-String-0}") { update control { Tmp-String-2 := "%{sql: SELECT value FROM radcheck WHERE username='%{User-Name}' and attribute = 'Access-Period'}" Tmp-String-3 := "%{sql: INSERT INTO radcheck (username,attribute,op,value) values ('%{User-Name}', 'Expiration', ':=', '%{Tmp-String-2}')}; SELECT NOW()" } }
In freeradius, Tmp-String-2 has no value, whereas if I run the query in mysql, I get a value of 86400 (I know the above doesn't sum anything).
How can I get and use the value?
I don't think Access-Period is a valid attribute (are you using your own dictionary?) Anyway, if you think freeradius is not passing the correct query, try activating mysql's general query log: http://dev.mysql.com/doc/refman/5.5/en/query-log.html . It should print out exactly what queries are recevied by mysql, and you can run those queries manually. Pretty handy for debug cases of mismatched quotes or brackets. -- Fajar