summaryrefslogtreecommitdiff
path: root/dbus/dbus-transport.c
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-11 13:19:15 +0000
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-18 10:35:05 +0000
commit96c3bcec776f932fa1883f6a2597991d138e6925 (patch)
tree29dc0852500d439869a1135365996d2ca006d518 /dbus/dbus-transport.c
parentc966d903747dd6f8c57000e37ed6317af0c70b3d (diff)
downloaddbus-96c3bcec776f932fa1883f6a2597991d138e6925.tar.gz
Add LSM-agnostic support for LinuxSecurityLabel credential
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89041 Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> (for SELinux) Acked-by: John Johansen <john.johansen@canonical.com> (for AppArmor) Acked-by: Casey Schaufler <casey@schaufler-ca.com> (for Smack) Tested-by: Tyler Hicks <tyhicks@canonical.com>
Diffstat (limited to 'dbus/dbus-transport.c')
-rw-r--r--dbus/dbus-transport.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/dbus/dbus-transport.c b/dbus/dbus-transport.c
index f63e0ced..5ceab0a9 100644
--- a/dbus/dbus-transport.c
+++ b/dbus/dbus-transport.c
@@ -1425,6 +1425,33 @@ _dbus_transport_set_unix_user_function (DBusTransport *transport,
transport->free_unix_user_data = free_data_function;
}
+dbus_bool_t
+_dbus_transport_get_linux_security_label (DBusTransport *transport,
+ char **label_p)
+{
+ DBusCredentials *auth_identity;
+
+ *label_p = NULL;
+
+ if (!transport->authenticated)
+ return FALSE;
+
+ auth_identity = _dbus_auth_get_identity (transport->auth);
+
+ if (_dbus_credentials_include (auth_identity,
+ DBUS_CREDENTIAL_LINUX_SECURITY_LABEL))
+ {
+ /* If no memory, we are supposed to return TRUE and set NULL */
+ *label_p = _dbus_strdup (_dbus_credentials_get_linux_security_label (auth_identity));
+
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+}
+
/**
* See dbus_connection_get_windows_user().
*