]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
Import minor dn related changes:
authorKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 19:53:12 +0000 (19:53 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sat, 23 Jan 1999 19:53:12 +0000 (19:53 +0000)
dn_parent(" ") returns NULL
dn2entry logs if dn2id returns id but id2entry doesn't return entry.

servers/slapd/back-ldbm/dn2id.c
servers/slapd/dn.c

index d540fc4d64e96b0e22ed7403ecbb87736d2fa3ff..683d30a2e56c4019e6c484bb812c0d6d140790ab 100644 (file)
@@ -177,6 +177,14 @@ dn2entry(
                return( e );
        }
 
+       if ( id != NOID ) {
+               Debug(LDAP_DEBUG_ANY,
+                       "dn2entry_%s: no entry for valid id (%lu), dn \"%s\"\n",
+                       rw ? "w" : "r", id, dn);
+               /* must have been deleted from underneath us */
+               /* treat as if NOID was found */
+       }
+
        /* stop when we get to the suffix */
        if ( be_issuffix( be, dn ) ) {
                return( NULL );
index 495eca4b70b100ca944f8cd5936f41f577b17087..e18a29f134e7e0ec639824a7990d453a5b84e2b3 100644 (file)
@@ -161,7 +161,19 @@ dn_parent(
        char    *s;
        int     inquote, gotesc;
 
-       if ( dn == NULL || *dn == '\0' || be_issuffix( be, dn ) ) {
+       if( dn == NULL ) {
+               return NULL;
+       }
+
+       while(*dn && SPACE(*dn)) {
+               dn++;
+       }
+
+       if( *dn == '\0' ) {
+               return( NULL );
+       }
+
+       if ( be_issuffix( be, dn ) ) {
                return( NULL );
        }
 
@@ -179,7 +191,7 @@ dn_parent(
                if ( *(s + 1) == '\0' ) {
                        return( NULL );
                } else {
-                       return( ch_strdup( s + 1 ) );
+                       return( ch_strdup( &s[1] ) );
                }
        }
 
@@ -191,22 +203,25 @@ dn_parent(
        inquote = 0;
        for ( s = dn; *s; s++ ) {
                if ( *s == '\\' ) {
-                       if ( *(s + 1) )
+                       if ( *(s + 1) ) {
                                s++;
+                       }
                        continue;
                }
                if ( inquote ) {
-                       if ( *s == '"' )
+                       if ( *s == '"' ) {
                                inquote = 0;
+                       }
                } else {
-                       if ( *s == '"' )
+                       if ( *s == '"' ) {
                                inquote = 1;
-                       else if ( DNSEPARATOR( *s ) )
-                               return( ch_strdup( s + 1 ) );
+                       } else if ( DNSEPARATOR( *s ) ) {
+                               return( ch_strdup( &s[1] ) );
+                       }
                }
        }
 
-       return( ch_strdup("") );
+       return( ch_strdup( "" ) );
 }
 
 /*