2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-07-23 12:51:10 +00:00

Preserve the user ownership of the file for xdcp command

This commit is contained in:
Mark Gurevich
2017-03-20 13:19:39 -04:00
parent 7bd2810161
commit 4e1d4629a9
2 changed files with 29 additions and 0 deletions

View File

@@ -4434,6 +4434,17 @@ sub parse_and_run_dcp
return 0;
}
unless ($options{'user'})
{
# user was not specified with -l flag, check it user calling the command
# was saved in DSH_FROM_USERID environment variable
my $current_userid = $ENV{'DSH_FROM_USERID'};
if (defined($current_userid)) {
# Set userid from value in DSH_FROM_USERID environment variable
$options{'user'} = $current_userid;
}
}
if (defined($options{'rootimg'}))
{
if (xCAT::Utils->isAIX())

View File

@@ -666,6 +666,24 @@ sub parse_args_xdcp
$::NODE_RCP = 1;
}
# find out who is the current user running xdcp
my $current_userid = getpwuid($>);
$ENV{DSH_FROM_USERID} = $current_userid;
my $to_userid;
if ($options{'user'}) # if -l option
{
$to_userid = $options{'user'};
}
else
{
$to_userid = $current_userid;
}
# Save userid running this command in ENV variable.
# It will be later extraced by DSHCLI.pm
$ENV{DSH_TO_USERID} = $to_userid;
if ($options{'bypass'})
{
$ENV{XCATBYPASS} = "yes"; # bypass xcatd