Thanks Alan, indeed I should have written (still not using it the right way as you pointed out) switch "%{User-Name}" { case "/@tenant101\.bic\.local/" {update control{Proxy-To-Realm := "tenant101"}} case "/@tenant102\.bic\.local/" {update control{Proxy-To-Realm := "tenant102"}} ... } BTW, I think this is called back-reference, isn't it? I'm pointing this out, just for anybody who may read this mail thread looking for the same feature. Thanks for your fast reply! Alex On Wed, Apr 26, 2023 at 5:30 PM Alan DeKok <aland@deployingradius.com> wrote:
On Apr 26, 2023, at 11:03 AM, Alex Zetaeffesse <fzetafs@gmail.com> wrote:
Is there a more compact way to state what follows?
switch { ("%{User-Name}" =~ /@tenant101\.bic\.local/) {update control{Proxy-To-Realm := "tenant101"}
That's not correct configuration syntax, but OK...
In general things like this are best done with regular expressions. Especially if the data you're trying to use is part of the input packet.
if (&User-Name =~ /([^.]+)\.bic\.local) { update control { &Proxy-To-Realm := "%{1}" } }
You also don't have to put quotes around references to User-Name. Just use &User-Name. This works, and that's what the documentation says to do. I have no idea why so many people use constructs like "%{User-Name}". It's just not necessary.
Alan DeKok.
- List info/subscribe/unsubscribe? See http://www.freeradius.org/list/users.html