users file and "!*" comparisons

Daniel Larsson Daniel.Larsson at servicefactory.com
Tue Aug 7 20:11:56 CEST 2007


On Tue, 2007-08-07 at 18:08 +0100, Arran Cudbard-Bell wrote:
> Daniel Larsson wrote:
> > I've encountered an unintuitive behaviour in the users file processing .
> > I wanted to do something similar to:
> >
> > DEFAULT Some-Attr !* "", Other-Attr !* ""
> >         ...
> >
> > I.e. if neither "Some-Attr" nor "Other-Attr" is present, it should
> > match.
> >   
> > However, this doesn't work, as paircmp in valuepair.c immediately
> > returns the result as soon as an operator "!*" is found in the check
> > list. No other check items in the user entry is checked. This seems to
> > apply to both 1.1 and 2.0 branches.
> >
> > Before I try to patch this, is this intended for some reason?
> >   
> 
> In the users file, the top line conditions are evaluated in sequence 
> until one evaluates to false.
> It doesn't matter which operators you use.

Yes, this was my understanding too, but tests with the !* operator
indicated it didn't work this way. Looking at the code seemed to confirm
this too (see the patch).

> 
> I actually find it quite helpful, and *more* intuitive that way, also 
> saves on processing for a line which could never match ...
> 
> Really if you want to be doing anything complicated with conditions I 
> would try the CVS head and look at 'man unlang'.
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freeradius.org/pipermail/freeradius-devel/attachments/20070807/adbe00ec/attachment.pgp>


More information about the Freeradius-Devel mailing list