diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2008-06-08 13:07:23 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2008-06-08 13:07:23 +0000 |
commit | 5fade3f9798c91058f992a894833a76958802478 (patch) | |
tree | 225f29ae91f82db8646aa27c0b227cc3458a9a81 | |
parent | 9dc4cfca15be6a5ccf0e00864b7cb02c2a0b7ac7 (diff) |
Convert passkey value to host order
-rw-r--r-- | hcid/security.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/hcid/security.c b/hcid/security.c index 1a711e18..17cb2f56 100644 --- a/hcid/security.c +++ b/hcid/security.c @@ -326,7 +326,7 @@ static void link_key_notify(int dev, bdaddr_t *sba, void *ptr) cp.reason = HCI_OE_LOW_RESOURCES; hci_send_cmd(dev, OGF_LINK_CTL, OCF_DISCONNECT, - DISCONNECT_CP_SIZE, &cp); + DISCONNECT_CP_SIZE, &cp); } } else hcid_dbus_bonding_process_complete(sba, dba, 0); @@ -362,11 +362,13 @@ static void user_confirm_request(int dev, bdaddr_t *sba, void *ptr) { evt_user_confirm_request *req = ptr; - if (hcid_dbus_user_confirm(sba, &req->bdaddr, req->passkey) < 0) - hci_send_cmd(dev, OGF_LINK_CTL, OCF_USER_CONFIRM_NEG_REPLY, - 6, ptr); + if (hcid_dbus_user_confirm(sba, &req->bdaddr, + btohl(req->passkey)) < 0) + hci_send_cmd(dev, OGF_LINK_CTL, + OCF_USER_CONFIRM_NEG_REPLY, 6, ptr); else - hcid_dbus_new_auth_request(sba, &req->bdaddr, AUTH_TYPE_CONFIRM); + hcid_dbus_new_auth_request(sba, &req->bdaddr, + AUTH_TYPE_CONFIRM); } static void user_passkey_request(int dev, bdaddr_t *sba, void *ptr) @@ -374,10 +376,11 @@ static void user_passkey_request(int dev, bdaddr_t *sba, void *ptr) evt_user_passkey_request *req = ptr; if (hcid_dbus_user_passkey(sba, &req->bdaddr) < 0) - hci_send_cmd(dev, OGF_LINK_CTL, OCF_USER_PASSKEY_NEG_REPLY, - 6, ptr); + hci_send_cmd(dev, OGF_LINK_CTL, + OCF_USER_PASSKEY_NEG_REPLY, 6, ptr); else - hcid_dbus_new_auth_request(sba, &req->bdaddr, AUTH_TYPE_PASSKEY); + hcid_dbus_new_auth_request(sba, &req->bdaddr, + AUTH_TYPE_PASSKEY); } static void remote_oob_data_request(int dev, bdaddr_t *sba, void *ptr) @@ -399,7 +402,7 @@ static void io_capa_request(int dev, bdaddr_t *sba, bdaddr_t *dba) bacpy(&cp.bdaddr, dba); cp.reason = HCI_PAIRING_NOT_ALLOWED; hci_send_cmd(dev, OGF_LINK_CTL, OCF_IO_CAPABILITY_NEG_REPLY, - IO_CAPABILITY_NEG_REPLY_CP_SIZE, &cp); + IO_CAPABILITY_NEG_REPLY_CP_SIZE, &cp); } else { io_capability_reply_cp cp; memset(&cp, 0, sizeof(cp)); @@ -408,7 +411,7 @@ static void io_capa_request(int dev, bdaddr_t *sba, bdaddr_t *dba) cp.oob_data = 0x00; cp.authentication = auth; hci_send_cmd(dev, OGF_LINK_CTL, OCF_IO_CAPABILITY_REPLY, - IO_CAPABILITY_REPLY_CP_SIZE, &cp); + IO_CAPABILITY_REPLY_CP_SIZE, &cp); } } @@ -468,14 +471,14 @@ static void pin_code_request(int dev, bdaddr_t *sba, bdaddr_t *dba) memcpy(pr.pin_code, hcid.pin_code, hcid.pin_len); pr.pin_len = hcid.pin_len; hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY, - PIN_CODE_REPLY_CP_SIZE, &pr); + PIN_CODE_REPLY_CP_SIZE, &pr); } else { if (pinlen > 0) { set_pin_length(sba, pinlen); memcpy(pr.pin_code, pin, pinlen); pr.pin_len = pinlen; hci_send_cmd(dev, OGF_LINK_CTL, OCF_PIN_CODE_REPLY, - PIN_CODE_REPLY_CP_SIZE, &pr); + PIN_CODE_REPLY_CP_SIZE, &pr); } else { /* Request PIN from passkey agent */ if (hcid_dbus_request_pin(dev, sba, ci) < 0) |