Regex problem with 3.0.5 and correct_escapes = false

Alan DeKok aland at
Sat Nov 22 15:12:02 CET 2014

unbeliever012000 wrote:
> My existing config has the following line within the sites authorised
> section;
> If ( User-Name =~ /(.*)\/(.*)\\^(.*)/i <file:///\\%5e(.*)\i> ) {

  That's arguably wrong, even for the old code.  If it worked, it was a bug.

> Yes this is nasty, but required to handle a specific format and worked
> under 3.0.x up to 3.0.5. Under 3.0.5 with correct_escapes set to false
> this is now generating an error of “Unexpected test after condition” on
> the second ‘(‘. I am presuming the ‘\/’ is being seen as the end of the
> regex within the parser.

  Yes.  It *should* have been '\\/'

> Setting correct_escapes to true, and changing the regex to
> /(.*)\/(.*)\^(.*)/i <file:///\\%5e(.*)\i> works. I am  not convinced
> this is worth fixing, after I think everyone would agree the regex reads
> better now. However, it maybe worth extending the radius.conf comment
> around correct_escapes to include this edge case.

  It's a small edge case.  I don't see it as a major issue.

  Alan DeKok.

More information about the Freeradius-Devel mailing list