summaryrefslogtreecommitdiffstats
path: root/src/responder/common
diff options
context:
space:
mode:
authorPetr Cech <pcech@redhat.com>2016-05-02 09:55:47 -0400
committerLukas Slebodnik <lslebodn@redhat.com>2016-05-11 13:42:58 +0200
commit56c9f8731173eae841a05f31bb03d311076a8485 (patch)
treed944d85ee9544b2c8adebfbaa98a8f01a84faa13 /src/responder/common
parent4f87f99f95891ebc0814e4566fa2defb4359b008 (diff)
downloadsssd-56c9f8731173eae841a05f31bb03d311076a8485.tar.gz
sssd-56c9f8731173eae841a05f31bb03d311076a8485.tar.xz
sssd-56c9f8731173eae841a05f31bb03d311076a8485.zip
RESPONDERS: Negcache in resp_ctx preparing
Preparation for initialization of negative cache in common responder. Reviewed-by: Pavel Březina <pbrezina@redhat.com>
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder.h2
-rw-r--r--src/responder/common/responder_common.c47
2 files changed, 49 insertions, 0 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h
index 56ff2b3ec..d3f5c8d94 100644
--- a/src/responder/common/responder.h
+++ b/src/responder/common/responder.h
@@ -92,6 +92,8 @@ struct resp_ctx {
const char *sock_name;
const char *priv_sock_name;
+ struct sss_nc_ctx *ncache;
+
struct sbus_connection *mon_conn;
struct be_conn *be_conns;
diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c
index 639356749..4f620f7d9 100644
--- a/src/responder/common/responder_common.c
+++ b/src/responder/common/responder_common.c
@@ -756,6 +756,47 @@ static int sss_responder_ctx_destructor(void *ptr)
return 0;
}
+static errno_t responder_init_ncache(TALLOC_CTX *mem_ctx,
+ struct confdb_ctx *cdb,
+ struct sss_nc_ctx **ncache)
+{
+ uint32_t neg_timeout;
+ int tmp_value;
+ int ret;
+
+ /* neg_timeout */
+ ret = confdb_get_int(cdb, CONFDB_NSS_CONF_ENTRY,
+ CONFDB_NSS_ENTRY_NEG_TIMEOUT,
+ 15, &tmp_value);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Fatal failure of setup negative cache timeout.\n");
+ ret = ENOENT;
+ goto done;
+ }
+
+ if (tmp_value < 0) {
+ ret = EINVAL;
+ goto done;
+ }
+
+ neg_timeout = tmp_value;
+ ret = EOK;
+
+ /* negative cache init */
+ ret = sss_ncache_init(mem_ctx, neg_timeout, ncache);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_FATAL_FAILURE,
+ "Fatal failure of initializing negative cache.\n");
+ goto done;
+ }
+
+ ret = EOK;
+
+done:
+ return ret;
+}
+
int sss_process_init(TALLOC_CTX *mem_ctx,
struct tevent_context *ev,
struct confdb_ctx *cdb,
@@ -913,6 +954,12 @@ int sss_process_init(TALLOC_CTX *mem_ctx,
goto fail;
}
+ ret = responder_init_ncache(rctx, rctx->cdb, &rctx->ncache);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, "fatal error initializing negcache\n");
+ goto fail;
+ }
+
DEBUG(SSSDBG_TRACE_FUNC, "Responder Initialization complete\n");
*responder_ctx = rctx;