Skip to content

Commit

Permalink
Support Windows authentication via command line parameter W or winaut…
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarbecker committed Aug 4, 2016
1 parent 174183e commit d81a166
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion source/helpers.pas
Expand Up @@ -2478,7 +2478,7 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
var
rx: TRegExpr;
ExeName, SessName, Host, User, Pass, Socket: String;
Port, NetType: Integer;
Port, NetType, WindowsAuth: Integer;
AbsentFiles: TStringList;

function GetParamValue(ShortName, LongName: String): String;
Expand Down Expand Up @@ -2545,6 +2545,7 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
Pass := GetParamValue('p', 'password');
Socket := GetParamValue('S', 'socket');
Port := StrToIntDef(GetParamValue('P', 'port'), 0);
WindowsAuth := StrToIntDef(GetParamValue('W', 'winauth'), -1);
// Leave out support for startup script, seems reasonable for command line connecting

if (Host <> '') or (User <> '') or (Pass <> '') or (Port <> 0) or (Socket <> '') then begin
Expand All @@ -2566,6 +2567,9 @@ procedure ParseCommandLine(CommandLine: String; var ConnectionParams: TConnectio
ConnectionParams.Hostname := Socket;
ConnectionParams.NetType := ntMySQL_NamedPipe;
end;
if WindowsAuth in [0,1] then
ConnectionParams.WindowsAuth := Boolean(WindowsAuth);

// Ensure we have a session name to pass to InitConnection
if (ConnectionParams.SessionPath = '') and (ConnectionParams.Hostname <> '') then
ConnectionParams.SessionPath := ConnectionParams.Hostname;
Expand Down

0 comments on commit d81a166

Please sign in to comment.