mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Issue #1529: detect klink.exe and putty.exe as variants of plink executable
This commit is contained in:
@ -310,6 +310,7 @@ type
|
||||
function getFirstWord(text: String; MustStartWithWordChar: Boolean=True): String;
|
||||
function RegExprGetMatch(Expression: String; var Input: String; ReturnMatchNum: Integer; DeleteFromSource, CaseInsensitive: Boolean): String; Overload;
|
||||
function RegExprGetMatch(Expression: String; Input: String; ReturnMatchNum: Integer): String; Overload;
|
||||
function ExecRegExprI(const ARegExpr, AInputStr: RegExprString): Boolean;
|
||||
function FormatByteNumber( Bytes: Int64; Decimals: Byte = 1 ): String; Overload;
|
||||
function FormatByteNumber( Bytes: String; Decimals: Byte = 1 ): String; Overload;
|
||||
function FormatTimeNumber(Seconds: Double; DisplaySeconds: Boolean): String;
|
||||
@ -1021,6 +1022,22 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function ExecRegExprI(const ARegExpr, AInputStr: RegExprString): Boolean;
|
||||
var
|
||||
r: TRegExpr;
|
||||
begin
|
||||
Result := False;
|
||||
r := TRegExpr.Create;
|
||||
r.ModifierI := True;
|
||||
try
|
||||
r.Expression := ARegExpr;
|
||||
Result := r.Exec(AInputStr);
|
||||
finally
|
||||
r.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
{**
|
||||
Format a filesize to automatically use the best fitting expression
|
||||
16 100 000 Bytes -> 16,1 MB
|
||||
|
@ -1085,7 +1085,7 @@ begin
|
||||
|
||||
// Build SSH command line
|
||||
// plink bob@domain.com -pw myPassw0rd1 -P 22 -i "keyfile.pem" -L 55555:localhost:3306
|
||||
IsPlink := FConnection.Parameters.SSHExe.ToLowerInvariant.Contains('plink');
|
||||
IsPlink := ExecRegExprI('([pk]link|putty)', FConnection.Parameters.SSHExe);
|
||||
SshCmd := FConnection.Parameters.SSHExe;
|
||||
if IsPlink then
|
||||
SshCmd := SshCmd + ' -ssh';
|
||||
|
Reference in New Issue
Block a user