Browse Source

Resolves: #474248
Summary: Replica crashes in the consumer initialization if the backend to be
replicated does not exist
Description:
. mapping_tree.c: if NULL mapping tree state is passed, return an error.
. repl_extop.c: if mapping tree node state is NULL, don't reset the mapping
tree state.
. replutil.c: if NULL mapping tree state is passed, log it and return.

Noriko Hosoi 17 years ago
parent
commit
1bf6bfb757

+ 5 - 3
ldap/servers/plugins/replication/repl_extop.c

@@ -837,10 +837,12 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
         {
             response = NSDS50_REPL_INTERNAL_ERROR;
 			/* reset the mapping tree state to what it was before
-			   we tried to do the bulk import */
-			repl_set_mtn_state_and_referrals(repl_root_sdn, mtnstate,
+			   we tried to do the bulk import if mtnstate exists */
+			if (mtnstate) {
+				repl_set_mtn_state_and_referrals(repl_root_sdn, mtnstate,
 											 NULL, NULL, mtnreferral);
-			slapi_ch_free_string(&mtnstate);
+				slapi_ch_free_string(&mtnstate);
+			}
 			charray_free(mtnreferral);
 			mtnreferral = NULL;
 			

+ 5 - 0
ldap/servers/plugins/replication/replutil.c

@@ -709,6 +709,11 @@ repl_set_mtn_state_and_referrals(
 	int ii = 0;
 	char **referrals_to_set = NULL;
 	PRBool chain_on_update = is_chain_on_update_setup(repl_root_sdn);
+	if (NULL == mtn_state) {
+		slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, 
+						"repl_set_mtn_referrals: cannot set NULL state.\n");
+		return;
+	}
 
 	/* Fix for blackflag bug 601440: We want the new behaviour of DS,
 	** going forward, to now be that if the nsds5replicareferral attrib

+ 4 - 0
ldap/servers/slapd/mapping_tree.c

@@ -3043,6 +3043,10 @@ slapi_mtn_set_state(const Slapi_DN *sdn, char *state)
         return LDAP_OPERATIONS_ERROR;
     }
 
+    if (NULL == state) {
+        return LDAP_OPERATIONS_ERROR;
+    }
+
     if ( (value = slapi_mtn_get_state(sdn)) != NULL )
     {
         if ( strcasecmp(value, state) == 0 )