[389-commits] Branch '389-ds-base-1.2.11' - ldap/servers

Noriko Hosoi nhosoi at fedoraproject.org
Wed Aug 29 18:08:47 UTC 2012


 ldap/servers/slapd/back-ldbm/ldbm_delete.c |   20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

New commits:
commit 20be9c42a6fa2f13bebd360a251d383ef2caa046
Author: Noriko Hosoi <nhosoi at redhat.com>
Date:   Tue Aug 28 17:28:59 2012 -0700

    Trac Ticket #437 - variable dn should not be used in ldbm_back_delete
    
    https://fedorahosted.org/389/ticket/437
    
    Fix description: When SLAPI_DELETE_TARGET_DN was replaced with
    SLAPI_DELETE_TARGET_SDN, removing obsolete variable dn was
    incomplete.  Actually, the variable dn is still referred in
    some error messages.  This patch sets the value from Slapi_DN
    to the dn variable.
    (cherry picked from commit b37e0c2e878ecef8c46449ce4e44a3c0deb344f2)

diff --git a/ldap/servers/slapd/back-ldbm/ldbm_delete.c b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
index 6e6a5de..14b2992 100644
--- a/ldap/servers/slapd/back-ldbm/ldbm_delete.c
+++ b/ldap/servers/slapd/back-ldbm/ldbm_delete.c
@@ -61,7 +61,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	struct backentry *e = NULL;
 	struct backentry *tombstone = NULL;
 	struct backentry *original_tombstone = NULL;
-	char *dn = NULL;
+	const char *dn = NULL;
 	back_txn txn;
 	back_txnid parent_txn;
 	int retval = -1;
@@ -76,7 +76,6 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	int rc = 0;
 	int ldap_result_code= LDAP_SUCCESS;
 	char *ldap_result_message= NULL;
-	Slapi_DN sdn;
 	Slapi_DN *sdnp = NULL;
 	char *e_uniqueid = NULL;
 	Slapi_DN nscpEntrySDN;
@@ -108,8 +107,6 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	slapi_pblock_get( pb, SLAPI_OPERATION, &operation );
 	slapi_pblock_get( pb, SLAPI_IS_REPLICATED_OPERATION, &is_replicated_operation );
 	
-	/* sdn needs to be initialized before "goto *_return */
-	slapi_sdn_init(&sdn);
 	slapi_sdn_init(&nscpEntrySDN);
 
 	/* dblayer_txn_init needs to be called before "goto error_return" */
@@ -128,12 +125,13 @@ ldbm_back_delete( Slapi_PBlock *pb )
 		slapi_log_error (SLAPI_LOG_TRACE, "ldbm_back_delete", "enter conn=%" NSPRIu64 " op=%d\n", pb->pb_conn->c_connid, operation->o_opid);
 	}
 
-	if (NULL == addr)
+	if ((NULL == addr) && (NULL == sdnp))
 	{
 		/* retval is -1 */
 		goto error_return;
 	}
-	ldap_result_code = slapi_dn_syntax_check(pb, slapi_sdn_get_dn(sdnp), 1);
+	dn = slapi_sdn_get_dn(sdnp);
+	ldap_result_code = slapi_dn_syntax_check(pb, dn, 1);
 	if (ldap_result_code)
 	{
 		ldap_result_code = LDAP_INVALID_DN_SYNTAX;
@@ -148,11 +146,6 @@ ldbm_back_delete( Slapi_PBlock *pb )
 	
 	inst = (ldbm_instance *) be->be_instance_info;
 
-	if (NULL == sdnp) {
-		slapi_sdn_init_normdn_byref(&sdn, dn);
-		sdnp = &sdn;
-	}
-
 	/* The dblock serializes writes to the database,
 	 * which reduces deadlocking in the db code,
 	 * which means that we run faster.
@@ -257,7 +250,7 @@ ldbm_back_delete( Slapi_PBlock *pb )
 		PR_ASSERT(!is_tombstone_entry);
 		if (is_tombstone_entry) { 
 				slapi_log_error(SLAPI_LOG_FATAL, "ldbm_back_delete",
-						"Attempt to Tombstone again a tombstone entry %s\n", dn);
+					"Attempt to Tombstone again a tombstone entry %s\n", dn);
 			delete_tombstone_entry = 1;
 		}
 	}
@@ -1186,7 +1179,7 @@ diskfull_return:
 		 * with this entry. Now that this name has been given up, one
 		 * of those entries can take over the name. 
 		 */
-		slapi_pblock_set(pb, SLAPI_URP_NAMING_COLLISION_DN, slapi_ch_strdup (dn));
+		slapi_pblock_set(pb, SLAPI_URP_NAMING_COLLISION_DN, slapi_ch_strdup(dn));
 	}
 	if (free_delete_existing_entry) {
 		done_with_pblock_entry(pb, SLAPI_DELETE_EXISTING_ENTRY);
@@ -1195,7 +1188,6 @@ diskfull_return:
 	}
 	backentry_free(&original_tombstone);
 	slapi_ch_free((void**)&errbuf);
-	slapi_sdn_done(&sdn);
 	slapi_sdn_done(&nscpEntrySDN);
 	slapi_ch_free_string(&e_uniqueid);
 	if (pb->pb_conn)




More information about the 389-commits mailing list