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

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