From 41ef946f3f74a46b9e26118116e4811e259b30ef Mon Sep 17 00:00:00 2001 From: Pavel Březina Date: Tue, 24 Jan 2012 13:42:59 +0100 Subject: SUDO Integration - in-memory cache in responder New sudo responder option: cache_timeout https://fedorahosted.org/sssd/ticket/1111 --- src/responder/sudo/sudosrv.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/responder/sudo/sudosrv.c') diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c index 841be43ef..6b7eae07b 100644 --- a/src/responder/sudo/sudosrv.c +++ b/src/responder/sudo/sudosrv.c @@ -129,6 +129,27 @@ int sudo_process_init(TALLOC_CTX *mem_ctx, sudo_dp_reconnect_init, iter); } + /* Get responder options */ + + /* Get cache_timeout option */ + ret = confdb_get_int(sudo_ctx->rctx->cdb, sudo_ctx, + CONFDB_SUDO_CONF_ENTRY, CONFDB_SUDO_CACHE_TIMEOUT, + CONFDB_DEFAULT_SUDO_CACHE_TIMEOUT, + &sudo_ctx->cache_timeout); + if (ret != EOK) { + DEBUG(SSSDBG_FATAL_FAILURE, ("Error reading from confdb (%d) [%s]\n", + ret, strerror(ret))); + return ret; + } + + /* Initialize in-memory cache */ + ret = sudosrv_cache_init(sudo_ctx, 10, &sudo_ctx->cache); + if (ret != EOK) { + DEBUG(SSSDBG_FATAL_FAILURE, + ("Could not create hash table: [%s]", strerror(ret))); + return ret; + } + DEBUG(SSSDBG_TRACE_FUNC, ("SUDO Initialization complete\n")); return EOK; -- cgit