Thread (7 messages) 7 messages, 2 authors, 2012-01-31
STALE5292d

[PATCH BlueZ 5/6] device: Fix not using the "bonded" property for new bondings

From: Vinicius Costa Gomes <hidden>
Date: 2012-01-31 17:10:52
Subsystem: the rest · Maintainer: Linus Torvalds

When checking if a device was already bonded, we should
use the paired property instead of reading the link key
from storage. This method will work for LE links, also.
---
 src/device.c |   16 +---------------
 1 files changed, 1 insertions(+), 15 deletions(-)
diff --git a/src/device.c b/src/device.c
index 88cd4cc..0133e07 100644
--- a/src/device.c
+++ b/src/device.c
@@ -2287,29 +2287,15 @@ DBusMessage *device_create_bonding(struct btd_device *device,
 					const char *agent_path,
 					uint8_t capability)
 {
-	char filename[PATH_MAX + 1];
-	char *str, srcaddr[18], dstaddr[18];
 	struct btd_adapter *adapter = device->adapter;
 	struct bonding_req *bonding;
-	bdaddr_t src;
 	int err;
 
-	adapter_get_address(adapter, &src);
-	ba2str(&src, srcaddr);
-	ba2str(&device->bdaddr, dstaddr);
-
 	if (device->bonding)
 		return btd_error_in_progress(msg);
 
-	/* check if a link key already exists */
-	create_name(filename, PATH_MAX, STORAGEDIR, srcaddr,
-			"linkkeys");
-
-	str = textfile_caseget(filename, dstaddr);
-	if (str) {
-		free(str);
+	if (device_is_bonded(device))
 		return btd_error_already_exists(msg);
-	}
 
 	err = adapter_create_bonding(adapter, &device->bdaddr, capability);
 	if (err < 0)
-- 
1.7.8.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help