]> git.sur5r.net Git - openldap/commitdiff
Make sure we have a separator when doing suffix matching
authorKurt Zeilenga <kurt@openldap.org>
Thu, 15 Mar 2001 03:05:33 +0000 (03:05 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 15 Mar 2001 03:05:33 +0000 (03:05 +0000)
servers/slapd/backend.c

index 4b00ae6b76e7f9ca1faabdc8f5436a94d4ec43a2..ac82f262767ee74f876049777c911ef5b4a8f0c3 100644 (file)
@@ -509,12 +509,16 @@ select_backend(
                        len = strlen( backends[i].be_nsuffix[j] );
 
                        if ( len > dnlen ) {
+                               /* suffix is longer than DN */
                                continue;
                        }
 
-                       if ( strcmp( backends[i].be_nsuffix[j],
-                           dn + (dnlen - len) ) == 0 )
-                       {
+                       if ( len < dnlen && DN_SEPARATOR( dn[(dnlen-len)-1] ) ) {
+                               /* make sure we have a separator */
+                               continue;
+                       }
+
+                       if ( strcmp( backends[i].be_nsuffix[j], &dn[dnlen-len] ) == 0 ) {
                                if( be == NULL ) {
                                        be = &backends[i];