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

Re: one-level search error? (ITS#1654)



masarati@aero.polimi.it wrote:
> 
> > Also, are you = willing to provide us with the information about which source-file = contains the error? One of our programmers has offered to have a look = himself to fix it in the 2.0.x version.
> 
> Sure. I have one quick fix: in servers/slapd/back-ldbm/search.c:286
> (REL_ENG_2, at least) there's a call to (void) dn_normalize( dn );
> it should be replaced with some code eating initial white space, if
> any, say:
> 
>                         /* check scope */
>                         if ( !scopeok && scope == LDAP_SCOPE_ONELEVEL ) {
>                                 if ( (dn = dn_parent( be, e->e_ndn )) != NULL ) {
> -                                       (void) dn_normalize( dn );
> -                                       scopeok = (dn == realbase)
> -                                               ? 1
> -                                               : (strcmp( dn, realbase ) ? 0 : 1 );
> +                                       char *newdn = dn;
> +                                       while ( ASCII_SPACE( newdn[ 0 ] ) ) newdn++;
> +                                       scopeok = ( strcmp( newdn, realbase ) ? 0 : 1 );
>                                         free( dn );
> but this is totally untested.  The flaw is somewhere in the logic
> of the dn normalization, which has been completely reworked in 2.1
> (see 2.1 alpha or HEAD code); normalizing more than once a dn in
> string representation that contains sequences of backslashes (e.g.
> your '\\\\') results in incremental backslash elimination (e.g.
> '\\\\' => '\\' => '\').  I don't think it worth trying to fix 2.0
> code at this level.
> 
> Pierangelo.

Do you think this fix may go into 2.0.X? I tested it now
and works as intended.

Ando.

-- 
Dr. Pierangelo Masarati               | voice: +39 02 2399 8309
Dip. Ing. Aerospaziale                | fax:   +39 02 2399 8334
Politecnico di Milano                 |
mailto:pierangelo.masarati@polimi.it
via La Masa 34, 20156 Milano, Italy   |
http://www.aero.polimi.it/~masarati