Initial support of Multi Valued Attributes operators

Olivier Beytrison olivier at
Mon Mar 25 22:25:18 CET 2013

On 25.03.2013 22:05, Arran Cudbard-Bell wrote:
> On 25 Mar 2013, at 13:33, Phil Mayers <p.mayers at IMPERIAL.AC.UK> wrote:
>> On 25/03/13 17:23, Olivier Beytrison wrote:
>>> People can have from one to 6-7 of those attributes. With normal unlang
>>> operators it will only compare the first attribute it finds.
>> In which case the case, the behaviour differs between "users" files (which compare all) and "unlang". Le sigh.
>>>> Likewise, I thought == matches if one of several attributes match, but
>>>> that's not behaviour I'm testing.
>>> Nope, it only check the first attribute. Till now there was no looping
>>> over all the possible same attribute-name in the list.
>> I wonder if that might not be a better solution; for the == and =~ operators, loop over all and match if any matches. This seems "least surprising" to me.
>> You would still then want a "match all" operator, which would need to be new.
> Actually yes, this makes more sense.

I can refactor my code so that == and =~ will act like |== and |=~. But 
then what about != and !~ ?

> If you want to test specific instances of an attribute you can always use <attr>[<num>].

If you know how much attribute you have yes. If it's random, rather hard 
to use. You need to use foreach atm.

> Honestly i'm not sure if &== is at all useful and adding features for perceived completeness just means additional code to maintain.

I must agree. &== is not that useful. I have a kind of use-case in my 
mind, but even with it, a if with two comparison would do the same. But 
adding is a question of 5 lines of code. But I can remove it.

> &=~  OTOH could be very useful for validation purposes.
&=~ and |=~ allows me to shrink my policies from ~ 80 lines of code to 
15. No need to use foreach anymore.

>> But I don't feel strongly about it; I'm already abusing unlang way too much anyway, and if I get the time and energy I'm going to investigate alternative solutions (that don't involve rlm_perl).
> Good plan. Do you have any interest in using Lua?

I'm. I like LUA.

  Olivier Beytrison
  Network & Security Engineer, HES-SO Fribourg
  Mail: olivier at

More information about the Freeradius-Devel mailing list