ASSERT FAILED

Alan DeKok aland at deployingradius.com
Wed May 15 15:27:55 CEST 2013


Jakob Hirsch wrote:
> I may be missing something here, but aren't unset attributes just
> expanded to an empty string?

  Yes.

> If so, what is difference between the
> outcome of
>   %{%{Unset-Attribute}:-""}
> and a simple
>   %{Unset-Attribute}

  Nothing.

  But %{%{Foo-Bar}:-} is redundant.  It says "If there's no Foo-Bar,
then use an empty string.  But if there's no Foo-Bar, the result of a
%{} expansion *is* an empty string.

> Oh, and btw: As the :- syntax is copied from Unix shells, shouldn't it
> just be "%{Attribute-Name:-attribute not set}", i.e. without additional
> "%{}"? In shells it's "${VARNAME:-VARNAME is empty}", not "${${VAR}:-VAR
> is empty}" (except if you have stored a variable name VAR, of course).
> Using :- with a static string doesn't make much sense, so the extra %{}
> is kind of redundant. But I guess it's too late for such a change now
> (maybe not for 3.0).

  The change was made deliberately, and to avoid bugs.  In shell,
variable names can't have colons.  In FreeRADIUS modules, they can.

  e.g. this is ambiguous:

  %{module:-foo:-bar}

  Is "-foo" a parameter to "module"?

  This is not ambiguous:

  %{%{module:-foo}:-bar}

  As a result, this behavior will remain in v3.  Anyone wanting to see
more cases of what works and what doesn't can read src/tests/xlat.txt

  Alan DeKok.


More information about the Freeradius-Devel mailing list