summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2015-02-10 15:41:52 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2015-02-11 11:57:46 +0000
commit87d40ec9508e75fbc6076e3e3b3ad7bedf6909bf (patch)
treebe8a10f56cec1e5a73259efa73e9b1b6902aa505
parentb417088ff7ef8c346181b279048bcd4b3da338a5 (diff)
downloaddbus-87d40ec9508e75fbc6076e3e3b3ad7bedf6909bf.tar.gz
Add test for windows sid.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
-rw-r--r--dbus/dbus-sysdeps-win.c2
-rw-r--r--dbus/dbus-sysdeps-win.h1
-rw-r--r--test/dbus-daemon.c24
3 files changed, 24 insertions, 3 deletions
diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c
index dbd9043d..526db8e8 100644
--- a/dbus/dbus-sysdeps-win.c
+++ b/dbus/dbus-sysdeps-win.c
@@ -984,7 +984,7 @@ static BOOL is_winxp_sp3_or_lower()
* @param process_id the process id for which the sid should be returned
* @returns process sid
*/
-static dbus_bool_t
+dbus_bool_t
_dbus_getsid(char **sid, dbus_pid_t process_id)
{
HANDLE process_token = INVALID_HANDLE_VALUE;
diff --git a/dbus/dbus-sysdeps-win.h b/dbus/dbus-sysdeps-win.h
index 02e7a83f..3efdf72e 100644
--- a/dbus/dbus-sysdeps-win.h
+++ b/dbus/dbus-sysdeps-win.h
@@ -88,6 +88,7 @@ dbus_bool_t _dbus_get_install_root(char *prefix, int len);
void _dbus_threads_windows_init_global (void);
void _dbus_threads_windows_ensure_ctor_linked (void);
+dbus_bool_t _dbus_getsid(char **sid, dbus_pid_t process_id);
#endif
/** @} end of sysdeps-win.h */
diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c
index 6b0e9b8a..45160910 100644
--- a/test/dbus-daemon.c
+++ b/test/dbus-daemon.c
@@ -371,6 +371,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;
@@ -402,9 +424,7 @@ test_creds (Fixture *f,
#endif
#ifdef G_OS_WIN32
- /* FIXME: when implemented:
g_assert (seen & SEEN_WINDOWS_SID);
- */
#endif
}