andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 4 months ago
Clone

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

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