diff options
| author | Marcel Holtmann <marcel@holtmann.org> | 2009-01-15 13:05:50 +0100 | 
|---|---|---|
| committer | Marcel Holtmann <marcel@holtmann.org> | 2009-01-15 13:05:50 +0100 | 
| commit | 5cfcdb72227f3855e90e45dca75c83005ec5267b (patch) | |
| tree | d75e78dcf761ba815516935454b1f46607427a45 /src | |
| parent | 41e30382f9a83f41da700465de274266c60248b4 (diff) | |
Fix IO capabilities for non-pairing and pairing cases
Diffstat (limited to 'src')
| -rw-r--r-- | src/dbus-hci.c | 26 | 
1 files changed, 14 insertions, 12 deletions
| diff --git a/src/dbus-hci.c b/src/dbus-hci.c index 3577043b..5b502f3f 100644 --- a/src/dbus-hci.c +++ b/src/dbus-hci.c @@ -1230,11 +1230,14 @@ int hcid_dbus_get_io_cap(bdaddr_t *local, bdaddr_t *remote,  	ba2str(remote, addr);  	device = adapter_find_device(adapter, addr); -	/* Check if the adapter is not pairable and if there isn't a bonding in -	 * progress */ +	if (!device) +		return -ENODEV; + +	/* Check if the adapter is not pairable and if there isn't a bonding +	 * in progress */  	if (!adapter_is_pairable(adapter) && -			!(device && device_is_bonding(device, NULL))) { -		if (*auth < 0x02) { +				!device_is_bonding(device, NULL)) { +		if (*auth < 0x02 && device_get_auth(device) < 0x02) {  			debug("Allowing no bonding in non-bondable mode");  			/* No input, no output */  			*cap = 0x03; @@ -1244,17 +1247,16 @@ int hcid_dbus_get_io_cap(bdaddr_t *local, bdaddr_t *remote,  	}  	/* For CreatePairedDevice use dedicated bonding */ -	if (device) { -		agent = device_get_agent(device); -		if (agent) -			*auth = 0x03; -	} -	if (!agent) +	agent = device_get_agent(device); +	if (agent) { +		debug("Pairing attempt, use dedicated bonding without MITM"); +		*auth = 0x02; +	} else  		agent = adapter_get_agent(adapter);  	if (!agent) {  		/* This is the non bondable mode case */ -		if (device && device_get_auth(device) > 0x01) { +		if (device_get_auth(device) > 0x01) {  			debug("Bonding request, but no agent present");  			return -1;  		} @@ -1271,7 +1273,7 @@ int hcid_dbus_get_io_cap(bdaddr_t *local, bdaddr_t *remote,  		return -1;  	} -	if (device && *auth == 0x00) { +	if (*auth == 0x00) {  		/* If remote requests dedicated bonding follow that lead */  		if (device_get_auth(device) == 0x02 ||  				device_get_auth(device) == 0x03) | 
