diff --git a/ldap.h b/ldap.h index 17c3852..96fc5c0 100644 --- a/ldap.h +++ b/ldap.h @@ -5,6 +5,7 @@ #include #include "asn1.h" +/* return zero if same, otherwise nonzero */ int matchstring(struct string* s,const char* c); int matchcasestring(struct string* s,const char* c); int matchprefix(struct string* s,const char* c); diff --git a/tinyldap.c b/tinyldap.c index e77174c..c0b91cf 100644 --- a/tinyldap.c +++ b/tinyldap.c @@ -1431,8 +1431,14 @@ static int lookupdn(struct string* dn,size_t* index, struct hashnode** hn) { } for (; i<=result.last; ++i) { if (isset(&result,i)) { - *index=i; - return 1; + uint32 j; + uint32_unpack(map+indices_offset+4*i,&j); + uint32 k; + uint32_unpack(map+j+8,&k); + if (!matchstring(dn,map+k)) { + *index=i; + return 1; + } } } }