From 37726232053804e18cb5c34e6dec42a8427240a2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Fri, 18 Aug 2006 23:32:01 +0000 Subject: Cancel agent requests on DEVDOWN --- hcid/dbus-security.c | 4 ++-- hcid/dbus.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c index d2d634e6..f7b409e6 100644 --- a/hcid/dbus-security.c +++ b/hcid/dbus-security.c @@ -569,7 +569,7 @@ void cancel_passkey_agent_requests(struct slist *agents, const char *path, bdadd for (l = default_agent->pending_requests; l != NULL; l = next) { struct pending_agent_request *req = l->data; next = l->next; - if (!strcmp(path, req->path) && !bacmp(addr, &req->bda)) { + if (!strcmp(path, req->path) && (!addr || !bacmp(addr, &req->bda))) { send_cancel_request(default_agent, req); default_agent->pending_requests = slist_remove(default_agent->pending_requests, req); @@ -582,7 +582,7 @@ void cancel_passkey_agent_requests(struct slist *agents, const char *path, bdadd for (l = agent->pending_requests; l != NULL; l = next) { struct pending_agent_request *req = l->data; next = l->next; - if (!strcmp(path, req->path) && !bacmp(addr, &req->bda)) { + if (!strcmp(path, req->path) && (!addr || !bacmp(addr, &req->bda))) { send_cancel_request(agent, req); agent->pending_requests = slist_remove(agent->pending_requests, req); } diff --git a/hcid/dbus.c b/hcid/dbus.c index 696211d5..6e174ab3 100644 --- a/hcid/dbus.c +++ b/hcid/dbus.c @@ -635,6 +635,8 @@ int hcid_dbus_stop_device(uint16_t id) /* check pending requests */ reply_pending_requests(path, pdata); + cancel_passkey_agent_requests(pdata->passkey_agents, path, NULL); + if (pdata->requestor_name) { free(pdata->requestor_name); pdata->requestor_name = NULL; -- cgit