Skip to contentSkip to conversation

gdbus: Drop message replies if the sender requested no reply

PATCH In review Philip Withnall 2 participants 2 messages Dec 2, 2015 – Jan 5, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gdbus: Drop message replies if the sender requested no reply

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.

---
 gdbus/object.c | 3 ++-

 1 file changed, 2 insertions(+), 1 deletion(-)
gdbus/object.c +0 -0
index 96db516..146a255 100644
@@ -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;

Signature · 1 line
2.5.0
#1 lore raw

Hi Philip,

Quoted 14 lines · Philip Withnall

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.

Quoted 2 lines

No Signed-off-by or Reviewed-by lines please.

Quoted 4 lines
---
  gdbus/object.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

Doesn't apply:

Applying: gdbus: Drop message replies if the sender requested no reply
fatal: corrupt patch at line 10
Patch failed at 0001 gdbus: Drop message replies if the sender requested no reply
The copy of the patch that failed is found in:

Regards,
-Denis