diff options
Diffstat (limited to 'test/dbus-daemon.c')
-rw-r--r-- | test/dbus-daemon.c | 50 |
1 files changed, 47 insertions, 3 deletions
diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 6b0e9b8a..26786fc2 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -28,6 +28,8 @@ #include "test-utils-glib.h" +#include <string.h> + #ifdef DBUS_UNIX # include <unistd.h> # include <sys/types.h> @@ -305,7 +307,8 @@ test_creds (Fixture *f, enum { SEEN_UNIX_USER = 1, SEEN_PID = 2, - SEEN_WINDOWS_SID = 4 + SEEN_WINDOWS_SID = 4, + SEEN_LINUX_SECURITY_LABEL = 8 } seen = 0; if (m == NULL) @@ -371,6 +374,28 @@ test_creds (Fixture *f, g_assert_not_reached (); #endif } + else if (g_strcmp0 (name, "WindowsSID") == 0) + { +#ifdef G_OS_WIN32 + gchar *sid; + guint32 result; + char *self_sid; + + g_assert (!(seen & SEEN_WINDOWS_SID)); + g_assert_cmpuint (dbus_message_iter_get_arg_type (&var_iter), ==, + DBUS_TYPE_STRING); + dbus_message_iter_get_basic (&var_iter, &sid); + g_message ("%s of this process is %s", name, sid); + if (_dbus_getsid (&self_sid, 0)) + { + g_assert_cmpstr (self_sid, ==, sid); + LocalFree(self_sid); + } + seen |= SEEN_WINDOWS_SID; +#else + g_assert_not_reached (); +#endif + } else if (g_strcmp0 (name, "ProcessID") == 0) { guint32 u32; @@ -389,6 +414,27 @@ test_creds (Fixture *f, #endif seen |= SEEN_PID; } + else if (g_strcmp0 (name, "LinuxSecurityLabel") == 0) + { +#ifdef __linux__ + gchar *label; + int len; + DBusMessageIter ay_iter; + + g_assert (!(seen & SEEN_LINUX_SECURITY_LABEL)); + g_assert_cmpuint (dbus_message_iter_get_arg_type (&var_iter), ==, + DBUS_TYPE_ARRAY); + dbus_message_iter_recurse (&var_iter, &ay_iter); + g_assert_cmpuint (dbus_message_iter_get_arg_type (&ay_iter), ==, + DBUS_TYPE_BYTE); + dbus_message_iter_get_fixed_array (&ay_iter, &label, &len); + g_message ("%s of this process is %s", name, label); + g_assert_cmpuint (strlen (label) + 1, ==, len); + seen |= SEEN_LINUX_SECURITY_LABEL; +#else + g_assert_not_reached (); +#endif + } dbus_message_iter_next (&arr_iter); } @@ -402,9 +448,7 @@ test_creds (Fixture *f, #endif #ifdef G_OS_WIN32 - /* FIXME: when implemented: g_assert (seen & SEEN_WINDOWS_SID); - */ #endif } |