Blame SOURCES/0005-Issue-5079-BUG-multiple-ways-to-specific-primary-508.patch

cb1cc6
From 2ee8d9d2ce8bf252287089d18e15b519f15e9538 Mon Sep 17 00:00:00 2001
cb1cc6
From: Firstyear <william@blackhats.net.au>
cb1cc6
Date: Thu, 6 Jan 2022 09:49:30 +1000
cb1cc6
Subject: [PATCH 1/5] Issue 5079 - BUG - multiple ways to specific primary
cb1cc6
 (#5087)
cb1cc6
cb1cc6
Bug Description: In a winsync environment, we can only sync
cb1cc6
changes to a primary replica. There are however, multiple
cb1cc6
ways to specify which server is a primary for a replication
cb1cc6
agreement, and I only accounted for one of them.
cb1cc6
cb1cc6
Fix Description: Improve the check to account for the
cb1cc6
other primary replica flags.
cb1cc6
cb1cc6
fixes: https://github.com/389ds/389-ds-base/issues/5079
cb1cc6
cb1cc6
Author: William Brown <william@blackhats.net.au>
cb1cc6
cb1cc6
Review by: @droideck
cb1cc6
---
cb1cc6
 ldap/servers/plugins/replication/repl5_agmt.c | 4 +++-
cb1cc6
 1 file changed, 3 insertions(+), 1 deletion(-)
cb1cc6
cb1cc6
diff --git a/ldap/servers/plugins/replication/repl5_agmt.c b/ldap/servers/plugins/replication/repl5_agmt.c
cb1cc6
index 82efdcd15..a71343dec 100644
cb1cc6
--- a/ldap/servers/plugins/replication/repl5_agmt.c
cb1cc6
+++ b/ldap/servers/plugins/replication/repl5_agmt.c
cb1cc6
@@ -482,7 +482,9 @@ agmt_new_from_entry(Slapi_Entry *e)
cb1cc6
 
cb1cc6
     /* DBDB: review this code */
cb1cc6
     if (slapi_entry_attr_hasvalue(e, "objectclass", "nsDSWindowsReplicationAgreement")) {
cb1cc6
-        if (replica && replica_get_type(replica) == REPLICA_TYPE_PRIMARY) {
cb1cc6
+        if (replica_get_type(replica) == REPLICA_TYPE_PRIMARY
cb1cc6
+           || (replica_get_type(replica) == REPLICA_TYPE_UPDATABLE && replica_is_flag_set(replica, REPLICA_LOG_CHANGES))
cb1cc6
+        ) {
cb1cc6
             ra->agreement_type = REPLICA_TYPE_WINDOWS;
cb1cc6
             windows_init_agreement_from_entry(ra, e);
cb1cc6
         } else {
cb1cc6
-- 
cb1cc6
2.37.1
cb1cc6