From 107110d44cfcc680f7c8bafab86908da7ac302e7 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 --- test/containers.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/containers.c b/test/containers.c index 5279b63b..34a56cea 100644 --- a/test/containers.c +++ b/test/containers.c @@ -326,6 +326,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.2