From: Howard Chu Date: Mon, 13 Jun 2005 21:21:27 +0000 (+0000) Subject: ITS#3773 fix RDN comparison X-Git-Tag: OPENLDAP_AC_BP~535 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=6cacc7fb5db3f9c02782d17cba8f52f1ff205fa7;p=openldap ITS#3773 fix RDN comparison --- diff --git a/servers/slapd/back-bdb/dn2id.c b/servers/slapd/back-bdb/dn2id.c index a2719a5dbc..69f80dd2f6 100644 --- a/servers/slapd/back-bdb/dn2id.c +++ b/servers/slapd/back-bdb/dn2id.c @@ -629,6 +629,7 @@ hdb_dn2id( int rc = 0, nrlen; diskNode *d; char *ptr; + unsigned char dlen[2]; ID idp; nrlen = dn_rdnlen( op->o_bd, in ); @@ -653,12 +654,15 @@ hdb_dn2id( d = op->o_tmpalloc( data.size * 3, op->o_tmpmemctx ); d->nrdnlen[1] = nrlen & 0xff; d->nrdnlen[0] = (nrlen >> 8) | 0x80; + dlen[0] = d->nrdnlen[0]; + dlen[1] = d->nrdnlen[1]; ptr = lutil_strncopy( d->nrdn, in->bv_val, nrlen ); *ptr = '\0'; data.data = d; rc = cursor->c_get( cursor, &key, &data, DB_GET_BOTH_RANGE ); - if ( rc == 0 && strncmp( d->nrdn, in->bv_val, nrlen )) { + if ( rc == 0 && (dlen[1] != d->nrdnlen[1] || dlen[0] != d->nrdnlen[0] || + strncmp( d->nrdn, in->bv_val, nrlen ))) { rc = DB_NOTFOUND; } if ( rc == 0 ) {