From eb0accc1d7f15faf4a992cb3a07f917e4769c711 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 23 Aug 2006 07:24:35 +0000 Subject: Remove name listener for bonding requestor when CancelBonding is called --- hcid/dbus-adapter.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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) -- cgit