diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dbus-hci.c | 17 | ||||
| -rw-r--r-- | src/device.c | 2 | 
2 files changed, 14 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 diff --git a/src/device.c b/src/device.c index fa8658e5..68d7bf21 100644 --- a/src/device.c +++ b/src/device.c @@ -640,6 +640,8 @@ struct btd_device *device_create(DBusConnection *conn, struct btd_adapter *adapt  	str2ba(address, &device->bdaddr);  	device->adapter = adapter; +	device->auth = 0xff; +  	return device;  } | 
