mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-21 09:58:13 +00:00
ADD: FTPS support
This commit is contained in:
parent
0d6c21c846
commit
e1069ed06c
3 changed files with 55 additions and 13 deletions
|
|
@ -90,7 +90,7 @@ object DialogBox: TDialogBox
|
|||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 3
|
||||
TabOrder = 4
|
||||
end
|
||||
object btnAnonymous: TButton
|
||||
AnchorSideLeft.Control = edtHost
|
||||
|
|
@ -106,7 +106,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 6
|
||||
Caption = 'Anonymous'
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 2
|
||||
TabOrder = 3
|
||||
end
|
||||
object edtRemoteDir: TEdit
|
||||
AnchorSideLeft.Control = edtPassword
|
||||
|
|
@ -120,7 +120,7 @@ object DialogBox: TDialogBox
|
|||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 7
|
||||
TabOrder = 8
|
||||
end
|
||||
object lblRemoteDir: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
|
|
@ -145,7 +145,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 18
|
||||
Caption = 'Use passive mode for transfers (like a WWW brower)'
|
||||
TabOrder = 9
|
||||
TabOrder = 10
|
||||
end
|
||||
object btnCancel: TButton
|
||||
AnchorSideTop.Control = chkPassiveMode
|
||||
|
|
@ -162,7 +162,7 @@ object DialogBox: TDialogBox
|
|||
Caption = 'Cancel'
|
||||
ModalResult = 2
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 11
|
||||
TabOrder = 12
|
||||
end
|
||||
object btnOK: TButton
|
||||
AnchorSideTop.Control = btnCancel
|
||||
|
|
@ -177,7 +177,7 @@ object DialogBox: TDialogBox
|
|||
Caption = '&OK'
|
||||
ModalResult = 1
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 10
|
||||
TabOrder = 11
|
||||
end
|
||||
object edtPassword: TEdit
|
||||
AnchorSideLeft.Control = edtUserName
|
||||
|
|
@ -193,7 +193,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 6
|
||||
EchoMode = emPassword
|
||||
PasswordChar = '*'
|
||||
TabOrder = 4
|
||||
TabOrder = 5
|
||||
end
|
||||
object lblPassword: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
|
|
@ -219,7 +219,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 12
|
||||
Caption = 'Use master password to protect the password'
|
||||
OnChange = CheckBoxChange
|
||||
TabOrder = 6
|
||||
TabOrder = 7
|
||||
end
|
||||
object btnChangePassword: TButton
|
||||
AnchorSideLeft.Control = edtUserName
|
||||
|
|
@ -235,7 +235,7 @@ object DialogBox: TDialogBox
|
|||
BorderSpacing.Top = 6
|
||||
Caption = 'Change password...'
|
||||
OnClick = ButtonClick
|
||||
TabOrder = 5
|
||||
TabOrder = 6
|
||||
Visible = False
|
||||
end
|
||||
object edtInitCommands: TEdit
|
||||
|
|
@ -250,7 +250,7 @@ object DialogBox: TDialogBox
|
|||
Width = 260
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 6
|
||||
TabOrder = 8
|
||||
TabOrder = 9
|
||||
end
|
||||
object lblInitCommands: TLabel
|
||||
AnchorSideLeft.Control = Owner
|
||||
|
|
@ -264,4 +264,17 @@ object DialogBox: TDialogBox
|
|||
Caption = 'Init commands:'
|
||||
ParentColor = False
|
||||
end
|
||||
object chkAutoTLS: TCheckBox
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = btnAnonymous
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 12
|
||||
Height = 17
|
||||
Top = 70
|
||||
Width = 58
|
||||
BorderSpacing.Left = 12
|
||||
Caption = 'SSL/TLS'
|
||||
OnChange = CheckBoxChange
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
-------------------------------------------------------------------------
|
||||
WFX plugin for working with File Transfer Protocol
|
||||
|
||||
Copyright (C) 2009-2011 Koblov Alexander (Alexx2000@mail.ru)
|
||||
Copyright (C) 2009-2012 Koblov Alexander (Alexx2000@mail.ru)
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -37,7 +37,7 @@ function ShowFtpConfDlg: Boolean;
|
|||
implementation
|
||||
|
||||
uses
|
||||
FtpFunc, FtpUtils;
|
||||
FtpFunc, FtpUtils, blcksock, ssl_openssl_lib;
|
||||
|
||||
function DlgProc (pDlg: PtrUInt; DlgItemName: PAnsiChar; Msg, wParam, lParam: PtrInt): PtrInt; dcpcall;
|
||||
var
|
||||
|
|
@ -81,8 +81,11 @@ begin
|
|||
SendDlgMsg(pDlg, 'edtInitCommands', DM_SETTEXT, Data, 0);
|
||||
Data:= PtrInt(gConnection.PassiveMode);
|
||||
SendDlgMsg(pDlg, 'chkPassiveMode', DM_SETCHECK, Data, 0);
|
||||
Data:= PtrInt(gConnection.AutoTLS);
|
||||
SendDlgMsg(pDlg, 'chkAutoTLS', DM_SETCHECK, Data, 0);
|
||||
end;
|
||||
DN_CHANGE:
|
||||
begin
|
||||
if DlgItemName = 'chkMasterPassword' then
|
||||
begin
|
||||
Data:= SendDlgMsg(pDlg, 'chkMasterPassword', DM_GETCHECK, 0, 0);
|
||||
|
|
@ -90,6 +93,26 @@ begin
|
|||
if not gConnection.MasterPassword then
|
||||
DeletePassword(gConnection.ConnectionName);
|
||||
end;
|
||||
if DlgItemName = 'chkAutoTLS' then
|
||||
begin
|
||||
Data:= SendDlgMsg(pDlg, 'chkAutoTLS', DM_GETCHECK, 0, 0);
|
||||
gConnection.AutoTLS:= Boolean(Data);
|
||||
if gConnection.AutoTLS then
|
||||
begin
|
||||
if not InitSSLInterface then
|
||||
begin
|
||||
MessageBox(PAnsiChar('OpenSSL library not found!' + LineEnding +
|
||||
'To use SSL connections, please install the OpenSSL ' +
|
||||
'libraries (' + DLLSSLName + ' and ' + DLLUtilName + ')!'),
|
||||
'OpenSSL', MB_OK or MB_ICONERROR
|
||||
);
|
||||
gConnection.AutoTLS:= False;
|
||||
Data:= PtrInt(gConnection.AutoTLS);
|
||||
SendDlgMsg(pDlg, 'chkAutoTLS', DM_SETCHECK, Data, 0);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
DN_CLICK:
|
||||
if DlgItemName = 'btnAnonymous' then
|
||||
begin
|
||||
|
|
@ -135,6 +158,8 @@ begin
|
|||
gConnection.InitCommands:= Text;
|
||||
Data:= SendDlgMsg(pDlg, 'chkPassiveMode', DM_GETCHECK, 0, 0);
|
||||
gConnection.PassiveMode:= Boolean(Data);
|
||||
Data:= SendDlgMsg(pDlg, 'chkAutoTLS', DM_GETCHECK, 0, 0);
|
||||
gConnection.AutoTLS:= Boolean(Data);
|
||||
// close dialog
|
||||
SendDlgMsg(pDlg, DlgItemName, DM_CLOSE, 1, 0);
|
||||
end
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ type
|
|||
Password: AnsiString;
|
||||
MasterPassword: Boolean;
|
||||
PassiveMode: Boolean;
|
||||
AutoTLS: Boolean;
|
||||
InitCommands: AnsiString;
|
||||
PasswordChanged: Boolean;
|
||||
end;
|
||||
|
|
@ -110,7 +111,7 @@ var
|
|||
implementation
|
||||
|
||||
uses
|
||||
IniFiles, StrUtils, FtpUtils, FtpConfDlg, syncobjs;
|
||||
IniFiles, StrUtils, FtpUtils, FtpConfDlg, syncobjs, ssl_openssl;
|
||||
|
||||
var
|
||||
ActiveConnectionList, ConnectionList: TStringList;
|
||||
|
|
@ -159,6 +160,7 @@ begin
|
|||
else
|
||||
Connection.Password := DecodeBase64(IniFile.ReadString('FTP', 'Connection' + sIndex + 'Password', EmptyStr));
|
||||
Connection.PassiveMode:= IniFile.ReadBool('FTP', 'Connection' + sIndex + 'PassiveMode', True);
|
||||
Connection.AutoTLS:= IniFile.ReadBool('FTP', 'Connection' + sIndex + 'AutoTLS', False);
|
||||
Connection.InitCommands := IniFile.ReadString('FTP', 'Connection' + sIndex + 'InitCommands', EmptyStr);
|
||||
// add connection to connection list
|
||||
ConnectionList.AddObject(Connection.ConnectionName, Connection);
|
||||
|
|
@ -189,6 +191,7 @@ begin
|
|||
else
|
||||
IniFile.WriteString('FTP', 'Connection' + sIndex + 'Password', EncodeBase64(Connection.Password));
|
||||
IniFile.WriteBool('FTP', 'Connection' + sIndex + 'PassiveMode', Connection.PassiveMode);
|
||||
IniFile.WriteBool('FTP', 'Connection' + sIndex + 'AutoTLS', Connection.AutoTLS);
|
||||
IniFile.WriteString('FTP', 'Connection' + sIndex + 'InitCommands', Connection.InitCommands);
|
||||
end;
|
||||
end;
|
||||
|
|
@ -250,6 +253,7 @@ begin
|
|||
FtpSend.OnStatus:= FtpSend.FTPStatus;
|
||||
FtpSend.TargetHost := Connection.Host;
|
||||
FtpSend.PassiveMode:= Connection.PassiveMode;
|
||||
FtpSend.AutoTLS:= Connection.AutoTLS;
|
||||
if Connection.Port <> EmptyStr then
|
||||
FtpSend.TargetPort := Connection.Port;
|
||||
if Connection.UserName <> EmptyStr then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue