summaryrefslogtreecommitdiffstats
path: root/src/device.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-02-03 11:18:22 -0800
committerJohan Hedberg <johan.hedberg@nokia.com>2009-02-03 11:20:01 -0800
commitf7d1ee361e410e096929bd3918178af356c50bbd (patch)
treeb6360e73aea8397c0e06120a2306c2bd7278d671 /src/device.c
parent38ca09be34dbb514fa1194b9a164d1b63a74069b (diff)
Fix authentication replies when disconnected
This patch makes sure that we don't reply to the authentiction requests if we get disconnected before authentication has completed.
Diffstat (limited to 'src/device.c')
-rw-r--r--src/device.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/device.c b/src/device.c
index 9c647f39..926d9591 100644
--- a/src/device.c
+++ b/src/device.c
@@ -1678,7 +1678,7 @@ static void create_bond_req_exit(DBusConnection *conn, void *user_data)
debug("%s: requestor exited before bonding was completed", device->path);
if (device->authr)
- device_cancel_authentication(device);
+ device_cancel_authentication(device, FALSE);
if (device->bonding) {
device->bonding->listener_id = 0;
@@ -1890,7 +1890,7 @@ void device_cancel_bonding(struct btd_device *device, uint8_t status)
debug("%s: canceling bonding request", device->path);
if (device->authr)
- device_cancel_authentication(device);
+ device_cancel_authentication(device, FALSE);
reply = new_authentication_return(bonding->msg, status);
g_dbus_send_message(bonding->conn, reply);
@@ -2032,7 +2032,7 @@ static void cancel_authentication(struct authentication_req *auth)
auth->cb = NULL;
}
-void device_cancel_authentication(struct btd_device *device)
+void device_cancel_authentication(struct btd_device *device, gboolean aborted)
{
struct authentication_req *auth = device->authr;
@@ -2044,7 +2044,9 @@ void device_cancel_authentication(struct btd_device *device)
if (auth->agent)
agent_cancel(auth->agent);
- cancel_authentication(auth);
+ if (!aborted)
+ cancel_authentication(auth);
+
device->authr = NULL;
g_free(auth);
}