summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2006-08-23 07:24:35 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2006-08-23 07:24:35 +0000
commiteb0accc1d7f15faf4a992cb3a07f917e4769c711 (patch)
treec463282a840c60214cfdd28d40bef1ca2d871496 /hcid
parentca6e6c5a32dda535b9f76f9b0f8433f71f977efa (diff)
Remove name listener for bonding requestor when CancelBonding is called
Diffstat (limited to 'hcid')
-rw-r--r--hcid/dbus-adapter.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/hcid/dbus-adapter.c b/hcid/dbus-adapter.c
index 93bf0e63..3e06d50e 100644
--- a/hcid/dbus-adapter.c
+++ b/hcid/dbus-adapter.c
@@ -1826,7 +1826,8 @@ static DBusHandlerResult handle_dev_cancel_bonding_req(DBusConnection *conn, DBu
return error_bonding_not_in_progress(conn, msg);
}
- if (strcmp(dbus_data->bonding_requestor, dbus_message_get_sender(msg)))
+ if (!dbus_data->bonding_requestor || strcmp(dbus_data->bonding_requestor,
+ dbus_message_get_sender(msg)))
return error_not_authorized(conn, msg);
dd = hci_open_dev(dbus_data->dev_id);
@@ -1880,6 +1881,11 @@ static DBusHandlerResult handle_dev_cancel_bonding_req(DBusConnection *conn, DBu
/* Reply to the create bonding request */
error_authentication_canceled(conn, dbus_data->bonding->rq);
+ name_listener_remove(conn, dbus_data->bonding_requestor,
+ (name_cb_t)create_bond_req_exit, dbus_data);
+ free(dbus_data->bonding_requestor);
+ dbus_data->bonding_requestor = NULL;
+
/* disconnect from the remote device */
if (dbus_data->bonding->disconnect) {
if (hci_disconnect(dd, htobs(cinfo->handle), HCI_OE_USER_ENDED_CONNECTION, 1000) < 0)