SiteAdvanced.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392
  1. //----------------------------------------------------------------------------
  2. #ifndef SiteAdvancedH
  3. #define SiteAdvancedH
  4. //----------------------------------------------------------------------------
  5. #include "ComboEdit.hpp"
  6. #include "PasswordEdit.hpp"
  7. #include "UpDownEdit.hpp"
  8. #include <System.Classes.hpp>
  9. #include <Vcl.ActnList.hpp>
  10. #include <Vcl.ComCtrls.hpp>
  11. #include <Vcl.Controls.hpp>
  12. #include <Vcl.ExtCtrls.hpp>
  13. #include <Vcl.Forms.hpp>
  14. #include <Vcl.ImgList.hpp>
  15. #include <Vcl.Mask.hpp>
  16. #include <Vcl.Menus.hpp>
  17. #include <Vcl.StdCtrls.hpp>
  18. #include "PngImageList.hpp"
  19. //----------------------------------------------------------------------------
  20. #include <Configuration.h>
  21. #include <SessionData.h>
  22. #include <PasTools.hpp>
  23. #include <GUITools.h>
  24. #include <System.ImageList.hpp>
  25. //----------------------------------------------------------------------------
  26. class TSiteAdvancedDialog : public TForm
  27. {
  28. __published:
  29. TPanel *MainPanel;
  30. TPageControl *PageControl;
  31. TTabSheet *AdvancedSheet;
  32. TGroupBox *ProtocolGroup;
  33. TCheckBox *CompressionCheck;
  34. TTabSheet *EnvironmentSheet;
  35. TTabSheet *ScpSheet;
  36. TGroupBox *OtherShellOptionsGroup;
  37. TCheckBox *LookupUserGroupsCheck;
  38. TCheckBox *ClearAliasesCheck;
  39. TCheckBox *UnsetNationalVarsCheck;
  40. TCheckBox *Scp1CompatibilityCheck;
  41. TGroupBox *ShellGroup;
  42. TComboBox *ShellEdit;
  43. TPanel *LeftPanel;
  44. TTreeView *NavigationTree;
  45. TTabSheet *ConnSheet;
  46. TGroupBox *TimeoutGroup;
  47. TLabel *Label11;
  48. TLabel *Label12;
  49. TUpDownEdit *TimeoutEdit;
  50. TTabSheet *ProxySheet;
  51. TGroupBox *ProxyTypeGroup;
  52. TLabel *ProxyHostLabel;
  53. TLabel *ProxyPortLabel;
  54. TUpDownEdit *ProxyPortEdit;
  55. TEdit *ProxyHostEdit;
  56. TEdit *ProxyUsernameEdit;
  57. TLabel *ProxyUsernameLabel;
  58. TLabel *ProxyPasswordLabel;
  59. TPasswordEdit *ProxyPasswordEdit;
  60. TGroupBox *ProxySettingsGroup;
  61. TLabel *ProxyTelnetCommandLabel;
  62. TEdit *ProxyTelnetCommandEdit;
  63. TTabSheet *BugsSheet;
  64. TGroupBox *BugsGroupBox;
  65. TLabel *BugHMAC2Label;
  66. TComboBox *BugHMAC2Combo;
  67. TLabel *BugDeriveKey2Label;
  68. TComboBox *BugDeriveKey2Combo;
  69. TLabel *BugRSAPad2Label;
  70. TComboBox *BugRSAPad2Combo;
  71. TTabSheet *AuthSheet;
  72. TGroupBox *AuthenticationGroup;
  73. TCheckBox *AuthKICheck;
  74. TGroupBox *EncryptionGroup;
  75. TListBox *CipherListBox;
  76. TLabel *Label8;
  77. TCheckBox *Ssh2LegacyDESCheck;
  78. TButton *CipherUpButton;
  79. TButton *CipherDownButton;
  80. TGroupBox *EnvironmentGroup;
  81. TLabel *BugPKSessID2Label;
  82. TComboBox *BugPKSessID2Combo;
  83. TCheckBox *ProxyLocalhostCheck;
  84. TLabel *Label17;
  85. TGroupBox *PingGroup;
  86. TLabel *PingIntervalLabel;
  87. TUpDownEdit *PingIntervalSecEdit;
  88. TRadioButton *PingOffButton;
  89. TRadioButton *PingNullPacketButton;
  90. TRadioButton *PingDummyCommandButton;
  91. TCheckBox *AuthKIPasswordCheck;
  92. TTabSheet *DirectoriesSheet;
  93. TGroupBox *DirectoriesGroup;
  94. TLabel *LocalDirectoryLabel;
  95. TLabel *RemoteDirectoryLabel;
  96. TLabel *LocalDirectoryDescLabel;
  97. TDirectoryEdit *LocalDirectoryEdit;
  98. TEdit *RemoteDirectoryEdit;
  99. TCheckBox *UpdateDirectoriesCheck;
  100. TCheckBox *CacheDirectoriesCheck;
  101. TCheckBox *ResolveSymlinksCheck;
  102. TCheckBox *CacheDirectoryChangesCheck;
  103. TCheckBox *PreserveDirectoryChangesCheck;
  104. TGroupBox *DSTModeGroup;
  105. TRadioButton *DSTModeUnixCheck;
  106. TRadioButton *DSTModeWinCheck;
  107. TGroupBox *ScpLsOptionsGroup;
  108. TCheckBox *IgnoreLsWarningsCheck;
  109. TCheckBox *SCPLsFullTimeAutoCheck;
  110. TTabSheet *SftpSheet;
  111. TGroupBox *SFTPBugsGroupBox;
  112. TLabel *Label10;
  113. TLabel *Label36;
  114. TComboBox *SFTPBugSymlinkCombo;
  115. TTabSheet *KexSheet;
  116. TGroupBox *KexOptionsGroup;
  117. TLabel *Label28;
  118. TListBox *KexListBox;
  119. TButton *KexUpButton;
  120. TButton *KexDownButton;
  121. TGroupBox *KexReexchangeGroup;
  122. TLabel *Label31;
  123. TUpDownEdit *RekeyTimeEdit;
  124. TLabel *Label32;
  125. TEdit *RekeyDataEdit;
  126. TGroupBox *IPvGroup;
  127. TRadioButton *IPAutoButton;
  128. TRadioButton *IPv4Button;
  129. TRadioButton *IPv6Button;
  130. TLabel *BugRekey2Label;
  131. TComboBox *BugRekey2Combo;
  132. TGroupBox *SFTPProtocolGroup;
  133. TLabel *Label34;
  134. TComboBox *SFTPMaxVersionCombo;
  135. TComboBox *SFTPBugSignedTSCombo;
  136. TGroupBox *DirectoryOptionsGroup;
  137. TTabSheet *TunnelSheet;
  138. TGroupBox *TunnelSessionGroup;
  139. TLabel *Label6;
  140. TLabel *Label14;
  141. TLabel *Label15;
  142. TLabel *Label16;
  143. TLabel *Label18;
  144. TEdit *TunnelHostNameEdit;
  145. TEdit *TunnelUserNameEdit;
  146. TPasswordEdit *TunnelPasswordEdit;
  147. TUpDownEdit *TunnelPortNumberEdit;
  148. TFilenameEdit *TunnelPrivateKeyEdit3;
  149. TLabel *Label19;
  150. TComboBox *ReturnVarEdit;
  151. TLabel *Label20;
  152. TGroupBox *AuthenticationParamsGroup;
  153. TCheckBox *AgentFwdCheck;
  154. TCheckBox *TunnelCheck;
  155. TGroupBox *TunnelOptionsGroup;
  156. TLabel *Label21;
  157. TComboBox *TunnelLocalPortNumberEdit;
  158. TRadioButton *DSTModeKeepCheck;
  159. TGroupBox *ConnectionGroup;
  160. TCheckBox *FtpPasvModeCheck;
  161. TTabSheet *RecycleBinSheet;
  162. TGroupBox *RecycleBinGroup;
  163. TLabel *RecycleBinPathLabel;
  164. TCheckBox *DeleteToRecycleBinCheck;
  165. TCheckBox *OverwrittenToRecycleBinCheck;
  166. TEdit *RecycleBinPathEdit;
  167. TLabel *EOLTypeLabel;
  168. TComboBox *EOLTypeCombo;
  169. TLabel *UtfLabel;
  170. TComboBox *UtfCombo;
  171. TLabel *TimeDifferenceLabel;
  172. TUpDownEdit *TimeDifferenceEdit;
  173. TLabel *TimeDifferenceHoursLabel;
  174. TUpDownEdit *TimeDifferenceMinutesEdit;
  175. TLabel *TimeDifferenceMinutesLabel;
  176. TLabel *Label9;
  177. TComboBox *ListingCommandEdit;
  178. TCheckBox *SshNoUserAuthCheck;
  179. TCheckBox *TryAgentCheck;
  180. TLabel *ProxyMethodLabel;
  181. TComboBox *SshProxyMethodCombo;
  182. TComboBox *ProxyDNSCombo;
  183. TComboBox *FtpProxyMethodCombo;
  184. TLabel *ProxyLocalCommandLabel;
  185. TEdit *ProxyLocalCommandEdit;
  186. TButton *ProxyLocalCommandBrowseButton;
  187. TStaticText *ProxyTelnetCommandHintText;
  188. TStaticText *ProxyLocalCommandHintText;
  189. TGroupBox *FtpPingGroup;
  190. TLabel *FtpPingIntervalLabel;
  191. TUpDownEdit *FtpPingIntervalSecEdit;
  192. TRadioButton *FtpPingOffButton;
  193. TRadioButton *FtpPingDummyCommandButton;
  194. TLabel *Label23;
  195. TComboBox *SftpServerEdit;
  196. TTabSheet *FtpSheet;
  197. TGroupBox *FtpGroup;
  198. TLabel *Label25;
  199. TMemo *PostLoginCommandsMemo;
  200. TLabel *BugMaxPkt2Label;
  201. TComboBox *BugMaxPkt2Combo;
  202. TLabel *FtpListAllLabel;
  203. TComboBox *FtpListAllCombo;
  204. TComboBox *FtpForcePasvIpCombo;
  205. TCheckBox *AllowScpFallbackCheck;
  206. TCheckBox *BufferSizeCheck;
  207. TCheckBox *SynchronizeBrowsingCheck;
  208. TGroupBox *GSSAPIGroup;
  209. TCheckBox *AuthGSSAPICheck3;
  210. TCheckBox *GSSAPIFwdTGTCheck;
  211. TLabel *BugIgnore2Label;
  212. TComboBox *BugIgnore2Combo;
  213. TComboBox *NeonProxyMethodCombo;
  214. TLabel *Label24;
  215. TComboBox *FtpUseMlsdCombo;
  216. TLabel *FtpForcePasvIpLabel;
  217. TButton *OKBtn;
  218. TButton *CancelBtn;
  219. TButton *HelpButton;
  220. TLabel *FtpAccountLabel;
  221. TEdit *FtpAccountEdit;
  222. TLabel *PrivateKeyLabel;
  223. TFilenameEdit *PrivateKeyEdit3;
  224. TGroupBox *TunnelAuthenticationParamsGroup;
  225. TImageList *ColorImageList;
  226. TButton *ColorButton;
  227. TTabSheet *SslSheet;
  228. TGroupBox *TlsGroup;
  229. TLabel *MinTlsVersionLabel;
  230. TComboBox *MinTlsVersionCombo;
  231. TLabel *MaxTlsVersionLabel;
  232. TComboBox *MaxTlsVersionCombo;
  233. TCheckBox *SslSessionReuseCheck2;
  234. TLabel *BugWinAdjLabel;
  235. TComboBox *BugWinAdjCombo;
  236. TButton *ProxyAutodetectButton;
  237. TTabSheet *NoteSheet;
  238. TGroupBox *NoteGroup;
  239. TMemo *NoteMemo;
  240. TCheckBox *TimeDifferenceAutoCheck;
  241. TLabel *Label3;
  242. TComboBox *FtpHostCombo;
  243. TGroupBox *TlsAuthenticationGroup;
  244. TLabel *Label4;
  245. TFilenameEdit *TlsCertificateFileEdit;
  246. TCheckBox *TrimVMSVersionsCheck;
  247. TCheckBox *FollowDirectorySymlinksCheck;
  248. TImageList *ColorImageList120;
  249. TImageList *ColorImageList144;
  250. TImageList *ColorImageList192;
  251. TButton *PrivateKeyToolsButton;
  252. TPopupMenu *PrivateKeyMenu;
  253. TMenuItem *PrivateKeyGenerateItem;
  254. TMenuItem *PrivateKeyUploadItem;
  255. TButton *PrivateKeyViewButton;
  256. TTabSheet *EncryptionSheet;
  257. TCheckBox *EncryptFilesCheck;
  258. TGroupBox *EncryptFilesGroup;
  259. TLabel *Label13;
  260. TPasswordEdit *EncryptKeyPasswordEdit;
  261. TCheckBox *ShowEncryptionKeyCheck;
  262. TButton *GenerateKeyButton;
  263. TEdit *EncryptKeyVisibleEdit;
  264. TTabSheet *S3Sheet;
  265. TGroupBox *S3Group;
  266. TLabel *Label27;
  267. TComboBox *S3DefaultReqionCombo;
  268. TLabel *S3UrlStyleLabel;
  269. TComboBox *S3UrlStyleCombo;
  270. TGroupBox *PuttyGroup;
  271. TButton *PuttySettingsButton;
  272. TLabel *PuttySettingsLabel;
  273. TEdit *PuttySettingsEdit;
  274. TCheckBox *AuthGSSAPIKEXCheck;
  275. TTabSheet *WebDavSheet;
  276. TGroupBox *WebdavGroup;
  277. TCheckBox *WebDavLiberalEscapingCheck;
  278. TGroupBox *S3AuthenticationGroup;
  279. TLabel *S3SessionTokenLabel;
  280. TMemo *S3SessionTokenMemo;
  281. TCheckBox *VMSAllRevisionsCheck;
  282. TLabel *Label5;
  283. TComboBox *SFTPRealPathCombo;
  284. TLabel *DetachedCertificateLabel;
  285. TFilenameEdit *DetachedCertificateEdit;
  286. TCheckBox *S3RequesterPaysCheck;
  287. TRadioButton *FtpPingDirectoryListingButton;
  288. TCheckBox *UsePosixRenameCheck;
  289. TLabel *S3RoleArnLabel;
  290. TEdit *S3RoleArnEdit;
  291. void __fastcall DataChange(TObject *Sender);
  292. void __fastcall FormShow(TObject *Sender);
  293. void __fastcall PageControlChange(TObject *Sender);
  294. void __fastcall AlgListBoxStartDrag(TObject *Sender,
  295. TDragObject *&DragObject);
  296. void __fastcall AlgListBoxDragOver(TObject *Sender, TObject *Source,
  297. int X, int Y, TDragState State, bool &Accept);
  298. void __fastcall AlgListBoxDragDrop(TObject *Sender, TObject *Source,
  299. int X, int Y);
  300. void __fastcall CipherButtonClick(TObject *Sender);
  301. void __fastcall AuthGSSAPICheck3Click(TObject *Sender);
  302. void __fastcall KexButtonClick(TObject *Sender);
  303. void __fastcall HelpButtonClick(TObject *Sender);
  304. void __fastcall PrivateKeyEdit3AfterDialog(TObject *Sender,
  305. UnicodeString &Name, bool &Action);
  306. void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
  307. void __fastcall PathEditBeforeDialog(TObject *Sender, UnicodeString &Name,
  308. bool &Action);
  309. void __fastcall PathEditAfterDialog(TObject * Sender,
  310. UnicodeString & Name, bool & Action);
  311. void __fastcall NavigationTreeCollapsing(TObject *Sender,
  312. TTreeNode *Node, bool &AllowCollapse);
  313. void __fastcall ProxyLocalCommandBrowseButtonClick(TObject *Sender);
  314. void __fastcall NavigationTreeChange(TObject * Sender,
  315. TTreeNode * Node);
  316. void __fastcall ColorButtonClick(TObject *Sender);
  317. void __fastcall MinTlsVersionComboChange(TObject *Sender);
  318. void __fastcall MaxTlsVersionComboChange(TObject *Sender);
  319. void __fastcall ProxyAutodetectButtonClick(TObject *Sender);
  320. void __fastcall NoteMemoKeyDown(TObject *Sender, WORD &Key, TShiftState Shift);
  321. void __fastcall TlsCertificateFileEditAfterDialog(TObject *Sender, UnicodeString &Name,
  322. bool &Action);
  323. void __fastcall PrivateKeyUploadItemClick(TObject *Sender);
  324. void __fastcall PrivateKeyGenerateItemClick(TObject *Sender);
  325. void __fastcall PrivateKeyToolsButtonClick(TObject *Sender);
  326. void __fastcall PrivateKeyViewButtonClick(TObject *Sender);
  327. void __fastcall ShowEncryptionKeyCheckClick(TObject *Sender);
  328. void __fastcall GenerateKeyButtonClick(TObject *Sender);
  329. void __fastcall EncryptKeyEditExit(TObject *Sender);
  330. void __fastcall PuttySettingsButtonClick(TObject *Sender);
  331. void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
  332. public:
  333. virtual __fastcall TSiteAdvancedDialog(TComponent * AOwner);
  334. bool __fastcall Execute(TSessionData * SessionData);
  335. protected:
  336. void __fastcall ChangePage(TTabSheet * Tab);
  337. void __fastcall PageChanged();
  338. virtual void __fastcall Dispatch(void * Message);
  339. bool __fastcall AllowAlgDrag(TListBox * AlgListBox, int X, int Y);
  340. void __fastcall AlgMove(TListBox * AlgListBox, int Source, int Dest);
  341. void __fastcall InitControls();
  342. bool IsDefaultSftpServer();
  343. private:
  344. int NoUpdate;
  345. int FAlgDragSource;
  346. int FAlgDragDest;
  347. int FOptions;
  348. UnicodeString FBeforeDialogPath;
  349. TFSProtocol FFSProtocol;
  350. TSessionData * FSessionData;
  351. TColor FColor;
  352. UnicodeString FLastPrivateKey;
  353. bool FKeyHasCertificate;
  354. std::unique_ptr<TPopupMenu> FColorPopupMenu;
  355. std::unique_ptr<TObjectList> FPrivateKeyMonitors;
  356. std::unique_ptr<TStrings> FPuttyRegSettings;
  357. std::unique_ptr<TTimer> FPuttySettingsTimer;
  358. void __fastcall LoadSession();
  359. void __fastcall UpdateControls();
  360. TSessionData * __fastcall GetSessionData();
  361. void __fastcall SaveSession(TSessionData * SessionData);
  362. void __fastcall CMDialogKey(TWMKeyDown & Message);
  363. void __fastcall WMHelp(TWMHelp & Message);
  364. int __fastcall LastSupportedFtpProxyMethod();
  365. bool __fastcall SupportedFtpProxyMethod(int Method);
  366. int __fastcall GetSupportedFtpProxyMethod(int Method);
  367. int __fastcall GetSupportedNeonProxyMethod(int Method);
  368. TProxyMethod __fastcall GetProxyMethod();
  369. int __fastcall GetFtpProxyLogonType();
  370. void __fastcall UpdateNavigationTree();
  371. void __fastcall SessionColorChange(TColor Color);
  372. TTlsVersion __fastcall IndexToTlsVersion(int Index);
  373. int __fastcall TlsVersionToIndex(TTlsVersion TlsVersion);
  374. bool __fastcall IsNeon(TFSProtocol FSProtocol);
  375. void __fastcall PrivateKeyCreatedOrModified(TObject * Sender, const UnicodeString FileName);
  376. TCustomEdit * __fastcall GetEncryptKeyEdit(bool AShow = true);
  377. void __fastcall PuttySettingsTimer(TObject * Sender);
  378. UnicodeString __fastcall GetPuttySiteName();
  379. UnicodeString __fastcall GetPuttySiteKey();
  380. void __fastcall ClosePuttySettings();
  381. void SerializePuttyRegistry(const UnicodeString & Key, TStrings * Values);
  382. bool HasCertificate(const UnicodeString & FileName);
  383. INTERFACE_HOOK;
  384. };
  385. //----------------------------------------------------------------------------
  386. #endif