diff options
author | Sumit Bose <sbose@redhat.com> | 2010-10-22 12:01:23 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2010-10-26 08:00:21 -0400 |
commit | 4967fe0bc52580f7e96974e30d3cf2f33fadaabe (patch) | |
tree | 670e9a767e483f6e4af045d2d5fb4f65e4be4142 /src | |
parent | 04feeade1f6259368a6b23c6b3ecbad261161659 (diff) | |
download | sssd-4967fe0bc52580f7e96974e30d3cf2f33fadaabe.tar.gz sssd-4967fe0bc52580f7e96974e30d3cf2f33fadaabe.tar.xz sssd-4967fe0bc52580f7e96974e30d3cf2f33fadaabe.zip |
Remove all nss requests after a reconnect
Currently we do not handle the open nss request after a reconnect and
wait until they timeout (which is a couple of minutes!). This patch adds
a handler that terminates all requests after a reconnect. Then responder
will return matching cache entries or nothing.
Diffstat (limited to 'src')
-rw-r--r-- | src/responder/common/responder.h | 2 | ||||
-rw-r--r-- | src/responder/common/responder_dp.c | 19 | ||||
-rw-r--r-- | src/responder/nss/nsssrv.c | 6 |
3 files changed, 26 insertions, 1 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h index 980e56189..783f9e405 100644 --- a/src/responder/common/responder.h +++ b/src/responder/common/responder.h @@ -161,6 +161,8 @@ struct cli_protocol_version *register_cli_protocol_version(void); typedef void (*sss_dp_callback_t)(uint16_t err_maj, uint32_t err_min, const char *err_msg, void *ptr); +void handle_requests_after_reconnect(void); + int sss_dp_send_acct_req(struct resp_ctx *rctx, TALLOC_CTX *callback_memctx, sss_dp_callback_t callback, void *callback_ctx, int timeout, const char *domain, diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c index fd7b9761d..f8c3b6f12 100644 --- a/src/responder/common/responder_dp.c +++ b/src/responder/common/responder_dp.c @@ -107,6 +107,25 @@ static int sss_dp_req_destructor(void *ptr) return 0; } +static bool reconnect_handler(hash_entry_t *item, void *user_data) +{ + struct sss_dp_req *sdp_req = talloc_get_type(item->value.ptr, + struct sss_dp_req); + + return (talloc_free(sdp_req) == EOK ? true : false); +} + +void handle_requests_after_reconnect(void) +{ + int ret; + + ret = hash_iterate(dp_requests, reconnect_handler, NULL); + if (ret != HASH_SUCCESS) { + DEBUG(1, ("hash_iterate failed, " + "not all request might be handled after reconnect.\n")); + } +} + static void sdp_req_timeout(struct tevent_context *ev, struct tevent_timer *te, struct timeval t, void *ptr) diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index 4f5aa6293..dfb0312e8 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -39,6 +39,7 @@ #include "dbus/dbus.h" #include "sbus/sssd_dbus.h" #include "responder/common/responder_packet.h" +#include "responder/common/responder.h" #include "providers/data_provider.h" #include "monitor/monitor_interfaces.h" #include "sbus/sbus_client.h" @@ -143,7 +144,10 @@ static void nss_dp_reconnect_init(struct sbus_connection *conn, DATA_PROVIDER_VERSION, "NSS"); /* all fine */ - if (ret == EOK) return; + if (ret == EOK) { + handle_requests_after_reconnect(); + return; + } } /* Failed to reconnect */ |