andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 046bf5b22c0dda652c2ccf4ae112f70fd27718e8 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Tue, 22 Sep 2015 09:49:12 -0400
Subject: [PATCH 340/342] Ticket 48266 - Online init crashes consumer

Bug Description:  When trying to create the 'replica keep alive' entry
                  on a consumer during an online init, the entry gets freed
                  in op_shared_add(), and then freed again in
                  replica_subentry_create() which leads to a crash.

Fix Description:  Do not free the "keep alive" entry if a referral is
                  returned when trying to create the keep-alive entry.

https://fedorahosted.org/389/ticket/48266

Reviewed by: tbordaz(Thanks!)

(cherry picked from commit 5538bac519c5363bb456e98d615c9366dedd57d8)
(cherry picked from commit 3896e68cd2ee56df7bcc95add500fee56733d62c)
---
 ldap/servers/plugins/replication/repl5_replica.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
index 84539d2..20b5ab1 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -432,7 +432,9 @@ replica_subentry_create(Slapi_DN *repl_root, ReplicaId rid)
             repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION), 0 /* flags */);
     slapi_add_internal_pb(pb);
     slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &return_value);
-    if (return_value != LDAP_SUCCESS && return_value != LDAP_ALREADY_EXISTS) 
+    if (return_value != LDAP_SUCCESS &&
+        return_value != LDAP_ALREADY_EXISTS &&
+        return_value != LDAP_REFERRAL /* CONSUMER */)
     {
         slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "Warning: unable to "
                 "create replication keep alive entry %s: %s\n", slapi_entry_get_dn_const(e),
-- 
1.9.3