sqlcounter_expire_on_login module
Hi everybody, I have been looking for how to solve this: A user log in to freeradius, and after the first login, exactly one day later the access should to expire. Example: User: 'aaa' - 1 day (24hours). First login: 2012-04-02 12:00:00 Expires on: 2012-04-03 12:00:00 I have enabled sqlcounter_expire_on_login module, when user log in first time, there are not uses (radacct is empty for this user) but, sqlcounter_expire_on_login's query returns empty set value, not returns a valid value (for example 0) so, when freeradius check the return, says this: (freeradius -X output) rlm_sqlcounter: Entering module authorize code sqlcounter_expand: 'SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='%{User-Name}' ORDER BY acctstarttime LIMIT 1;' [expire_on_login] expand: SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='%{User-Name}' ORDER BY acctstarttime LIMIT 1; -> SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='sa373YIMET' ORDER BY acctstarttime LIMIT 1; sqlcounter_expand: '%{sql:SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='sa373YIMET' ORDER BY acctstarttime LIMIT 1;}' [expire_on_login] sql_xlat [expire_on_login] expand: %{User-Name} -> sa373YIMET [expire_on_login] sql_set_user escaped user --> 'sa373YIMET' [expire_on_login] expand: SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='sa373YIMET' ORDER BY acctstarttime LIMIT 1; -> SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='sa373YIMET' ORDER BY acctstarttime LIMIT 1; rlm_sql (sql): Reserving sql socket id: 3 [expire_on_login] SQL query did not return any results rlm_sql (sql): Released sql socket id: 3 [expire_on_login] expand: %{sql:SELECT TIME_TO_SEC(TIMEDIFF(NOW(), acctstarttime)) FROM radacct WHERE UserName='sa373YIMET' ORDER BY acctstarttime LIMIT 1;} -> rlm_sqlcounter: No integer found in string "" ++[expire_on_login] returns noop Anybody could tell me how can I do to solve it? I hope your answers. Thank you very much. Best regards, Antonio. -- View this message in context: http://freeradius.1045715.n5.nabble.com/sqlcounter-expire-on-login-module-tp... Sent from the FreeRadius - User mailing list archive at Nabble.com.
On 2012/05/03 09:37 AM, tonimanel wrote:
Hi everybody,
I have been looking for how to solve this: A user log in to freeradius, and after the first login, exactly one day later the access should to expire.
Example: User: 'aaa' - 1 day (24hours). First login: 2012-04-02 12:00:00 Expires on: 2012-04-03 12:00:00
I have enabled sqlcounter_expire_on_login module, when user log in first time, there are not uses (radacct is empty for this user) but, sqlcounter_expire_on_login's query returns empty set value, not returns a valid value (for example 0) so, when freeradius check the return, says this:
Modify your query... select ifnull((The rest of your query),0) It will then return 0 when no records are found. -- Johan Meiring Cape PC Services CC Tel: (021) 883-8271 Fax: (021) 886-7782 -------------------- Before acting on this email or opening any attachments you should read Cape PC Service's email disclaimer at: http://www.pcservices.co.za/disclaimer.html
Thanks for your answer. I had been testing some queries ... Now works fine with SELECT IFNULL((query),0) Thank you very much. Best regards, Antonio. -- View this message in context: http://freeradius.1045715.n5.nabble.com/sqlcounter-expire-on-login-module-tp... Sent from the FreeRadius - User mailing list archive at Nabble.com.
participants (2)
-
Johan Meiring -
tonimanel