diff --git a/bus/driver.c b/bus/driver.c index 5c4e9a2..7cd87e4 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -1536,6 +1536,14 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection, DBusMessageIter array_iter; unsigned long ulong_val; const char *service; +#if 0 + /* only used by unfinished bits - Solaris/SELinux */ + DBusMessageIter entry_iter; + DBusMessageIter var_iter; + void *adt_data; + dbus_uint32_t adt_size; + BusSELinuxID *sid; +#endif _DBUS_ASSERT_ERROR_IS_CLEAR (error); @@ -1567,6 +1575,71 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection, goto oom; } + /* FIXME: untested, someone on a Solaris system needs to test this */ +#if 0 + if (dbus_connection_get_adt_audit_session_data (conn, &adt_data, + &adt_size) && + adt_size <= _DBUS_INT_MAX) + { + if (!_dbus_asv_open_entry (&array_iter, &entry_iter, + "ADTAuditSessionData", "ay", + &var_iter)) + goto oom; + + if (!dbus_message_iter_append_fixed_array (&var_iter, DBUS_TYPE_BYTE, + adt_data, adt_size)) + { + _dbus_asv_abandon_entry (&array_iter, &entry_iter, &var_iter); + goto oom; + } + + if (!_dbus_asv_close_entry (&array_iter, &entry_iter, &var_iter)) + goto oom; + } +#endif + + /* FIXME: someone on a SELinux system needs to implement and test this */ +#if 0 + sid = bus_connection_get_selinux_id (conn); + + if (sid != NULL) + { + /* FIXME: get context from sid, similar to + * bus_selinux_append_context() */ + + if (!_dbus_asv_open_entry (&array_iter, &entry_iter, + "SELinuxSecurityContext", "ay", + &var_iter)) + goto oom; + + if (!dbus_message_iter_append_fixed_array (&var_iter, DBUS_TYPE_BYTE, + context, strlen (context))) + { + _dbus_asv_abandon_entry (&array_iter, &entry_iter, &var_iter); + goto oom; + } + + if (!_dbus_asv_close_entry (&array_iter, &entry_iter, &var_iter)) + goto oom; + } +#endif + +#ifdef DBUS_WIN + { + char *windows_sid = NULL; + _dbus_getsid(&windows_sid); + + if (windows_sid != NULL) + { + if (!_dbus_asv_add_string (&array_iter, "WindowsSID", windows_sid)) + { + LocalFree(windows_sid); + goto oom; + } + LocalFree(windows_sid); + } + } +#endif if (!_dbus_asv_close (&reply_iter, &array_iter)) goto oom; diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 52a48fd..f2ac5fb 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -16,7 +16,7 @@ autoversion(../configure.ac dbus) set (DBUS_PATCH_VERSION "0") include(Macros) -TIMESTAMP(DBUS_BUILD_TIMESTAMP) +#TIMESTAMP(DBUS_BUILD_TIMESTAMP) ########### basic vars ############### diff --git a/dbus/dbus-sysdeps-win.c b/dbus/dbus-sysdeps-win.c index 397520a..c6340fc 100644 --- a/dbus/dbus-sysdeps-win.c +++ b/dbus/dbus-sysdeps-win.c @@ -744,7 +744,7 @@ _dbus_pid_for_log (void) * @param points to sid buffer, need to be freed with LocalFree() * @returns process sid */ -static dbus_bool_t +dbus_bool_t _dbus_getsid(char **sid) { HANDLE process_token = INVALID_HANDLE_VALUE; diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index e59a5e5..4f23701 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -5645,6 +5645,28 @@ UINT32 The numeric Unix process ID, as defined by POSIX + + WindowsSID + STRING + The Windows security identifier in its string form, + e.g. "S-1-5-21-3623811015-3361044348-30300820-1013" for + domain or local computer user or "S-1-5-18" for the + LOCAL_SYSTEM user + + + diff --git a/test/dbus-daemon.c b/test/dbus-daemon.c index 5f9a6a4..83411cb 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -414,6 +414,35 @@ test_creds (Fixture *f, g_assert_not_reached (); #endif } + else if (g_strcmp0 (name, "SELinuxSecurityContext") == 0) + { +#ifdef __linux__ + g_assert_cmpuint (dbus_message_iter_get_arg_type (&var_iter), ==, + DBUS_TYPE_ARRAY); + /* FIXME: get byte array, print it, and assert that it's right */ +#else + g_assert_not_reached (); +#endif + } + else if (g_strcmp0 (name, "ADTAuditSessionData") == 0) + { + /* ... */ + } + else if (g_strcmp0 (name, "WindowsSID") == 0) + { +#ifdef G_OS_WIN32 + const gchar *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); + /* FIXME: assert that it's correct */ + seen |= SEEN_WINDOWS_SID; +#else + g_assert_not_reached (); +#endif + } dbus_message_iter_next (&arr_iter); }