Sorry to answer to this post so late : About your last post :
You probably had the Realm attribute set to the string "~\^\(.+\)\\.telco$". Which mean that string matching worked.
You were right, by having a look at the old log, that was how it was working. But then could we say that this behaviour has change between 2.1.6 and 2.2.x ? (now the "real" real is kept by freeradius instead of the "matched" one in proxy.conf ?). Thanks Thomas -----Message d'origine----- De : Thomas Fagart [mailto:tfagart@brozs.net] Envoyé : mardi 12 mai 2015 16:57 À : Alan DeKok Cc : FreeRadius users mailing list Objet : Re: [Attrs Regex] Many thanks that will do the trick ! Sorry not to have been clear enough about my needs. Thomas Le 2015-05-12 15:38, Alan DeKok a écrit :
On May 12, 2015, at 8:53 AM, Thomas Fagart <tfagart@brozs.net> wrote:
Thanks a lot for your answer, so this is not a feature :-). (I don't know how this could have worked then :-(), I could send trace if you want, because this has been working for many years with more than 20 requests /secondes).
You probably had the Realm attribute set to the string "~\^\(.+\)\\.telco$". Which mean that string matching worked.
Or, someone made local patches to the server.
We will try to code such a module in perl.
Is there any other way we could do that (eg regex on keys) using existing modules ?
Perhaps you could explain the goal, instead of talking about a particular solution.
You could put the regular expression into unlang, and then go from there:
if (Realm =~ /^(.+)\.telco$/) { update request { My-Filter-Realm := "DEFAULT" } } else { update request { My-Filter-Realm := "%{Realm}" } }
Then add My-Filter-Realm to raddb/dictionary as a "string" attribute. And make the attr_filter module key off of My-Filter-Realm instead of Realm.
Alan DeKok.