andykimpe / rpms / 389-ds-base

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

Blame SOURCES/0058-Ticket-49541-repl-config-should-not-allow-rid-65535-.patch

96373c
From 38ca528af83f1874a79ad6744215bd4af1404414 Mon Sep 17 00:00:00 2001
96373c
From: Mark Reynolds <mreynolds@redhat.com>
96373c
Date: Thu, 18 Jan 2018 13:17:08 -0500
96373c
Subject: [PATCH] Ticket 49541 - repl config should not allow rid 65535 for
96373c
 masters
96373c
96373c
Description:  Reject adding a replica config entry with a rid of 65535 or higher,
96373c
              and prevent setting master's rid to 65535 or higher.
96373c
96373c
https://pagure.io/389-ds-base/issue/49541
96373c
96373c
Reviewed by: mreynolds(one line commit rule)
96373c
96373c
(cherry picked from commit ebb00a4180693225cf3c2f4aced54dc33141fa77)
96373c
---
96373c
 dirsrvtests/tests/suites/replication/replica_config_test.py | 9 +++++----
96373c
 ldap/servers/plugins/replication/repl5_replica.c            | 2 +-
96373c
 2 files changed, 6 insertions(+), 5 deletions(-)
96373c
96373c
diff --git a/dirsrvtests/tests/suites/replication/replica_config_test.py b/dirsrvtests/tests/suites/replication/replica_config_test.py
96373c
index 50ea2ece9..143a12479 100644
96373c
--- a/dirsrvtests/tests/suites/replication/replica_config_test.py
96373c
+++ b/dirsrvtests/tests/suites/replication/replica_config_test.py
96373c
@@ -24,7 +24,7 @@ replica_dict = {'objectclass': 'top nsDS5Replica'.split(),
96373c
                 'nsDS5ReplicaRoot': 'dc=example,dc=com',
96373c
                 'nsDS5ReplicaType': '3',
96373c
                 'nsDS5Flags': '1',
96373c
-                'nsDS5ReplicaId': '65535',
96373c
+                'nsDS5ReplicaId': '65534',
96373c
                 'nsds5ReplicaPurgeDelay': '604800',
96373c
                 'nsDS5ReplicaBindDN': 'cn=u',
96373c
                 'cn': 'replica'}
96373c
@@ -42,7 +42,7 @@ agmt_dict = {'objectClass': 'top nsDS5ReplicationAgreement'.split(),
96373c
 
96373c
 repl_add_attrs = [('nsDS5ReplicaType', '-1', '4', overflow, notnum, '1'),
96373c
                   ('nsDS5Flags', '-1', '2', overflow, notnum, '1'),
96373c
-                  ('nsDS5ReplicaId', '0', '65536', overflow, notnum, '1'),
96373c
+                  ('nsDS5ReplicaId', '0', '65535', overflow, notnum, '1'),
96373c
                   ('nsds5ReplicaPurgeDelay', '-2', too_big, overflow, notnum, '1'),
96373c
                   ('nsDS5ReplicaBindDnGroupCheckInterval', '-2', too_big, overflow, notnum, '1'),
96373c
                   ('nsds5ReplicaTombstonePurgeInterval', '-2', too_big, overflow, notnum, '1'),
96373c
@@ -60,7 +60,8 @@ repl_mod_attrs = [('nsDS5Flags', '-1', '2', overflow, notnum, '1'),
96373c
                   ('nsds5ReplicaBackoffMin', '0', too_big, overflow, notnum, '3'),
96373c
                   ('nsds5ReplicaBackoffMax', '0', too_big, overflow, notnum, '6')]
96373c
 
96373c
-agmt_attrs = [('nsds5ReplicaPort', '0', '65536', overflow, notnum, '389'),
96373c
+agmt_attrs = [
96373c
+              ('nsds5ReplicaPort', '0', '65535', overflow, notnum, '389'),
96373c
               ('nsds5ReplicaTimeout', '-1', too_big, overflow, notnum, '6'),
96373c
               ('nsds5ReplicaBusyWaitTime', '-1', too_big, overflow, notnum, '6'),
96373c
               ('nsds5ReplicaSessionPauseTime', '-1', too_big, overflow, notnum, '6'),
96373c
@@ -393,5 +394,5 @@ if __name__ == '__main__':
96373c
     # Run isolated
96373c
     # -s for DEBUG mode
96373c
     CURRENT_FILE = os.path.realpath(__file__)
96373c
-    pytest.main("-s %s" % CURRENT_FILE)
96373c
+    pytest.main(["-s", CURRENT_FILE])
96373c
 
96373c
diff --git a/ldap/servers/plugins/replication/repl5_replica.c b/ldap/servers/plugins/replication/repl5_replica.c
96373c
index e75807a62..bdb8a5167 100644
96373c
--- a/ldap/servers/plugins/replication/repl5_replica.c
96373c
+++ b/ldap/servers/plugins/replication/repl5_replica.c
96373c
@@ -1988,7 +1988,7 @@ _replica_init_from_config(Replica *r, Slapi_Entry *e, char *errortext)
96373c
              r->repl_type == REPLICA_TYPE_PRIMARY) {
96373c
         if ((val = slapi_entry_attr_get_charptr(e, attr_replicaId))) {
96373c
             int64_t rid;
96373c
-            if (repl_config_valid_num(attr_replicaId, val, 1, 65535, &rc, errormsg, &rid) != 0) {
96373c
+            if (repl_config_valid_num(attr_replicaId, val, 1, 65534, &rc, errormsg, &rid) != 0) {
96373c
                 slapi_ch_free_string(&val;;
96373c
                 return -1;
96373c
             }
96373c
-- 
96373c
2.13.6
96373c