From 6218854f9ad683ce4b4dd648c45d48e3cc52ea75 Mon Sep 17 00:00:00 2001 From: "sanghyeok.oh" Date: Mon, 17 Jul 2017 15:00:49 +0900 Subject: [PATCH] kdbus: libdbuspolicy: To perform policy check, pass unique name to libdbuspolicy In case of signal broadcasting, message has null destination, To perform policy check correctly, gdbus should pass unique name to libdbuspolicy as destination. Change-Id: I563f7ad5ab99a9c91b5180350bb32259d3fed2b6 Signed-off-by: sanghyeok.oh --- gio/gkdbus.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/gio/gkdbus.c b/gio/gkdbus.c index 4387b90..63351d3 100755 --- a/gio/gkdbus.c +++ b/gio/gkdbus.c @@ -2980,15 +2980,19 @@ again: #ifdef LIBDBUSPOLICY if (worker->dbuspolicy != NULL) { - if (g_dbus_message_get_message_type (kmsg->message) == G_DBUS_MESSAGE_TYPE_METHOD_CALL) + if (g_dbus_message_get_message_type (kmsg->message) == G_DBUS_MESSAGE_TYPE_METHOD_CALL || + g_dbus_message_get_message_type (kmsg->message) == G_DBUS_MESSAGE_TYPE_SIGNAL) { if ((kmsg->sender_euid != (uid_t) -1) && (kmsg->sender_egid != (gid_t) -1) && (kmsg->sender_seclabel != NULL)) { gint check; + gchar *destination = g_dbus_message_get_destination (kmsg->message); + if (!destination) + destination = worker->unique_name; check = dbuspolicy1_check_in (worker->dbuspolicy, - g_dbus_message_get_destination (kmsg->message), + destination, kmsg->sender_names, kmsg->sender_seclabel, kmsg->sender_euid, @@ -3505,7 +3509,9 @@ _g_kdbus_send (GKDBusWorker *worker, #ifdef LIBDBUSPOLICY if (worker->dbuspolicy != NULL) { - if (g_dbus_message_get_message_type (message) == G_DBUS_MESSAGE_TYPE_METHOD_CALL) + if (g_dbus_message_get_message_type (message) == G_DBUS_MESSAGE_TYPE_METHOD_CALL || + (g_dbus_message_get_message_type (message) == G_DBUS_MESSAGE_TYPE_SIGNAL && + g_dbus_message_get_destination (message) != NULL)) { gint check; -- 2.7.4