summaryrefslogtreecommitdiff
path: root/src/bus-proxyd/test-bus-policy.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-11-26 21:15:39 +0100
committerLennart Poettering <lennart@poettering.net>2014-11-26 21:15:39 +0100
commit278ebf8d26f0ebf9d63d8aa1b91a2adbdd8aa4e0 (patch)
tree0d67d0b6c40c3dc6631a68a37912408dc7cdfa97 /src/bus-proxyd/test-bus-policy.c
parent55e189007c707fb827b8b287903c258de234bd12 (diff)
bus-policy: actually test messages against the newly added test.conf
Diffstat (limited to 'src/bus-proxyd/test-bus-policy.c')
-rw-r--r--src/bus-proxyd/test-bus-policy.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/bus-proxyd/test-bus-policy.c b/src/bus-proxyd/test-bus-policy.c
index 3140e083c2..1c1d1ef9ed 100644
--- a/src/bus-proxyd/test-bus-policy.c
+++ b/src/bus-proxyd/test-bus-policy.c
@@ -157,6 +157,25 @@ int main(int argc, char *argv[]) {
assert_se(test_policy_load(&p, "test.conf") >= 0);
policy_dump(&p);
+
+ ucred.uid = 0;
+ assert_se(policy_check_own(&p, &ucred, "org.foo.FooService") == true);
+ assert_se(policy_check_own(&p, &ucred, "org.foo.FooService2") == false);
+ assert_se(policy_check_send(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.test.test1", "/an/object/path", "org.test.int2", "Member") == false);
+ assert_se(policy_check_send(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.test.test1", "/an/object/path", "org.foo.FooBroadcastInterface", "Member") == true);
+ assert_se(policy_check_recv(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.foo.FooService", "/an/object/path", "org.foo.FooBroadcastInterface", "Member") == true);
+ assert_se(policy_check_recv(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.foo.FooService", "/an/object/path", "org.foo.FooBroadcastInterface2", "Member") == false);
+ assert_se(policy_check_recv(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.foo.FooService2", "/an/object/path", "org.foo.FooBroadcastInterface", "Member") == false);
+
+ ucred.uid = 100;
+ assert_se(policy_check_own(&p, &ucred, "org.foo.FooService") == false);
+ assert_se(policy_check_own(&p, &ucred, "org.foo.FooService2") == false);
+ assert_se(policy_check_send(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.test.test1", "/an/object/path", "org.test.int2", "Member") == false);
+ assert_se(policy_check_send(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.test.test1", "/an/object/path", "org.foo.FooBroadcastInterface", "Member") == false);
+ assert_se(policy_check_recv(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.foo.FooService", "/an/object/path", "org.foo.FooBroadcastInterface", "Member") == true);
+ assert_se(policy_check_recv(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.foo.FooService", "/an/object/path", "org.foo.FooBroadcastInterface2", "Member") == false);
+ assert_se(policy_check_recv(&p, &ucred, SD_BUS_MESSAGE_METHOD_CALL, "org.foo.FooService2", "/an/object/path", "org.foo.FooBroadcastInterface", "Member") == false);
+
policy_free(&p);
return EXIT_SUCCESS;