Commit c4b33156 authored by Dietmar Maurer's avatar Dietmar Maurer

fix bug #408: reset ENV before starting shell

parent b52133c4
......@@ -641,22 +641,29 @@ __PACKAGE__->register_method ({
my $timeout = 10;
my @cmd = ('/usr/bin/vncterm', '-rfbport', $port,
my $cmd = ['/usr/bin/vncterm', '-rfbport', $port,
'-timeout', $timeout, '-authpath', $authpath,
'-perm', 'Sys.Console', '-c', @$remcmd, @$shcmd);
'-perm', 'Sys.Console', '-c', @$remcmd, @$shcmd];
my $realcmd = sub {
my $upid = shift;
syslog ('info', "starting vnc proxy $upid\n");
my $cmdstr = join (' ', @cmd);
my $cmdstr = join (' ', @$cmd);
syslog ('info', "launch command: $cmdstr");
if (system(@cmd) != 0) {
my $msg = "vncterm failed - $?";
syslog ('err', $msg);
return;
eval {
foreach my $k (keys %ENV) {
next if $k eq 'PATH' || $k eq 'TERM' || $k eq 'USER' || $k eq 'HOME';
delete $ENV{$k};
}
$ENV{PWD} = '/';
PVE::Tools::run_command($cmd, errmsg => "vncterm failed");
};
if (my $err = $@) {
syslog ('err', $err);
}
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment