From: Kurt Zeilenga Date: Sun, 17 Jan 1999 20:12:00 +0000 (+0000) Subject: Use Entry's e_ndn instead of recomputing it. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~757 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=77b2e2cb25d7a8ae8223559862adcf1fa8b63fa7;p=openldap Use Entry's e_ndn instead of recomputing it. --- diff --git a/servers/slapd/back-ldbm/add.c b/servers/slapd/back-ldbm/add.c index 849289ca12..cc18e41f53 100644 --- a/servers/slapd/back-ldbm/add.c +++ b/servers/slapd/back-ldbm/add.c @@ -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) { diff --git a/servers/slapd/back-ldbm/search.c b/servers/slapd/back-ldbm/search.c index 438397f441..b1f7d33ef3 100644 --- a/servers/slapd/back-ldbm/search.c +++ b/servers/slapd/back-ldbm/search.c @@ -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 ); }