From bd4f8ed634b86bb02dd7550197156ad0f63e9fbc Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Thu, 8 Jun 2017 14:43:43 +0100 Subject: [PATCH] test/containers: Check that connections from containers are unprivileged Signed-off-by: Simon McVittie https://bugs.freedesktop.org/show_bug.cgi?id=101354 --- test/containers.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/containers.c b/test/containers.c index 5af034d1..2780a6c5 100644 --- a/test/containers.c +++ b/test/containers.c @@ -333,6 +333,19 @@ test_basic (Fixture *f, g_assert_cmpstr (g_variant_get_type_string (tuple), ==, "()"); g_clear_pointer (&tuple, g_variant_unref); + g_test_message ("Checking that confined app is not considered privileged..."); + tuple = g_dbus_connection_call_sync (f->confined_conn, DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, DBUS_INTERFACE_DBUS, + "UpdateActivationEnvironment", + g_variant_new ("(a{ss})", NULL), + G_VARIANT_TYPE_UNIT, + G_DBUS_CALL_FLAGS_NONE, -1, NULL, + &f->error); + g_assert_error (f->error, G_DBUS_ERROR, G_DBUS_ERROR_ACCESS_DENIED); + g_test_message ("Access denied as expected: %s", f->error->message); + g_clear_error (&f->error); + g_assert_null (tuple); + /* Check that the socket is cleaned up when the dbus-daemon is terminated */ test_kill_pid (f->daemon_pid); g_spawn_close_pid (f->daemon_pid); -- 2.13.3