Windows implementation of GetConnectionCredentials.
authorRalf Habacker <ralf.habacker@freenet.de>
Fri, 7 Sep 2012 03:00:59 +0000 (05:00 +0200)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 11 Feb 2015 11:57:43 +0000 (11:57 +0000)
Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445

bus/driver.c
doc/dbus-specification.xml

index ceebb6f..8304066 100644 (file)
@@ -38,6 +38,7 @@
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-message.h>
 #include <dbus/dbus-marshal-recursive.h>
+#include <dbus/dbus-marshal-validate.h>
 #include <string.h>
 
 static DBusConnection *
@@ -1646,6 +1647,7 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
   DBusMessageIter reply_iter;
   DBusMessageIter array_iter;
   unsigned long ulong_val;
+  char *windows_sid;
   const char *service;
 
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
@@ -1680,6 +1682,24 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection,
         goto oom;
     }
 
+  if (dbus_connection_get_windows_user (conn, &windows_sid))
+    {
+      DBusString str;
+      dbus_bool_t result;
+      _dbus_string_init_const (&str, windows_sid);
+      result = _dbus_validate_utf8 (&str, 0, _dbus_string_get_length (&str));
+      _dbus_string_free (&str);
+      if (result)
+        {
+          if (!_dbus_asv_add_string (&array_iter, "WindowsSID", windows_sid))
+            {
+              dbus_free(windows_sid);
+              goto oom;
+            }
+        }
+      dbus_free(windows_sid);
+    }
+
   if (!_dbus_asv_close (&reply_iter, &array_iter))
     goto oom;
 
index 2f9fef8..a9a8c59 100644 (file)
                   this concept. On Unix, this is the process ID defined by
                   POSIX.</entry>
               </row>
+              <row>
+                <entry>WindowsSID</entry>
+                <entry>STRING</entry>
+                <entry>The Windows security identifier in its string form,
+                e.g. "S-1-5-21-3623811015-3361044348-30300820-1013" for
+                a domain or local computer user or "S-1-5-18" for the
+                LOCAL_SYSTEM user</entry>
+              </row>
             </tbody>
           </tgroup>
         </informaltable>