please document SQL-User-Name xlat option in sql-log module (1.1.7)
Hi, rlm_sql_log has an option record {"sql_user_name", PW_TYPE_STRING_PTR, offsetof(rlm_sql_log_t,sql_user_name), NULL, ""}, This is not documented in the config file. I tried to use %{SQL-User-Name} in my relay config, didn't know of this option's existence, so it was assumed to be NULL. The code then doesn't translate User-Name at all, and my variable subst created INSERT strings with an empty user name. I suggest just copying the text from sql.conf, as the semantics seems to be the same: #################################################################### # Query config: Username ###################################################################### # This is the username that will get substituted, escaped, and added # as attribute 'SQL-User-Name'. '%{SQL-User-Name}' should be used below # everywhere a username substitution is needed so you you can be sure # the username passed from the client is escaped properly. # # Uncomment the next line, if you want the sql_user_name to mean: # # Use Stripped-User-Name, if it's there. # Else use User-Name, if it's there, # Else use hard-coded string "DEFAULT" as the user name. #sql_user_name = "%{Stripped-User-Name:-%{User-Name:-DEFAULT}}" # sql_user_name = "%{User-Name}" Greetings, Stefan -- Stefan WINTER Stiftung RESTENA - Réseau Téléinformatique de l'Education Nationale et de la Recherche Ingenieur Forschung & Entwicklung 6, rue Richard Coudenhove-Kalergi L-1359 Luxembourg E-Mail: stefan.winter@restena.lu Tel.: +352 424409-1 http://www.restena.lu Fax: +352 422473
Stefan Winter wrote:
rlm_sql_log has an option record
{"sql_user_name", PW_TYPE_STRING_PTR, offsetof(rlm_sql_log_t,sql_user_name), NULL, ""},
This is not documented in the config file. I tried to use %{SQL-User-Name} in my relay config, didn't know of this option's existence, so it was assumed to be NULL.
What is the problem then? If you don't set the option "sql_user_name" rlm_sql_log doesn't create a "SQL-User-Name" pair. This is the same as rlm_sql.
The code then doesn't translate User-Name at all, and my variable subst created INSERT strings with an empty user name.
I'm not sure what you mean by that. rlm_sql_log expands %{User-Name} to the username passed from the client, not an empty string.
I suggest just copying the text from sql.conf, as the semantics seems to be the same:
[...]
Indeed it is the same as rlm_sql, therefore I'm not sure there is really a need to duplicate the whole description. I think adding one line with an example will be enough, so you can notice its existence. sql_log { path = ${radacctdir}/sql-relay acct_table = "radacct" postauth_table = "radpostauth" sql_user_name = %{%{User-Name}:-DEFAULT}} ... } -- Nicolas Baradakis
participants (2)
-
Nicolas Baradakis -
Stefan Winter