amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone

Blame SOURCES/0008-Ticket-47516-replication-stops-with-excessive-clock-.patch

ba46c7
From 93b7d05d9547d498e9cb38da350153d4db340ca6 Mon Sep 17 00:00:00 2001
ba46c7
From: Rich Megginson <rmeggins@redhat.com>
ba46c7
Date: Wed, 18 Sep 2013 12:32:23 -0600
ba46c7
Subject: [PATCH 08/28] Ticket #47516 replication stops with excessive clock skew
ba46c7
ba46c7
https://fedorahosted.org/389/ticket/47516
ba46c7
Reviewed by: nhosoi (Thanks!)
ba46c7
Branch: master
ba46c7
Fix Description: Add a new configuration parameter to cn=config
ba46c7
nsslapd-ignore-time-skew: on|off - default off
ba46c7
If nsslapd-ignore-time-skew: on, the replication consumer will log errors
ba46c7
about excessive time skew, but will allow replication to proceed, and will
ba46c7
not return a time skew error to the replication supplier.
ba46c7
Platforms tested: RHEL6 x86_64
ba46c7
Flag Day: no
ba46c7
Doc impact: yes - document new config param
ba46c7
(cherry picked from commit 1f2c15119f12b2da83da2305a432bc310ee0d84b)
ba46c7
---
ba46c7
 ldap/servers/plugins/replication/repl_extop.c |   11 +++++++-
ba46c7
 ldap/servers/slapd/libglobs.c                 |   33 ++++++++++++++++++++++++-
ba46c7
 ldap/servers/slapd/proto-slap.h               |    2 +
ba46c7
 ldap/servers/slapd/slap.h                     |    2 +
ba46c7
 4 files changed, 45 insertions(+), 3 deletions(-)
ba46c7
ba46c7
diff --git a/ldap/servers/plugins/replication/repl_extop.c b/ldap/servers/plugins/replication/repl_extop.c
ba46c7
index 47348b7..f41cc7d 100644
ba46c7
--- a/ldap/servers/plugins/replication/repl_extop.c
ba46c7
+++ b/ldap/servers/plugins/replication/repl_extop.c
ba46c7
@@ -835,12 +835,19 @@ multimaster_extop_StartNSDS50ReplicationRequest(Slapi_PBlock *pb)
ba46c7
 				rc = replica_update_csngen_state_ext (replica, supplier_ruv, replicacsn); /* too much skew */
ba46c7
 				if (rc == CSN_LIMIT_EXCEEDED)
ba46c7
 				{
ba46c7
-					response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
ba46c7
+					extern int config_get_ignore_time_skew();
ba46c7
+
ba46c7
 					slapi_log_error(SLAPI_LOG_FATAL, repl_plugin_name,
ba46c7
 									"conn=%" NSPRIu64 " op=%d repl=\"%s\": "
ba46c7
 									"Excessive clock skew from supplier RUV\n",
ba46c7
 									(long long unsigned int)connid, opid, repl_root);
ba46c7
-					goto send_response;
ba46c7
+					if (!config_get_ignore_time_skew()) {
ba46c7
+						response = NSDS50_REPL_EXCESSIVE_CLOCK_SKEW;
ba46c7
+						goto send_response;
ba46c7
+					} else {
ba46c7
+						/* else just continue */
ba46c7
+						rc = 0;
ba46c7
+					}
ba46c7
 				}
ba46c7
 				else if (rc != 0)
ba46c7
 				{
ba46c7
diff --git a/ldap/servers/slapd/libglobs.c b/ldap/servers/slapd/libglobs.c
ba46c7
index 1a889fd..f8c5b01 100644
ba46c7
--- a/ldap/servers/slapd/libglobs.c
ba46c7
+++ b/ldap/servers/slapd/libglobs.c
ba46c7
@@ -257,6 +257,7 @@ slapi_onoff_t init_sasl_mapping_fallback;
ba46c7
 slapi_onoff_t init_return_orig_type;
ba46c7
 slapi_onoff_t init_enable_turbo_mode;
ba46c7
 slapi_int_t init_listen_backlog_size;
ba46c7
+slapi_onoff_t init_ignore_time_skew;
ba46c7
 #ifdef MEMPOOL_EXPERIMENTAL
ba46c7
 slapi_onoff_t init_mempool_switch;
ba46c7
 #endif
ba46c7
@@ -1047,7 +1048,11 @@ static struct config_get_and_set {
ba46c7
 	{CONFIG_LISTEN_BACKLOG_SIZE, config_set_listen_backlog_size,
ba46c7
 		NULL, 0,
ba46c7
 		(void**)&global_slapdFrontendConfig.listen_backlog_size, CONFIG_INT,
ba46c7
-		(ConfigGetFunc)config_get_listen_backlog_size, &init_listen_backlog_size}
ba46c7
+		(ConfigGetFunc)config_get_listen_backlog_size, &init_listen_backlog_size},
ba46c7
+	{CONFIG_IGNORE_TIME_SKEW, config_set_ignore_time_skew,
ba46c7
+		NULL, 0,
ba46c7
+		(void**)&global_slapdFrontendConfig.ignore_time_skew,
ba46c7
+		CONFIG_ON_OFF, (ConfigGetFunc)config_get_ignore_time_skew, &init_ignore_time_skew}
ba46c7
 #ifdef MEMPOOL_EXPERIMENTAL
ba46c7
 	,{CONFIG_MEMPOOL_SWITCH_ATTRIBUTE, config_set_mempool_switch,
ba46c7
 		NULL, 0,
ba46c7
@@ -1488,6 +1493,7 @@ FrontendConfig_init () {
ba46c7
   init_enable_turbo_mode = cfg->enable_turbo_mode = LDAP_ON;
ba46c7
 
ba46c7
   init_listen_backlog_size = cfg->listen_backlog_size = DAEMON_LISTEN_SIZE;
ba46c7
+  init_ignore_time_skew = cfg->ignore_time_skew = LDAP_OFF;
ba46c7
 #ifdef MEMPOOL_EXPERIMENTAL
ba46c7
   init_mempool_switch = cfg->mempool_switch = LDAP_ON;
ba46c7
   cfg->mempool_maxfreelist = 1024;
ba46c7
@@ -6910,6 +6916,18 @@ config_get_unhashed_pw_switch()
ba46c7
 }
ba46c7
 
ba46c7
 int
ba46c7
+config_get_ignore_time_skew(void)
ba46c7
+{
ba46c7
+    int retVal;
ba46c7
+    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
ba46c7
+    CFG_LOCK_READ(slapdFrontendConfig);
ba46c7
+    retVal = slapdFrontendConfig->ignore_time_skew;
ba46c7
+    CFG_UNLOCK_READ(slapdFrontendConfig);
ba46c7
+
ba46c7
+    return retVal;
ba46c7
+}
ba46c7
+
ba46c7
+int
ba46c7
 config_set_enable_turbo_mode( const char *attrname, char *value,
ba46c7
                             char *errorbuf, int apply )
ba46c7
 {
ba46c7
@@ -6923,6 +6941,19 @@ config_set_enable_turbo_mode( const char *attrname, char *value,
ba46c7
 }
ba46c7
 
ba46c7
 int
ba46c7
+config_set_ignore_time_skew( const char *attrname, char *value,
ba46c7
+                            char *errorbuf, int apply )
ba46c7
+{
ba46c7
+    int retVal = LDAP_SUCCESS;
ba46c7
+    slapdFrontendConfig_t *slapdFrontendConfig = getFrontendConfig();
ba46c7
+
ba46c7
+    retVal = config_set_onoff(attrname, value,
ba46c7
+                              &(slapdFrontendConfig->ignore_time_skew),
ba46c7
+                              errorbuf, apply);
ba46c7
+    return retVal;
ba46c7
+}
ba46c7
+
ba46c7
+int
ba46c7
 config_set_listen_backlog_size( const char *attrname, char *value,
ba46c7
 		char *errorbuf, int apply )
ba46c7
 {
ba46c7
diff --git a/ldap/servers/slapd/proto-slap.h b/ldap/servers/slapd/proto-slap.h
ba46c7
index 60fa4e4..37f5f85 100644
ba46c7
--- a/ldap/servers/slapd/proto-slap.h
ba46c7
+++ b/ldap/servers/slapd/proto-slap.h
ba46c7
@@ -396,6 +396,7 @@ int config_set_unhashed_pw_switch(const char *attrname, char *value, char *error
ba46c7
 int config_set_return_orig_type_switch(const char *attrname, char *value, char *errorbuf, int apply);
ba46c7
 int config_set_sasl_maxbufsize(const char *attrname, char *value, char *errorbuf, int apply );
ba46c7
 int config_set_listen_backlog_size(const char *attrname, char *value, char *errorbuf, int apply);
ba46c7
+int config_set_ignore_time_skew(const char *attrname, char *value, char *errorbuf, int apply);
ba46c7
 
ba46c7
 #if !defined(_WIN32) && !defined(AIX)
ba46c7
 int config_set_maxdescriptors( const char *attrname, char *value, char *errorbuf, int apply );
ba46c7
@@ -569,6 +570,7 @@ int config_get_listen_backlog_size(void);
ba46c7
 
ba46c7
 PLHashNumber hashNocaseString(const void *key);
ba46c7
 PRIntn hashNocaseCompare(const void *v1, const void *v2);
ba46c7
+int config_get_ignore_time_skew();
ba46c7
 
ba46c7
 int is_abspath(const char *);
ba46c7
 char* rel2abspath( char * );
ba46c7
diff --git a/ldap/servers/slapd/slap.h b/ldap/servers/slapd/slap.h
ba46c7
index b1246c5..eaa824d 100644
ba46c7
--- a/ldap/servers/slapd/slap.h
ba46c7
+++ b/ldap/servers/slapd/slap.h
ba46c7
@@ -2094,6 +2094,7 @@ typedef struct _slapdEntryPoints {
ba46c7
 #ifndef DAEMON_LISTEN_SIZE
ba46c7
 #define DAEMON_LISTEN_SIZE 128
ba46c7
 #endif
ba46c7
+#define CONFIG_IGNORE_TIME_SKEW "nsslapd-ignore-time-skew"
ba46c7
 
ba46c7
 #ifdef MEMPOOL_EXPERIMENTAL
ba46c7
 #define CONFIG_MEMPOOL_SWITCH_ATTRIBUTE "nsslapd-mempool"
ba46c7
@@ -2335,6 +2336,7 @@ typedef struct _slapdFrontendConfig {
ba46c7
   slapi_onoff_t ignore_vattrs;
ba46c7
   slapi_onoff_t unhashed_pw_switch;	/* switch to on/off/nolog unhashed pw */
ba46c7
   slapi_onoff_t enable_turbo_mode;
ba46c7
+  slapi_onoff_t ignore_time_skew;
ba46c7
 } slapdFrontendConfig_t;
ba46c7
 
ba46c7
 /* possible values for slapdFrontendConfig_t.schemareplace */
ba46c7
-- 
ba46c7
1.7.1
ba46c7