diff options
author | Colin Walters <walters@verbum.org> | 2012-10-30 15:38:32 -0400 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-11-20 19:12:19 +0100 |
commit | 1a37b9b9043ef83e9900e460a9a1fccced3acf89 (patch) | |
tree | 3db1771012ce53e9e8d79958609bdd857c81b363 /src/shared/dbus-common.h | |
parent | d23965a64eb5c2c97b839dc2e3e79fc1613994f1 (diff) |
dbus-common: Add helper method to handle no-reply messages
[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.
Diffstat (limited to 'src/shared/dbus-common.h')
-rw-r--r-- | src/shared/dbus-common.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/dbus-common.h b/src/shared/dbus-common.h index 005a715d0a..3b7ae16934 100644 --- a/src/shared/dbus-common.h +++ b/src/shared/dbus-common.h @@ -113,6 +113,10 @@ typedef struct BusBoundProperties { const void *const base; /* base pointer to which the offset must be added to reach data */ } BusBoundProperties; +dbus_bool_t bus_maybe_send_reply (DBusConnection *c, + DBusMessage *message, + DBusMessage *reply); + DBusHandlerResult bus_send_error_reply( DBusConnection *c, DBusMessage *message, |