mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-14 18:12:05 +08:00
Suppress clear text password in error dialog when plink.exe could not get executed, or exits with error. Fixes issue #2966.
This commit is contained in:
@ -1013,13 +1013,14 @@ procedure TMySQLConnection.SetActive( Value: Boolean );
|
|||||||
var
|
var
|
||||||
Connected: PMYSQL;
|
Connected: PMYSQL;
|
||||||
ClientFlags, FinalPort: Integer;
|
ClientFlags, FinalPort: Integer;
|
||||||
Error, tmpdb, FinalHost, FinalSocket, PlinkCmd, StatusName: String;
|
Error, tmpdb, FinalHost, FinalSocket, PlinkCmd, PlinkCmdDisplay, StatusName: String;
|
||||||
CurCharset: String;
|
CurCharset: String;
|
||||||
StartupInfo: TStartupInfo;
|
StartupInfo: TStartupInfo;
|
||||||
ExitCode: LongWord;
|
ExitCode: LongWord;
|
||||||
sslca, sslkey, sslcert: PAnsiChar;
|
sslca, sslkey, sslcert: PAnsiChar;
|
||||||
PluginDir: AnsiString;
|
PluginDir: AnsiString;
|
||||||
Vars, Status: TDBQuery;
|
Vars, Status: TDBQuery;
|
||||||
|
rx: TRegExpr;
|
||||||
begin
|
begin
|
||||||
if Value and (FHandle = nil) then begin
|
if Value and (FHandle = nil) then begin
|
||||||
DoBeforeConnect;
|
DoBeforeConnect;
|
||||||
@ -1077,6 +1078,10 @@ begin
|
|||||||
if FParameters.SSHPrivateKey <> '' then
|
if FParameters.SSHPrivateKey <> '' then
|
||||||
PlinkCmd := PlinkCmd + ' -i "' + FParameters.SSHPrivateKey + '"';
|
PlinkCmd := PlinkCmd + ' -i "' + FParameters.SSHPrivateKey + '"';
|
||||||
PlinkCmd := PlinkCmd + ' -N -L ' + IntToStr(FParameters.SSHLocalPort) + ':' + FParameters.Hostname + ':' + IntToStr(FParameters.Port);
|
PlinkCmd := PlinkCmd + ' -N -L ' + IntToStr(FParameters.SSHLocalPort) + ':' + FParameters.Hostname + ':' + IntToStr(FParameters.Port);
|
||||||
|
rx := TRegExpr.Create;
|
||||||
|
rx.Expression := '(-pw\s+")[^"]*(")';
|
||||||
|
PlinkCmdDisplay := rx.Replace(PlinkCmd, '${1}******${2}', True);
|
||||||
|
rx.Free;
|
||||||
Log(lcInfo, 'Attempt to create plink.exe process, waiting '+FormatNumber(FParameters.SSHTimeout)+'s for response ...');
|
Log(lcInfo, 'Attempt to create plink.exe process, waiting '+FormatNumber(FParameters.SSHTimeout)+'s for response ...');
|
||||||
// Create plink.exe process
|
// Create plink.exe process
|
||||||
FillChar(FPlinkProcInfo, SizeOf(TProcessInformation), 0);
|
FillChar(FPlinkProcInfo, SizeOf(TProcessInformation), 0);
|
||||||
@ -1088,10 +1093,10 @@ begin
|
|||||||
WaitForSingleObject(FPlinkProcInfo.hProcess, FParameters.SSHTimeout*1000);
|
WaitForSingleObject(FPlinkProcInfo.hProcess, FParameters.SSHTimeout*1000);
|
||||||
GetExitCodeProcess(FPlinkProcInfo.hProcess, ExitCode);
|
GetExitCodeProcess(FPlinkProcInfo.hProcess, ExitCode);
|
||||||
if ExitCode <> STILL_ACTIVE then
|
if ExitCode <> STILL_ACTIVE then
|
||||||
raise EDatabaseError.Create('PLink exited unexpected. Command line was:'+CRLF+PlinkCmd);
|
raise EDatabaseError.Create('PLink exited unexpected. Command line was:'+CRLF+PlinkCmdDisplay);
|
||||||
end else begin
|
end else begin
|
||||||
ClosePlink;
|
ClosePlink;
|
||||||
raise EDatabaseError.Create('Couldn''t execute PLink: '+CRLF+PlinkCmd);
|
raise EDatabaseError.Create('Couldn''t execute PLink: '+CRLF+PlinkCmdDisplay);
|
||||||
end;
|
end;
|
||||||
FinalHost := 'localhost';
|
FinalHost := 'localhost';
|
||||||
FinalPort := FParameters.SSHLocalPort;
|
FinalPort := FParameters.SSHLocalPort;
|
||||||
|
Reference in New Issue
Block a user