2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-05-31 10:06:39 +00:00

Merge pull request #7083 from gurevichmark/rest_non_root

Use specified non-root user for REST API nodeshell method
This commit is contained in:
besawn 2022-01-05 14:37:46 -05:00 committed by GitHub
commit c36e701af0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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]);