diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-10 15:46:32 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-10 17:56:51 +0200 |
commit | 2e2b36084a98f9071fd178c6540ce57b2f577f8d (patch) | |
tree | 1b37c16d6b488e2f08292de2987e0d2f0cf31b66 /src/bus-proxyd/bus-policy.c | |
parent | 638ca89c53e2b897cfb3f627f4acbc7d09af2f4c (diff) |
bus-proxy: read the right policy when running in user mode
Diffstat (limited to 'src/bus-proxyd/bus-policy.c')
-rw-r--r-- | src/bus-proxyd/bus-policy.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/src/bus-proxyd/bus-policy.c b/src/bus-proxyd/bus-policy.c index 2df4bf7204..2234e7af3a 100644 --- a/src/bus-proxyd/bus-policy.c +++ b/src/bus-proxyd/bus-policy.c @@ -83,6 +83,8 @@ static int file_load(Policy *p, const char *path) { if (r < 0) { if (r == -ENOENT) return 0; + if (r == -EISDIR) + return r; log_error("Failed to load %s: %s", path, strerror(-r)); return r; @@ -513,24 +515,31 @@ static int file_load(Policy *p, const char *path) { } } -int policy_load(Policy *p) { - _cleanup_strv_free_ char **l = NULL; +int policy_load(Policy *p, char **files) { char **i; int r; assert(p); - file_load(p, "/etc/dbus-1/system.conf"); - file_load(p, "/etc/dbus-1/system-local.conf"); + STRV_FOREACH(i, files) { - r = conf_files_list(&l, ".conf", NULL, "/etc/dbus-1/system.d/", NULL); - if (r < 0) { - log_error("Failed to get configuration file list: %s", strerror(-r)); - return r; - } + r = file_load(p, *i); + if (r == -EISDIR) { + _cleanup_strv_free_ char **l = NULL; + char **j; + + r = conf_files_list(&l, ".conf", NULL, *i, NULL); + if (r < 0) { + log_error("Failed to get configuration file list: %s", strerror(-r)); + return r; + } + + STRV_FOREACH(j, l) + file_load(p, *j); + } - STRV_FOREACH(i, l) - file_load(p, *i); + /* We ignore all errors but EISDIR, and just proceed. */ + } return 0; } |