Parser problem?

Alan DeKok aland at deployingradius.com
Tue May 13 15:54:45 CEST 2008


Norbert Wegener wrote:
> I don't want the module saneusername to  be executed, when the username
> either
> contains "HOST" or ends with ".net" or contains "@".
> Therefore in 2.0.4 I have this code in sites-available/default:
> 
> authorize {
> 
>        if (!(  "%{User-Name}" =~ /HOST/ || "%{User-Name}" =~ /.net/ || 
> "%{User-Name}" =~ /@/  )) {

  But brackets around everything.  The parser is *horrible*.

	if (!((User-Name =~ /HOST/) || (User-Name =~ /\.net$/) || (User-Name =~
/@/))) {

  i.e. all on one line, which brackets around every condition.

  This should also work:

	if (User-Name !~ /HOST|\.net$|@/) {

> What do I have to change to make it work as expected?

  Brackets.

  The parser really needs to be updated to use something sane... like yacc.

  Alan DeKok.



More information about the Freeradius-Users mailing list