Login.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446
  1. //----------------------------------------------------------------------------
  2. #ifndef LoginH
  3. #define LoginH
  4. //----------------------------------------------------------------------------
  5. #include <vcl\System.hpp>
  6. #include <vcl\Windows.hpp>
  7. #include <vcl\SysUtils.hpp>
  8. #include <vcl\Classes.hpp>
  9. #include <vcl\Graphics.hpp>
  10. #include <vcl\StdCtrls.hpp>
  11. #include <vcl\Forms.hpp>
  12. #include <vcl\Controls.hpp>
  13. #include <vcl\Buttons.hpp>
  14. #include <vcl\ExtCtrls.hpp>
  15. #include <ComCtrls.hpp>
  16. #include <Mask.hpp>
  17. #include <ComboEdit.hpp>
  18. #include <ActnList.hpp>
  19. #include <UpDownEdit.hpp>
  20. #include <PasswordEdit.hpp>
  21. #include <Menus.hpp>
  22. #include <ImgList.hpp>
  23. //----------------------------------------------------------------------------
  24. #include <Configuration.h>
  25. #include <SessionData.h>
  26. #include <PasTools.hpp>
  27. #include "LogSettings.h"
  28. #include "GeneralSettings.h"
  29. //----------------------------------------------------------------------------
  30. class TLoginDialog : public TForm
  31. {
  32. __published:
  33. TButton *LoginButton;
  34. TButton *CloseButton;
  35. TButton *AboutButton;
  36. TActionList *ActionList;
  37. TAction *EditSessionAction;
  38. TAction *SaveSessionAction;
  39. TAction *DeleteSessionAction;
  40. TAction *ImportSessionsAction;
  41. TAction *LoginAction;
  42. TAction *AboutAction;
  43. TAction *CleanUpAction;
  44. TAction *NewSessionAction;
  45. TPanel *MainPanel;
  46. TPageControl *PageControl;
  47. TTabSheet *SessionListSheet;
  48. TButton *LoadButton;
  49. TButton *DeleteButton;
  50. TTreeView *SessionTree;
  51. TButton *NewButton;
  52. TTabSheet *BasicSheet;
  53. TTabSheet *AdvancedSheet;
  54. TGroupBox *ProtocolGroup;
  55. TLabel *Label7;
  56. TRadioButton *SshProt1Button;
  57. TRadioButton *SshProt2Button;
  58. TCheckBox *CompressionCheck;
  59. TTabSheet *EnvironmentSheet;
  60. TTabSheet *ScpSheet;
  61. TGroupBox *OtherShellOptionsGroup;
  62. TCheckBox *LookupUserGroupsCheck;
  63. TCheckBox *ClearAliasesCheck;
  64. TCheckBox *UnsetNationalVarsCheck;
  65. TCheckBox *Scp1CompatibilityCheck;
  66. TGroupBox *ShellGroup;
  67. TComboBox *ShellEdit;
  68. TTabSheet *LogSheet;
  69. TLoggingFrame *LoggingFrame;
  70. TTabSheet *GeneralSheet;
  71. TLabel *Label13;
  72. TButton *PreferencesButton;
  73. TGeneralSettingsFrame *GeneralSettingsFrame;
  74. TPanel *LeftPanel;
  75. TTreeView *NavigationTree;
  76. TCheckBox *ShowAdvancedLoginOptionsCheck;
  77. TGroupBox *BasicGroup;
  78. TLabel *Label1;
  79. TLabel *Label2;
  80. TLabel *Label3;
  81. TLabel *Label4;
  82. TLabel *PrivateKeyLabel;
  83. TEdit *HostNameEdit;
  84. TEdit *UserNameEdit;
  85. TPasswordEdit *PasswordEdit;
  86. TUpDownEdit *PortNumberEdit;
  87. TFilenameEdit *PrivateKeyEdit;
  88. TTabSheet *ConnSheet;
  89. TGroupBox *TimeoutGroup;
  90. TLabel *Label11;
  91. TLabel *Label12;
  92. TUpDownEdit *TimeoutEdit;
  93. TTabSheet *ProxySheet;
  94. TGroupBox *ProxyTypeGroup;
  95. TLabel *ProxyHostLabel;
  96. TLabel *ProxyPortLabel;
  97. TUpDownEdit *ProxyPortEdit;
  98. TEdit *ProxyHostEdit;
  99. TEdit *ProxyUsernameEdit;
  100. TLabel *ProxyUsernameLabel;
  101. TLabel *ProxyPasswordLabel;
  102. TPasswordEdit *ProxyPasswordEdit;
  103. TGroupBox *ProxySettingsGroup;
  104. TLabel *ProxyTelnetCommandLabel;
  105. TEdit *ProxyTelnetCommandEdit;
  106. TTabSheet *BugsSheet;
  107. TGroupBox *BugsGroupBox;
  108. TLabel *BugIgnore1Label;
  109. TComboBox *BugIgnore1Combo;
  110. TLabel *BugPlainPW1Label;
  111. TComboBox *BugPlainPW1Combo;
  112. TLabel *BugRSA1Label;
  113. TComboBox *BugRSA1Combo;
  114. TLabel *BugHMAC2Label;
  115. TComboBox *BugHMAC2Combo;
  116. TLabel *BugDeriveKey2Label;
  117. TComboBox *BugDeriveKey2Combo;
  118. TLabel *BugRSAPad2Label;
  119. TComboBox *BugRSAPad2Combo;
  120. TRadioButton *SshProt1onlyButton;
  121. TRadioButton *SshProt2onlyButton;
  122. TTabSheet *AuthSheet;
  123. TGroupBox *AuthenticationGroup;
  124. TCheckBox *AuthTISCheck;
  125. TCheckBox *AuthKICheck;
  126. TGroupBox *EncryptionGroup;
  127. TListBox *CipherListBox;
  128. TLabel *Label8;
  129. TCheckBox *Ssh2LegacyDESCheck;
  130. TButton *CipherUpButton;
  131. TButton *CipherDownButton;
  132. TButton *SetDefaultSessionButton;
  133. TAction *SetDefaultSessionAction;
  134. TButton *ToolsMenuButton;
  135. TPopupMenu *ToolsPopupMenu;
  136. TMenuItem *Import1;
  137. TMenuItem *Cleanup1;
  138. TButton *ShellIconsButton;
  139. TAction *DesktopIconAction;
  140. TGroupBox *EnvironmentGroup;
  141. TGroupBox *TransferProtocolGroup;
  142. TPopupMenu *IconsPopupMenu;
  143. TMenuItem *Desktopicon1;
  144. TAction *SendToHookAction;
  145. TMenuItem *ExplorersSendtoshortcut1;
  146. TLabel *BugPKSessID2Label;
  147. TComboBox *BugPKSessID2Combo;
  148. TCheckBox *ProxyLocalhostCheck;
  149. TLabel *Label17;
  150. TAction *CheckForUpdatesAction;
  151. TMenuItem *CheckForUpdates1;
  152. TButton *SaveButton;
  153. TButton *LanguagesButton;
  154. TGroupBox *PingGroup;
  155. TLabel *PingIntervalLabel;
  156. TUpDownEdit *PingIntervalSecEdit;
  157. TRadioButton *PingOffButton;
  158. TRadioButton *PingNullPacketButton;
  159. TRadioButton *PingDummyCommandButton;
  160. TCheckBox *AuthKIPasswordCheck;
  161. TTabSheet *DirectoriesSheet;
  162. TGroupBox *DirectoriesGroup;
  163. TLabel *LocalDirectoryLabel;
  164. TLabel *RemoteDirectoryLabel;
  165. TLabel *LocalDirectoryDescLabel;
  166. TDirectoryEdit *LocalDirectoryEdit;
  167. TEdit *RemoteDirectoryEdit;
  168. TCheckBox *UpdateDirectoriesCheck;
  169. TCheckBox *CacheDirectoriesCheck;
  170. TCheckBox *ResolveSymlinksCheck;
  171. TCheckBox *CacheDirectoryChangesCheck;
  172. TCheckBox *PreserveDirectoryChangesCheck;
  173. TGroupBox *DSTModeGroup;
  174. TRadioButton *DSTModeUnixCheck;
  175. TRadioButton *DSTModeWinCheck;
  176. TCheckBox *AuthGSSAPICheck2;
  177. TGroupBox *ScpLsOptionsGroup;
  178. TCheckBox *IgnoreLsWarningsCheck;
  179. TCheckBox *SCPLsFullTimeAutoCheck;
  180. TTabSheet *SftpSheet;
  181. TGroupBox *SFTPBugsGroupBox;
  182. TLabel *Label10;
  183. TLabel *Label36;
  184. TComboBox *SFTPBugSymlinkCombo;
  185. TTabSheet *KexSheet;
  186. TGroupBox *KexOptionsGroup;
  187. TLabel *Label28;
  188. TListBox *KexListBox;
  189. TButton *KexUpButton;
  190. TButton *KexDownButton;
  191. TGroupBox *KexReexchangeGroup;
  192. TLabel *Label31;
  193. TUpDownEdit *RekeyTimeEdit;
  194. TLabel *Label32;
  195. TEdit *RekeyDataEdit;
  196. TGroupBox *IPvGroup;
  197. TRadioButton *IPAutoButton;
  198. TRadioButton *IPv4Button;
  199. TRadioButton *IPv6Button;
  200. TLabel *BugRekey2Label;
  201. TComboBox *BugRekey2Combo;
  202. TGroupBox *SFTPProtocolGroup;
  203. TLabel *Label34;
  204. TComboBox *SFTPMaxVersionCombo;
  205. TComboBox *SFTPBugSignedTSCombo;
  206. TButton *HelpButton;
  207. TButton *ColorButton;
  208. TPopupMenu *ColorPopupMenu;
  209. TMenuItem *ColorDefaultItem;
  210. TMenuItem *PickColorItem;
  211. TImageList *ColorImageList;
  212. TButton *RenameButton;
  213. TAction *RenameSessionAction;
  214. TGroupBox *DirectoryOptionsGroup;
  215. TTabSheet *TunnelSheet;
  216. TGroupBox *TunnelSessionGroup;
  217. TLabel *Label6;
  218. TLabel *Label14;
  219. TLabel *Label15;
  220. TLabel *Label16;
  221. TLabel *Label18;
  222. TEdit *TunnelHostNameEdit;
  223. TEdit *TunnelUserNameEdit;
  224. TPasswordEdit *TunnelPasswordEdit;
  225. TUpDownEdit *TunnelPortNumberEdit;
  226. TFilenameEdit *TunnelPrivateKeyEdit;
  227. TLabel *Label19;
  228. TComboBox *ReturnVarEdit;
  229. TLabel *Label20;
  230. TGroupBox *AuthenticationParamsGroup;
  231. TCheckBox *AgentFwdCheck;
  232. TCheckBox *TunnelCheck;
  233. TGroupBox *TunnelOptionsGroup;
  234. TLabel *Label21;
  235. TComboBox *TunnelLocalPortNumberEdit;
  236. TRadioButton *DSTModeKeepCheck;
  237. TComboBox *TransferProtocolCombo;
  238. TLabel *Label22;
  239. TCheckBox *AllowScpFallbackCheck;
  240. TGroupBox *ConnectionGroup;
  241. TCheckBox *FtpPasvModeCheck;
  242. TTabSheet *RecycleBinSheet;
  243. TGroupBox *RecycleBinGroup;
  244. TLabel *RecycleBinPathLabel;
  245. TCheckBox *DeleteToRecycleBinCheck;
  246. TCheckBox *OverwrittenToRecycleBinCheck;
  247. TEdit *RecycleBinPathEdit;
  248. TStaticText *RecycleBinLinkLabel;
  249. TLabel *EOLTypeLabel;
  250. TComboBox *EOLTypeCombo;
  251. TLabel *UtfLabel;
  252. TComboBox *UtfCombo;
  253. TLabel *TimeDifferenceLabel;
  254. TUpDownEdit *TimeDifferenceEdit;
  255. TLabel *TimeDifferenceHoursLabel;
  256. TUpDownEdit *TimeDifferenceMinutesEdit;
  257. TLabel *TimeDifferenceMinutesLabel;
  258. TLabel *EnvironmentOtherLabel;
  259. TAction *ShellIconSessionAction;
  260. TLabel *Label9;
  261. TComboBox *ListingCommandEdit;
  262. TCheckBox *SshNoUserAuthCheck;
  263. TCheckBox *TryAgentCheck;
  264. TLabel *ProxyMethodLabel;
  265. TComboBox *SshProxyMethodCombo;
  266. TComboBox *ProxyDNSCombo;
  267. TComboBox *FtpProxyMethodCombo;
  268. TLabel *ProxyLocalCommandLabel;
  269. TEdit *ProxyLocalCommandEdit;
  270. TButton *ProxyLocalCommandBrowseButton;
  271. TStaticText *ProxyTelnetCommandHintText;
  272. TStaticText *ProxyLocalCommandHintText;
  273. TImageList *SessionImageList;
  274. TButton *NewFolderButton;
  275. TAction *NewSessionFolderAction;
  276. TGroupBox *FtpPingGroup;
  277. TLabel *FtpPingIntervalLabel;
  278. TUpDownEdit *FtpPingIntervalSecEdit;
  279. TRadioButton *FtpPingOffButton;
  280. TRadioButton *FtpPingNullPacketButton;
  281. TRadioButton *FtpPingDummyCommandButton;
  282. TLabel *Label23;
  283. TComboBox *SftpServerEdit;
  284. TTabSheet *FtpSheet;
  285. TGroupBox *FtpGroup;
  286. TLabel *Label25;
  287. TMemo *PostLoginCommandsMemo;
  288. TLabel *BugMaxPkt2Label;
  289. TComboBox *BugMaxPkt2Combo;
  290. TComboBox *FtpsCombo;
  291. TLabel *Label5;
  292. TComboBox *FtpListAllCombo;
  293. TCheckBox *FtpForcePasvIpCheck;
  294. void __fastcall DataChange(TObject *Sender);
  295. void __fastcall FormShow(TObject *Sender);
  296. void __fastcall SessionTreeDblClick(TObject *Sender);
  297. void __fastcall SessionTreeKeyDown(TObject *Sender, WORD &Key,
  298. TShiftState Shift);
  299. void __fastcall EditSessionActionExecute(TObject *Sender);
  300. void __fastcall SaveSessionActionExecute(TObject *Sender);
  301. void __fastcall DeleteSessionActionExecute(TObject *Sender);
  302. void __fastcall ImportSessionsActionExecute(TObject *Sender);
  303. void __fastcall CleanUpActionExecute(TObject *Sender);
  304. void __fastcall AboutActionExecute(TObject *Sender);
  305. void __fastcall ActionListUpdate(TBasicAction *Action,
  306. bool &Handled);
  307. void __fastcall PreferencesButtonClick(TObject *Sender);
  308. void __fastcall NewSessionActionExecute(TObject *Sender);
  309. void __fastcall NavigationTreeChange(TObject *Sender, TTreeNode *Node);
  310. void __fastcall PageControlChange(TObject *Sender);
  311. void __fastcall AlgListBoxStartDrag(TObject *Sender,
  312. TDragObject *&DragObject);
  313. void __fastcall AlgListBoxDragOver(TObject *Sender, TObject *Source,
  314. int X, int Y, TDragState State, bool &Accept);
  315. void __fastcall AlgListBoxDragDrop(TObject *Sender, TObject *Source,
  316. int X, int Y);
  317. void __fastcall CipherButtonClick(TObject *Sender);
  318. void __fastcall SetDefaultSessionActionExecute(TObject *Sender);
  319. void __fastcall ToolsMenuButtonClick(TObject *Sender);
  320. void __fastcall DesktopIconActionExecute(TObject *Sender);
  321. void __fastcall SendToHookActionExecute(TObject *Sender);
  322. void __fastcall CheckForUpdatesActionExecute(TObject *Sender);
  323. void __fastcall LanguagesButtonClick(TObject *Sender);
  324. void __fastcall AuthGSSAPICheck2Click(TObject *Sender);
  325. void __fastcall KexButtonClick(TObject *Sender);
  326. void __fastcall HelpButtonClick(TObject *Sender);
  327. void __fastcall PrivateKeyEditAfterDialog(TObject *Sender,
  328. AnsiString &Name, bool &Action);
  329. void __fastcall FormCloseQuery(TObject *Sender, bool &CanClose);
  330. void __fastcall ColorButtonClick(TObject *Sender);
  331. void __fastcall ColorDefaultItemClick(TObject *Sender);
  332. void __fastcall PickColorItemClick(TObject *Sender);
  333. void __fastcall RenameSessionActionExecute(TObject * Sender);
  334. void __fastcall PathEditBeforeDialog(TObject *Sender, AnsiString &Name,
  335. bool &Action);
  336. void __fastcall TransferProtocolComboChange(TObject *Sender);
  337. void __fastcall NavigationTreeCollapsing(TObject *Sender,
  338. TTreeNode *Node, bool &AllowCollapse);
  339. void __fastcall RecycleBinLinkLabelClick(TObject *Sender);
  340. void __fastcall ShellIconSessionActionExecute(TObject *Sender);
  341. void __fastcall ProxyLocalCommandBrowseButtonClick(TObject *Sender);
  342. void __fastcall SessionTreeChange(TObject *Sender, TTreeNode *Node);
  343. void __fastcall SessionTreeEdited(TObject *Sender, TTreeNode *Node,
  344. AnsiString &S);
  345. void __fastcall SessionTreeEditing(TObject *Sender, TTreeNode *Node,
  346. bool &AllowEdit);
  347. void __fastcall SessionTreeCustomDrawItem(TCustomTreeView *Sender,
  348. TTreeNode *Node, TCustomDrawState State, bool &DefaultDraw);
  349. void __fastcall SessionTreeExpandedCollapsed(TObject *Sender, TTreeNode *Node);
  350. void __fastcall SessionTreeCompare(TObject *Sender, TTreeNode *Node1,
  351. TTreeNode *Node2, int Data, int &Compare);
  352. void __fastcall NewSessionFolderActionExecute(TObject *Sender);
  353. void __fastcall SessionTreeStartDrag(TObject *Sender,
  354. TDragObject *&DragObject);
  355. void __fastcall SessionTreeDragDrop(TObject *Sender, TObject *Source,
  356. int X, int Y);
  357. void __fastcall SessionTreeMouseMove(TObject *Sender, TShiftState Shift,
  358. int X, int Y);
  359. void __fastcall SessionTreeEndDrag(TObject *Sender, TObject *Target,
  360. int X, int Y);
  361. private:
  362. int NoUpdate;
  363. TSessionData * FSessionData;
  364. TSessionData * FEditingSessionData;
  365. TStoredSessionList * FStoredSessions;
  366. int FAlgDragSource, FAlgDragDest;
  367. int FOptions;
  368. TPopupMenu * FLanguagesPopupMenu;
  369. AnsiString FOrigCaption;
  370. bool FInitialized;
  371. TTabSheet * FSavedTab;
  372. int FSavedSession;
  373. bool FLocaleChanging;
  374. void * FSystemSettings;
  375. AnsiString FCurrentSessionName;
  376. TColor FColor;
  377. AnsiString FBeforeDialogPath;
  378. TStringList * FTreeLabels;
  379. bool FRecycleBinSheetVisible;
  380. TWndMethod FOldSessionTreeProc;
  381. TTreeNode * FHintNode;
  382. TTreeViewScrollOnDragOver * FScrollOnDragOver;
  383. int FDefaultPort;
  384. void __fastcall LoadSession(TSessionData * aSessionData);
  385. void __fastcall UpdateControls();
  386. void __fastcall SetSessionData(TSessionData * value);
  387. TSessionData * __fastcall GetSessionData();
  388. void __fastcall SaveSession(TSessionData * aStoredSession);
  389. void __fastcall LoadSessions();
  390. TSessionData * __fastcall GetSelectedSession();
  391. void __fastcall CMDialogKey(TWMKeyDown & Message);
  392. void __fastcall WMHelp(TWMHelp & Message);
  393. int __fastcall FSProtocolToIndex(TFSProtocol FSProtocol, bool & AllowScpFallback);
  394. TFSProtocol __fastcall IndexToFSProtocol(int Index, bool AllowScpFallback);
  395. int __fastcall LastSupportedFtpProxyMethod();
  396. bool __fastcall SupportedFtpProxyMethod(int Method);
  397. TProxyMethod __fastcall GetProxyMethod();
  398. int __fastcall GetFtpProxyLogonType();
  399. void __fastcall UpdateNavigationTree();
  400. void __fastcall UpdateTree(TTreeNode * ANode, bool Recursive);
  401. void __fastcall UpdateFolderNode(TTreeNode * Node);
  402. TTreeNode * __fastcall AddSession(TSessionData * Data);
  403. TTreeNode * __fastcall AddSessionPath(AnsiString Path);
  404. void __fastcall DestroySession(TSessionData * Data);
  405. void __fastcall CheckDuplicateFolder(TTreeNode * Parent, AnsiString Text,
  406. TTreeNode * Node);
  407. void __fastcall NewSessionFolderInputDialogInitialize(
  408. TObject * Sender, TInputDialogData * Data);
  409. AnsiString __fastcall SessionNodePath(TTreeNode * Node);
  410. TTreeNode * __fastcall SessionFolderNode(TTreeNode * Node);
  411. TTreeNode * __fastcall CurrentSessionFolderNode();
  412. void __fastcall SessionTreeProc(TMessage & Message);
  413. bool __fastcall SessionAllowDrop(TTreeNode * DropTarget);
  414. int __fastcall DefaultPort();
  415. void __fastcall MasterPasswordRecrypt(TObject * Sender);
  416. protected:
  417. void __fastcall Default();
  418. void __fastcall LoadConfiguration();
  419. void __fastcall SaveConfiguration();
  420. void __fastcall LoadState();
  421. void __fastcall SaveState();
  422. void __fastcall ShowPreferencesDialog();
  423. void __fastcall ChangePage(TTabSheet * Tab);
  424. virtual void __fastcall Dispatch(void * Message);
  425. bool __fastcall AllowAlgDrag(TListBox * AlgListBox, int X, int Y);
  426. void __fastcall AlgMove(TListBox * AlgListBox, int Source, int Dest);
  427. void __fastcall LocaleClick(TObject * Sender);
  428. void __fastcall LocaleGetClick(TObject * Sender);
  429. void __fastcall Init();
  430. void __fastcall InitControls();
  431. void __fastcall VerifyKey(AnsiString FileName, bool TypeOnly);
  432. void __fastcall EditSession();
  433. __property TSessionData * SelectedSession = { read=GetSelectedSession };
  434. public:
  435. virtual __fastcall TLoginDialog(TComponent* AOwner);
  436. __fastcall ~TLoginDialog();
  437. void __fastcall Init(TStoredSessionList *SessionList, int Options);
  438. bool __fastcall Execute(TSessionData *& Data);
  439. };
  440. //----------------------------------------------------------------------------
  441. #endif