]> git.sur5r.net Git - openldap/commitdiff
Use Entry's e_ndn instead of recomputing it.
authorKurt Zeilenga <kurt@openldap.org>
Sun, 17 Jan 1999 20:12:00 +0000 (20:12 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 17 Jan 1999 20:12:00 +0000 (20:12 +0000)
servers/slapd/back-ldbm/add.c
servers/slapd/back-ldbm/search.c

index 849289ca12c3e48ee00f7b0283bd6e4162e47e14..cc18e41f53bdc0dc735c6293cb17d5b9a5945e4a 100644 (file)
@@ -20,12 +20,12 @@ ldbm_back_add(
 )
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
-       char            *dn = NULL, *pdn;
+       char            *dn, *pdn;
        Entry           *p = NULL;
        int                     rootlock = 0;
        int                     rc = -1; 
 
-       dn = dn_normalize( ch_strdup( e->e_dn ) );
+       dn = e->e_ndn;
 
        Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_add: %s\n", dn, 0, 0);
 
@@ -35,7 +35,6 @@ ldbm_back_add(
        if ( ( dn2id( be, dn ) ) != NOID ) {
                pthread_mutex_unlock(&li->li_add_mutex);
                entry_free( e );
-               free( dn );
                send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, "", "" );
                return( -1 );
        }
@@ -47,7 +46,6 @@ ldbm_back_add(
                        0, 0, 0 );
 
                entry_free( e );
-               free( dn );
                send_ldap_result( conn, op, LDAP_OBJECT_CLASS_VIOLATION, "",
                    "" );
                return( -1 );
@@ -75,7 +73,6 @@ ldbm_back_add(
                        }
 
                        entry_free( e );
-                       free( dn );
                        free( pdn );
                        return -1;
                }
@@ -101,7 +98,6 @@ ldbm_back_add(
                        cache_return_entry_w( &li->li_cache, p ); 
 
                        entry_free( e );
-                       free( dn );
                        return -1;
                }
 
@@ -115,7 +111,6 @@ ldbm_back_add(
                            "", "" );
 
                        entry_free( e );
-                       free( dn );
                        return -1;
                }
 
@@ -152,7 +147,6 @@ ldbm_back_add(
                 * because e hasn't been added to the cache yet
                 */
                entry_free( e );
-               free( dn );
                send_ldap_result( conn, op, LDAP_ALREADY_EXISTS, "", "" );
                return( -1 );
        }
@@ -209,9 +203,6 @@ ldbm_back_add(
        rc = 0;
 
 return_results:;
-       if ( dn != NULL )
-               free( dn );
-
        cache_set_state( &li->li_cache, e, 0 );
 
        if (p != NULL) {
index 438397f441d8dfb5dd3095036c39c350842bdd02..b1f7d33ef36b43ba901f3d4a020d49778a3ea6c2 100644 (file)
@@ -217,13 +217,12 @@ ldbm_back_search(
                                        if ( (dn = dn_parent( be, e->e_dn )) != NULL ) {
                                                (void) dn_normalize( dn );
                                                scopeok = (dn == realBase) ? 1 : (! strcasecmp( dn, realBase ));
+                                               free( dn );
                                        } else {
                                                scopeok = (realBase == NULL || *realBase == '\0');
                                        }
-                                       free( dn );
                                } else if ( scope == LDAP_SCOPE_SUBTREE ) {
-                                       dn = ch_strdup( e->e_dn );
-                                       (void) dn_normalize( dn );
+                                       dn = ch_strdup( e->e_ndn );
                                        scopeok = dn_issuffix( dn, realBase );
                                        free( dn );
                                }