Open Source Telephony
 help / color / mirror / Atom feed
From: Philip Withnall <philip@tecnocode.co.uk>
To: ofono@ofono.org
Subject: [PATCH] gdbus: Drop message replies if the sender requested no reply
Date: Wed, 02 Dec 2015 15:44:07 +0000	[thread overview]
Message-ID: <1449071047.4523.18.camel@tecnocode.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 1406 bytes --]

If the sender flags a D-Bus message as not expecting a reply, it is
against system bus policy to send a reply — sending one will result in
errors being sent to us by dbus-daemon.

Magically drop all replies to messages which request no reply.

This is not a complete fix. In an ideal world, the existing check for
G_DBUS_METHOD_FLAG_NOREPLY would be dropped, as the server should be
prepared to return a reply to every method, if the client requests and
expects one — otherwise the client will time out. However, that’s a
much
bigger change with a much bigger risk of breaking things, so I’ll stick
with this for now.

Signed-off-by: Philip Withnall <philip.withnall@collabora.co.uk>
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
---
 gdbus/object.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gdbus/object.c b/gdbus/object.c
index 96db516..146a255 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -258,7 +258,8 @@ static DBusHandlerResult
process_message(DBusConnection *connection,
 
 	reply = method->function(connection, message,
iface_user_data);
 
-	if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY) {
+	if (method->flags & G_DBUS_METHOD_FLAG_NOREPLY ||
+	    dbus_message_get_no_reply(message)) {
 		if (reply != NULL)
 			dbus_message_unref(reply);
 		return DBUS_HANDLER_RESULT_HANDLED;
-- 
2.5.0

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 213 bytes --]

             reply	other threads:[~2015-12-02 15:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-02 15:44 Philip Withnall [this message]
2016-01-05  5:36 ` [PATCH] gdbus: Drop message replies if the sender requested no reply Denis Kenzior
     [not found] <1452297478.3610.4.camel@tecnocode.co.uk>
2016-01-11 17:20 ` Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1449071047.4523.18.camel@tecnocode.co.uk \
    --to=philip@tecnocode.co.uk \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox