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

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