diff --git a/0001-Fix-memory-leaks-when-using-dbus_g_method_get_sender.patch b/0001-Fix-memory-leaks-when-using-dbus_g_method_get_sender.patch new file mode 100644 index 0000000..994ccc5 --- /dev/null +++ b/0001-Fix-memory-leaks-when-using-dbus_g_method_get_sender.patch @@ -0,0 +1,264 @@ +From 201b71d13882bf963d41845b88401ce5f90c7a9b Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Mon, 14 Dec 2009 11:58:54 +0000 +Subject: [PATCH 1/2] Fix memory leaks when using dbus_g_method_get_sender() + +--- + lib/bluetooth-agent.c | 64 ++++++++++++++++++++++++++++++++++++------------ + lib/obex-agent.c | 32 ++++++++++++++++++------ + 2 files changed, 72 insertions(+), 24 deletions(-) + +diff --git a/lib/bluetooth-agent.c b/lib/bluetooth-agent.c +index 00e8dcb..a08eb9c 100644 +--- a/lib/bluetooth-agent.c ++++ b/lib/bluetooth-agent.c +@@ -80,14 +80,18 @@ static gboolean bluetooth_agent_request_pin_code(BluetoothAgent *agent, + const char *path, DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + DBusGProxy *device; + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->pincode_func) { + if (priv->adapter != NULL) +@@ -110,14 +114,18 @@ static gboolean bluetooth_agent_request_passkey(BluetoothAgent *agent, + const char *path, DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + DBusGProxy *device; + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->passkey_func) { + if (priv->adapter != NULL) +@@ -141,14 +149,18 @@ static gboolean bluetooth_agent_display_passkey(BluetoothAgent *agent, + DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + DBusGProxy *device; + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->display_func) { + if (priv->adapter != NULL) +@@ -172,14 +184,18 @@ static gboolean bluetooth_agent_request_confirmation(BluetoothAgent *agent, + DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + DBusGProxy *device; + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->confirm_func) { + if (priv->adapter != NULL) +@@ -203,14 +219,18 @@ static gboolean bluetooth_agent_authorize(BluetoothAgent *agent, + DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + DBusGProxy *device; + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->authorize_func) { + if (priv->adapter != NULL) +@@ -233,12 +253,16 @@ static gboolean bluetooth_agent_confirm_mode(BluetoothAgent *agent, + const char *mode, DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + dbus_g_method_return(context); + +@@ -249,13 +273,17 @@ static gboolean bluetooth_agent_cancel(BluetoothAgent *agent, + DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->cancel_func) + result = priv->cancel_func(context, priv->cancel_data); +@@ -267,12 +295,16 @@ static gboolean bluetooth_agent_release(BluetoothAgent *agent, + DBusGMethodInvocation *context) + { + BluetoothAgentPrivate *priv = BLUETOOTH_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + g_object_unref(agent); + +diff --git a/lib/obex-agent.c b/lib/obex-agent.c +index 714dc6a..38b2fde 100644 +--- a/lib/obex-agent.c ++++ b/lib/obex-agent.c +@@ -73,13 +73,17 @@ static gboolean obex_agent_request(ObexAgent *agent, const char *path, + DBusGMethodInvocation *context) + { + ObexAgentPrivate *priv = OBEX_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->request_func) { + DBusGProxy *proxy; +@@ -102,13 +106,17 @@ static gboolean obex_agent_progress(ObexAgent *agent, const char *path, + guint64 transferred, DBusGMethodInvocation *context) + { + ObexAgentPrivate *priv = OBEX_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->progress_func) { + DBusGProxy *proxy; +@@ -130,13 +138,17 @@ static gboolean obex_agent_complete(ObexAgent *agent, const char *path, + DBusGMethodInvocation *context) + { + ObexAgentPrivate *priv = OBEX_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->complete_func) { + DBusGProxy *proxy; +@@ -158,13 +170,17 @@ static gboolean obex_agent_release(ObexAgent *agent, + DBusGMethodInvocation *context) + { + ObexAgentPrivate *priv = OBEX_AGENT_GET_PRIVATE(agent); +- const char *sender = dbus_g_method_get_sender(context); ++ char *sender = dbus_g_method_get_sender(context); + gboolean result = FALSE; + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); + return FALSE; ++ } ++ ++ g_free (sender); + + if (priv->release_func) + result = priv->release_func(context, priv->release_data); +-- +1.6.5.2 + diff --git a/0002-Fix-crash-when-obex-client-isn-t-running-already.patch b/0002-Fix-crash-when-obex-client-isn-t-running-already.patch new file mode 100644 index 0000000..ac837f4 --- /dev/null +++ b/0002-Fix-crash-when-obex-client-isn-t-running-already.patch @@ -0,0 +1,49 @@ +From ed95cf3ab7b4ab65127b014a80b971188a3b02da Mon Sep 17 00:00:00 2001 +From: Bastien Nocera +Date: Mon, 14 Dec 2009 12:58:31 +0000 +Subject: [PATCH 2/2] Fix crash when obex-client isn't running already + +When obex-client isn't running yet, we can't get a name owner +for the service. But we'd still get a callback from the service +when trying to use it, and crash trying to compare the sender +with a NULL string. + +Instead, set the owner's dbus name if we don't already have one +in obex_agent_request(). + +See: https://bugzilla.redhat.com/show_bug.cgi?id=544881 +--- + lib/obex-agent.c | 14 ++++++++++---- + 1 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/lib/obex-agent.c b/lib/obex-agent.c +index 38b2fde..276fcb3 100644 +--- a/lib/obex-agent.c ++++ b/lib/obex-agent.c +@@ -78,13 +78,19 @@ static gboolean obex_agent_request(ObexAgent *agent, const char *path, + + DBG("agent %p sender %s", agent, sender); + +- if (g_str_equal(sender, priv->busname) == FALSE) { ++ if (priv->busname == NULL) { ++ /* When we get called the first time, if OBEX_SERVICE ++ * was not available, we get its name here */ ++ priv->busname = sender; ++ } else { ++ if (g_str_equal(sender, priv->busname) == FALSE) { ++ g_free (sender); ++ return FALSE; ++ } ++ + g_free (sender); +- return FALSE; + } + +- g_free (sender); +- + if (priv->request_func) { + DBusGProxy *proxy; + +-- +1.6.5.2 + diff --git a/gnome-bluetooth.spec b/gnome-bluetooth.spec index 02450ff..caf4336 100644 --- a/gnome-bluetooth.spec +++ b/gnome-bluetooth.spec @@ -1,6 +1,6 @@ Name: gnome-bluetooth Version: 2.29.3 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Bluetooth graphical utilities Group: Applications/Communications @@ -37,6 +37,10 @@ Requires: pulseaudio-module-bluetooth Requires(post): desktop-file-utils Requires(postun): desktop-file-utils +# https://bugzilla.redhat.com/show_bug.cgi?id=544881 +Patch0: 0001-Fix-memory-leaks-when-using-dbus_g_method_get_sender.patch +Patch1: 0002-Fix-crash-when-obex-client-isn-t-running-already.patch + %description The gnome-bluetooth package contains graphical utilities to setup, monitor and use Bluetooth devices. @@ -74,6 +78,8 @@ This package contains the Moblin user interface for gnome-bluetooth. %prep %setup -q +%patch0 -p1 +%patch1 -p1 %build %configure --disable-desktop-update --disable-icon-update --enable-introspection=no @@ -215,6 +221,9 @@ fi %{_bindir}/bluetooth-panel %changelog +* Mon Dec 14 2009 Bastien Nocera 2.29.3-2 +- Add patch to fix possible crasher in bluetooth-sendto (#544881) + * Mon Nov 30 2009 Bastien Nocera 2.29.3-1 - Update to 2.29.3