diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2011-08-09 21:56:34 +0200 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2011-08-15 15:21:18 -0400 |
commit | 0e27817133b931dcbe9d196e9ed0d737164ba613 (patch) | |
tree | f29c078df7d28c05763dd0db803dd3548a08b648 | |
parent | 711c9015c3845eb7ff733ea34829c4ecf32d8ab5 (diff) | |
download | sssd-0e27817133b931dcbe9d196e9ed0d737164ba613.tar.gz sssd-0e27817133b931dcbe9d196e9ed0d737164ba613.tar.xz sssd-0e27817133b931dcbe9d196e9ed0d737164ba613.zip |
Do not delete requests inside hash_iterate loop
-rw-r--r-- | src/responder/common/responder_dp.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c index 8050e06f8..a89425c43 100644 --- a/src/responder/common/responder_dp.c +++ b/src/responder/common/responder_dp.c @@ -107,22 +107,24 @@ 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; + hash_value_t *values; + unsigned long count, i; + struct sss_dp_req *sdp_req; - ret = hash_iterate(dp_requests, reconnect_handler, NULL); + ret = hash_values(dp_requests, &count, &values); if (ret != HASH_SUCCESS) { - DEBUG(1, ("hash_iterate failed, " + DEBUG(1, ("hash_values failed, " "not all request might be handled after reconnect.\n")); + return; + } + + DEBUG(7, ("Will handle %lu requests after reconnect\n", count)); + for (i=0; i<count; i++) { + sdp_req = talloc_get_type(values[i].ptr, struct sss_dp_req); + talloc_free(sdp_req); } } |