"switch" statement": would you know a more compact statement?
Alex Zetaeffesse
fzetafs at gmail.com
Wed Apr 26 15:03:40 UTC 2023
Hi FR people,
Is there a more compact way to state what follows?
switch {
("%{User-Name}" =~ /@tenant101\.bic\.local/) {update
control{Proxy-To-Realm := "tenant101"}
("%{User-Name}" =~ /@tenant102\.bic\.local/) {update
control{Proxy-To-Realm := "tenant102"}
("%{User-Name}" =~ /@tenant103\.bic\.local/) {update
control{Proxy-To-Realm := "tenant103"}
("%{User-Name}" =~ /@tenant104\.bic\.local/) {update
control{Proxy-To-Realm := "tenant104"}
("%{User-Name}" =~ /@tenant105\.bic\.local/) {update
control{Proxy-To-Realm := "tenant105"}
("%{User-Name}" =~ /@tenant106\.bic\.local/) {update
control{Proxy-To-Realm := "tenant106"}
("%{User-Name}" =~ /@tenant107\.bic\.local/) {update
control{Proxy-To-Realm := "tenant107"}
....
("%{User-Name}" =~ /@tenant170\.bic\.local/) {update
control{Proxy-To-Realm := "tenant170"}
}
Eventually, I may get the value of the Proxy-To-Realm variable, by
stripping the 2nd and top level domain and there would not need to repeat
the case.
Thanks,
Alex
More information about the Freeradius-Users
mailing list