commit 36adb1c089ff5293c533eea81075501596d869af Author: Simon McVittie Date: 2013-02-27 19:08:46 +0000 sketch of how to implement Solaris ADT, SELinux context diff --git a/bus/driver.c b/bus/driver.c index 564cecb..a412f19 100644 --- a/bus/driver.c +++ b/bus/driver.c @@ -1537,6 +1537,14 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection, unsigned long ulong_val; char *windows_sid; 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); @@ -1580,6 +1588,54 @@ bus_driver_handle_get_connection_credentials (DBusConnection *connection, dbus_free(windows_sid); } + /* 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 if (!_dbus_asv_close (&reply_iter, &array_iter)) goto oom; diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml index e48532d..5519d6c 100644 --- a/doc/dbus-specification.xml +++ b/doc/dbus-specification.xml @@ -5661,6 +5661,20 @@ a 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 6ce2cc0..e270afb 100644 --- a/test/dbus-daemon.c +++ b/test/dbus-daemon.c @@ -418,6 +418,20 @@ test_creds (Fixture *f, #endif seen |= SEEN_PID; } + 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) + { + /* ... */ + } dbus_message_iter_next (&arr_iter); }