mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-15 11:32:41 +00:00
fix bug #408: reset ENV before starting shell
This commit is contained in:
parent
d721d4dfd2
commit
6d39449226
@ -641,22 +641,29 @@ __PACKAGE__->register_method ({
|
|||||||
|
|
||||||
my $timeout = 10;
|
my $timeout = 10;
|
||||||
|
|
||||||
my @cmd = ('/usr/bin/vncterm', '-rfbport', $port,
|
my $cmd = ['/usr/bin/vncterm', '-rfbport', $port,
|
||||||
'-timeout', $timeout, '-authpath', $authpath,
|
'-timeout', $timeout, '-authpath', $authpath,
|
||||||
'-perm', 'Sys.Console', '-c', @$remcmd, @$shcmd);
|
'-perm', 'Sys.Console', '-c', @$remcmd, @$shcmd];
|
||||||
|
|
||||||
my $realcmd = sub {
|
my $realcmd = sub {
|
||||||
my $upid = shift;
|
my $upid = shift;
|
||||||
|
|
||||||
syslog ('info', "starting vnc proxy $upid\n");
|
syslog ('info', "starting vnc proxy $upid\n");
|
||||||
|
|
||||||
my $cmdstr = join (' ', @cmd);
|
my $cmdstr = join (' ', @$cmd);
|
||||||
syslog ('info', "launch command: $cmdstr");
|
syslog ('info', "launch command: $cmdstr");
|
||||||
|
|
||||||
if (system(@cmd) != 0) {
|
eval {
|
||||||
my $msg = "vncterm failed - $?";
|
foreach my $k (keys %ENV) {
|
||||||
syslog ('err', $msg);
|
next if $k eq 'PATH' || $k eq 'TERM' || $k eq 'USER' || $k eq 'HOME';
|
||||||
return;
|
delete $ENV{$k};
|
||||||
|
}
|
||||||
|
$ENV{PWD} = '/';
|
||||||
|
|
||||||
|
PVE::Tools::run_command($cmd, errmsg => "vncterm failed");
|
||||||
|
};
|
||||||
|
if (my $err = $@) {
|
||||||
|
syslog ('err', $err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user