summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hcid/dbus-security.c2
-rw-r--r--hcid/dbus.c20
-rw-r--r--hcid/dbus.h1
-rw-r--r--hcid/hcid.h2
-rw-r--r--hcid/security.c4
5 files changed, 19 insertions, 10 deletions
diff --git a/hcid/dbus-security.c b/hcid/dbus-security.c
index 273c212e..432956f0 100644
--- a/hcid/dbus-security.c
+++ b/hcid/dbus-security.c
@@ -486,6 +486,8 @@ int handle_passkey_request(int dev, const char *path, bdaddr_t *sba, bdaddr_t *d
adapter = data;
+ adapter->pairing_active = 1;
+
ba2str(dba, addr);
for (l = adapter->passkey_agents; l != NULL; l = l->next) {
diff --git a/hcid/dbus.c b/hcid/dbus.c
index 413f6853..6ed5b6a4 100644
--- a/hcid/dbus.c
+++ b/hcid/dbus.c
@@ -611,7 +611,7 @@ void hcid_dbus_request_pin(int dev, bdaddr_t *sba, struct hci_conn_info *ci)
handle_passkey_request(dev, path, sba, &ci->bdaddr);
}
-void hcid_dbus_bonding_created_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status)
+void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status)
{
struct hci_dbus_data *pdata;
DBusMessage *msg_reply = NULL;
@@ -633,6 +633,18 @@ void hcid_dbus_bonding_created_complete(bdaddr_t *local, bdaddr_t *peer, const u
snprintf(path, sizeof(path), "%s/hci%d", ADAPTER_PATH, id);
+ /* create the authentication reply */
+ if (!dbus_connection_get_object_path_data(connection, path, (void *) &pdata)) {
+ error("Getting %s path data failed!", path);
+ goto failed;
+ }
+
+ /* Don't send any signals if a pairing process isn't active */
+ if (!pdata->pairing_active)
+ return;
+
+ pdata->pairing_active = 0;
+
/*
* 0x00: authentication request successfully completed
* 0x01-0x0F: authentication request failed
@@ -657,12 +669,6 @@ void hcid_dbus_bonding_created_complete(bdaddr_t *local, bdaddr_t *peer, const u
dbus_connection_flush(connection);
- /* create the authentication reply */
- if (!dbus_connection_get_object_path_data(connection, path, (void *) &pdata)) {
- error("Getting %s path data failed!", path);
- goto failed;
- }
-
if (!pdata->bonding)
goto failed; /* skip: no bonding req pending */
diff --git a/hcid/dbus.h b/hcid/dbus.h
index 57a258ef..61817090 100644
--- a/hcid/dbus.h
+++ b/hcid/dbus.h
@@ -118,6 +118,7 @@ struct hci_dbus_data {
struct slist *passkey_agents;
struct bonding_request_info *bonding;
struct slist *active_conn;
+ int pairing_active;
};
struct passkey_agent {
diff --git a/hcid/hcid.h b/hcid/hcid.h
index 80357937..d4b4cbd4 100644
--- a/hcid/hcid.h
+++ b/hcid/hcid.h
@@ -118,7 +118,7 @@ void hcid_dbus_inquiry_result(bdaddr_t *local, bdaddr_t *peer, uint32_t class, i
void hcid_dbus_remote_name(bdaddr_t *local, bdaddr_t *peer, uint8_t status, char *name);
void hcid_dbus_conn_complete(bdaddr_t *local, uint8_t status, uint16_t handle, bdaddr_t *peer);
void hcid_dbus_disconn_complete(bdaddr_t *local, uint8_t status, uint16_t handle, uint8_t reason);
-void hcid_dbus_bonding_created_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status);
+void hcid_dbus_bonding_process_complete(bdaddr_t *local, bdaddr_t *peer, const uint8_t status);
void hcid_dbus_create_conn_cancel(bdaddr_t *local, void *ptr);
void hcid_dbus_setname_complete(bdaddr_t *local);
void hcid_dbus_setscan_enable_complete(bdaddr_t *local);
diff --git a/hcid/security.c b/hcid/security.c
index 45af7466..4af61fb4 100644
--- a/hcid/security.c
+++ b/hcid/security.c
@@ -226,7 +226,7 @@ static void link_key_notify(int dev, bdaddr_t *sba, void *ptr)
write_link_key(sba, dba, evt->link_key, evt->key_type,
io_data[dev_id].pin_length);
- hcid_dbus_bonding_created_complete(sba, dba, 0);
+ hcid_dbus_bonding_process_complete(sba, dba, 0);
io_data[dev_id].pin_length = -1;
}
@@ -623,7 +623,7 @@ static inline void auth_complete(int dev, bdaddr_t *sba, void *ptr)
return;
if (evt->status)
- hcid_dbus_bonding_created_complete(sba, &dba, evt->status);
+ hcid_dbus_bonding_process_complete(sba, &dba, evt->status);
}
static gboolean io_security_event(GIOChannel *chan, GIOCondition cond, gpointer data)