|
|
b045b9 |
From 73c72aba0ab31f9d16cdfd8879e9da5f3fb985e0 Mon Sep 17 00:00:00 2001
|
|
|
b045b9 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
b045b9 |
Date: Tue, 17 Oct 2017 12:39:18 -0400
|
|
|
b045b9 |
Subject: [PATCH] Ticket 48006 - Missing warning for invalid replica backoff
|
|
|
b045b9 |
configuration
|
|
|
b045b9 |
|
|
|
b045b9 |
Description: Add warning if you try to set a min backoff time that is
|
|
|
b045b9 |
greater than the configured maximum, or the max time that
|
|
|
b045b9 |
is less than the minimum.
|
|
|
b045b9 |
|
|
|
b045b9 |
Also fixed compiler warning in ldbm_config.c
|
|
|
b045b9 |
|
|
|
b045b9 |
https://pagure.io/389-ds-base/issue/48006
|
|
|
b045b9 |
|
|
|
b045b9 |
Reviewed by: firstyear(Thanks!)
|
|
|
b045b9 |
|
|
|
b045b9 |
(cherry picked from commit e123acb6987c75f6d7282b32c4f279b976eb6f5e)
|
|
|
b045b9 |
---
|
|
|
b045b9 |
.../plugins/replication/repl5_replica_config.c | 24 ++++++++++++++++++++--
|
|
|
b045b9 |
ldap/servers/slapd/back-ldbm/ldbm_config.c | 2 +-
|
|
|
b045b9 |
2 files changed, 23 insertions(+), 3 deletions(-)
|
|
|
b045b9 |
|
|
|
b045b9 |
diff --git a/ldap/servers/plugins/replication/repl5_replica_config.c b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
b045b9 |
index f28044c19..22d766143 100644
|
|
|
b045b9 |
--- a/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
b045b9 |
+++ b/ldap/servers/plugins/replication/repl5_replica_config.c
|
|
|
b045b9 |
@@ -465,7 +465,8 @@ replica_config_modify(Slapi_PBlock *pb,
|
|
|
b045b9 |
}
|
|
|
b045b9 |
} else if (strcasecmp(config_attr, type_replicaBackoffMin) == 0) {
|
|
|
b045b9 |
if (apply_mods) {
|
|
|
b045b9 |
- PRUint64 val = atoll(config_attr_value);
|
|
|
b045b9 |
+ uint64_t val = atoll(config_attr_value);
|
|
|
b045b9 |
+ uint64_t max;
|
|
|
b045b9 |
|
|
|
b045b9 |
if (val <= 0) {
|
|
|
b045b9 |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
b045b9 |
@@ -475,11 +476,21 @@ replica_config_modify(Slapi_PBlock *pb,
|
|
|
b045b9 |
slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "replica_config_modify - %s\n", errortext);
|
|
|
b045b9 |
break;
|
|
|
b045b9 |
}
|
|
|
b045b9 |
+ max = replica_get_backoff_max(r);
|
|
|
b045b9 |
+ if (val > max){
|
|
|
b045b9 |
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
b045b9 |
+ PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
b045b9 |
+ "Attribute %s value (%s) is invalid, must be a number less than the max backoff time (%d).\n",
|
|
|
b045b9 |
+ config_attr, config_attr_value, (int)max);
|
|
|
b045b9 |
+ slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "replica_config_modify - %s\n", errortext);
|
|
|
b045b9 |
+ break;
|
|
|
b045b9 |
+ }
|
|
|
b045b9 |
replica_set_backoff_min(r, val);
|
|
|
b045b9 |
}
|
|
|
b045b9 |
} else if (strcasecmp(config_attr, type_replicaBackoffMax) == 0) {
|
|
|
b045b9 |
if (apply_mods) {
|
|
|
b045b9 |
- PRUint64 val = atoll(config_attr_value);
|
|
|
b045b9 |
+ uint64_t val = atoll(config_attr_value);
|
|
|
b045b9 |
+ uint64_t min;
|
|
|
b045b9 |
|
|
|
b045b9 |
if (val <= 0) {
|
|
|
b045b9 |
*returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
b045b9 |
@@ -490,6 +501,15 @@ replica_config_modify(Slapi_PBlock *pb,
|
|
|
b045b9 |
errortext);
|
|
|
b045b9 |
break;
|
|
|
b045b9 |
}
|
|
|
b045b9 |
+ min = replica_get_backoff_min(r);
|
|
|
b045b9 |
+ if (val < min) {
|
|
|
b045b9 |
+ *returncode = LDAP_UNWILLING_TO_PERFORM;
|
|
|
b045b9 |
+ PR_snprintf(errortext, SLAPI_DSE_RETURNTEXT_SIZE,
|
|
|
b045b9 |
+ "Attribute %s value (%s) is invalid, must be a number more than the min backoff time (%d).\n",
|
|
|
b045b9 |
+ config_attr, config_attr_value, (int)min);
|
|
|
b045b9 |
+ slapi_log_err(SLAPI_LOG_ERR, repl_plugin_name, "replica_config_modify - %s\n", errortext);
|
|
|
b045b9 |
+ break;
|
|
|
b045b9 |
+ }
|
|
|
b045b9 |
replica_set_backoff_max(r, val);
|
|
|
b045b9 |
}
|
|
|
b045b9 |
} else if (strcasecmp(config_attr, type_replicaPrecisePurge) == 0) {
|
|
|
b045b9 |
diff --git a/ldap/servers/slapd/back-ldbm/ldbm_config.c b/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
b045b9 |
index 2ef4652ce..feb993366 100644
|
|
|
b045b9 |
--- a/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
b045b9 |
+++ b/ldap/servers/slapd/back-ldbm/ldbm_config.c
|
|
|
b045b9 |
@@ -388,7 +388,7 @@ ldbm_config_directory_set(void *arg, void *value, char *errorbuf, int phase, int
|
|
|
b045b9 |
goto done;
|
|
|
b045b9 |
}
|
|
|
b045b9 |
slapi_pblock_destroy(search_pb);
|
|
|
b045b9 |
- if (NULL == s || '\0' == s || 0 == PL_strcmp(s, "(null)")) {
|
|
|
b045b9 |
+ if (NULL == s || '\0' == *s || 0 == PL_strcmp(s, "(null)")) {
|
|
|
b045b9 |
slapi_log_err(SLAPI_LOG_ERR,
|
|
|
b045b9 |
"ldbm_config_directory_set", "db directory is not set; check %s in the db config: %s\n",
|
|
|
b045b9 |
CONFIG_DIRECTORY, CONFIG_LDBM_DN);
|
|
|
b045b9 |
--
|
|
|
b045b9 |
2.13.6
|
|
|
b045b9 |
|