diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2009-01-16 15:13:33 +0100 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2009-01-16 15:13:33 +0100 | 
| commit | 97dd9b6963ee0f8517bf8e2633d28b6505f2f7ba (patch) | |
| tree | 6d30205d23125abeea67cc4f84120ea7c5d332b3 /src/dbus-hci.c | |
| parent | 8dc9d59d5e01a57893a927f033368255dd9551c9 (diff) | |
Use MITM for CreatePairedDevice and handle the NoInputNoOuput cases
Diffstat (limited to 'src/dbus-hci.c')
| -rw-r--r-- | src/dbus-hci.c | 14 | 
1 files changed, 11 insertions, 3 deletions
| diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 36bd0c94..85805906 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -295,7 +295,7 @@ int hcid_dbus_user_confirm(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey)  	struct btd_adapter *adapter;  	struct btd_device *device;  	char addr[18]; -	uint8_t type; +	uint8_t remcap, remauth, type;  	uint16_t dev_id;  	adapter = manager_find_adapter(sba); @@ -333,8 +333,14 @@ int hcid_dbus_user_confirm(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey)  		return -1;  	} -	/* If no MITM protection required, auto-accept */ -	if (!(device_get_auth(device) & 0x01) && !(type & 0x01)) { +	remcap = device_get_cap(device); +	remauth = device_get_auth(device); + +	debug("remote IO capabilities are 0x%02x", remcap); +	debug("remote authentication requirement is 0x%02x", remauth); + +	/* If no side requires MITM protection; auto-accept */ +	if (!(remauth & 0x01) && (!(type & 0x01) || remcap == 0x03)) {  		int dd;  		dd = hci_open_dev(dev_id); @@ -348,6 +354,8 @@ int hcid_dbus_user_confirm(bdaddr_t *sba, bdaddr_t *dba, uint32_t passkey)  		hci_close_dev(dd); +		debug("auto accept of confirmation"); +  		return device_request_authentication(device,  						AUTH_TYPE_AUTO, 0, NULL);  	} | 
