[systemd-devel] [PATCH] dbus-common: Add helper method to handle no-reply messages

Colin Walters walters at verbum.org
Tue Oct 30 12:38:32 PDT 2012


[Tested in latest gnome-ostree; if accepted, I'll look at a followup
 patch which fixes the other dbus_connection_send(reply, ...) calls
 besides logind]

DBus messages can have a flag NO_REPLY associated that means "I don't
need a reply".  This is for efficiency reasons - for one-off requests
that can't return an error, etc.

However, it's up to users to manually check
dbus_message_get_no_reply() from a message.  libdbus will happily send
out a reply if you don't.

Unfortunately, doing so is not just less efficient - it also triggers
a security error, for complex reasons.  This is something that will
eventually be fixed in dbus, but it's also correct to handle it in
client applications.

This new helper API is slightly nicer in that you don't have to pass
NULL to say you don't want a reply serial for your reply.

This patch also tweaks logind to use the API - there are more areas of
the code that need this treatment too.
---
 src/login/logind-dbus.c  |  4 ++--
 src/shared/dbus-common.c | 13 +++++++++++--
 src/shared/dbus-common.h |  4 ++++
 3 files changed, 17 insertions(+), 4 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-dbus-common-Add-helper-method-to-handle-no-reply-mes.patch
Type: text/x-patch
Size: 3736 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20121030/83ade350/attachment.bin>


More information about the systemd-devel mailing list