String Validation
Neville
nev at itsnev.co.uk
Sun Aug 16 13:03:34 CEST 2009
>> If a connection that comes in with a GROUP NAME from SQL of "USUK-XX"
>> or "WUK-XX" and I want to strip of the "-XX", how would I do this with
>> ulang so I only validate the following?
>
> Using the regexp feature, you can match part of an attribute then
> reference it later, like so:
> if (SQL-GROUP =~ /(.*)-XX/) {
> update request {
> SQL-GROUP := "%{1}"
> }
> }
>
> --Mike
Thx Mike,
Sorry, I don't think my example help as XX could be ANYTHING.
E.g. USUK-5GB ; USUK-1GB ; USUK-10GB, so looking to STRIP everying after the
"-" and including the "-" to the end of the string.
The reason for doing this as I only want to validate against the first part
of the String, otherwise the Nested IF Statment will be Huge.
If your able, would appreciate if you can update the IF statement below to
reflect what I'm trying to do.
if(SQL-GROUP == "USUK") {
ok
}
elsif(NAS-IP-Address == AAA.BBB.CCC.DDD && SQL-GROUP == "WUK") {
ok
}
else {
reject
}
Thx in advance
Nev
More information about the Freeradius-Users
mailing list