andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 4 months ago
Clone
Blob Blame History Raw
From c2e2b0391e2b36c91c983b6948355c833108424d Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Tue, 14 Jun 2016 17:19:48 -0400
Subject: [PATCH 384/386] Ticket 48636 - Fix config validation check

Bug Description: We were previous checking if an unsigfned int was less than zero

Fix Description:  Improve config validation by using long instead of PRUint64

https://fedorahosted.org/389/ticket/48636

Reviewed by: nhosoi(Thanks!)

(cherry picked from commit 43d5ac680f7781f95205db94e5ff2958d39b78a4)
(cherry picked from commit c66ba8cb24c35d186b14f169e9206269067891a0)
(cherry picked from commit 0c3f203dc72932c827b340289ac1592dae78d188)
(cherry picked from commit a81ca80a9d0fe07274ef71e1cfde7599f277b25f)
---
 ldap/servers/plugins/replication/repl5_replica_config.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
index f8db8e8..a1dceae 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -497,17 +497,20 @@ replica_config_modify (Slapi_PBlock *pb, Slapi_Entry* entryBefore, Slapi_Entry*
                 {
                     if (apply_mods)
                     {
-                        PRUint64 val = atoll(config_attr_value);
+                        long val = atol(config_attr_value);
 
-                        if(val < 0){
+                        if (val < 0){
                             *returncode = LDAP_UNWILLING_TO_PERFORM;
-                            PR_snprintf (errortext, SLAPI_DSE_RETURNTEXT_SIZE,
+                            PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE,
                                     "attribute %s value (%s) is invalid, must be a number zero or greater.\n",
                                     config_attr, config_attr_value);
-                            slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name, "replica_config_modify: %s\n", errortext);
+                            slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
+                                            "replica_config_modify: %s\n", errortext);
                             break;
+                        } else {
+                            /* Set the timeout */
+                            replica_set_release_timeout(r, val);
                         }
-                        replica_set_release_timeout(r, val);
                     }
                 }
                 else
-- 
2.4.11