Conditional expression ":-" deprecated?
John Morrissey
jwm at horde.net
Sat Jan 23 16:46:40 CET 2010
We have a vendor product that only supports usernames shorter than 64
characters. I used the unlang expression:
if ("%{#User-Name:-0}" <= 63)
to avoid sending accounting with longer usernames to it, which yielded:
server buffered-dpi-esc4 {
+- entering group preacct {...}
++? if ("%{#User-Name:-0}" <= 63)
WARNING: Deprecated conditional expansion ":-". See "man unlang" for details
expand: %{#User-Name:-0} -> 70
? Evaluating ("%{#User-Name:-0}" <= 63) -> FALSE
++? if ("%{#User-Name:-0}" <= 63) -> FALSE
I got the ":-" expression from unlang(5), which doesn't mention that it's
deprecated. I used this expression to specify a default length of 0 since
unlang(5) states that %{#attr} returns an empty value if attr isn't present,
and I wasn't sure how FreeRADIUS would react to a numeric comparison against
an unset value.
I'm using:
if (User-Name && "%{#User-Name}" <= 63) {
instead for now, but is the ":-" expression really deprecated, and is there
an alternative equivalent? How will FreeRADIUS react to an unset value in a
numeric comparison?
john
--
John Morrissey _o /\ ---- __o
jwm at horde.net _-< \_ / \ ---- < \,
www.horde.net/ __(_)/_(_)________/ \_______(_) /_(_)__
More information about the Freeradius-Users
mailing list