Detect when a device is disconnected

Pretty hacky way to detect whether the device we're handling has
been disconnected during a verify or enrollment. This should allow
us to avoid users having to wait when somebody pulls the plug.
This commit is contained in:
Bastien Nocera
2009-01-27 12:29:23 +00:00
committed by Daniel Drake
parent bbead87f58
commit 4ea1c48f9f
4 changed files with 56 additions and 7 deletions

View File

@ -154,7 +154,7 @@ static DBusGProxy *create_manager (pam_handle_t *pamh, DBusGConnection **ret_con
return manager;
}
static close_and_unref (DBusGConnection *connection)
static void close_and_unref (DBusGConnection *connection)
{
DBusConnection *conn;
@ -335,7 +335,11 @@ static int do_verify(GMainLoop *loop, pam_handle_t *pamh, DBusGProxy *dev)
ret = PAM_SUCCESS;
else if (g_str_equal (data->result, "verify-unknown-error"))
ret = PAM_AUTHINFO_UNAVAIL;
else {
else if (g_str_equal (data->result, "verify-disconnected")) {
ret = PAM_AUTHINFO_UNAVAIL;
g_free (data->result);
break;
} else {
send_info_msg (data->pamh, "An unknown error occured");
ret = PAM_AUTH_ERR;
g_free (data->result);