Skip to content

Commit 9d22904

Browse files
committed
fix: value-less --cleartextenabled flag was ignored
Closes #296
1 parent 16ab0f5 commit 9d22904

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎source/apphelpers.pas‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2699,6 +2699,15 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
26992699
end;
27002700
end;
27012701

2702+
function GetParamFlag(ShortName, LongName: String): Integer;
2703+
begin
2704+
// Return 1 when the switch was passed without a value, e.g. --cleartextenabled instead of --cleartextenabled=1
2705+
Result := -1;
2706+
rx.Expression := '\s(\-'+ShortName+'|\-\-'+LongName+')(\s|$)';
2707+
if rx.Exec(CommandLine) then
2708+
Result := 1;
2709+
end;
2710+
27022711
procedure GetFileNames(Expression: String);
27032712
begin
27042713
rx.Expression := Expression;
@@ -2752,6 +2761,8 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
27522761
User := GetParamValue('u', 'user');
27532762
Pass := GetParamValue('p', 'password');
27542763
CleartextPluginEnabled := StrToIntDef(GetParamValue('cte', 'cleartextenabled'), -1);
2764+
if CleartextPluginEnabled = -1 then
2765+
CleartextPluginEnabled := GetParamFlag('cte', 'cleartextenabled');
27552766
Socket := GetParamValue('S', 'socket');
27562767
Port := GetParamValue('P', 'port');
27572768
AllDatabases := GetParamValue('db', 'databases');

0 commit comments

Comments
 (0)