Blob Blame Raw
From f9a4b8153a1b46da5052ffda60723596048b20fb Mon Sep 17 00:00:00 2001
From: Mark Reynolds <mreynolds@redhat.com>
Date: Tue, 14 Jun 2016 17:19:48 -0400
Subject: [PATCH 99/99] 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 b8239e0da865f33cae930088dd2a746a49f2d32a)
---
 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 71b3c92..866a712 100644
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
@@ -601,17 +601,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