summaryrefslogtreecommitdiff
path: root/src/bus-proxyd/bus-proxyd.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-06-10 15:46:32 +0200
committerLennart Poettering <lennart@poettering.net>2014-06-10 17:56:51 +0200
commit2e2b36084a98f9071fd178c6540ce57b2f577f8d (patch)
tree1b37c16d6b488e2f08292de2987e0d2f0cf31b66 /src/bus-proxyd/bus-proxyd.c
parent638ca89c53e2b897cfb3f627f4acbc7d09af2f4c (diff)
bus-proxy: read the right policy when running in user mode
Diffstat (limited to 'src/bus-proxyd/bus-proxyd.c')
-rw-r--r--src/bus-proxyd/bus-proxyd.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/bus-proxyd/bus-proxyd.c b/src/bus-proxyd/bus-proxyd.c
index 9937159fcb..07995ec832 100644
--- a/src/bus-proxyd/bus-proxyd.c
+++ b/src/bus-proxyd/bus-proxyd.c
@@ -47,19 +47,21 @@
#include "capability.h"
#include "bus-policy.h"
-static const char *arg_address = DEFAULT_SYSTEM_BUS_PATH;
+static const char *arg_address = KERNEL_SYSTEM_BUS_PATH;
static char *arg_command_line_buffer = NULL;
static bool arg_drop_privileges = false;
+static char **arg_configuration = NULL;
static int help(void) {
printf("%s [OPTIONS...]\n\n"
"Connect STDIO or a socket to a given bus address.\n\n"
- " -h --help Show this help\n"
- " --version Show package version\n"
- " --drop-privileges Drop privileges\n"
- " --address=ADDRESS Connect to the bus specified by ADDRESS\n"
- " (default: " DEFAULT_SYSTEM_BUS_PATH ")\n",
+ " -h --help Show this help\n"
+ " --version Show package version\n"
+ " --drop-privileges Drop privileges\n"
+ " --configuration=PATH Configuration file or directory\n"
+ " --address=ADDRESS Connect to the bus specified by ADDRESS\n"
+ " (default: " KERNEL_SYSTEM_BUS_PATH ")\n",
program_invocation_short_name);
return 0;
@@ -71,6 +73,7 @@ static int parse_argv(int argc, char *argv[]) {
ARG_VERSION = 0x100,
ARG_ADDRESS,
ARG_DROP_PRIVILEGES,
+ ARG_CONFIGURATION,
};
static const struct option options[] = {
@@ -78,10 +81,11 @@ static int parse_argv(int argc, char *argv[]) {
{ "version", no_argument, NULL, ARG_VERSION },
{ "address", required_argument, NULL, ARG_ADDRESS },
{ "drop-privileges", no_argument, NULL, ARG_DROP_PRIVILEGES },
+ { "configuration", required_argument, NULL, ARG_CONFIGURATION },
{ NULL, 0, NULL, 0 },
};
- int c;
+ int c, r;
assert(argc >= 0);
assert(argv);
@@ -107,6 +111,12 @@ static int parse_argv(int argc, char *argv[]) {
arg_drop_privileges = true;
break;
+ case ARG_CONFIGURATION:
+ r = strv_extend(&arg_configuration, optarg);
+ if (r < 0)
+ return log_oom();
+ break;
+
case '?':
return -EINVAL;
@@ -1054,7 +1064,7 @@ int main(int argc, char *argv[]) {
if (r <= 0)
goto finish;
- r = policy_load(&policy);
+ r = policy_load(&policy, arg_configuration);
if (r < 0) {
log_error("Failed to load policy: %s", strerror(-r));
goto finish;
@@ -1425,6 +1435,7 @@ finish:
sd_bus_flush(b);
policy_free(&policy);
+ strv_free(arg_configuration);
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
}