Unlang, regex problem

Stephan Jäger stephan.jaeger at ewetel.de
Mon Jul 30 14:34:25 CEST 2007


Hello,

there seems to be a problem with Unlang, !~ does not work as expected.

if ("%{User-Name}" =~ /foobar/) {
}

works:

Mon Jul 30 14:14:14 2007 : Debug: >>> CALLING EVALUATE "%{User-Name}"
=~ /foobar/)
Mon Jul 30 14:14:14 2007 : Debug: >>> LOOKING AT "%{User-Name}"
=~ /foobar/)
Mon Jul 30 14:14:14 2007 : Debug: >>> 24:%{User-Name} 17 23:foobar
Mon Jul 30 14:14:14 2007 : Debug: >>> EVALUATE 0 ::)::
Mon Jul 30 14:14:14 2007 : Debug: >>> AT EOL2a
Mon Jul 30 14:14:14 2007 : Debug: >>> EVALUATE RETURNED ::)::
Mon Jul 30 14:14:14 2007 : Debug: >>> AT EOL

but:

if ("%{User-Name}" !~ /foobar/) {
}

does not work:

Mon Jul 30 14:15:07 2007 : Debug: >>> CALLING EVALUATE "%{User-Name}" !
~ /foobar/)
Mon Jul 30 14:15:07 2007 : Debug: >>> LOOKING AT "%{User-Name}" !
~ /foobar/)
Mon Jul 30 14:15:07 2007 : Debug: >>> I0 24:%{User-Name}
Mon Jul 30 14:15:07 2007 : Debug: >>> EVALUATE 0 ::!~ /foobar/)::
Mon Jul 30 14:15:07 2007 : Debug: >>> AT EOL2a
Mon Jul 30 14:15:07 2007 : Debug: >>> EVALUATE RETURNED ::!~ /foobar/)::
Mon Jul 30 14:15:07 2007 : Error: Unexpected trailing text at: !
~ /foobar/)


You can work around this with:

if (!"%{User-Name}" =~ /foobar/) {
}

But i guess the other way should work too.


Regards

Stephan Jaeger
-- 
Stephan Jäger <stephan.jaeger at ewetel.de>




More information about the Freeradius-Devel mailing list