zrhoffman / rpms / 389-ds-base

Forked from rpms/389-ds-base 3 years ago
Clone
Blob Blame History Raw
From 060b9298fd03cbdac725be398e7754f67aa2b5c1 Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Tue, 22 Sep 2015 09:49:12 -0400
Subject: [PATCH 63/65] 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 1c127b40c1c7298839562326babbf2cba65cce1b)
---
 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 6ac28c1..708008c 100644
--- a/ldap/servers/plugins/replication/repl5_replica.c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
@@ -448,7 +448,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