diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2008-06-06 13:06:27 +0000 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2008-06-06 13:06:27 +0000 |
commit | f425717dc531dc8f44e8b77981dbb9bfb54e34aa (patch) | |
tree | 17a73dfb47d89feeb61e81eb6fcf4ffb6bbda983 /hcid | |
parent | 71fc3121bc9f76112e13e9d29f7822f5db8dd3e9 (diff) |
Return proper negative replies to different types of authentication requests
Diffstat (limited to 'hcid')
-rw-r--r-- | hcid/adapter.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/hcid/adapter.c b/hcid/adapter.c index 8d71b3bd..82b0e3f7 100644 --- a/hcid/adapter.c +++ b/hcid/adapter.c @@ -2611,6 +2611,24 @@ cleanup: return FALSE; } +static void cancel_auth_request(int dd, auth_type_t type, bdaddr_t *bda) +{ + switch (type) { + case AUTH_TYPE_PINCODE: + hci_send_cmd(dd, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, + 6, bda); + break; + case AUTH_TYPE_CONFIRM: + hci_send_cmd(dd, OGF_LINK_CTL, OCF_USER_CONFIRM_NEG_REPLY, + 6, bda); + break; + case AUTH_TYPE_PASSKEY: + hci_send_cmd(dd, OGF_LINK_CTL, OCF_USER_PASSKEY_NEG_REPLY, + 6, bda); + break; + } +} + static void create_bond_req_exit(void *user_data) { struct adapter *adapter = user_data; @@ -2635,9 +2653,7 @@ static void create_bond_req_exit(void *user_data) dd = hci_open_dev(adapter->dev_id); if (dd >= 0) { - hci_send_cmd(dd, OGF_LINK_CTL, - OCF_PIN_CODE_NEG_REPLY, - 6, &adapter->bonding->bdaddr); + cancel_auth_request(dd, p->type, &p->bdaddr); hci_close_dev(dd); } } @@ -2792,8 +2808,7 @@ static DBusMessage *adapter_cancel_bonding(DBusConnection *conn, return failed_strerror(msg, err); } - hci_send_cmd(dd, OGF_LINK_CTL, OCF_PIN_CODE_NEG_REPLY, - 6, &bdaddr); + cancel_auth_request(dd, pin_req->type, &pin_req->bdaddr); hci_close_dev(dd); } |