- Add patch to avoid sending reply to noreply messages; this avoids some

spurious dbus denial logs during system startup from NM
This commit is contained in:
Colin Walters 2009-01-07 20:43:45 +00:00
parent b4d786dd91
commit b9d5759882
2 changed files with 136 additions and 1 deletions

View File

@ -0,0 +1,127 @@
From a9eaac78c30a9a2728384b88eb6667504b758e24 Mon Sep 17 00:00:00 2001
From: Colin Walters <walters@verbum.org>
Date: Wed, 7 Jan 2009 10:02:12 -0500
Subject: [PATCH] Bug 19441 - Don't send reply when none is requested
It's normally harmless, but unrequested replies now get noisly
denied by the system bus.
---
dbus/dbus-gobject.c | 42 ++++++++++++++++++++++++------------------
1 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/dbus/dbus-gobject.c b/dbus/dbus-gobject.c
index 572fafd..107dd10 100644
--- a/dbus/dbus-gobject.c
+++ b/dbus/dbus-gobject.c
@@ -1117,7 +1117,7 @@ invoke_object_method (GObject *object,
DBusConnection *connection,
DBusMessage *message)
{
- gboolean had_error, call_only;
+ gboolean had_error, use_thread, send_reply;
GError *gerror;
GValueArray *value_array;
GValue return_value = {0,};
@@ -1128,7 +1128,7 @@ invoke_object_method (GObject *object,
int out_param_count;
int out_param_pos, out_param_gvalue_pos;
DBusHandlerResult result;
- DBusMessage *reply;
+ DBusMessage *reply = NULL;
gboolean have_retval;
gboolean retval_signals_error;
gboolean retval_is_synthetic;
@@ -1140,10 +1140,8 @@ invoke_object_method (GObject *object,
/* Determine whether or not this method should be invoked in a new
thread
*/
- if (strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0)
- call_only = TRUE;
- else
- call_only = FALSE;
+ use_thread = strcmp (string_table_lookup (get_method_data (object_info, method), 2), "A") == 0;
+ send_reply = !dbus_message_get_no_reply (message);
have_retval = FALSE;
retval_signals_error = FALSE;
@@ -1194,7 +1192,7 @@ invoke_object_method (GObject *object,
g_value_init (g_value_array_get_nth (value_array, 0), G_TYPE_OBJECT);
g_value_set_object (g_value_array_get_nth (value_array, 0), object);
- if (call_only)
+ if (use_thread)
{
GValue context_value = {0,};
DBusGMethodInvocation *context;
@@ -1340,7 +1338,7 @@ invoke_object_method (GObject *object,
value_array->n_values,
value_array->values,
NULL, method->function);
- if (call_only)
+ if (use_thread)
{
result = DBUS_HANDLER_RESULT_HANDLED;
goto done;
@@ -1354,17 +1352,25 @@ invoke_object_method (GObject *object,
{
DBusMessageIter iter;
- reply = dbus_message_new_method_return (message);
- if (reply == NULL)
- goto nomem;
+ /* Careful here - there are two major cases in this section of the code.
+ * If send_reply is TRUE, we're constructing a dbus message and freeing
+ * the return values. If it's FALSE, then we just need to free the
+ * values.
+ */
+ if (send_reply)
+ {
+ reply = dbus_message_new_method_return (message);
+ if (reply == NULL)
+ goto nomem;
- /* Append output arguments to reply */
- dbus_message_iter_init_append (reply, &iter);
+ /* Append output arguments to reply */
+ dbus_message_iter_init_append (reply, &iter);
+ }
/* First, append the return value, unless it's synthetic */
if (have_retval && !retval_is_synthetic)
- {
- if (!_dbus_gvalue_marshal (&iter, &return_value))
+ {
+ if (send_reply && !_dbus_gvalue_marshal (&iter, &return_value))
goto nomem;
if (!retval_is_constant)
g_value_unset (&return_value);
@@ -1416,7 +1422,7 @@ invoke_object_method (GObject *object,
out_param_gvalue_pos++;
}
- if (!_dbus_gvalue_marshal (&iter, &gvalue))
+ if (send_reply && !_dbus_gvalue_marshal (&iter, &gvalue))
goto nomem;
/* Here we actually free the allocated value; we
* took ownership of it with _dbus_gvalue_take, unless
@@ -1426,7 +1432,7 @@ invoke_object_method (GObject *object,
g_value_unset (&gvalue);
}
}
- else
+ else if (send_reply)
reply = gerror_to_dbus_error_message (object_info, message, gerror);
if (reply)
@@ -1438,7 +1444,7 @@ invoke_object_method (GObject *object,
result = DBUS_HANDLER_RESULT_HANDLED;
done:
g_free (in_signature);
- if (!call_only)
+ if (!use_thread)
{
g_array_free (out_param_values, TRUE);
g_value_array_free (out_param_gvalues);
--
1.6.0.6

View File

@ -8,7 +8,7 @@
Summary: GLib bindings for D-Bus
Name: dbus-glib
Version: 0.78
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://www.freedesktop.org/software/dbus/
Source0: http://dbus.freedesktop.org/releases/dbus-glib/%{name}-%{version}.tar.gz
Source1: dbus-bus-introspect.xml
@ -27,6 +27,9 @@ BuildRequires: autoconf
# this patch requires autoreconf
BuildRequires: autoconf automake libtool gettext-devel gtk-doc
#http://bugs.freedesktop.org/show_bug.cgi?id=19441
Patch0: 0001-Bug-19441-Don-t-send-reply-when-none-is-requested.patch
%description
D-Bus add-on library to integrate the standard D-Bus library with
@ -59,6 +62,7 @@ D-Bus tools written using the gtk+ GUI libaries
%prep
%setup -q
%patch0 -p1 -b .noreply
%build
libtoolize --force --copy
@ -119,6 +123,10 @@ rm -rf %{buildroot}
%endif
%changelog
* Wed Jan 07 2009 Colin Walters <walters@verbum.org> - 0.78-2
- Add patch to avoid sending reply to noreply messages; this avoids
some spurious dbus denial logs during system startup from NM
* Thu Dec 04 2008 Colin Walters <walters@verbum.org> - 0.78-1
- New upstream release, drop upstreamed patches