rlm_sql_log: failure on Accounting-On / Off
Hi, I'm still not happy with rlm_sql_log, and this time I'm reasonably sure it's not just me being dumb. I've recently received two Accounting-Offs, and got this in the logs: Mon Aug 13 13:53:18 2012 : Error: [sql-relay-acct-eduroam] Couldn't add SQL-User-Name attribute Mon Aug 13 13:53:18 2012 : Error: [sql-relay-acct-eduroam] Couldn't add SQL-User-Name attribute Well, sure. Accounting On/Off do not usually have a User-Name attribute in them as they are global status messages for the NAS. Looking at the code, this has more than effects than a misleading log message: if (sql_set_user(inst, request, sqlusername, NULL) <0) { radlog_request(L_ERR, 0, request, "Couldn't add SQL-User-Name attribute"); return RLM_MODULE_FAIL; } The module immediately returns FAIL, and will thus not construct nor save the SQL message (even though the SQL statement itself doesn't contain SQL-User-Name at all). The information from the Accounting-On/Off is lost. That's not nice. Could this code be wrapped around by a test which determines the packet type, and is more gentle on Accounting-On/Off? Greetings, Stefan Winter -- Stefan WINTER Ingenieur de Recherche Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et de la Recherche 6, rue Richard Coudenhove-Kalergi L-1359 Luxembourg Tel: +352 424409 1 Fax: +352 422473
Hi,
That's not nice. Could this code be wrapped around by a test which determines the packet type, and is more gentle on Accounting-On/Off?
I should add that my statement in config is: sql_user_name = "%{User-Name}" which would evaluate to an empty string. Which shouldn't be a problem, but seems to be. Stefan
Greetings,
Stefan Winter
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
-- Stefan WINTER Ingenieur de Recherche Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et de la Recherche 6, rue Richard Coudenhove-Kalergi L-1359 Luxembourg Tel: +352 424409 1 Fax: +352 422473
Stefan Winter wrote:
I'm still not happy with rlm_sql_log, and this time I'm reasonably sure it's not just me being dumb.
Try the sql module in 3.0. The "rlm_sql_null" config is now documented.
That's not nice. Could this code be wrapped around by a test which determines the packet type, and is more gentle on Accounting-On/Off?
Sure. Submit a patch. :) I'll see if I can take a look. But it should work much better in 3.0, with the rlm_sql_null config. Alan DeKok.
Try the sql module in 3.0. The "rlm_sql_null" config is now documented.
That's not nice. Could this code be wrapped around by a test which determines the packet type, and is more gentle on Accounting-On/Off?
Sure. Submit a patch. :)
Well... If it already got fixed for 3.0, I prefer workarounds. I now set it to sql_user_name = "%{%{User-Name}:-NO User-Name}" which makes stuff work. It has the side-effect that real accounting tickets which don't have a User-Name will now *not* complain any more, but will instead be logged with this bogus string. I'd prefer if such pathological tickets do get somewhat exposed in the logs, but I can live with it the way it is now :-) Thanks, Stefan
I'll see if I can take a look. But it should work much better in 3.0, with the rlm_sql_null config.
Alan DeKok. - List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
-- Stefan WINTER Ingenieur de Recherche Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et de la Recherche 6, rue Richard Coudenhove-Kalergi L-1359 Luxembourg Tel: +352 424409 1 Fax: +352 422473
participants (2)
-
Alan DeKok -
Stefan Winter