Make context option NOP
This commit is contained in:
parent
ef6b25b3bb
commit
d50c1f39ab
12
su.c
12
su.c
@ -442,7 +442,6 @@ static void usage(int status) {
|
|||||||
"Options:\n"
|
"Options:\n"
|
||||||
" --daemon start the su daemon agent\n"
|
" --daemon start the su daemon agent\n"
|
||||||
" -c, --command COMMAND pass COMMAND to the invoked shell\n"
|
" -c, --command COMMAND pass COMMAND to the invoked shell\n"
|
||||||
" --context context Change SELinux context\n"
|
|
||||||
" -h, --help display this help message and exit\n"
|
" -h, --help display this help message and exit\n"
|
||||||
" -, -l, --login pretend the shell to be a login shell\n"
|
" -, -l, --login pretend the shell to be a login shell\n"
|
||||||
" -m, -p,\n"
|
" -m, -p,\n"
|
||||||
@ -540,12 +539,8 @@ static __attribute__ ((noreturn)) void allow(struct su_context *ctx) {
|
|||||||
arg0, PARG(0), PARG(1), PARG(2), PARG(3), PARG(4), PARG(5),
|
arg0, PARG(0), PARG(1), PARG(2), PARG(3), PARG(4), PARG(5),
|
||||||
(ctx->to.optind + 6 < ctx->to.argc) ? " ..." : "");
|
(ctx->to.optind + 6 < ctx->to.argc) ? " ..." : "");
|
||||||
|
|
||||||
if(ctx->to.context) {
|
setexeccon("u:r:su:s0");
|
||||||
setexeccon(ctx->to.context);
|
|
||||||
} else {
|
|
||||||
setexeccon("u:r:su:s0");
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx->to.argv[--argc] = arg0;
|
ctx->to.argv[--argc] = arg0;
|
||||||
execvp(binary, ctx->to.argv + argc);
|
execvp(binary, ctx->to.argv + argc);
|
||||||
err = errno;
|
err = errno;
|
||||||
@ -691,7 +686,6 @@ int su_main_nodaemon(int argc, char **argv) {
|
|||||||
.keepenv = 0,
|
.keepenv = 0,
|
||||||
.shell = NULL,
|
.shell = NULL,
|
||||||
.command = NULL,
|
.command = NULL,
|
||||||
.context = NULL,
|
|
||||||
.argv = argv,
|
.argv = argv,
|
||||||
.argc = argc,
|
.argc = argc,
|
||||||
.optind = 0,
|
.optind = 0,
|
||||||
@ -761,7 +755,7 @@ int su_main_nodaemon(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
case 'z':
|
case 'z':
|
||||||
ctx.to.context = optarg;
|
// Do nothing, placed here for legacy support :)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* Bionic getopt_long doesn't terminate its error output by newline */
|
/* Bionic getopt_long doesn't terminate its error output by newline */
|
||||||
|
Loading…
Reference in New Issue
Block a user