[RADIATOR] Problem with regex, or with Radiator parsing Check Items

Heikki Vatiainen hvn at open.com.au
Thu Nov 21 15:10:31 CST 2013


On 11/21/2013 03:51 PM, Tim Jones wrote:

> I was adding a Handler to deal with EAP-SIM requests, and tried to use
> the following regex to check the User-Name attribute:
> 
> /^1\d{14,15}(\@.+)*$/

Hello Tim,

try this instead:

<Handler User-Name = "/^1\d{14,15}(\@.+)*$/">

That is, the value must be within double quotes since it contains a comma.

It can also be simplified a bit too:

<Handler User-Name = "/^1\d{14,15}(@.+)*$/">

> But my log file is throwing out "ERR: Bad attribute=value pair:
> 15}(\@.+)*$/", so it looks like Radiator is hitting the comma and trying
> to parse the rest of the regex as a regular "Check-Item=Value".

Yes, that's correct. The reference manual says Handler's checklist is
formatted the same as check items e.g., in file. The 'Check and Reply
items' section says that values with commas require double quotes.

> I changed my regex to:
> 
> /^1\d{14}(\@.+)*$|^1\d{15}(\@.+)*$/
> 
> which is working for me now.
>
> Is this a bug in the parsing of the regex, or have I misunderstood the
> formatting for variable-length repeating characters?

I think it works as intended and with the double quotes you can make it
work as you originally thought. The regexp looks fine.

Thanks,
Heikki

-- 
Heikki Vatiainen <hvn at open.com.au>

Radiator: the most portable, flexible and configurable RADIUS server
anywhere. SQL, proxy, DBM, files, LDAP, NIS+, password, NT, Emerald,
Platypus, Freeside, TACACS+, PAM, external, Active Directory, EAP, TLS,
TTLS, PEAP, TNC, WiMAX, RSA, Vasco, Yubikey, MOTP, HOTP, TOTP,
DIAMETER etc. Full source on Unix, Windows, MacOSX, Solaris, VMS,
NetWare etc.


More information about the radiator mailing list