2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-21 19:22:05 +00:00

Use correct non-root user for REST API nodeshell method

This commit is contained in:
Mark Gurevich 2022-01-05 11:24:26 -05:00
parent 7c22110a7e
commit f4eafb35c9

View File

@ -1226,14 +1226,19 @@ sub process_request
$ENV{$var} = $value;
}
# if DSH_FROM_USERID does not exist, set for internal calls
# if request->{username} exists, set DSH_FROM_USERID to it
# if DSH_FROM_USERID or DSH_TO_USERID do not exist, set for internal calls
# if request->{username} exists, set DSH_FROM_USERID and DSH_TO_USERID to it
# override input, this is what was authenticated
if (!($ENV{'DSH_FROM_USERID'})) {
if (($request->{username}) && defined($request->{username}->[0])) {
$ENV{DSH_FROM_USERID} = $request->{username}->[0];
}
}
if (!($ENV{'DSH_TO_USERID'})) {
if (($request->{username}) && defined($request->{username}->[0])) {
$ENV{DSH_TO_USERID} = $request->{username}->[0];
}
}
if ($command eq "xdsh")
{
xdsh($nodes, $args, $callback, $command, $request->{noderange}->[0]);