From ebb00a4180693225cf3c2f4aced54dc33141fa77 Mon Sep 17 00:00:00 2001 From: Mark Reynolds Date: Jan 18 2018 18:17:08 +0000 Subject: Ticket 49541 - repl config should not allow rid 65535 for masters Description: Reject adding a replica config entry with a rid of 65535 or higher, and prevent setting master's rid to 65535 or higher. https://pagure.io/389-ds-base/issue/49541 Reviewed by: mreynolds(one line commit rule) --- diff --git a/dirsrvtests/tests/suites/replication/replica_config_test.py b/dirsrvtests/tests/suites/replication/replica_config_test.py index c6ef80a..c93c58b 100644 --- a/dirsrvtests/tests/suites/replication/replica_config_test.py +++ b/dirsrvtests/tests/suites/replication/replica_config_test.py @@ -24,7 +24,7 @@ overflow = '9999999999999999999999999999999999999999999999999999999999999999999' replica_dict = {'nsDS5ReplicaRoot': 'dc=example,dc=com', 'nsDS5ReplicaType': '3', 'nsDS5Flags': '1', - 'nsDS5ReplicaId': '65535', + 'nsDS5ReplicaId': '65534', 'nsds5ReplicaPurgeDelay': '604800', 'nsDS5ReplicaBindDN': 'cn=u', 'cn': 'replica'} @@ -41,7 +41,7 @@ agmt_dict = {'cn': 'test_agreement', repl_add_attrs = [('nsDS5ReplicaType', '-1', '4', overflow, notnum, '1'), ('nsDS5Flags', '-1', '2', overflow, notnum, '1'), - ('nsDS5ReplicaId', '0', '65536', overflow, notnum, '1'), + ('nsDS5ReplicaId', '0', '65535', overflow, notnum, '1'), ('nsds5ReplicaPurgeDelay', '-2', too_big, overflow, notnum, '1'), ('nsDS5ReplicaBindDnGroupCheckInterval', '-2', too_big, overflow, notnum, '1'), ('nsds5ReplicaTombstonePurgeInterval', '-2', too_big, overflow, notnum, '1'), @@ -60,7 +60,7 @@ repl_mod_attrs = [('nsDS5Flags', '-1', '2', overflow, notnum, '1'), ('nsds5ReplicaBackoffMax', '0', too_big, overflow, notnum, '6')] agmt_attrs = [ - ('nsds5ReplicaPort', '0', '65536', overflow, notnum, '389'), + ('nsds5ReplicaPort', '0', '65535', overflow, notnum, '389'), ('nsds5ReplicaTimeout', '-1', too_big, overflow, notnum, '6'), ('nsds5ReplicaBusyWaitTime', '-1', too_big, overflow, notnum, '6'), ('nsds5ReplicaSessionPauseTime', '-1', too_big, overflow, notnum, '6'), @@ -255,5 +255,5 @@ if __name__ == '__main__': # Run isolated # -s for DEBUG mode CURRENT_FILE = os.path.realpath(__file__) - pytest.main("-s %s" % CURRENT_FILE) + pytest.main(["-s", CURRENT_FILE]) diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c index 2861020..4ec3d89 100644 --- a/ldap/servers/plugins/replication/repl5_replica.c +++ b/ldap/servers/plugins/replication/repl5_replica.c @@ -1990,7 +1990,7 @@ _replica_init_from_config(Replica *r, Slapi_Entry *e, char *errortext) r->repl_type == REPLICA_TYPE_PRIMARY) { if ((val = slapi_entry_attr_get_charptr(e, attr_replicaId))) { int64_t rid; - if (repl_config_valid_num(attr_replicaId, val, 1, 65535, &rc, errormsg, &rid) != 0) { + if (repl_config_valid_num(attr_replicaId, val, 1, 65534, &rc, errormsg, &rid) != 0) { slapi_ch_free_string(&val); return -1; }