[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: (ITS#3538) Substring filter normalization
There remains significant debate in the IETF regarding
how substrings matching should behave. My proposal is
detailed in draft-ietf-ldapbis-strprep. Conseneus
has yet to be determined.
At 07:38 AM 2/12/2005, weber@bucknell.edu wrote:
>Full_Name: Chris Weber
>Version: 2.2.23
>OS: Solaris 9
>URL: ftp://ftp.openldap.org/incoming/
>Submission from: (NULL) (134.82.42.1)
>
>
> I feel that the way in which OpenLDAP 2.2.23 normalizes substring filters is
>probably incorrect. At present, substring filters are normalized like:
>
> (cn=* ab) => (cn=*ab)
> (cn=ab *) => (cn=ab*)
> (cn=* ab *) => (cn=*ab*)
> (cn=* ab * cd *) => (cn=*ab*cd*)
>
> This treatment is due to each of a substring filter's "initial", "any", and
>"final" strings being individually normalized out of context, as though they
>were each an entire string rather than internal substrings of a larger string.
>
> I've applied the following patch locally to restore the expected behavior.
>The changes are to:
>
> schema_init.c:UTF8StringNormalize
>
>and cause substring filter parts to be normalized in their proper contexts.
>Perhaps there's a better place or more general way to accomplish this within
>OpenLDAP's source tree, but this is straightforward and seems to have no other
>consequences.
>
>
>--- openldap-2.2.23/servers/slapd/schema_init.c 2005-01-20 12:01:09.000000000
>-0500
>+++ openldap-2.2.23BU/servers/slapd/schema_init.c 2005-02-12 09:33:19.568860000
>-0500
>@@ -1361,7 +1361,10 @@
> nvalue.bv_len = 0;
> nvalue.bv_val = tmp.bv_val;
>
>- wasspace=1; /* trim leading spaces */
>+ wasspace = ( ( ( use & SLAP_MR_SUBSTR_ANY ) == SLAP_MR_SUBSTR_ANY )
>+ || ( ( use & SLAP_MR_SUBSTR_FINAL ) == SLAP_MR_SUBSTR_FINAL ) )
>+ ? 0 : 1; /* trim leading spaces? */
>+
> for( i=0; i<tmp.bv_len; i++) {
> if ( ASCII_SPACE( tmp.bv_val[i] )) {
> if( wasspace++ == 0 ) {
>@@ -1375,7 +1378,9 @@
> }
>
> if( nvalue.bv_len ) {
>- if( wasspace ) {
>+ if( wasspace
>+ && ( ( use & SLAP_MR_SUBSTR_INITIAL ) != SLAP_MR_SUBSTR_INITIAL )
>+ && ( ( use & SLAP_MR_SUBSTR_ANY ) != SLAP_MR_SUBSTR_ANY ) ) {
> /* last character was a space, trim it */
> --nvalue.bv_len;
> }