diff options
Diffstat (limited to 'src/util/child_common.c')
-rw-r--r-- | src/util/child_common.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/util/child_common.c b/src/util/child_common.c index cc6a8fa75..4ee3a37e9 100644 --- a/src/util/child_common.c +++ b/src/util/child_common.c @@ -626,10 +626,10 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx, char ***_argv) { /* - * program name, debug_level, debug_timestamps, - * debug_microseconds and NULL + * program name, debug_level, debug_to_file, debug_timestamps, + * debug_microseconds, uid, gid and NULL */ - uint_t argc = 5; + uint_t argc = 7; char ** argv; errno_t ret = EINVAL; @@ -644,7 +644,7 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx, /* * program name, debug_level, debug_to_file, debug_timestamps, - * debug_microseconds and NULL + * debug_microseconds, uid, gid and NULL */ argv = talloc_array(mem_ctx, char *, argc); if (argv == NULL) { @@ -692,6 +692,18 @@ static errno_t prepare_child_argv(TALLOC_CTX *mem_ctx, goto fail; } + argv[--argc] = talloc_asprintf(argv, "--uid=%"SPRIuid, getuid()); + if (argv[argc] == NULL) { + ret = ENOMEM; + goto fail; + } + + argv[--argc] = talloc_asprintf(argv, "--gid=%"SPRIgid, getgid()); + if (argv[argc] == NULL) { + ret = ENOMEM; + goto fail; + } + argv[--argc] = talloc_strdup(argv, binary); if (argv[argc] == NULL) { ret = ENOMEM; |