andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 6 months ago
Clone
dc8c34
From 099fb56a076bc69183f234ee78a432796c78a669 Mon Sep 17 00:00:00 2001
dc8c34
From: Rich Megginson <rmeggins@redhat.com>
dc8c34
Date: Thu, 16 Jan 2014 12:57:22 -0700
dc8c34
Subject: [PATCH 154/225] Ticket #47516 replication stops with excessive clock
dc8c34
 skew
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47516
dc8c34
Reviewed by: nhosoi (Thanks!)
dc8c34
Branch: 389-ds-base-1.2.11
dc8c34
Fix Description: The previous fix was not adequate.  Instead, the determination
dc8c34
of whether or not to ignore time skew should be determined in
dc8c34
csngen_adjust_time().
dc8c34
Platforms tested: RHEL6 x86_64
dc8c34
Flag Day: no
dc8c34
Doc impact: yes - document new config param
dc8c34
(cherry picked from commit 9f2b104b0938b21d7c9fe37c736d0e6328843aeb)
dc8c34
(cherry picked from commit a6ec074c6295a59938f313b4fe09430e8f601fab)
dc8c34
(cherry picked from commit b51a57b20386e506a7eb484b62d39bf249ef995f)
dc8c34
(cherry picked from commit d128dbde4bff3d9c523d58b5ff485d052edbaf92)
dc8c34
---
dc8c34
 ldap/servers/plugins/replication/repl_extop.c | 11 ++---------
dc8c34
 ldap/servers/slapd/csngen.c                   |  8 ++++++--
dc8c34
 2 files changed, 8 insertions(+), 11 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
dc8c34
index cccebb4..92207df 100644
dc8c34
--- a/ldap/servers/plugins/replication/repl_extop.c
dc8c34
+++ b/ldap/servers/plugins/replication/repl_extop.c
dc8c34
@@ -835,19 +835,12 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
dc8c34
 				rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */
dc8c34
 				if (rc == CSN_LIMIT_EXCEEDED)
dc8c34
 				{
dc8c34
-					extern int config_get_ignore_time_skew();
dc8c34
-
dc8c34
 					slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
dc8c34
 									"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
dc8c34
 									"Excessive clock skew from supplier RUV\n",
dc8c34
 									connid, opid, repl_root);
dc8c34
-					if (!config_get_ignore_time_skew()) {
dc8c34
-						response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
dc8c34
-						goto send_response;
dc8c34
-					} else {
dc8c34
-						/* else just continue */
dc8c34
-						rc = 0;
dc8c34
-					}
dc8c34
+					response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
dc8c34
+					goto send_response;
dc8c34
 				}
dc8c34
 				else if (rc != 0)
dc8c34
 				{
dc8c34
diff --git a/ldap/servers/slapd/csngen.c b/ldap/servers/slapd/csngen.c
dc8c34
index 7e0bdb6..3ec7620 100644
dc8c34
--- a/ldap/servers/slapd/csngen.c
dc8c34
+++ b/ldap/servers/slapd/csngen.c
dc8c34
@@ -315,6 +315,8 @@ int csngen_adjust_time (CSNGen *gen, const CSN* csn)
dc8c34
     time_t remote_time, remote_offset, cur_time;
dc8c34
 	PRUint16 remote_seqnum;
dc8c34
     int rc;
dc8c34
+    extern int config_get_ignore_time_skew();
dc8c34
+    int ignore_time_skew = config_get_ignore_time_skew();
dc8c34
 
dc8c34
     if (gen == NULL || csn == NULL)
dc8c34
         return CSN_INVALID_PARAMETER;
dc8c34
@@ -369,7 +371,7 @@ int csngen_adjust_time (CSNGen *gen, const CSN* csn)
dc8c34
         remote_offset = remote_time - cur_time;
dc8c34
 		if (remote_offset > gen->state.remote_offset)
dc8c34
 		{
dc8c34
-			if (remote_offset <= CSN_MAX_TIME_ADJUST)
dc8c34
+			if (ignore_time_skew || (remote_offset <= CSN_MAX_TIME_ADJUST))
dc8c34
 			{
dc8c34
 	        	gen->state.remote_offset = remote_offset;
dc8c34
 			}
dc8c34
@@ -640,6 +642,8 @@ _csngen_cmp_callbacks (const void *el1, const void *el2)
dc8c34
 static int 
dc8c34
 _csngen_adjust_local_time (CSNGen *gen, time_t cur_time)
dc8c34
 {
dc8c34
+    extern int config_get_ignore_time_skew();
dc8c34
+    int ignore_time_skew = config_get_ignore_time_skew();
dc8c34
     time_t time_diff = cur_time - gen->state.sampled_time;
dc8c34
 
dc8c34
     if (time_diff == 0) {
dc8c34
@@ -703,7 +707,7 @@ _csngen_adjust_local_time (CSNGen *gen, time_t cur_time)
dc8c34
                              gen->state.remote_offset);
dc8c34
         }
dc8c34
 
dc8c34
-        if (abs (time_diff) > CSN_MAX_TIME_ADJUST)
dc8c34
+        if (!ignore_time_skew && (abs (time_diff) > CSN_MAX_TIME_ADJUST))
dc8c34
         {
dc8c34
             slapi_log_error (SLAPI_LOG_FATAL, NULL, "_csngen_adjust_local_time: "
dc8c34
                              "adjustment limit exceeded; value - %d, limit - %d\n",
dc8c34
-- 
dc8c34
1.8.1.4
dc8c34