mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Add cleartext option to sessions
This commit is contained in:

committed by
Ansgar Becker

parent
6641b82a43
commit
0facfaa5cc
@ -340,6 +340,11 @@ msgstr "Prompt for credentials"
|
|||||||
msgid "Use Windows authentication"
|
msgid "Use Windows authentication"
|
||||||
msgstr "Use Windows authentication"
|
msgstr "Use Windows authentication"
|
||||||
|
|
||||||
|
#. connform..PageControlDetails..tabSettings..chkCleartextPluginEnabled..Caption
|
||||||
|
#: connections.dfm:737
|
||||||
|
msgid "Use cleartext plugin"
|
||||||
|
msgstr "Use cleartext plugin"
|
||||||
|
|
||||||
#. connform..PageControlDetails..tabSettings..chkLocalTimeZone....Hint
|
#. connform..PageControlDetails..tabSettings..chkLocalTimeZone....Hint
|
||||||
#: connections.dfm:406
|
#: connections.dfm:406
|
||||||
msgid "Use your client time zone in date/time SQL functions, e.g. NOW(), for MySQL 4.1.3+"
|
msgid "Use your client time zone in date/time SQL functions, e.g. NOW(), for MySQL 4.1.3+"
|
||||||
|
@ -141,7 +141,7 @@ type
|
|||||||
asWrapLongLines, asDisplayBLOBsAsText, asSingleQueries, asMemoEditorWidth, asMemoEditorHeight, asMemoEditorMaximized,
|
asWrapLongLines, asDisplayBLOBsAsText, asSingleQueries, asMemoEditorWidth, asMemoEditorHeight, asMemoEditorMaximized,
|
||||||
asMemoEditorWrap, asDelimiter, asSQLHelpWindowLeft, asSQLHelpWindowTop, asSQLHelpWindowWidth,
|
asMemoEditorWrap, asDelimiter, asSQLHelpWindowLeft, asSQLHelpWindowTop, asSQLHelpWindowWidth,
|
||||||
asSQLHelpWindowHeight, asSQLHelpPnlLeftWidth, asSQLHelpPnlRightTopHeight, asHost,
|
asSQLHelpWindowHeight, asSQLHelpPnlLeftWidth, asSQLHelpPnlRightTopHeight, asHost,
|
||||||
asUser, asPassword, asWindowsAuth, asLoginPrompt, asPort,
|
asUser, asPassword, asCleartextPluginEnabled, asWindowsAuth, asLoginPrompt, asPort,
|
||||||
asPlinkExecutable, asSSHtunnelHost, asSSHtunnelHostPort, asSSHtunnelPort, asSSHtunnelUser,
|
asPlinkExecutable, asSSHtunnelHost, asSSHtunnelHostPort, asSSHtunnelPort, asSSHtunnelUser,
|
||||||
asSSHtunnelPassword, asSSHtunnelTimeout, asSSHtunnelPrivateKey, asSSLActive, asSSLKey,
|
asSSHtunnelPassword, asSSHtunnelTimeout, asSSHtunnelPrivateKey, asSSLActive, asSSLKey,
|
||||||
asSSLCert, asSSLCA, asSSLCipher, asNetType, asCompressed, asLocalTimeZone, asQueryTimeout, asKeepAlive,
|
asSSLCert, asSSLCA, asSSLCipher, asNetType, asCompressed, asLocalTimeZone, asQueryTimeout, asKeepAlive,
|
||||||
@ -2627,7 +2627,7 @@ var
|
|||||||
rx: TRegExpr;
|
rx: TRegExpr;
|
||||||
ExeName, SessName, Host, User, Pass, Socket,
|
ExeName, SessName, Host, User, Pass, Socket,
|
||||||
SSLPrivateKey, SSLCACertificate, SSLCertificate, SSLCipher: String;
|
SSLPrivateKey, SSLCACertificate, SSLCertificate, SSLCipher: String;
|
||||||
Port, NetType, WindowsAuth, WantSSL: Integer;
|
Port, NetType, WindowsAuth, WantSSL, CleartextPluginEnabled: Integer;
|
||||||
AbsentFiles: TStringList;
|
AbsentFiles: TStringList;
|
||||||
|
|
||||||
function GetParamValue(ShortName, LongName: String): String;
|
function GetParamValue(ShortName, LongName: String): String;
|
||||||
@ -2692,6 +2692,7 @@ begin
|
|||||||
Host := GetParamValue('h', 'host');
|
Host := GetParamValue('h', 'host');
|
||||||
User := GetParamValue('u', 'user');
|
User := GetParamValue('u', 'user');
|
||||||
Pass := GetParamValue('p', 'password');
|
Pass := GetParamValue('p', 'password');
|
||||||
|
CleartextPluginEnabled := StrToIntDef(GetParamValue('cleartextenabled', 'cleartextenabled'), -1);
|
||||||
Socket := GetParamValue('S', 'socket');
|
Socket := GetParamValue('S', 'socket');
|
||||||
Port := StrToIntDef(GetParamValue('P', 'port'), 0);
|
Port := StrToIntDef(GetParamValue('P', 'port'), 0);
|
||||||
WindowsAuth := StrToIntDef(GetParamValue('W', 'winauth'), -1);
|
WindowsAuth := StrToIntDef(GetParamValue('W', 'winauth'), -1);
|
||||||
@ -2716,6 +2717,8 @@ begin
|
|||||||
if Host <> '' then ConnectionParams.Hostname := Host;
|
if Host <> '' then ConnectionParams.Hostname := Host;
|
||||||
if User <> '' then ConnectionParams.Username := User;
|
if User <> '' then ConnectionParams.Username := User;
|
||||||
if Pass <> '' then ConnectionParams.Password := Pass;
|
if Pass <> '' then ConnectionParams.Password := Pass;
|
||||||
|
if CleartextPluginEnabled in [0,1] then
|
||||||
|
ConnectionParams.CleartextPluginEnabled := Boolean(CleartextPluginEnabled);
|
||||||
if Port <> 0 then ConnectionParams.Port := Port;
|
if Port <> 0 then ConnectionParams.Port := Port;
|
||||||
if Socket <> '' then begin
|
if Socket <> '' then begin
|
||||||
ConnectionParams.Hostname := Socket;
|
ConnectionParams.Hostname := Socket;
|
||||||
@ -3521,6 +3524,7 @@ begin
|
|||||||
InitSetting(asHost, 'Host', 0, False, '127.0.0.1', True);
|
InitSetting(asHost, 'Host', 0, False, '127.0.0.1', True);
|
||||||
InitSetting(asUser, 'User', 0, False, '', True);
|
InitSetting(asUser, 'User', 0, False, '', True);
|
||||||
InitSetting(asPassword, 'Password', 0, False, '', True);
|
InitSetting(asPassword, 'Password', 0, False, '', True);
|
||||||
|
InitSetting(asCleartextPluginEnabled, 'CleartextPluginEnabled' 0, False, '', True);
|
||||||
InitSetting(asWindowsAuth, 'WindowsAuth', 0, False, '', True);
|
InitSetting(asWindowsAuth, 'WindowsAuth', 0, False, '', True);
|
||||||
InitSetting(asLoginPrompt, 'LoginPrompt', 0, False, '', True);
|
InitSetting(asLoginPrompt, 'LoginPrompt', 0, False, '', True);
|
||||||
InitSetting(asPort, 'Port', 0, False, '', True);
|
InitSetting(asPort, 'Port', 0, False, '', True);
|
||||||
|
@ -734,6 +734,19 @@ object connform: Tconnform
|
|||||||
TabOrder = 8
|
TabOrder = 8
|
||||||
OnClick = Modification
|
OnClick = Modification
|
||||||
end
|
end
|
||||||
|
object chkCleartextPluginEnabled: TCheckBox
|
||||||
|
Left = 120
|
||||||
|
Top = 329
|
||||||
|
Width = 294
|
||||||
|
Height = 17
|
||||||
|
Hint =
|
||||||
|
'Send your password to the server in cleartext' +
|
||||||
|
', for MySQL 5.5.47+'
|
||||||
|
Anchors = [akLeft, akTop, akRight]
|
||||||
|
Caption = 'Use cleartext plugin'
|
||||||
|
TabOrder = 13
|
||||||
|
OnClick = Modification
|
||||||
|
end
|
||||||
object editStartupScript: TButtonedEdit
|
object editStartupScript: TButtonedEdit
|
||||||
Left = 120
|
Left = 120
|
||||||
Top = 165
|
Top = 165
|
||||||
|
@ -76,6 +76,7 @@ type
|
|||||||
editSSHTimeout: TEdit;
|
editSSHTimeout: TEdit;
|
||||||
updownSSHTimeout: TUpDown;
|
updownSSHTimeout: TUpDown;
|
||||||
chkWindowsAuth: TCheckBox;
|
chkWindowsAuth: TCheckBox;
|
||||||
|
chkCleartextPluginEnabled: TCheckBox;
|
||||||
splitterMain: TSplitter;
|
splitterMain: TSplitter;
|
||||||
tabStart: TTabSheet;
|
tabStart: TTabSheet;
|
||||||
lblHelp: TLabel;
|
lblHelp: TLabel;
|
||||||
@ -378,6 +379,7 @@ begin
|
|||||||
Sess.Password := editPassword.Text;
|
Sess.Password := editPassword.Text;
|
||||||
Sess.LoginPrompt := chkLoginPrompt.Checked;
|
Sess.LoginPrompt := chkLoginPrompt.Checked;
|
||||||
Sess.WindowsAuth := chkWindowsAuth.Checked;
|
Sess.WindowsAuth := chkWindowsAuth.Checked;
|
||||||
|
Sess.CleartextPluginEnabled := chkCleartextPluginEnabled.Checked;
|
||||||
Sess.Port := updownPort.Position;
|
Sess.Port := updownPort.Position;
|
||||||
Sess.NetType := TNetType(comboNetType.ItemIndex);
|
Sess.NetType := TNetType(comboNetType.ItemIndex);
|
||||||
Sess.Compressed := chkCompressed.Checked;
|
Sess.Compressed := chkCompressed.Checked;
|
||||||
@ -574,6 +576,7 @@ begin
|
|||||||
Result.Password := editPassword.Text;
|
Result.Password := editPassword.Text;
|
||||||
Result.LoginPrompt := chkLoginPrompt.Checked;
|
Result.LoginPrompt := chkLoginPrompt.Checked;
|
||||||
Result.WindowsAuth := chkWindowsAuth.Checked;
|
Result.WindowsAuth := chkWindowsAuth.Checked;
|
||||||
|
Result.CleartextPluginEnabled := chkCleartextPluginEnabled.Checked;
|
||||||
if updownPort.Enabled then
|
if updownPort.Enabled then
|
||||||
Result.Port := updownPort.Position
|
Result.Port := updownPort.Position
|
||||||
else
|
else
|
||||||
@ -836,6 +839,7 @@ begin
|
|||||||
editPassword.Text := Sess.Password;
|
editPassword.Text := Sess.Password;
|
||||||
chkLoginPrompt.Checked := Sess.LoginPrompt;
|
chkLoginPrompt.Checked := Sess.LoginPrompt;
|
||||||
chkWindowsAuth.Checked := Sess.WindowsAuth;
|
chkWindowsAuth.Checked := Sess.WindowsAuth;
|
||||||
|
chkCleartextPluginEnabled.Checked := Sess.CleartextPluginEnabled;
|
||||||
updownPort.Position := Sess.Port;
|
updownPort.Position := Sess.Port;
|
||||||
chkCompressed.Checked := Sess.Compressed;
|
chkCompressed.Checked := Sess.Compressed;
|
||||||
updownQueryTimeout.Position := Sess.QueryTimeout;
|
updownQueryTimeout.Position := Sess.QueryTimeout;
|
||||||
@ -1094,6 +1098,7 @@ begin
|
|||||||
or (Sess.Username <> editUsername.Text)
|
or (Sess.Username <> editUsername.Text)
|
||||||
or (Sess.LoginPrompt <> chkLoginPrompt.Checked)
|
or (Sess.LoginPrompt <> chkLoginPrompt.Checked)
|
||||||
or (Sess.WindowsAuth <> chkWindowsAuth.Checked)
|
or (Sess.WindowsAuth <> chkWindowsAuth.Checked)
|
||||||
|
or (Sess.CleartextPluginEnabled <> chkCleartextPluginEnabled.Checked)
|
||||||
or (Sess.Port <> updownPort.Position)
|
or (Sess.Port <> updownPort.Position)
|
||||||
or (Sess.Compressed <> chkCompressed.Checked)
|
or (Sess.Compressed <> chkCompressed.Checked)
|
||||||
or (Sess.QueryTimeout <> updownQueryTimeout.Position)
|
or (Sess.QueryTimeout <> updownQueryTimeout.Position)
|
||||||
@ -1122,7 +1127,8 @@ begin
|
|||||||
FOnlyPasswordModified := PasswordModified and (not FSessionModified);
|
FOnlyPasswordModified := PasswordModified and (not FSessionModified);
|
||||||
FSessionModified := FSessionModified or PasswordModified;
|
FSessionModified := FSessionModified or PasswordModified;
|
||||||
if (Sender=editHost) or (Sender=editUsername) or (Sender=editPassword) or
|
if (Sender=editHost) or (Sender=editUsername) or (Sender=editPassword) or
|
||||||
(Sender=comboNetType) or (Sender=chkWindowsAuth) or (Sender=editPort) then begin
|
(Sender=comboNetType) or (Sender=chkWindowsAuth) or (Sender=editPort) or
|
||||||
|
(Sender=chkCleartextPluginEnabled) then begin
|
||||||
// Be sure to use the modified connection params next time the user clicks the "Databases" pulldown
|
// Be sure to use the modified connection params next time the user clicks the "Databases" pulldown
|
||||||
FreeAndNil(FPopupDatabases);
|
FreeAndNil(FPopupDatabases);
|
||||||
end;
|
end;
|
||||||
@ -1170,6 +1176,7 @@ begin
|
|||||||
else
|
else
|
||||||
lblHost.Caption := _('Hostname / IP:');
|
lblHost.Caption := _('Hostname / IP:');
|
||||||
chkWindowsAuth.Enabled := Params.IsMSSQL;
|
chkWindowsAuth.Enabled := Params.IsMSSQL;
|
||||||
|
chkCleartextPluginEnabled.Enabled := Params.IsMySQL;
|
||||||
lblUsername.Enabled := ((not chkLoginPrompt.Checked) or (not chkLoginPrompt.Enabled))
|
lblUsername.Enabled := ((not chkLoginPrompt.Checked) or (not chkLoginPrompt.Enabled))
|
||||||
and ((not chkWindowsAuth.Checked) or (not chkWindowsAuth.Enabled));
|
and ((not chkWindowsAuth.Checked) or (not chkWindowsAuth.Enabled));
|
||||||
editUsername.Enabled := lblUsername.Enabled;
|
editUsername.Enabled := lblUsername.Enabled;
|
||||||
|
@ -217,7 +217,8 @@ type
|
|||||||
FSessionPath, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate, FSSLCipher, FServerVersion,
|
FSessionPath, FSSLPrivateKey, FSSLCertificate, FSSLCACertificate, FSSLCipher, FServerVersion,
|
||||||
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
FSSHHost, FSSHUser, FSSHPassword, FSSHPlinkExe, FSSHPrivateKey: String;
|
||||||
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter, FQueryTimeout, FKeepAlive: Integer;
|
FPort, FSSHPort, FSSHLocalPort, FSSHTimeout, FCounter, FQueryTimeout, FKeepAlive: Integer;
|
||||||
FLoginPrompt, FCompressed, FLocalTimeZone, FFullTableStatus, FWindowsAuth, FWantSSL, FIsFolder: Boolean;
|
FLoginPrompt, FCompressed, FLocalTimeZone, FFullTableStatus,
|
||||||
|
FWindowsAuth, FWantSSL, FIsFolder, FCleartextPluginEnabled: Boolean;
|
||||||
FSessionColor: TColor;
|
FSessionColor: TColor;
|
||||||
FLastConnect: TDateTime;
|
FLastConnect: TDateTime;
|
||||||
function GetImageIndex: Integer;
|
function GetImageIndex: Integer;
|
||||||
@ -260,6 +261,7 @@ type
|
|||||||
property Password: String read FPassword write FPassword;
|
property Password: String read FPassword write FPassword;
|
||||||
property LoginPrompt: Boolean read FLoginPrompt write FLoginPrompt;
|
property LoginPrompt: Boolean read FLoginPrompt write FLoginPrompt;
|
||||||
property WindowsAuth: Boolean read FWindowsAuth write FWindowsAuth;
|
property WindowsAuth: Boolean read FWindowsAuth write FWindowsAuth;
|
||||||
|
property CleartextPluginEnabled: Boolean read FCleartextPluginEnabled write FCleartextPluginEnabled;
|
||||||
property AllDatabasesStr: String read FAllDatabases write FAllDatabases;
|
property AllDatabasesStr: String read FAllDatabases write FAllDatabases;
|
||||||
property Comment: String read FComment write FComment;
|
property Comment: String read FComment write FComment;
|
||||||
property StartupScriptFilename: String read FStartupScriptFilename write FStartupScriptFilename;
|
property StartupScriptFilename: String read FStartupScriptFilename write FStartupScriptFilename;
|
||||||
@ -1127,6 +1129,7 @@ begin
|
|||||||
FHostname := AppSettings.GetDefaultString(asHost);
|
FHostname := AppSettings.GetDefaultString(asHost);
|
||||||
FLoginPrompt := AppSettings.GetDefaultBool(asLoginPrompt);
|
FLoginPrompt := AppSettings.GetDefaultBool(asLoginPrompt);
|
||||||
FWindowsAuth := AppSettings.GetDefaultBool(asWindowsAuth);
|
FWindowsAuth := AppSettings.GetDefaultBool(asWindowsAuth);
|
||||||
|
FCleartextPluginEnabled := AppSettings.GetDefaultBool(asCleartextPluginEnabled);
|
||||||
FUsername := DefaultUsername;
|
FUsername := DefaultUsername;
|
||||||
FPassword := AppSettings.GetDefaultString(asPassword);
|
FPassword := AppSettings.GetDefaultString(asPassword);
|
||||||
FPort := DefaultPort;
|
FPort := DefaultPort;
|
||||||
@ -1194,6 +1197,7 @@ begin
|
|||||||
FPassword := decrypt(AppSettings.ReadString(asPassword));
|
FPassword := decrypt(AppSettings.ReadString(asPassword));
|
||||||
FLoginPrompt := AppSettings.ReadBool(asLoginPrompt);
|
FLoginPrompt := AppSettings.ReadBool(asLoginPrompt);
|
||||||
FWindowsAuth := AppSettings.ReadBool(asWindowsAuth);
|
FWindowsAuth := AppSettings.ReadBool(asWindowsAuth);
|
||||||
|
FCleartextPluginEnabled := AppSettings.ReadBool(asCleartextPluginEnabled);
|
||||||
FPort := MakeInt(AppSettings.ReadString(asPort));
|
FPort := MakeInt(AppSettings.ReadString(asPort));
|
||||||
FCompressed := AppSettings.ReadBool(asCompressed);
|
FCompressed := AppSettings.ReadBool(asCompressed);
|
||||||
FAllDatabases := AppSettings.ReadString(asDatabases);
|
FAllDatabases := AppSettings.ReadString(asDatabases);
|
||||||
@ -1249,6 +1253,7 @@ begin
|
|||||||
else begin
|
else begin
|
||||||
AppSettings.WriteString(asHost, FHostname);
|
AppSettings.WriteString(asHost, FHostname);
|
||||||
AppSettings.WriteBool(asWindowsAuth, FWindowsAuth);
|
AppSettings.WriteBool(asWindowsAuth, FWindowsAuth);
|
||||||
|
AppSettings.WriteBool(asCleartextPluginEnabled, FCleartextPluginEnabled);
|
||||||
AppSettings.WriteString(asUser, FUsername);
|
AppSettings.WriteString(asUser, FUsername);
|
||||||
AppSettings.WriteString(asPassword, encrypt(FPassword));
|
AppSettings.WriteString(asPassword, encrypt(FPassword));
|
||||||
AppSettings.WriteBool(asLoginPrompt, FLoginPrompt);
|
AppSettings.WriteBool(asLoginPrompt, FLoginPrompt);
|
||||||
@ -1825,6 +1830,10 @@ begin
|
|||||||
mysql_options(FHandle, Integer(MARIADB_OPT_TLS_VERSION), PAnsiChar('TLSv1,TLSv1.1,TLSv1.2,TLSv1.3'));
|
mysql_options(FHandle, Integer(MARIADB_OPT_TLS_VERSION), PAnsiChar('TLSv1,TLSv1.1,TLSv1.2,TLSv1.3'));
|
||||||
mysql_options(FHandle, Integer(MYSQL_OPT_TLS_VERSION), PAnsiChar('TLSv1,TLSv1.1,TLSv1.2,TLSv1.3'));
|
mysql_options(FHandle, Integer(MYSQL_OPT_TLS_VERSION), PAnsiChar('TLSv1,TLSv1.1,TLSv1.2,TLSv1.3'));
|
||||||
|
|
||||||
|
// Enable cleartext plugin
|
||||||
|
if Parameters.CleartextPluginEnabled then
|
||||||
|
mysql_options(FHandle, MYSQL_ENABLE_CLEARTEXT_PLUGIN, 1);
|
||||||
|
|
||||||
Connected := mysql_real_connect(
|
Connected := mysql_real_connect(
|
||||||
FHandle,
|
FHandle,
|
||||||
PAnsiChar(Utf8Encode(FinalHost)),
|
PAnsiChar(Utf8Encode(FinalHost)),
|
||||||
|
Reference in New Issue
Block a user