From c63ef0343401d86ad447e207b3911a76467a4254 Mon Sep 17 00:00:00 2001
From: Petr Cech <pcech@redhat.com>
Date: Fri, 22 Apr 2016 08:52:35 -0400
Subject: [PATCH 7/8] RESPONDER: Removing neg_timeout from ifp repsonder

Timeout of negative cache is handled by context of negative cache
itself. This patch removes neg_timeout parameter from ifp_ctx and from
ifp_user_get_attr_state.

Resolves:
https://fedorahosted.org/sssd/ticket/2317
---
 src/responder/ifp/ifp_private.h |  1 -
 src/responder/ifp/ifpsrv.c      |  7 -------
 src/responder/ifp/ifpsrv_cmd.c  | 12 ++++--------
 3 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/src/responder/ifp/ifp_private.h b/src/responder/ifp/ifp_private.h
index 43519de6fef3033f1e47cecb787d6b02dc9c6e56..9eacdbb9e43a17db4800eb0eb12cdc3e4f130741 100644
--- a/src/responder/ifp/ifp_private.h
+++ b/src/responder/ifp/ifp_private.h
@@ -40,7 +40,6 @@ struct ifp_ctx {
     struct resp_ctx *rctx;
     struct sss_names_ctx *snctx;
     struct sss_nc_ctx *ncache;
-    int neg_timeout;
 
     struct sysbus_ctx *sysbus;
     const char **user_whitelist;
diff --git a/src/responder/ifp/ifpsrv.c b/src/responder/ifp/ifpsrv.c
index 969dbcd31ff3df661b163845242c8390bb8f4bd2..55a182143b82c7eedfa4f4619adc6ab1de73bf4d 100644
--- a/src/responder/ifp/ifpsrv.c
+++ b/src/responder/ifp/ifpsrv.c
@@ -284,13 +284,6 @@ int ifp_process_init(TALLOC_CTX *mem_ctx,
     }
 
     /* 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 = responder_get_neg_timeout_from_confdb(cdb, &neg_timeout);
     if (ret != EOK) goto fail;
 
diff --git a/src/responder/ifp/ifpsrv_cmd.c b/src/responder/ifp/ifpsrv_cmd.c
index 00f0272bc1cf11a80603eed2ba60bda68ecf4a6c..c50f51763fdf5cfcf941c8be76333ddafe9023b5 100644
--- a/src/responder/ifp/ifpsrv_cmd.c
+++ b/src/responder/ifp/ifpsrv_cmd.c
@@ -35,7 +35,7 @@ struct ifp_attr_req {
 
 static struct tevent_req *
 ifp_user_get_attr_send(TALLOC_CTX *mem_ctx, struct resp_ctx *rctx,
-                       struct sss_nc_ctx *ncache, int neg_timeout,
+                       struct sss_nc_ctx *ncache,
                        enum sss_dp_acct_type search_type,
                        const char *inp, const char **attrs);
 static errno_t ifp_user_get_attr_recv(TALLOC_CTX *mem_ctx,
@@ -91,8 +91,7 @@ int ifp_user_get_attr(struct sbus_request *dbus_req, void *data)
           attr_req->name, ireq->dbus_req->client);
 
     req = ifp_user_get_attr_send(ireq, ifp_ctx->rctx,
-                                 ifp_ctx->ncache, ifp_ctx->neg_timeout,
-                                 SSS_DP_USER,
+                                 ifp_ctx->ncache, SSS_DP_USER,
                                  attr_req->name, attr_req->attrs);
     if (req == NULL) {
         return sbus_request_finish(dbus_req, NULL);
@@ -321,8 +320,7 @@ int ifp_user_get_groups(struct sbus_request *dbus_req,
           group_req->name, group_req->ireq->dbus_req->client);
 
     req = ifp_user_get_attr_send(ireq, ifp_ctx->rctx,
-                                 ifp_ctx->ncache, ifp_ctx->neg_timeout,
-                                 SSS_DP_INITGROUPS,
+                                 ifp_ctx->ncache, SSS_DP_INITGROUPS,
                                  group_req->name, group_req->attrs);
     if (req == NULL) {
         return sbus_request_finish(dbus_req, NULL);
@@ -433,7 +431,6 @@ struct ifp_user_get_attr_state {
 
     struct resp_ctx *rctx;
     struct sss_nc_ctx *ncache;
-    int neg_timeout;
 };
 
 static void ifp_user_get_attr_lookup(struct tevent_req *subreq);
@@ -441,7 +438,7 @@ static void ifp_user_get_attr_done(struct tevent_req *subreq);
 
 static struct tevent_req *
 ifp_user_get_attr_send(TALLOC_CTX *mem_ctx, struct resp_ctx *rctx,
-                       struct sss_nc_ctx *ncache, int neg_timeout,
+                       struct sss_nc_ctx *ncache,
                        enum sss_dp_acct_type search_type,
                        const char *inp, const char **attrs)
 {
@@ -458,7 +455,6 @@ ifp_user_get_attr_send(TALLOC_CTX *mem_ctx, struct resp_ctx *rctx,
     state->attrs = attrs;
     state->rctx = rctx;
     state->ncache = ncache;
-    state->neg_timeout = neg_timeout;
     state->search_type = search_type;
 
     subreq = sss_parse_inp_send(req, rctx, inp);
-- 
2.5.5

