disappearing configuration items in unlang
I'm using the latest and greatest 2.0.0 HEAD. If I wrap an 'if' statement round something (in this case a query in mysql_dialup.conf), any config items seem to get blown away. So for instance: authorize_reply_query = "\ SELECT id, UserName, Attribute, Value, op \ FROM ${authreply_table} \ WHERE Username = '%{SQL-User-Name}' \ AND (Huntgroup = '%{Huntgroup-Name}' OR Huntgroup = '') \ ORDER BY id" ... is just fine, but as soon as I wrap an 'if' round it ... # hugh - huntgroup test if ("${use_huntgroup}" == "yes") { authorize_reply_query = "\ SELECT id, UserName, Attribute, Value, op \ FROM ${authreply_table} \ WHERE Username = '%{SQL-User-Name}' \ AND (Huntgroup = '%{Huntgroup-Name}' OR Huntgroup = '') \ ORDER BY id" } else { authorize_reply_query = "\ SELECT id, UserName, Attribute, Value, op \ FROM ${authreply_table} \ WHERE Username = '%{SQL-User-Name}' \ ORDER BY id" } ... radiusd barfs on startup with: config: No such configuration item authreply_table in section if when expanding string "SELECT id, UserName, Attribute, Value, op FROM ${authreply_table} WHERE Username = '%{SQL-User-Name}' ORDER BY id" I'm setting 'use_huntgroup' in sql.conf, if that makes any difference. But using "if (1)" has the same effect. I am at a loss. -- hugh
Hugh Messenger wrote:
I'm using the latest and greatest 2.0.0 HEAD.
If I wrap an 'if' statement round something (in this case a query in mysql_dialup.conf), any config items seem to get blown away.
You can't. "if" is a processing directive that is valid only when packets are being processed. The configuration items are parsed once when the server starts, and don't change after that.
So for instance:
It would be very nice to be able to do that, but it would also be very difficult to implement. The solution is to add a layer of indirection: authorize_reply_query = "%{control:Tmp-String-0}" Then, while processing the request, set: update control { Tmp-String-0 = "..." } That *should* work, I think. Alan DeKok.
participants (2)
-
Alan DeKok -
Hugh Messenger