|
|
583fac |
From 7b4cb7aebdf5264e12e4ffad96fd21b3d7d2a14f Mon Sep 17 00:00:00 2001
|
|
|
583fac |
From: Ludwig Krispenz <lkrispen@redhat.com>
|
|
|
583fac |
Date: Tue, 11 Dec 2018 11:06:44 +0100
|
|
|
583fac |
Subject: [PATCH] Ticket 50078 - cannot add cenotaph in read only consumer
|
|
|
583fac |
|
|
|
583fac |
Bug: For modrdn operations a cenotaph entry is created to be used in later conflict
|
|
|
583fac |
resolution procedures, this is done by an internal add operation and
|
|
|
583fac |
fails on hubs and consumers
|
|
|
583fac |
|
|
|
583fac |
Fix: Add the "bypass referral" flag to the internal add operation to allow it
|
|
|
583fac |
|
|
|
583fac |
Reviewed by: Thierry, thanks
|
|
|
583fac |
---
|
|
|
583fac |
dirsrvtests/tests/tickets/ticket50078_test.py | 68 +++++++++++++++++++
|
|
|
583fac |
ldap/servers/plugins/replication/urp.c | 2 +-
|
|
|
583fac |
2 files changed, 69 insertions(+), 1 deletion(-)
|
|
|
583fac |
create mode 100644 dirsrvtests/tests/tickets/ticket50078_test.py
|
|
|
583fac |
|
|
|
583fac |
diff --git a/dirsrvtests/tests/tickets/ticket50078_test.py b/dirsrvtests/tests/tickets/ticket50078_test.py
|
|
|
583fac |
new file mode 100644
|
|
|
583fac |
index 000000000..3f6c5ec2d
|
|
|
583fac |
--- /dev/null
|
|
|
583fac |
+++ b/dirsrvtests/tests/tickets/ticket50078_test.py
|
|
|
583fac |
@@ -0,0 +1,68 @@
|
|
|
583fac |
+import pytest
|
|
|
583fac |
+from lib389.utils import *
|
|
|
583fac |
+from lib389.topologies import topology_m1h1c1
|
|
|
583fac |
+from lib389.idm.user import UserAccounts
|
|
|
583fac |
+
|
|
|
583fac |
+from lib389._constants import (DEFAULT_SUFFIX, REPLICA_RUV_FILTER, defaultProperties,
|
|
|
583fac |
+ REPLICATION_BIND_DN, REPLICATION_BIND_PW, REPLICATION_BIND_METHOD,
|
|
|
583fac |
+ REPLICATION_TRANSPORT, SUFFIX, RA_NAME, RA_BINDDN, RA_BINDPW,
|
|
|
583fac |
+ RA_METHOD, RA_TRANSPORT_PROT, SUFFIX)
|
|
|
583fac |
+
|
|
|
583fac |
+logging.getLogger(__name__).setLevel(logging.DEBUG)
|
|
|
583fac |
+log = logging.getLogger(__name__)
|
|
|
583fac |
+
|
|
|
583fac |
+TEST_USER = "test_user"
|
|
|
583fac |
+
|
|
|
583fac |
+def test_ticket50078(topology_m1h1c1):
|
|
|
583fac |
+ """
|
|
|
583fac |
+ Test that for a MODRDN operation the cenotaph entry is created on
|
|
|
583fac |
+ a hub or consumer.
|
|
|
583fac |
+ """
|
|
|
583fac |
+
|
|
|
583fac |
+ M1 = topology_m1h1c1.ms["master1"]
|
|
|
583fac |
+ H1 = topology_m1h1c1.hs["hub1"]
|
|
|
583fac |
+ C1 = topology_m1h1c1.cs["consumer1"]
|
|
|
583fac |
+ #
|
|
|
583fac |
+ # Test replication is working
|
|
|
583fac |
+ #
|
|
|
583fac |
+ if M1.testReplication(DEFAULT_SUFFIX, topology_m1h1c1.cs["consumer1"]):
|
|
|
583fac |
+ log.info('Replication is working.')
|
|
|
583fac |
+ else:
|
|
|
583fac |
+ log.fatal('Replication is not working.')
|
|
|
583fac |
+ assert False
|
|
|
583fac |
+
|
|
|
583fac |
+ ua = UserAccounts(M1, DEFAULT_SUFFIX)
|
|
|
583fac |
+ ua.create(properties={
|
|
|
583fac |
+ 'uid': "%s%d" % (TEST_USER, 1),
|
|
|
583fac |
+ 'cn' : "%s%d" % (TEST_USER, 1),
|
|
|
583fac |
+ 'sn' : 'user',
|
|
|
583fac |
+ 'uidNumber' : '1000',
|
|
|
583fac |
+ 'gidNumber' : '2000',
|
|
|
583fac |
+ 'homeDirectory' : '/home/testuser'
|
|
|
583fac |
+ })
|
|
|
583fac |
+
|
|
|
583fac |
+ user = ua.get('%s1' % TEST_USER)
|
|
|
583fac |
+ log.info(" Rename the test entry %s..." % user)
|
|
|
583fac |
+ user.rename('uid=test_user_new')
|
|
|
583fac |
+
|
|
|
583fac |
+ # wait until replication is in sync
|
|
|
583fac |
+ if M1.testReplication(DEFAULT_SUFFIX, topology_m1h1c1.cs["consumer1"]):
|
|
|
583fac |
+ log.info('Replication is working.')
|
|
|
583fac |
+ else:
|
|
|
583fac |
+ log.fatal('Replication is not working.')
|
|
|
583fac |
+ assert False
|
|
|
583fac |
+
|
|
|
583fac |
+ # check if cenotaph was created on hub and consumer
|
|
|
583fac |
+ ents = H1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, filterstr="(&(objectclass=nstombstone)(cenotaphid=*))")
|
|
|
583fac |
+ assert len(ents) == 1
|
|
|
583fac |
+
|
|
|
583fac |
+ ents = C1.search_s(DEFAULT_SUFFIX, ldap.SCOPE_SUBTREE, filterstr="(&(objectclass=nstombstone)(cenotaphid=*))")
|
|
|
583fac |
+ assert len(ents) == 1
|
|
|
583fac |
+
|
|
|
583fac |
+
|
|
|
583fac |
+
|
|
|
583fac |
+if __name__ == '__main__':
|
|
|
583fac |
+ # Run isolated
|
|
|
583fac |
+ # -s for DEBUG mode
|
|
|
583fac |
+ CURRENT_FILE = os.path.realpath(__file__)
|
|
|
583fac |
+ pytest.main("-s %s" % CURRENT_FILE)
|
|
|
583fac |
diff --git a/ldap/servers/plugins/replication/urp.c b/ldap/servers/plugins/replication/urp.c
|
|
|
583fac |
index 11c5da7cf..37fe77379 100644
|
|
|
583fac |
--- a/ldap/servers/plugins/replication/urp.c
|
|
|
583fac |
+++ b/ldap/servers/plugins/replication/urp.c
|
|
|
583fac |
@@ -911,7 +911,7 @@ urp_fixup_add_cenotaph (Slapi_PBlock *pb, char *sessionid, CSN *opcsn)
|
|
|
583fac |
cenotaph,
|
|
|
583fac |
NULL,
|
|
|
583fac |
repl_get_plugin_identity(PLUGIN_MULTIMASTER_REPLICATION),
|
|
|
583fac |
- OP_FLAG_REPL_FIXUP|OP_FLAG_NOOP|OP_FLAG_CENOTAPH_ENTRY);
|
|
|
583fac |
+ OP_FLAG_REPL_FIXUP|OP_FLAG_NOOP|OP_FLAG_CENOTAPH_ENTRY|SLAPI_OP_FLAG_BYPASS_REFERRALS);
|
|
|
583fac |
slapi_add_internal_pb(add_pb);
|
|
|
583fac |
slapi_pblock_get(add_pb, SLAPI_PLUGIN_INTOP_RESULT, &ret;;
|
|
|
583fac |
|
|
|
583fac |
--
|
|
|
583fac |
2.17.2
|
|
|
583fac |
|