users file and "!*" comparisons
Daniel Larsson
Daniel.Larsson at servicefactory.com
Tue Aug 7 20:10:33 CEST 2007
On Tue, 2007-08-07 at 13:33 -0400, Alan DeKok 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.
>
> No. That is not the way it's documented. See "man users". Each item
> in the check list is ANDed. What you wrote is:
>
> Some-Attr doesn't exist AND some other attribute doesn't exist.
>
> If Some-Attr *does* exist, the first check fails, and the next one
> isn't even looked at.
The second one isn't looked at in any case. Even if Some-Attr does *not*
exist, the check returns false immediately, regardless of the presence
of Other-Attr.
>
> > Before I try to patch this, is this intended for some reason?
>
> It's both intended and documented.
>
> If you want more complex comparisons, see the CVS head. There, you
> can do:
>
> if (!Some-Attr || !Other-Attr) ...
>
> Which is what you seem to want.
No, perhaps my wording was confused. I wanted a match if neither was
present.
-------------- 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/e86dfff4/attachment.pgp>
More information about the Freeradius-Devel
mailing list