Hello, please see trivial patch attached.
While I was investigating case I found that to access value of
'ldap_purge_cache_timeout' option I need to use enum value
SDAP_CACHE_PURGE_TIMEOUT. I consider this to be a bad name (swap of
cache and purge) as I took me additional time to find this out. I think
that proposed name is better.
Unless somebody feels strongly against the patch I think it could be
reviewed by our new colleague.
Thanks!
From a13195207a0cad1cae0d243b83af150413301a05 Mon Sep 17 00:00:00 2001
From: Pavel Reichl prei...@redhat.com
Date: Wed, 29 Jul 2015 03:57:46 -0400
Subject: [PATCH] SDAP: rename SDAP_CACHE_PURGE_TIMEOUT
Enum member SDAP_CACHE_PURGE_TIMEOUT has counter-intuitive name as it's used
to access 'ldap_purge_cache_timeout' option.
SDAP_CACHE_PURGE_TIMEOUT is more fitting name.
---
src/providers/ldap/ldap_id_cleanup.c | 2 +-
src/providers/ldap/ldap_id_enum.c| 4 ++--
src/providers/ldap/sdap.c| 2 +-
src/providers/ldap/sdap.h| 2 +-
src/providers/ldap/sdap_async_enum.c | 2 +-
src/tests/cmocka/test_sdap.c | 14 +++---
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/providers/ldap/ldap_id_cleanup.c b/src/providers/ldap/ldap_id_cleanup.c
index 171c9b0aecd35f3ddabb00e5c260b66981a1d0f4..be9496a2e26955c34fa3222f4ce969058aab7822 100644
--- a/src/providers/ldap/ldap_id_cleanup.c
+++ b/src/providers/ldap/ldap_id_cleanup.c
@@ -59,7 +59,7 @@ errno_t ldap_setup_cleanup(struct sdap_id_ctx *id_ctx,
struct ldap_id_cleanup_ctx *cleanup_ctx = NULL;
char *name = NULL;
-period = dp_opt_get_int(id_ctx-opts-basic, SDAP_CACHE_PURGE_TIMEOUT);
+period = dp_opt_get_int(id_ctx-opts-basic, SDAP_PURGE_CACHE_TIMEOUT);
if (period == 0) {
/* Cleanup has been explicitly disabled, so we won't
* create any cleanup tasks. */
diff --git a/src/providers/ldap/ldap_id_enum.c b/src/providers/ldap/ldap_id_enum.c
index bc1b020c4dc1e5139ab03af187ea5a61666128c7..8832eb558a6795648b011858426da3c7eef9ba4c 100644
--- a/src/providers/ldap/ldap_id_enum.c
+++ b/src/providers/ldap/ldap_id_enum.c
@@ -67,13 +67,13 @@ errno_t ldap_setup_enumeration(struct be_ctx *be_ctx,
first_delay = 0;
}
-cleanup = dp_opt_get_int(opts-basic, SDAP_CACHE_PURGE_TIMEOUT);
+cleanup = dp_opt_get_int(opts-basic, SDAP_PURGE_CACHE_TIMEOUT);
if (cleanup == 0) {
/* We need to cleanup the cache once in a while when enumerating, otherwise
* enumeration would only download deltas since the previous lastUSN and would
* not detect removed entries
*/
-ret = dp_opt_set_int(opts-basic, SDAP_CACHE_PURGE_TIMEOUT,
+ret = dp_opt_set_int(opts-basic, SDAP_PURGE_CACHE_TIMEOUT,
LDAP_ENUM_PURGE_TIMEOUT);
if (ret != EOK) {
DEBUG(SSSDBG_CRIT_FAILURE,
diff --git a/src/providers/ldap/sdap.c b/src/providers/ldap/sdap.c
index 051e3c1d248f738106cb80b97ca992f5e0212a3e..97bc14b8730565b6d0d2c41e51f910f042357bc3 100644
--- a/src/providers/ldap/sdap.c
+++ b/src/providers/ldap/sdap.c
@@ -248,7 +248,7 @@ static void sdap_inherit_basic_options(char **inherit_opt_list,
struct dp_option *subdom_opts)
{
int inherit_options[] = {
-SDAP_CACHE_PURGE_TIMEOUT,
+SDAP_PURGE_CACHE_TIMEOUT,
SDAP_AD_USE_TOKENGROUPS,
SDAP_OPTS_BASIC /* sentinel */
};
diff --git a/src/providers/ldap/sdap.h b/src/providers/ldap/sdap.h
index 444502bf7159edcf4cebe530cce8b216c737ec30..b3321be48e1b24124d59fbfe88096a2109c920a6 100644
--- a/src/providers/ldap/sdap.h
+++ b/src/providers/ldap/sdap.h
@@ -176,7 +176,7 @@ enum sdap_basic_opt {
SDAP_OFFLINE_TIMEOUT,
SDAP_FORCE_UPPER_CASE_REALM,
SDAP_ENUM_REFRESH_TIMEOUT,
-SDAP_CACHE_PURGE_TIMEOUT,
+SDAP_PURGE_CACHE_TIMEOUT,
SDAP_TLS_CACERT,
SDAP_TLS_CACERTDIR,
SDAP_TLS_CERT,
diff --git a/src/providers/ldap/sdap_async_enum.c b/src/providers/ldap/sdap_async_enum.c
index f22276c3ce6f839b765bbc1602fafb010cc37d89..2d3821542ccbb6262bcaf3772af4dd6d244c8134 100644
--- a/src/providers/ldap/sdap_async_enum.c
+++ b/src/providers/ldap/sdap_async_enum.c
@@ -102,7 +102,7 @@ sdap_dom_enum_ex_send(TALLOC_CTX *memctx,
state-svc_conn = svc_conn;
sdom-last_enum = tevent_timeval_current();
-t = dp_opt_get_int(ctx-opts-basic, SDAP_CACHE_PURGE_TIMEOUT);
+t = dp_opt_get_int(ctx-opts-basic, SDAP_PURGE_CACHE_TIMEOUT);
if ((sdom-last_purge.tv_sec + t) sdom-last_enum.tv_sec) {
state-purge = true;
}
diff --git a/src/tests/cmocka/test_sdap.c b/src/tests/cmocka/test_sdap.c
index cb3265f2cf66a1f4c6d55db20dfaf94179759f47..75fc34504bc35e4e4a5fc11bc9d645e78bc2da72 100644
--- a/src/tests/cmocka/test_sdap.c
+++ b/src/tests/cmocka/test_sdap.c
@@ -841,7 +841,7 @@ static int test_sdap_inherit_option_setup(void **state)
discard_const(test_princ);