summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJakub Hrozek <jhrozek@redhat.com>2014-04-19 19:49:21 +0200
committerJakub Hrozek <jhrozek@redhat.com>2014-06-03 13:31:26 +0200
commit78512c471e3fd70811ad9def888778aec0f492dc (patch)
treebb6b92138b120bdc6a7a38deca04ed6199f6c44f
parent2c3fa3a3264c957957db48c6c488049b6cf8b7a1 (diff)
downloadsssd-78512c471e3fd70811ad9def888778aec0f492dc.tar.gz
sssd-78512c471e3fd70811ad9def888778aec0f492dc.tar.xz
sssd-78512c471e3fd70811ad9def888778aec0f492dc.zip
IFP: Initialize negative cache timeout
In order to avoid hitting the back end with repetitive requests, the InfoPipe responder needs a negative cache, too. This patch follows the convention set by other responders, where the negative cache timeouts are read from the [nss] section. This is not ideal, however, and ticket #2318 tracks moving the configuration to the [ifp] section primarily. The timeout is also a separate parameter in the NSS context. We should consider moving it to the negcache context instead (#2317). Reviewed-by: Pavel Březina <pbrezina@redhat.com> Reviewed-by: Stef Walter <stefw@redhat.com> (cherry picked from commit 6cbb9f0d7c6be2cd3553dcb548984bb98926d5cb)
-rw-r--r--src/responder/ifp/ifp_private.h3
-rw-r--r--src/responder/ifp/ifpsrv.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/src/responder/ifp/ifp_private.h b/src/responder/ifp/ifp_private.h
index bc476291a..e44b27bf4 100644
--- a/src/responder/ifp/ifp_private.h
+++ b/src/responder/ifp/ifp_private.h
@@ -25,6 +25,7 @@
#define _IFPSRV_PRIVATE_H_
#include "responder/common/responder.h"
+#include "responder/common/negcache.h"
#include "providers/data_provider.h"
#include "responder/ifp/ifp_iface_generated.h"
@@ -38,6 +39,8 @@ struct sysbus_ctx {
struct ifp_ctx {
struct resp_ctx *rctx;
struct sss_names_ctx *snctx;
+ struct sss_nc_ctx *ncache;
+ int neg_timeout;
struct sysbus_ctx *sysbus;
};
diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index 65613b941..f9dc69057 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -256,6 +256,20 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
goto fail;
}
+ /* Set up the negative cache */
+ ret = confdb_get_int(cdb, CONFDB_NSS_CONF_ENTRY,
+ CONFDB_NSS_ENTRY_NEG_TIMEOUT, 15,
+ &ifp_ctx->neg_timeout);
+ if (ret != EOK) {
+ goto fail;
+ }
+
+ ret = sss_ncache_init(rctx, &ifp_ctx->ncache);
+ if (ret != EOK) {
+ DEBUG(SSSDBG_CRIT_FAILURE, ("fatal error initializing negcache\n"));
+ goto fail;
+ }
+
/* Enable automatic reconnection to the Data Provider */
ret = confdb_get_int(ifp_ctx->rctx->cdb,
CONFDB_IFP_CONF_ENTRY,