summaryrefslogtreecommitdiffstats
path: root/src/responder/common
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-03-10 15:27:59 -0500
committerStephen Gallagher <sgallagh@redhat.com>2010-03-15 11:12:56 -0400
commit9fbf00c7802719becd633ecbc45879d5d0ddb985 (patch)
treec38722bd78d605b26d76c24d6c13bd45bc0936bf /src/responder/common
parent065b4307c33407e28f28fdba1aee2747b88b0984 (diff)
downloadsssd-9fbf00c7802719becd633ecbc45879d5d0ddb985.tar.gz
sssd-9fbf00c7802719becd633ecbc45879d5d0ddb985.tar.xz
sssd-9fbf00c7802719becd633ecbc45879d5d0ddb985.zip
Properly handle dbus send attempts on a closed connection
dbus_connection_send_with_reply() will report success and return a NULL pending_reply when the connection is not open for communication. This patch creates a new wrapper around dbus_connection_send_with_reply() to properly detect this condition and report it as an error.
Diffstat (limited to 'src/responder/common')
-rw-r--r--src/responder/common/responder_dp.c32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c
index d5a4ca760..001661ca6 100644
--- a/src/responder/common/responder_dp.c
+++ b/src/responder/common/responder_dp.c
@@ -412,7 +412,6 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
void *callback_ctx,
struct sss_dp_req **ndp)
{
- DBusConnection *dbus_conn;
DBusMessage *msg;
DBusPendingCall *pending_reply;
dbus_bool_t dbret;
@@ -432,7 +431,6 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
" This maybe a bug, it shouldn't happen!\n", domain));
return EIO;
}
- dbus_conn = sbus_get_connection(be_conn->conn);
/* create the message */
msg = dbus_message_new_method_call(NULL,
@@ -457,9 +455,16 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
return EIO;
}
- dbret = dbus_connection_send_with_reply(dbus_conn, msg,
- &pending_reply, timeout);
- if (!dbret || pending_reply == NULL) {
+ sdp_req = talloc_zero(rctx, struct sss_dp_req);
+ if (!sdp_req) {
+ dbus_message_unref(msg);
+ return ENOMEM;
+ }
+
+ ret = sbus_conn_send(be_conn->conn, msg, timeout,
+ sss_dp_send_acct_callback,
+ sdp_req, &pending_reply);
+ if (ret != EOK) {
/*
* Critical Failure
* We can't communicate on this connection
@@ -470,11 +475,6 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
return EIO;
}
- sdp_req = talloc_zero(rctx, struct sss_dp_req);
- if (!sdp_req) {
- dbus_message_unref(msg);
- return ENOMEM;
- }
sdp_req->ev = rctx->ev;
sdp_req->pending_reply = pending_reply;
@@ -493,18 +493,6 @@ static int sss_dp_send_acct_req_create(struct resp_ctx *rctx,
talloc_set_destructor((TALLOC_CTX *)cb, sss_dp_callback_destructor);
}
- /* Set up the reply handler */
- dbret = dbus_pending_call_set_notify(pending_reply,
- sss_dp_send_acct_callback,
- sdp_req, NULL);
- if (!dbret) {
- DEBUG(0, ("Could not queue up pending request!\n"));
- talloc_zfree(sdp_req);
- dbus_pending_call_cancel(pending_reply);
- dbus_message_unref(msg);
- return EIO;
- }
-
dbus_message_unref(msg);
*ndp = sdp_req;