diff options
author | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-04 15:10:41 -0800 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2009-02-04 15:10:41 -0800 |
commit | 8493d6363e61f1ef68763aab8e65f75be7f67fac (patch) | |
tree | 6e16a93a5c7ccaf16bc0393e61218e9ad2b6e0d3 /src/dbus-hci.c | |
parent | 1d2672966f514507f82058782034c481800122e6 (diff) |
Don't store the link key for "no bonding" cases
We should not store the link key if either side had "no bonding" as
their authentication requirement.
Diffstat (limited to 'src/dbus-hci.c')
-rw-r--r-- | src/dbus-hci.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 562609e0..5238d36f 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -902,15 +902,22 @@ int hcid_dbus_link_key_notify(bdaddr_t *local, bdaddr_t *peer, { struct btd_device *device; struct btd_adapter *adapter; - int err; + uint8_t local_auth = 0xff, remote_auth; if (!get_adapter_and_device(local, peer, &adapter, &device, TRUE)) return -ENODEV; - err = write_link_key(local, peer, key, key_type, pin_length); - if (err < 0) { - error("write_link_key: %s (%d)", strerror(-err), -err); - return err; + get_auth_requirements(local, peer, &local_auth); + remote_auth = device_get_auth(device); + + /* Only store the link key if neither side had "no bonding" as a + * requirement */ + if (local_auth > 0x01 && remote_auth > 0x01) { + int err = write_link_key(local, peer, key, key_type, pin_length); + if (err < 0) { + error("write_link_key: %s (%d)", strerror(-err), -err); + return err; + } } /* If this is not the first link key set a flag so a subsequent auth |