mirror of
https://github.com/systemd/systemd.git
synced 2026-08-04 15:10:33 +00:00
run0: make sure we submit $SHELL to remote
Normally, the service manager sets $SHELL to the target user's login shell, but run0 always overrides that with either originating user's shell or value from --setenv=SHELL=. In both cases $SHELL needs to be sent. Fixes #35007
This commit is contained in:
@@ -1029,18 +1029,25 @@ static int parse_argv_sudo_mode(int argc, char *argv[]) {
|
||||
const char *e;
|
||||
|
||||
e = strv_env_get(arg_environment, "SHELL");
|
||||
if (e)
|
||||
if (e) {
|
||||
arg_exec_path = strdup(e);
|
||||
else {
|
||||
if (!arg_exec_path)
|
||||
return log_oom();
|
||||
} else {
|
||||
if (arg_transport == BUS_TRANSPORT_LOCAL) {
|
||||
r = get_shell(&arg_exec_path);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to determine shell: %m");
|
||||
} else
|
||||
} else {
|
||||
arg_exec_path = strdup("/bin/sh");
|
||||
if (!arg_exec_path)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
r = strv_env_assign(&arg_environment, "SHELL", arg_exec_path);
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to set $SHELL environment variable: %m");
|
||||
}
|
||||
if (!arg_exec_path)
|
||||
return log_oom();
|
||||
|
||||
l = make_login_shell_cmdline(arg_exec_path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user