summaryrefslogtreecommitdiff
path: root/src/responder/pam
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/pam
parent065b4307c33407e28f28fdba1aee2747b88b0984 (diff)
downloadsssd-9fbf00c7802719becd633ecbc45879d5d0ddb985.tar.gz
sssd-9fbf00c7802719becd633ecbc45879d5d0ddb985.tar.bz2
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/pam')
-rw-r--r--src/responder/pam/pamsrv_dp.c27
1 files changed, 5 insertions, 22 deletions
diff --git a/src/responder/pam/pamsrv_dp.c b/src/responder/pam/pamsrv_dp.c
index 071d09b8..d9431f22 100644
--- a/src/responder/pam/pamsrv_dp.c
+++ b/src/responder/pam/pamsrv_dp.c
@@ -43,10 +43,10 @@ static void pam_dp_process_reply(DBusPendingCall *pending, void *ptr)
dbus_error_init(&dbus_error);
- dbus_pending_call_block(pending);
msg = dbus_pending_call_steal_reply(pending);
if (msg == NULL) {
- DEBUG(0, ("Severe error. A reply callback was called but no reply was received and no timeout occurred\n"));
+ DEBUG(0, ("Severe error. A reply callback was called but no reply was"
+ "received and no timeout occurred\n"));
preq->pd->pam_status = PAM_SYSTEM_ERR;
goto done;
}
@@ -84,8 +84,6 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
struct pam_data *pd = preq->pd;
struct be_conn *be_conn;
DBusMessage *msg;
- DBusPendingCall *pending_reply;
- DBusConnection *dbus_conn;
dbus_bool_t ret;
int res;
@@ -100,7 +98,6 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
" This maybe a bug, it shouldn't happen!\n", preq->domain));
return EIO;
}
- dbus_conn = sbus_get_connection(be_conn->conn);
msg = dbus_message_new_method_call(NULL,
DP_PATH,
@@ -121,22 +118,8 @@ int pam_dp_send_req(struct pam_auth_req *preq, int timeout)
return EIO;
}
- ret = dbus_connection_send_with_reply(dbus_conn, msg, &pending_reply, timeout);
- if (!ret || pending_reply == NULL) {
- /*
- * 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;
- }
-
- dbus_pending_call_set_notify(pending_reply,
- pam_dp_process_reply, preq, NULL);
- dbus_message_unref(msg);
-
- return EOK;
+ return sbus_conn_send(be_conn->conn, msg,
+ timeout, pam_dp_process_reply,
+ preq, NULL);
}