[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: commit: ldap/servers/slapd filterentry.c

Note to those not reading -bugs... this is in reference to ITS#269.

Hallvard B Furuseth wrote:
> kurt@OpenLDAP.org writes:
> > Rename filter entry's  strcpy_special() to strcpy_regex() to better
> > reflect its purpose.  Modify switch to support REG_EXTENDED expressions.
> > Use REG_EXTENDED instead of REG_BASIC everywhere.
> Why?

Because REG_EXTENDED appeared to be more consistently implemented

> In libldap/getfilter (and maybe slapd/acl*.c), yes.  But
> filterentry only needs "^.*$", so it seems simpler and
> and remove '+' and ']'.

Also, REG_BASIC is only supported for backwards compatibility.
As the interface is not exposed, we only have to be compatible
with ourselves.

> probably faster to use basic regexps

Likely not.  They both have the same engine underneath and
provide similiar functionality (especially in view of some
implementations extensions).  Of course, if we were concerned
about speed, we might set REG_NOSUB in filterentry use.

> (Apparently ']' is not a
> special character in POSIX regexps, it's just something with '['
> recognizes.  And the behaviour is undefined if an ordinary characer is
> quoted.)

In my reading of GNU and HS implementations, \c matches c when c
is an ordinary character.  So if ] is ordinary, escaping it won't
hurt.  If ] is an operator (as I believe it is in the GNU regex
implementation), it needs to be escaped.  Likewise with }.
> > Modify <ac/regex.h> to support <gnuregex.h> for testing purposes.
> > Requires: env CPPFLAGS="-DHAVE_GNUREGEX_H=1" LIBS=-lgnuregex ./configure
> I hadn't heard of gnuregex.h,

Some OS vendors provide GNU Regex installed as <gnuregex.h>/-lgnuregex
and provide HS Regex as <regex.h>/-lc.   The change allows those
with such systems to use the vendor installed GNU regex without
having to installed it myself or playing symlink or other games.

>but another is the newer GNU "rx":
>         #include <rxposix.h>
>         cc ... -lrx

Last time I toyed with GNU "rx", IIRC, it installed as <regex.h>/-lrx
(under the specified --prefix).  I don't know of any OS vendor who
provides an rx installation (as part of their distribution).