summaryrefslogtreecommitdiffstats
path: root/src/providers/dp_auth_util.c
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/providers/dp_auth_util.c
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/providers/dp_auth_util.c')
-rw-r--r--src/providers/dp_auth_util.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/src/providers/dp_auth_util.c b/src/providers/dp_auth_util.c
index 52911769a..e78884aaa 100644
--- a/src/providers/dp_auth_util.c
+++ b/src/providers/dp_auth_util.c
@@ -336,13 +336,9 @@ done:
int dp_common_send_id(struct sbus_connection *conn, uint16_t version,
const char *name)
{
- DBusPendingCall *pending_reply;
- DBusConnection *dbus_conn;
DBusMessage *msg;
dbus_bool_t ret;
- dbus_conn = sbus_get_connection(conn);
-
/* create the message */
msg = dbus_message_new_method_call(NULL,
DP_PATH,
@@ -365,23 +361,6 @@ int dp_common_send_id(struct sbus_connection *conn, uint16_t version,
return EIO;
}
- ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply,
- 30000 /* TODO: set timeout */);
- if (!ret || !pending_reply) {
- /*
- * Critical Failure
- * We can't communicate on this connection
- * We'll drop it using the default destructor.
- */
- DEBUG(0, ("D-BUS send failed.\n"));
- dbus_message_unref(msg);
- return EIO;
- }
-
- /* Set up the reply handler */
- dbus_pending_call_set_notify(pending_reply, id_callback, NULL, NULL);
- dbus_message_unref(msg);
-
- return EOK;
+ return sbus_conn_send(conn, msg, 30000, id_callback, NULL, NULL);
}