summaryrefslogtreecommitdiff
path: root/src/bus-proxyd/test-bus-xml-policy.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2015-01-09 19:30:01 +0100
committerLennart Poettering <lennart@poettering.net>2015-01-09 19:30:01 +0100
commit48aae6d6a051acd9c0630fab1e79b82c847e538b (patch)
tree367a107d59566b9fbe5a6773e68bd8bec767f32a /src/bus-proxyd/test-bus-xml-policy.c
parent585b46db6baedf61aa94bf8fe9322a97bd06013d (diff)
bus-proxy-test: show parsed system/session policy
Diffstat (limited to 'src/bus-proxyd/test-bus-xml-policy.c')
-rw-r--r--src/bus-proxyd/test-bus-xml-policy.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/bus-proxyd/test-bus-xml-policy.c b/src/bus-proxyd/test-bus-xml-policy.c
index b0f4ed7d3d..c22409c0f6 100644
--- a/src/bus-proxyd/test-bus-xml-policy.c
+++ b/src/bus-proxyd/test-bus-xml-policy.c
@@ -50,17 +50,41 @@ static int test_policy_load(Policy *p, const char *name) {
assert_se(path);
if (access(path, R_OK) == 0)
- policy_load(p, STRV_MAKE(path));
+ r = policy_load(p, STRV_MAKE(path));
else
r = -ENOENT;
return r;
}
+static int show_policy(const char *fn) {
+ Policy p = {};
+ int r;
+
+ r = policy_load(&p, STRV_MAKE(fn));
+ if (r < 0) {
+ log_error_errno(r, "Failed to load policy %s: %m", fn);
+ return r;
+ }
+
+ policy_dump(&p);
+ policy_free(&p);
+
+ return 0;
+}
+
int main(int argc, char *argv[]) {
Policy p = {};
+ printf("Showing session policy BEGIN\n");
+ show_policy("/etc/dbus-1/session.conf");
+ printf("Showing session policy END\n");
+
+ printf("Showing system policy BEGIN\n");
+ show_policy("/etc/dbus-1/system.conf");
+ printf("Showing system policy END\n");
+
/* Ownership tests */
assert_se(test_policy_load(&p, "ownerships.conf") == 0);