1 From 6c9997fb1cdff4281166e8c2fb8276018b1025dd Mon Sep 17 00:00:00 2001
2 From: Jacek Bukarewicz <j.bukarewicz@samsung.com>
3 Date: Mon, 15 Jun 2015 11:46:47 +0200
4 Subject: [PATCH 8/8] Add "GetConnectionSmackContext" D-Bus daemon method
6 This method is used to obtain smack label of given D-Bus client.
7 Note that it is deprecated and is included only for compatilibity with
8 existing D-Bus users. GetConnectionCredentials should be used to obtain
11 Change-Id: Idf9648032ca5cbd9605ffab055e6384baa4eb9b4
13 bus/driver.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
14 1 file changed, 63 insertions(+)
16 diff --git a/bus/driver.c b/bus/driver.c
17 index 9708f49..4e76224 100644
20 @@ -1759,6 +1759,65 @@ bus_driver_handle_get_id (DBusConnection *connection,
21 return BUS_RESULT_FALSE;
25 +bus_driver_handle_get_connection_smack_context (DBusConnection *connection,
26 + BusTransaction *transaction,
27 + DBusMessage *message,
30 + DBusConnection *conn;
31 + DBusMessage *reply = NULL;
33 + const char *service;
35 + _DBUS_ASSERT_ERROR_IS_CLEAR (error);
37 + conn = bus_driver_get_conn_helper (connection, message, "credentials",
42 + reply = dbus_message_new_method_return (message);
46 + if (!_dbus_connection_get_linux_security_label (conn, &label))
48 + dbus_set_error (error, DBUS_ERROR_FAILED,
49 + "Failed to get smack label of connection",
57 + if (!dbus_message_append_args (reply,
58 + DBUS_TYPE_STRING, &label,
62 + if (!bus_transaction_send_from_driver (transaction, connection, reply))
65 + dbus_message_unref (reply);
68 + return BUS_RESULT_TRUE;
71 + BUS_SET_OOM (error);
75 + dbus_message_unref (reply);
79 + return BUS_RESULT_FALSE;
86 @@ -1849,6 +1908,10 @@ static const MessageHandler dbus_message_handlers[] = {
87 bus_driver_handle_get_id },
88 { "GetConnectionCredentials", "s", "a{sv}",
89 bus_driver_handle_get_connection_credentials },
90 + { "GetConnectionSmackContext", /* deprecated - you should use GetConnectionCredentials instead */
91 + DBUS_TYPE_STRING_AS_STRING,
92 + DBUS_TYPE_STRING_AS_STRING,
93 + bus_driver_handle_get_connection_smack_context },
94 { NULL, NULL, NULL, NULL }