kdbus: bugfix for return codes on call to non-existing destination 72/128372/4
authorAdrian Szyndela <adrian.s@samsung.com>
Tue, 9 May 2017 12:45:26 +0000 (14:45 +0200)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 1 Jun 2017 10:11:43 +0000 (10:11 +0000)
Calling a method on non-existing destination with auto start disabled
caused error org.freedesktop.DBus.ServiceUnknown.
Non-kdbus implementation gives org.freedesktop.DBus.NameHasNoOwner.
This patch makes kdbus return the same error as non-kdbus implementation.

Change-Id: Iadbf060159e91d5c4e10ea9a26abb50d02154a5f

dbus/dbus-transport-kdbus.c
packaging/dbus.spec

index a3e2dd7..ba03f04 100755 (executable)
@@ -707,6 +707,7 @@ kdbus_write_msg_internal (DBusTransportKdbus  *transport,
   unsigned fds_count;
   const char* header_data;
   DBusError error;
+  const char *destination_name = destination;
 
   dbus_uint64_t items_size;
   dbus_uint64_t flags = 0;
@@ -923,9 +924,15 @@ kdbus_write_msg_internal (DBusTransportKdbus  *transport,
               break;
 
               case DBUSPOLICY_RESULT_DEST_NOT_AVAILABLE:
-                reply = reply_with_error (DBUS_ERROR_SERVICE_UNKNOWN, NULL,
-                                          "Cannot send message - destination not known",
-                                          message);
+                _dbus_assert (destination_name != NULL);
+                if (dbus_message_get_auto_start (message))
+                  reply = reply_with_error (DBUS_ERROR_SERVICE_UNKNOWN, NULL,
+                                            "Cannot send message - destination not known",
+                                            message);
+                else
+                  reply = reply_with_error (DBUS_ERROR_NAME_HAS_NO_OWNER, "Name \"%s\" does not exist",
+                                            destination_name,
+                                            message);
               break;
 
               case DBUSPOLICY_RESULT_KDBUS_ERROR:
index ea0df82..2df3d1d 100644 (file)
@@ -174,6 +174,8 @@ popd
 %if %{with_systemd}
     --enable-systemd                                                   \
 %endif
+    --enable-kdbus-transport                                            \
+    --enable-libdbuspolicy                                             \
     --with-system-pid-file=/tmp/dbus_launch                            \
     --with-console-auth-dir=/var/run/dbus/at_console/                  \
     --with-systemdsystemunitdir=%{_unitdir}                            \