[Pkg-bluetooth-commits] r978 - in /packages/bluez/tags/4.66-2: ./ debian/ debian/patches/

iwamatsu at users.alioth.debian.org iwamatsu at users.alioth.debian.org
Thu Dec 2 05:25:24 UTC 2010


Author: iwamatsu
Date: Thu Dec  2 05:24:53 2010
New Revision: 978

URL: http://svn.debian.org/wsvn/pkg-bluetooth/?sc=1&rev=978
Log:
[svn-buildpackage] Tagging bluez 4.66-2

* Fix init script to be a nop when the package is removed.
  debian/bluez.bluetooth.init (Closes: #593172).
* Fix removal of obsolete conffile.
  debian/bluez.preinst (Closes: #592982, #568301).
* Backports some pathces from upstream (Closes: #601583).
  Add some patch from 4.70.


Added:
    packages/bluez/tags/4.66-2/
      - copied from r977, packages/bluez/tags/4.66-1/
    packages/bluez/tags/4.66-2/debian/patches/0204_Fix-memory-leak.patch
    packages/bluez/tags/4.66-2/debian/patches/0206_Fix-missing-error-check-to-dbus_message_get_args.patch
    packages/bluez/tags/4.66-2/debian/patches/0207_Fix-attempt-to-use-a-potential-negative-array-index.patch
    packages/bluez/tags/4.66-2/debian/patches/0208_Fix-sdp_get_supp_feat-function.patch
    packages/bluez/tags/4.66-2/debian/patches/0209_Fix-unblock-removed-device.patch
    packages/bluez/tags/4.66-2/debian/patches/0213_Fix-not-freeing-memory-on-driver-exit.patch
    packages/bluez/tags/4.66-2/debian/patches/0214_Fix-possible-memory-leaks-on-ofono-driver.patch
    packages/bluez/tags/4.66-2/debian/patches/0215_Fix-not-cancelling-authentication-when-bonding-fails.patch
    packages/bluez/tags/4.66-2/debian/patches/0217_Fix-sending-authentication-reply-when-bonding-is-alr.patch
    packages/bluez/tags/4.66-2/debian/patches/0218_Fix-use-of-errno-after-calling-some-function-that-co.patch
    packages/bluez/tags/4.66-2/debian/patches/0227_core-fix-emitting-pairable-when-there-could-still-oc.patch
    packages/bluez/tags/4.66-2/debian/patches/0229_Fix-the-return-value-of-read_device_alias.patch
Modified:
    packages/bluez/tags/4.66-2/debian/bluez.bluetooth.init
    packages/bluez/tags/4.66-2/debian/bluez.preinst
    packages/bluez/tags/4.66-2/debian/changelog

Modified: packages/bluez/tags/4.66-2/debian/bluez.bluetooth.init
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/bluez.bluetooth.init?rev=978&op=diff
==============================================================================
--- packages/bluez/tags/4.66-2/debian/bluez.bluetooth.init (original)
+++ packages/bluez/tags/4.66-2/debian/bluez.bluetooth.init Thu Dec  2 05:24:53 2010
@@ -38,6 +38,8 @@
 SDPTOOL=/usr/bin/sdptool
 
 SSD_OPTIONS="--oknodo --quiet --exec $DAEMON"
+
+test -f /usr/sbin/bluetoothd || exit 0
 
 test -f /etc/default/bluetooth && . /etc/default/bluetooth
 test -f /etc/default/rcS && . /etc/default/rcS

Modified: packages/bluez/tags/4.66-2/debian/bluez.preinst
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/bluez.preinst?rev=978&op=diff
==============================================================================
--- packages/bluez/tags/4.66-2/debian/bluez.preinst (original)
+++ packages/bluez/tags/4.66-2/debian/bluez.preinst Thu Dec  2 05:24:53 2010
@@ -48,7 +48,7 @@
     # now that modprobe whines remove this old conffile, will be
     # http://bugs.debian.org/523050
     base="/etc/modprobe.d/bluez"
-    rm_conffile "$base"
+    rm_conffile bluez "$base"
     if [ -e "$base.dpkg-bak" ]; then
         if [ -e "$base.conf" ]; then
             echo "$base.conf exists, not touching"

Modified: packages/bluez/tags/4.66-2/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/changelog?rev=978&op=diff
==============================================================================
--- packages/bluez/tags/4.66-2/debian/changelog (original)
+++ packages/bluez/tags/4.66-2/debian/changelog Thu Dec  2 05:24:53 2010
@@ -1,3 +1,37 @@
+bluez (4.66-2) testing; urgency=low
+
+  * Fix init script to be a nop when the package is removed.
+    debian/bluez.bluetooth.init (Closes: #593172).
+  * Fix removal of obsolete conffile.
+    debian/bluez.preinst (Closes: #592982, #568301).
+  * Backports some pathces from upstream (Closes: #601583).
+    - 0204_Fix-memory-leak.patch
+      Fix memory leak in hfp_ag_record function.
+    - 0206_Fix-missing-error-check-to-dbus_message_get_args.patch
+      Fix missing error check to dbus_message_get_args.
+    - 0207_Fix-attempt-to-use-a-potential-negative-array-index.patch
+      Fix attempt to use a potential negative array index.
+    - 0208_Fix-sdp_get_supp_feat-function.patch
+	  Fix data allocation size to get in sdp_get_supp_feat. 
+    - 0209_Fix-unblock-removed-device.patch
+	  Fix unblock removed device.
+    - 0213_Fix-not-freeing-memory-on-driver-exit.patch
+      Fix not freeing memory on driver exit.
+    - 0214_Fix-possible-memory-leaks-on-ofono-driver.patch
+	  Fix memory leak by add address check.
+    - 0215_Fix-not-cancelling-authentication-when-bonding-fails.patch
+	  Fix not cancelling authentication when bonding fails
+    - 0217_Fix-sending-authentication-reply-when-bonding-is-alr.patch
+	  When bonding is already completed, sending authentication reply.
+    - 0218_Fix-use-of-errno-after-calling-some-function-that-co.patch
+	  Fix return erro code in device_authentication_requested function.
+    - 0227_core-fix-emitting-pairable-when-there-could-still-oc.patch
+	  Move error check code.
+    - 0229_Fix-the-return-value-of-read_device_alias.patch
+	  Fix the return value of read_device_alias function.
+
+ -- Nobuhiro Iwamatsu <iwamatsu at debian.org>  Thu, 04 Nov 2010 05:45:03 +0900
+
 bluez (4.66-1) unstable; urgency=low
 
   * New upstream release.

Added: packages/bluez/tags/4.66-2/debian/patches/0204_Fix-memory-leak.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0204_Fix-memory-leak.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0204_Fix-memory-leak.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0204_Fix-memory-leak.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,36 @@
+From b336e93a471f4ede121edaf822cd525c2ffc17a7 Mon Sep 17 00:00:00 2001
+From: Johan Hedberg <johan.hedberg at nokia.com>
+Date: Thu, 17 Jun 2010 09:40:56 +0300
+Subject: [PATCH 04/37] Fix memory leak
+
+---
+ audio/manager.c |    8 +++++++-
+ 1 files changed, 7 insertions(+), 1 deletions(-)
+
+diff --git a/audio/manager.c b/audio/manager.c
+index f6a98cd..5edfb18 100644
+--- a/audio/manager.c
++++ b/audio/manager.c
+@@ -351,12 +351,18 @@ static sdp_record_t *hfp_ag_record(uint8_t ch, uint32_t feat)
+ 	sdp_data_t *channel, *features;
+ 	uint8_t netid = 0x01;
+ 	uint16_t sdpfeat;
+-	sdp_data_t *network = sdp_data_alloc(SDP_UINT8, &netid);
++	sdp_data_t *network;
+ 
+ 	record = sdp_record_alloc();
+ 	if (!record)
+ 		return NULL;
+ 
++	network = sdp_data_alloc(SDP_UINT8, &netid);
++	if (!network) {
++		sdp_record_free(record);
++		return NULL;
++	}
++
+ 	sdp_uuid16_create(&root_uuid, PUBLIC_BROWSE_GROUP);
+ 	root = sdp_list_append(0, &root_uuid);
+ 	sdp_set_browse_groups(record, root);
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0206_Fix-missing-error-check-to-dbus_message_get_args.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0206_Fix-missing-error-check-to-dbus_message_get_args.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0206_Fix-missing-error-check-to-dbus_message_get_args.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0206_Fix-missing-error-check-to-dbus_message_get_args.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,31 @@
+From b2d85659223b628d17bb5f69e00d6f514761cba6 Mon Sep 17 00:00:00 2001
+From: Johan Hedberg <johan.hedberg at nokia.com>
+Date: Thu, 17 Jun 2010 21:31:32 +0300
+Subject: [PATCH 06/37] Fix missing error check to dbus_message_get_args
+
+---
+ audio/telephony-maemo6.c |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
+index 41950be..e8b75fd 100644
+--- a/audio/telephony-maemo6.c
++++ b/audio/telephony-maemo6.c
+@@ -1311,9 +1311,12 @@ static void hal_battery_level_reply(DBusPendingCall *call, void *user_data)
+ 		goto done;
+ 	}
+ 
+-	dbus_message_get_args(reply, NULL,
++	if (!dbus_message_get_args(reply, NULL,
+ 				DBUS_TYPE_INT32, &level,
+-				DBUS_TYPE_INVALID);
++				DBUS_TYPE_INVALID)) {
++		error("Unexpected args in hald reply");
++		goto done;
++	}
+ 
+ 	*value = (int) level;
+ 
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0207_Fix-attempt-to-use-a-potential-negative-array-index.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0207_Fix-attempt-to-use-a-potential-negative-array-index.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0207_Fix-attempt-to-use-a-potential-negative-array-index.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0207_Fix-attempt-to-use-a-potential-negative-array-index.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,41 @@
+From 2e0d7c44ff32150c209cf7066dbeb34e464090e5 Mon Sep 17 00:00:00 2001
+From: Johan Hedberg <johan.hedberg at nokia.com>
+Date: Thu, 17 Jun 2010 23:20:33 +0300
+Subject: [PATCH 07/37] Fix attempt to use a potential negative array index
+
+---
+ src/security.c |    7 ++++---
+ 1 files changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/src/security.c b/src/security.c
+index e8c463c..ca394e1 100644
+--- a/src/security.c
++++ b/src/security.c
+@@ -377,11 +377,14 @@ static void link_key_notify(int dev, bdaddr_t *sba, void *ptr)
+ 	dev_id = hci_devid(sa);
+ 	if (dev_id < 0)
+ 		err = -errno;
+-	else
++	else {
+ 		err = hcid_dbus_link_key_notify(sba, dba, evt->link_key,
+ 						evt->key_type,
+ 						io_data[dev_id].pin_length,
+ 						old_key_type);
++		io_data[dev_id].pin_length = -1;
++	}
++
+ 	if (err < 0) {
+ 		uint16_t handle;
+ 
+@@ -403,8 +406,6 @@ static void link_key_notify(int dev, bdaddr_t *sba, void *ptr)
+ 						DISCONNECT_CP_SIZE, &cp);
+ 		}
+ 	}
+-
+-	io_data[dev_id].pin_length = -1;
+ }
+ 
+ static void return_link_keys(int dev, bdaddr_t *sba, void *ptr)
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0208_Fix-sdp_get_supp_feat-function.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0208_Fix-sdp_get_supp_feat-function.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0208_Fix-sdp_get_supp_feat-function.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0208_Fix-sdp_get_supp_feat-function.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,53 @@
+From 15b2bfd69b42c2b6a37916a7067a429491a0da95 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Elvis=20Pf=C3=BCtzenreuter?= <epx at signove.com>
+Date: Wed, 16 Jun 2010 13:30:48 -0300
+Subject: [PATCH 08/37] Fix sdp_get_supp_feat function
+
+In case of string data items, value is a pointer by itself.
+---
+ lib/sdp.c |   25 ++++++++++++++++++++++---
+ 1 files changed, 22 insertions(+), 3 deletions(-)
+
+diff --git a/lib/sdp.c b/lib/sdp.c
+index 79f4ae5..17745ac 100644
+--- a/lib/sdp.c
++++ b/lib/sdp.c
+@@ -4769,13 +4769,32 @@ int sdp_get_supp_feat(const sdp_record_t *rec, sdp_list_t **seqp)
+ 
+ 		if (d->dtd < SDP_SEQ8 || d->dtd > SDP_SEQ32)
+ 			goto fail;
++
+ 		subseq = NULL;
++
+ 		for (dd = d->val.dataseq; dd; dd = dd->next) {
+ 			sdp_data_t *data;
+-			if (dd->dtd != SDP_UINT8 && dd->dtd != SDP_UINT16 &&
+-						dd->dtd != SDP_TEXT_STR8)
++			void *val;
++			int length;
++
++			switch (dd->dtd) {
++			case SDP_URL_STR8:
++			case SDP_URL_STR16:
++			case SDP_TEXT_STR8:
++			case SDP_TEXT_STR16:
++				val = dd->val.str;
++				length = dd->unitSize - sizeof(uint8_t);
++				break;
++			case SDP_UINT8:
++			case SDP_UINT16:
++				val = &dd->val;
++				length = 0;
++				break;
++			default:
+ 				goto fail;
+-			data = sdp_data_alloc(dd->dtd, &dd->val);
++			}
++
++			data = sdp_data_alloc_with_length(dd->dtd, val, length);
+ 			if (data)
+ 				subseq = sdp_list_append(subseq, data);
+ 		}
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0209_Fix-unblock-removed-device.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0209_Fix-unblock-removed-device.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0209_Fix-unblock-removed-device.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0209_Fix-unblock-removed-device.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,73 @@
+From e0eddab0745f605fba545d03e84ed13769d744c8 Mon Sep 17 00:00:00 2001
+From: Daniel Orstadius <daniel.orstadius at gmail.com>
+Date: Mon, 28 Jun 2010 13:45:37 +0300
+Subject: [PATCH 09/37] Fix unblock removed device
+
+Unblocks a device when removing it. Adds boolean argument to
+function device_unblock to only emit property changed signal and
+probe drivers when unblocking a device if the device is not
+unblocked as part of being removed.
+---
+ src/device.c |   17 ++++++++++++-----
+ 1 files changed, 12 insertions(+), 5 deletions(-)
+
+diff --git a/src/device.c b/src/device.c
+index 11b1fd2..73243c9 100644
+--- a/src/device.c
++++ b/src/device.c
+@@ -513,7 +513,8 @@ static int device_block(DBusConnection *conn, struct btd_device *device)
+ 	return 0;
+ }
+ 
+-static int device_unblock(DBusConnection *conn, struct btd_device *device)
++static int device_unblock(DBusConnection *conn, struct btd_device *device,
++							gboolean silent)
+ {
+ 	int dev_id, dd, err;
+ 	bdaddr_t src;
+@@ -543,10 +544,12 @@ static int device_unblock(DBusConnection *conn, struct btd_device *device)
+ 	if (err < 0)
+ 		error("write_blocked(): %s (%d)", strerror(-err), -err);
+ 
+-	emit_property_changed(conn, device->path, DEVICE_INTERFACE, "Blocked",
++	if (!silent) {
++		emit_property_changed(conn, device->path,
++					DEVICE_INTERFACE, "Blocked",
+ 					DBUS_TYPE_BOOLEAN, &device->blocked);
+-
+-	device_probe_drivers(device, device->uuids);
++		device_probe_drivers(device, device->uuids);
++	}
+ 
+ 	return 0;
+ }
+@@ -560,7 +563,7 @@ static DBusMessage *set_blocked(DBusConnection *conn, DBusMessage *msg,
+ 	if (value)
+ 		err = device_block(conn, device);
+ 	else
+-		err = device_unblock(conn, device);
++		err = device_unblock(conn, device, FALSE);
+ 
+ 	switch (-err) {
+ 	case 0:
+@@ -1100,6 +1103,7 @@ static void device_remove_stored(struct btd_device *device)
+ {
+ 	bdaddr_t src;
+ 	char addr[18];
++	DBusConnection *conn = get_dbus_connection();
+ 
+ 	adapter_get_address(device->adapter, &src);
+ 	ba2str(&device->bdaddr, addr);
+@@ -1109,6 +1113,9 @@ static void device_remove_stored(struct btd_device *device)
+ 	delete_entry(&src, "profiles", addr);
+ 	delete_entry(&src, "trusts", addr);
+ 	delete_all_records(&src, &device->bdaddr);
++
++	if (device->blocked)
++		device_unblock(conn, device, TRUE);
+ }
+ 
+ void device_remove(struct btd_device *device, gboolean remove_stored)
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0213_Fix-not-freeing-memory-on-driver-exit.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0213_Fix-not-freeing-memory-on-driver-exit.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0213_Fix-not-freeing-memory-on-driver-exit.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0213_Fix-not-freeing-memory-on-driver-exit.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,29 @@
+From ef1e62baec7833bd4a53720d1ee2bdcd91e6a705 Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
+Date: Tue, 8 Jun 2010 10:48:24 +0300
+Subject: [PATCH 13/37] Fix not freeing memory on driver exit
+
+---
+ audio/telephony-maemo6.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/audio/telephony-maemo6.c b/audio/telephony-maemo6.c
+index e8b75fd..31704c3 100644
+--- a/audio/telephony-maemo6.c
++++ b/audio/telephony-maemo6.c
+@@ -1981,6 +1981,12 @@ int telephony_init(void)
+ 
+ void telephony_exit(void)
+ {
++	g_free(net.operator_name);
++	net.operator_name = NULL;
++
++	g_free(last_dialed_number);
++	last_dialed_number = NULL;
++
+ 	g_slist_foreach(calls, (GFunc) csd_call_free, NULL);
+ 	g_slist_free(calls);
+ 	calls = NULL;
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0214_Fix-possible-memory-leaks-on-ofono-driver.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0214_Fix-possible-memory-leaks-on-ofono-driver.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0214_Fix-possible-memory-leaks-on-ofono-driver.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0214_Fix-possible-memory-leaks-on-ofono-driver.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,30 @@
+From 2a6500b516bb7c864f810cb4bba7584bf24a246a Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
+Date: Tue, 8 Jun 2010 11:20:15 +0300
+Subject: [PATCH 14/37] Fix possible memory leaks on ofono driver
+
+---
+ audio/telephony-ofono.c |    7 +++++--
+ 1 files changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c
+index e710ce8..9c20112 100644
+--- a/audio/telephony-ofono.c
++++ b/audio/telephony-ofono.c
+@@ -598,8 +598,11 @@ static void list_modem_reply(DBusPendingCall *call, void *user_data)
+ 
+ 		dbus_message_iter_get_basic(&sub, &modem_obj_path_local);
+ 		modem_obj_path = g_strdup(modem_obj_path_local);
+-		DBG("modem_obj_path is %p, %s\n", modem_obj_path,
+-						modem_obj_path);
++		if (modem_obj_path != NULL) {
++			DBG("modem_obj_path is %p, %s\n", modem_obj_path,
++							modem_obj_path);
++			break;
++		}
+ 		dbus_message_iter_next(&sub);
+ 	}
+ 
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0215_Fix-not-cancelling-authentication-when-bonding-fails.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0215_Fix-not-cancelling-authentication-when-bonding-fails.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0215_Fix-not-cancelling-authentication-when-bonding-fails.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0215_Fix-not-cancelling-authentication-when-bonding-fails.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,189 @@
+From 8b78d14dd4ac9776f5848dee94ce2fcf976fd6d8 Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
+Date: Mon, 28 Jun 2010 14:01:05 +0300
+Subject: [PATCH 15/37] Fix not cancelling authentication when bonding fails
+
+---
+ src/dbus-hci.h |    2 -
+ src/device.c   |  101 +++++++++++++++++++++++++-------------------------------
+ 2 files changed, 45 insertions(+), 58 deletions(-)
+
+diff --git a/src/dbus-hci.h b/src/dbus-hci.h
+index a29dd53..44cd5e5 100644
+--- a/src/dbus-hci.h
++++ b/src/dbus-hci.h
+@@ -50,8 +50,6 @@ gboolean get_adapter_and_device(bdaddr_t *src, bdaddr_t *dst,
+ 					struct btd_device **device,
+ 					gboolean create);
+ 
+-DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status);
+-
+ const char *class_to_icon(uint32_t class);
+ 
+ void set_dbus_connection(DBusConnection *conn);
+diff --git a/src/device.c b/src/device.c
+index d4ff131..781b6e2 100644
+--- a/src/device.c
++++ b/src/device.c
+@@ -157,14 +157,6 @@ static uint16_t uuid_list[] = {
+ 
+ static GSList *device_drivers = NULL;
+ 
+-static DBusHandlerResult error_connection_attempt_failed(DBusConnection *conn,
+-						DBusMessage *msg, int err)
+-{
+-	return error_common_reply(conn, msg,
+-			ERROR_INTERFACE ".ConnectionAttemptFailed",
+-			err > 0 ? strerror(err) : "Connection attempt failed");
+-}
+-
+ static DBusHandlerResult error_failed(DBusConnection *conn,
+ 					DBusMessage *msg, const char * desc)
+ {
+@@ -1744,7 +1736,7 @@ static gboolean start_discovery(gpointer user_data)
+ 	return FALSE;
+ }
+ 
+-DBusMessage *new_authentication_return(DBusMessage *msg, uint8_t status)
++static DBusMessage *new_authentication_return(DBusMessage *msg, int status)
+ {
+ 	switch (status) {
+ 	case 0x00: /* success */
+@@ -1902,59 +1894,25 @@ static gboolean bonding_io_cb(GIOChannel *io, GIOCondition cond,
+ 							gpointer user_data)
+ {
+ 	struct btd_device *device = user_data;
+-	DBusMessage *reply;
+-
+-	if (!device->bonding)
+-		return FALSE;
+ 
+-	reply = new_authentication_return(device->bonding->msg,
+-						HCI_CONNECTION_TERMINATED);
+-	g_dbus_send_message(device->bonding->conn, reply);
+-
+-	bonding_request_free(device->bonding);
++	device->bonding->io_id = 0;
++	device_cancel_bonding(device, HCI_CONNECTION_TERMINATED);
+ 
+ 	return FALSE;
+ }
+ 
+-static void bonding_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
++static int device_authentication_requested(struct btd_device *device,
++						int handle)
+ {
+-	struct btd_device *device = user_data;
+ 	struct hci_request rq;
+ 	auth_requested_cp cp;
+ 	evt_cmd_status rp;
+ 	int dd;
+-	uint16_t handle;
+-
+-	if (!device->bonding) {
+-		if (!err)
+-			g_io_channel_shutdown(io, TRUE, NULL);
+-		return;
+-	}
+-
+-	if (err) {
+-		error("%s", err->message);
+-		error_connection_attempt_failed(device->bonding->conn,
+-						device->bonding->msg,
+-						ENETDOWN);
+-		goto cleanup;
+-	}
+-
+-	if (!bt_io_get(io, BT_IO_L2RAW, &err,
+-			BT_IO_OPT_HANDLE, &handle,
+-			BT_IO_OPT_INVALID)) {
+-		error("Unable to get connection handle: %s", err->message);
+-		error_connection_attempt_failed(device->bonding->conn,
+-						device->bonding->msg,
+-						ENETDOWN);
+-		g_error_free(err);
+-		goto failed;
+-	}
+ 
+ 	dd = hci_open_dev(adapter_get_dev_id(device->adapter));
+ 	if (dd < 0) {
+-		DBusMessage *reply = no_such_adapter(device->bonding->msg);
+-		g_dbus_send_message(device->bonding->conn, reply);
+-		goto failed;
++		error("Unable to open adapter: %s(%d)", strerror(errno), errno);
++		return -errno;
+ 	}
+ 
+ 	memset(&rp, 0, sizeof(rp));
+@@ -1974,22 +1932,53 @@ static void bonding_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
+ 	if (hci_send_req(dd, &rq, HCI_REQ_TIMEOUT) < 0) {
+ 		error("Unable to send HCI request: %s (%d)",
+ 					strerror(errno), errno);
+-		error_failed_errno(device->bonding->conn, device->bonding->msg,
+-				errno);
+ 		hci_close_dev(dd);
+-		goto failed;
++		return -errno;
+ 	}
+ 
+ 	if (rp.status) {
+ 		error("HCI_Authentication_Requested failed with status 0x%02x",
+ 				rp.status);
+-		error_failed_errno(device->bonding->conn, device->bonding->msg,
+-				bt_error(rp.status));
+ 		hci_close_dev(dd);
+-		goto failed;
++		return rp.status;
+ 	}
+ 
++	info("Authentication requested");
++
+ 	hci_close_dev(dd);
++	return 0;
++}
++
++static void bonding_connect_cb(GIOChannel *io, GError *err, gpointer user_data)
++{
++	struct btd_device *device = user_data;
++	uint16_t handle;
++	int status;
++
++	if (!device->bonding) {
++		if (!err)
++			g_io_channel_shutdown(io, TRUE, NULL);
++		return;
++	}
++
++	if (err) {
++		error("Unable to connect: %s", err->message);
++		status = HCI_CONNECTION_TERMINATED;
++		goto cleanup;
++	}
++
++	if (!bt_io_get(io, BT_IO_L2RAW, &err,
++			BT_IO_OPT_HANDLE, &handle,
++			BT_IO_OPT_INVALID)) {
++		error("Unable to get connection handle: %s", err->message);
++		g_error_free(err);
++		status = -errno;
++		goto failed;
++	}
++
++	status = device_authentication_requested(device, handle);
++	if (status != 0)
++		goto failed;
+ 
+ 	device->bonding->io_id = g_io_add_watch(io,
+ 					G_IO_NVAL | G_IO_HUP | G_IO_ERR,
+@@ -2002,7 +1991,7 @@ failed:
+ 
+ cleanup:
+ 	device->bonding->io_id = 0;
+-	bonding_request_free(device->bonding);
++	device_cancel_bonding(device, status);
+ }
+ 
+ static void create_bond_req_exit(DBusConnection *conn, void *user_data)
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0217_Fix-sending-authentication-reply-when-bonding-is-alr.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0217_Fix-sending-authentication-reply-when-bonding-is-alr.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0217_Fix-sending-authentication-reply-when-bonding-is-alr.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0217_Fix-sending-authentication-reply-when-bonding-is-alr.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,36 @@
+From 4a4471e7e071fe8e8ae68d1b130dac6db9748fe2 Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
+Date: Mon, 28 Jun 2010 11:20:15 +0300
+Subject: [PATCH 17/37] Fix sending authentication reply when bonding is already completed
+
+It cause errors such:
+
+2010-06-28 11:12:39.683799 > HCI Event: Auth Complete (0x06) plen 3
+    status 0x05 handle 43
+    Error: Authentication Failure
+2010-06-28 11:12:39.699344 < HCI Command: User Confirmation Request
+				Negative Reply (0x01|0x002d) plen 6
+    bdaddr 00:25:56:D0:7F:63
+2010-06-28 11:12:39.705754 > HCI Event: Command Complete (0x0e) plen 10
+    User Confirmation Request Negative Reply (0x01|0x002d) ncmd 1
+    status 0x0c bdaddr 00:25:56:D0:7F:63
+    Error: Command Disallowed
+---
+ src/device.c |    1 +
+ 1 files changed, 1 insertions(+), 0 deletions(-)
+
+diff --git a/src/device.c b/src/device.c
+index 04332c6..ea0640e 100644
+--- a/src/device.c
++++ b/src/device.c
+@@ -2075,6 +2075,7 @@ void device_bonding_complete(struct btd_device *device, uint8_t status)
+ 		agent_cancel(auth->agent);
+ 
+ 	if (status) {
++		device_cancel_authentication(device, TRUE);
+ 		device_cancel_bonding(device, status);
+ 		return;
+ 	}
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0218_Fix-use-of-errno-after-calling-some-function-that-co.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0218_Fix-use-of-errno-after-calling-some-function-that-co.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0218_Fix-use-of-errno-after-calling-some-function-that-co.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0218_Fix-use-of-errno-after-calling-some-function-that-co.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,42 @@
+From 52248c856d1727f0e19fec757bf02508c03832da Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
+Date: Tue, 29 Jun 2010 15:26:22 +0300
+Subject: [PATCH 18/37] Fix use of errno after calling some function that could overwrite it
+
+---
+ src/device.c |   10 ++++++----
+ 1 files changed, 6 insertions(+), 4 deletions(-)
+
+diff --git a/src/device.c b/src/device.c
+index ea0640e..6af76d1 100644
+--- a/src/device.c
++++ b/src/device.c
+@@ -1891,8 +1891,9 @@ static int device_authentication_requested(struct btd_device *device,
+ 
+ 	dd = hci_open_dev(adapter_get_dev_id(device->adapter));
+ 	if (dd < 0) {
+-		error("Unable to open adapter: %s(%d)", strerror(errno), errno);
+-		return -errno;
++		int err = -errno;
++		error("Unable to open adapter: %s(%d)", strerror(-err), -err);
++		return err;
+ 	}
+ 
+ 	memset(&rp, 0, sizeof(rp));
+@@ -1910,10 +1911,11 @@ static int device_authentication_requested(struct btd_device *device,
+ 	rq.event  = EVT_CMD_STATUS;
+ 
+ 	if (hci_send_req(dd, &rq, HCI_REQ_TIMEOUT) < 0) {
++		int err = -errno;
+ 		error("Unable to send HCI request: %s (%d)",
+-					strerror(errno), errno);
++					strerror(-err), -err);
+ 		hci_close_dev(dd);
+-		return -errno;
++		return err;
+ 	}
+ 
+ 	if (rp.status) {
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0227_core-fix-emitting-pairable-when-there-could-still-oc.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0227_core-fix-emitting-pairable-when-there-could-still-oc.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0227_core-fix-emitting-pairable-when-there-could-still-oc.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0227_core-fix-emitting-pairable-when-there-could-still-oc.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,57 @@
+From b5d5bf263f4034ed9e7d40500ad8815b8e45cc8c Mon Sep 17 00:00:00 2001
+From: Luiz Augusto von Dentz <luiz.dentz-von at nokia.com>
+Date: Wed, 30 Jun 2010 18:22:35 +0300
+Subject: [PATCH 27/37] core: fix emitting pairable when there could still occur an error
+
+An error could be generate by set_mode which then will make application
+to assume that we were unable to change the property, which wasn't the
+case.
+---
+ src/adapter.c |   24 +++++++++++++-----------
+ 1 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/src/adapter.c b/src/adapter.c
+index 5d90b46..d1fae55 100644
+--- a/src/adapter.c
++++ b/src/adapter.c
+@@ -521,6 +521,19 @@ static DBusMessage *set_pairable(DBusConnection *conn, DBusMessage *msg,
+ 	if (pairable == adapter->pairable)
+ 		goto done;
+ 
++	if (!(adapter->scan_mode & SCAN_INQUIRY))
++		goto store;
++
++	mode = (pairable && adapter->discov_timeout > 0 &&
++				adapter->discov_timeout <= 60) ?
++					MODE_LIMITED : MODE_DISCOVERABLE;
++
++	err = set_mode(adapter, mode);
++	if (err < 0 && msg)
++		return failed_strerror(msg, -err);
++
++store:
++
+ 	adapter->pairable = pairable;
+ 
+ 	write_device_pairable(&adapter->bdaddr, pairable);
+@@ -533,17 +546,6 @@ static DBusMessage *set_pairable(DBusConnection *conn, DBusMessage *msg,
+ 		adapter_set_pairable_timeout(adapter,
+ 						adapter->pairable_timeout);
+ 
+-	if (!(adapter->scan_mode & SCAN_INQUIRY))
+-		goto done;
+-
+-	mode = (pairable && adapter->discov_timeout > 0 &&
+-				adapter->discov_timeout <= 60) ?
+-					MODE_LIMITED : MODE_DISCOVERABLE;
+-
+-	err = set_mode(adapter, mode);
+-	if (err < 0 && msg)
+-		return failed_strerror(msg, -err);
+-
+ done:
+ 	return msg ? dbus_message_new_method_return(msg) : NULL;
+ }
+-- 
+1.7.2.3
+

Added: packages/bluez/tags/4.66-2/debian/patches/0229_Fix-the-return-value-of-read_device_alias.patch
URL: http://svn.debian.org/wsvn/pkg-bluetooth/packages/bluez/tags/4.66-2/debian/patches/0229_Fix-the-return-value-of-read_device_alias.patch?rev=978&op=file
==============================================================================
--- packages/bluez/tags/4.66-2/debian/patches/0229_Fix-the-return-value-of-read_device_alias.patch (added)
+++ packages/bluez/tags/4.66-2/debian/patches/0229_Fix-the-return-value-of-read_device_alias.patch Thu Dec  2 05:24:53 2010
@@ -1,0 +1,27 @@
+From e4648f70c8228eac9854ed1a2c0dc398dfb777a4 Mon Sep 17 00:00:00 2001
+From: Vinicius Costa Gomes <vinicius.gomes at openbossa.org>
+Date: Fri, 2 Jul 2010 13:09:07 -0300
+Subject: [PATCH 29/37] Fix the return value of read_device_alias
+
+To mantain consistency read_device_alias must return 0 on
+success, not the number of bytes written.
+---
+ src/storage.c |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/src/storage.c b/src/storage.c
+index 07c1ac2..e09e257 100644
+--- a/src/storage.c
++++ b/src/storage.c
+@@ -73,7 +73,7 @@ int read_device_alias(const char *src, const char *dst, char *alias, size_t size
+ 
+ 	free(tmp);
+ 
+-	return err;
++	return err < 0 ? -EIO : 0;
+ }
+ 
+ int write_device_alias(const char *src, const char *dst, const char *alias)
+-- 
+1.7.2.3
+




More information about the Pkg-bluetooth-commits mailing list