Subject: | Password printed on STDOUT in the clear if timeout occurs before password is sent |
IF TIMEOUT OCCURS HERE
unless($scp->expect($timeout,-re=>'[Pp]assword.*?:|[Pp]assphrase.*?:')){
my $err = $scp->before() || $scp->match();
if($err){
if($handler){ $handler->($err) }
print STD2OUT "Problem performing scp: $err";
}
print STD2OUT "scp timed out while trying to connect to $host\n";
<SHOULD RETURN HERE>
}
......
PASSWORD SENT
......
PASSWORD CAPTURED AS ERROR CASE BY 2ND REGEX AND PRINTED ON STDOUT
unless($no_check || $verbose){
$scp->expect($timeout_err,
[qr/[Pp]ass.*/ => sub{
my $error = $scp->before() || $scp->match();
$error=~s/\s*/$1/g;
if($handler){
$handler->($error);
}
else{
print STD2OUT "Error: Bad password [$error]\n";
}
}
],
[qr/\w+.*/ => sub{
my $error = $scp->match() || $scp->before();
#$error=~s/\s*/$1/g;
if($handler){
$handler->($error);
}
else{
print STD2OUT "Error - $error\n";
}
}
],
['eof' => sub{} ],
);
}
else{
$scp->expect($timeout_err, ['eof' => sub { }]);
}