diff options
author | Simo Sorce <simo@redhat.com> | 2012-03-07 18:05:06 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-03-08 08:09:56 -0500 |
commit | 65976ea5e9767bfaced81dfb97dc87d59f50b57e (patch) | |
tree | dd26f9d109a837f698133f2a218f6269e31d0fb9 /src | |
parent | bd72b3510105599b5bdaf00c203df1164b304238 (diff) | |
download | sssd-65976ea5e9767bfaced81dfb97dc87d59f50b57e.tar.gz sssd-65976ea5e9767bfaced81dfb97dc87d59f50b57e.tar.xz sssd-65976ea5e9767bfaced81dfb97dc87d59f50b57e.zip |
Use the correct hash table for pending requests
The function that handled pending requests on reconnect was checking an
orphaned global variable that was never used, redenring the whole function
uselsess.
This fixes a very nasty bug that was causing requests for which we never
received an answer for (for example because the backend failed and was
restarted) to be never removed and therefore causing a black hole effect for
any other request of the same type.
Fixes: https://fedorahosted.org/sssd/ticket/1229
Diffstat (limited to 'src')
-rw-r--r-- | src/responder/autofs/autofssrv.c | 2 | ||||
-rw-r--r-- | src/responder/common/responder.h | 6 | ||||
-rw-r--r-- | src/responder/common/responder_common.c | 1 | ||||
-rw-r--r-- | src/responder/common/responder_dp.c | 9 | ||||
-rw-r--r-- | src/responder/nss/nsssrv.c | 2 | ||||
-rw-r--r-- | src/responder/ssh/sshsrv.c | 2 | ||||
-rw-r--r-- | src/responder/sudo/sudosrv.c | 2 |
7 files changed, 14 insertions, 10 deletions
diff --git a/src/responder/autofs/autofssrv.c b/src/responder/autofs/autofssrv.c index 096cce9d..dcb188fd 100644 --- a/src/responder/autofs/autofssrv.c +++ b/src/responder/autofs/autofssrv.c @@ -91,7 +91,7 @@ autofs_dp_reconnect_init(struct sbus_connection *conn, "autofs"); /* all fine */ if (ret == EOK) { - handle_requests_after_reconnect(); + handle_requests_after_reconnect(be_conn->rctx); return; } } diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h index 619ae46e..1309c14d 100644 --- a/src/responder/common/responder.h +++ b/src/responder/common/responder.h @@ -56,10 +56,14 @@ struct cli_protocol_version { const char *description; }; +struct resp_ctx; + struct be_conn { struct be_conn *next; struct be_conn *prev; + struct resp_ctx *rctx; + const char *cli_name; struct sss_domain_info *domain; @@ -188,7 +192,7 @@ struct dp_callback_ctx { struct cli_ctx *cctx; }; -void handle_requests_after_reconnect(void); +void handle_requests_after_reconnect(struct resp_ctx *rctx); int responder_logrotate(DBusMessage *message, struct sbus_connection *conn); diff --git a/src/responder/common/responder_common.c b/src/responder/common/responder_common.c index a9b5d56b..52b271b9 100644 --- a/src/responder/common/responder_common.c +++ b/src/responder/common/responder_common.c @@ -326,6 +326,7 @@ static int sss_dp_init(struct resp_ctx *rctx, be_conn->cli_name = cli_name; be_conn->domain = domain; be_conn->intf = intf; + be_conn->rctx = rctx; /* Set up SBUS connection to the monitor */ ret = dp_get_sbus_address(be_conn, &be_conn->sbus_address, domain->name); diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c index a116fedd..a54c68d7 100644 --- a/src/responder/common/responder_dp.c +++ b/src/responder/common/responder_dp.c @@ -28,8 +28,6 @@ #include "providers/data_provider.h" #include "sbus/sbus_client.h" -hash_table_t *dp_requests = NULL; - struct sss_dp_req; struct sss_dp_callback { @@ -120,19 +118,19 @@ static int sss_dp_req_destructor(void *ptr) return 0; } -void handle_requests_after_reconnect(void) +void handle_requests_after_reconnect(struct resp_ctx *rctx) { int ret; hash_value_t *values; unsigned long count, i; struct sss_dp_req *sdp_req; - if (!dp_requests) { + if (!rctx->dp_request_table) { DEBUG(7, ("No requests to handle after reconnect\n")); return; } - ret = hash_values(dp_requests, &count, &values); + ret = hash_values(rctx->dp_request_table, &count, &values); if (ret != HASH_SUCCESS) { DEBUG(1, ("hash_values failed, " "not all request might be handled after reconnect.\n")); @@ -145,6 +143,7 @@ void handle_requests_after_reconnect(void) talloc_free(sdp_req); } } + static int sss_dp_get_reply(DBusPendingCall *pending, dbus_uint16_t *dp_err, dbus_uint32_t *dp_ret, diff --git a/src/responder/nss/nsssrv.c b/src/responder/nss/nsssrv.c index f97898d4..bff8e3cd 100644 --- a/src/responder/nss/nsssrv.c +++ b/src/responder/nss/nsssrv.c @@ -229,7 +229,7 @@ static void nss_dp_reconnect_init(struct sbus_connection *conn, "NSS"); /* all fine */ if (ret == EOK) { - handle_requests_after_reconnect(); + handle_requests_after_reconnect(be_conn->rctx); return; } } diff --git a/src/responder/ssh/sshsrv.c b/src/responder/ssh/sshsrv.c index 886070e2..8e979a78 100644 --- a/src/responder/ssh/sshsrv.c +++ b/src/responder/ssh/sshsrv.c @@ -71,7 +71,7 @@ static void ssh_dp_reconnect_init(struct sbus_connection *conn, "SSH"); /* all fine */ if (ret == EOK) { - handle_requests_after_reconnect(); + handle_requests_after_reconnect(be_conn->rctx); return; } } diff --git a/src/responder/sudo/sudosrv.c b/src/responder/sudo/sudosrv.c index 137bd327..6e609cda 100644 --- a/src/responder/sudo/sudosrv.c +++ b/src/responder/sudo/sudosrv.c @@ -71,7 +71,7 @@ static void sudo_dp_reconnect_init(struct sbus_connection *conn, "SUDO"); /* all fine */ if (ret == EOK) { - handle_requests_after_reconnect(); + handle_requests_after_reconnect(be_conn->rctx); return; } } |