SessionData.h 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758
  1. //---------------------------------------------------------------------------
  2. #ifndef SessionDataH
  3. #define SessionDataH
  4. #include "Common.h"
  5. #include "Option.h"
  6. #include "FileBuffer.h"
  7. #include "NamedObjs.h"
  8. #include "HierarchicalStorage.h"
  9. #include "Configuration.h"
  10. #include <Xml.XMLIntf.hpp>
  11. //---------------------------------------------------------------------------
  12. enum TCipher { cipWarn, cip3DES, cipBlowfish, cipAES, cipDES, cipArcfour, cipChaCha20 };
  13. #define CIPHER_COUNT (cipChaCha20+1)
  14. // explicit values to skip obsoleted fsExternalSSH, fsExternalSFTP
  15. enum TFSProtocol { fsSCPonly = 0, fsSFTP = 1, fsSFTPonly = 2, fsFTP = 5, fsWebDAV = 6, fsS3 = 7 };
  16. #define FSPROTOCOL_COUNT (fsS3+1)
  17. extern const wchar_t * ProxyMethodNames;
  18. enum TProxyMethod { pmNone, pmSocks4, pmSocks5, pmHTTP, pmTelnet, pmCmd };
  19. enum TSshProt { ssh1only, ssh1deprecated, ssh2deprecated, ssh2only };
  20. enum TKex { kexWarn, kexDHGroup1, kexDHGroup14, kexDHGEx, kexRSA, kexECDH };
  21. #define KEX_COUNT (kexECDH+1)
  22. enum THostKey { hkWarn, hkRSA, hkDSA, hkECDSA, hkED25519, hkMax };
  23. #define HOSTKEY_COUNT (hkMax)
  24. enum TGssLib { gssGssApi32, gssSspi, gssCustom };
  25. #define GSSLIB_COUNT (gssCustom+1)
  26. // names have to match PuTTY registry entries (see settings.c)
  27. enum TSshBug { sbIgnore1, sbPlainPW1, sbRSA1, sbHMAC2, sbDeriveKey2, sbRSAPad2,
  28. sbPKSessID2, sbRekey2, sbMaxPkt2, sbIgnore2, sbOldGex2, sbWinAdj, sbChanReq };
  29. #define BUG_COUNT (sbChanReq+1)
  30. enum TSftpBug { sbSymlink, sbSignedTS };
  31. #define SFTP_BUG_COUNT (sbSignedTS+1)
  32. extern const wchar_t * PingTypeNames;
  33. enum TPingType { ptOff, ptNullPacket, ptDummyCommand };
  34. enum TAddressFamily { afAuto, afIPv4, afIPv6 };
  35. enum TFtps { ftpsNone, ftpsImplicit, ftpsExplicitSsl, ftpsExplicitTls };
  36. // has to match SSL_VERSION_XXX constants in AsyncSslSocketLayer.h
  37. // ssl2 has no effect now
  38. enum TTlsVersion { ssl2 = 2, ssl3 = 3, tls10 = 10, tls11 = 11, tls12 = 12 };
  39. // has to match libs3 S3UriStyle
  40. enum TS3UrlStyle { s3usVirtualHost, s3usPath };
  41. enum TSessionSource { ssNone, ssStored, ssStoredModified };
  42. enum TSessionUrlFlags
  43. {
  44. sufSpecific = 0x01,
  45. sufUserName = 0x02,
  46. sufPassword = 0x04,
  47. sufHostKey = 0x08,
  48. sufRawSettings = 0x10,
  49. sufHttpForWebDAV = 0x20,
  50. sufSession = sufUserName | sufPassword | sufHostKey,
  51. sufComplete = sufSession | sufRawSettings,
  52. sufOpen = sufUserName | sufPassword
  53. };
  54. enum TParseUrlFlags
  55. {
  56. pufAllowStoredSiteWithProtocol = 0x01,
  57. };
  58. //---------------------------------------------------------------------------
  59. extern const UnicodeString CipherNames[CIPHER_COUNT];
  60. extern const UnicodeString KexNames[KEX_COUNT];
  61. extern const UnicodeString HostKeyNames[HOSTKEY_COUNT];
  62. extern const UnicodeString GssLibNames[GSSLIB_COUNT];
  63. extern const wchar_t SshProtList[][10];
  64. extern const TCipher DefaultCipherList[CIPHER_COUNT];
  65. extern const TKex DefaultKexList[KEX_COUNT];
  66. extern const THostKey DefaultHostKeyList[HOSTKEY_COUNT];
  67. extern const TGssLib DefaultGssLibList[GSSLIB_COUNT];
  68. extern const wchar_t FSProtocolNames[FSPROTOCOL_COUNT][16];
  69. extern const int DefaultSendBuf;
  70. extern const UnicodeString AnonymousUserName;
  71. extern const UnicodeString AnonymousPassword;
  72. extern const int SshPortNumber;
  73. extern const int FtpPortNumber;
  74. extern const int FtpsImplicitPortNumber;
  75. extern const int HTTPPortNumber;
  76. extern const int HTTPSPortNumber;
  77. extern const int TelnetPortNumber;
  78. extern const int ProxyPortNumber;
  79. extern const UnicodeString PuttySshProtocol;
  80. extern const UnicodeString PuttyTelnetProtocol;
  81. extern const UnicodeString SftpProtocol;
  82. extern const UnicodeString ScpProtocol;
  83. extern const UnicodeString FtpProtocol;
  84. extern const UnicodeString FtpsProtocol;
  85. extern const UnicodeString FtpesProtocol;
  86. extern const UnicodeString WebDAVProtocol;
  87. extern const UnicodeString WebDAVSProtocol;
  88. extern const UnicodeString S3Protocol;
  89. extern const UnicodeString SshProtocol;
  90. extern const UnicodeString WinSCPProtocolPrefix;
  91. extern const wchar_t UrlParamSeparator;
  92. extern const wchar_t UrlParamValueSeparator;
  93. extern const UnicodeString UrlHostKeyParamName;
  94. extern const UnicodeString UrlSaveParamName;
  95. extern const UnicodeString PassphraseOption;
  96. extern const UnicodeString S3HostName;
  97. //---------------------------------------------------------------------------
  98. class TStoredSessionList;
  99. //---------------------------------------------------------------------------
  100. class TSessionData : public TNamedObject
  101. {
  102. friend class TStoredSessionList;
  103. private:
  104. UnicodeString FHostName;
  105. int FPortNumber;
  106. UnicodeString FUserName;
  107. RawByteString FPassword;
  108. RawByteString FNewPassword;
  109. bool FChangePassword;
  110. int FPingInterval;
  111. TPingType FPingType;
  112. bool FTryAgent;
  113. bool FAgentFwd;
  114. UnicodeString FListingCommand;
  115. bool FAuthTIS;
  116. bool FAuthKI;
  117. bool FAuthKIPassword;
  118. bool FAuthGSSAPI;
  119. bool FGSSAPIFwdTGT;
  120. bool FChangeUsername;
  121. bool FCompression;
  122. TSshProt FSshProt;
  123. bool FSsh2DES;
  124. bool FSshNoUserAuth;
  125. TCipher FCiphers[CIPHER_COUNT];
  126. TKex FKex[KEX_COUNT];
  127. THostKey FHostKeys[HOSTKEY_COUNT];
  128. TGssLib FGssLib[GSSLIB_COUNT];
  129. UnicodeString FGssLibCustom;
  130. bool FClearAliases;
  131. TEOLType FEOLType;
  132. bool FTrimVMSVersions;
  133. UnicodeString FPublicKeyFile;
  134. UnicodeString FPassphrase;
  135. UnicodeString FPuttyProtocol;
  136. TFSProtocol FFSProtocol;
  137. bool FModified;
  138. UnicodeString FLocalDirectory;
  139. UnicodeString FRemoteDirectory;
  140. bool FLockInHome;
  141. bool FSpecial;
  142. bool FSynchronizeBrowsing;
  143. bool FUpdateDirectories;
  144. bool FCacheDirectories;
  145. bool FCacheDirectoryChanges;
  146. bool FPreserveDirectoryChanges;
  147. bool FSelected;
  148. TAutoSwitch FLookupUserGroups;
  149. UnicodeString FReturnVar;
  150. bool FExitCode1IsError;
  151. bool FScp1Compatibility;
  152. UnicodeString FShell;
  153. UnicodeString FSftpServer;
  154. int FTimeout;
  155. bool FUnsetNationalVars;
  156. bool FIgnoreLsWarnings;
  157. bool FTcpNoDelay;
  158. int FSendBuf;
  159. UnicodeString FSourceAddress;
  160. bool FSshSimple;
  161. TProxyMethod FProxyMethod;
  162. UnicodeString FProxyHost;
  163. int FProxyPort;
  164. UnicodeString FProxyUsername;
  165. RawByteString FProxyPassword;
  166. UnicodeString FProxyTelnetCommand;
  167. UnicodeString FProxyLocalCommand;
  168. TAutoSwitch FProxyDNS;
  169. bool FProxyLocalhost;
  170. int FFtpProxyLogonType;
  171. TAutoSwitch FBugs[BUG_COUNT];
  172. UnicodeString FPuttySettings;
  173. UnicodeString FCustomParam1;
  174. UnicodeString FCustomParam2;
  175. bool FResolveSymlinks;
  176. bool FFollowDirectorySymlinks;
  177. TDateTime FTimeDifference;
  178. bool FTimeDifferenceAuto;
  179. int FSFTPDownloadQueue;
  180. int FSFTPUploadQueue;
  181. int FSFTPListingQueue;
  182. int FSFTPMaxVersion;
  183. unsigned long FSFTPMaxPacketSize;
  184. TDSTMode FDSTMode;
  185. TAutoSwitch FSFTPBugs[SFTP_BUG_COUNT];
  186. bool FDeleteToRecycleBin;
  187. bool FOverwrittenToRecycleBin;
  188. UnicodeString FRecycleBinPath;
  189. UnicodeString FPostLoginCommands;
  190. TAutoSwitch FSCPLsFullTime;
  191. TAutoSwitch FFtpListAll;
  192. TAutoSwitch FFtpHost;
  193. TAutoSwitch FFtpDeleteFromCwd;
  194. bool FSslSessionReuse;
  195. UnicodeString FTlsCertificateFile;
  196. TAddressFamily FAddressFamily;
  197. UnicodeString FRekeyData;
  198. unsigned int FRekeyTime;
  199. int FColor;
  200. bool FTunnel;
  201. UnicodeString FTunnelHostName;
  202. int FTunnelPortNumber;
  203. UnicodeString FTunnelUserName;
  204. RawByteString FTunnelPassword;
  205. UnicodeString FTunnelPublicKeyFile;
  206. int FTunnelLocalPortNumber;
  207. UnicodeString FTunnelPortFwd;
  208. UnicodeString FTunnelHostKey;
  209. bool FFtpPasvMode;
  210. TAutoSwitch FFtpForcePasvIp;
  211. TAutoSwitch FFtpUseMlsd;
  212. UnicodeString FFtpAccount;
  213. int FFtpPingInterval;
  214. TPingType FFtpPingType;
  215. TAutoSwitch FFtpTransferActiveImmediately;
  216. TFtps FFtps;
  217. TTlsVersion FMinTlsVersion;
  218. TTlsVersion FMaxTlsVersion;
  219. TAutoSwitch FNotUtf;
  220. int FInternalEditorEncoding;
  221. UnicodeString FS3DefaultRegion;
  222. TS3UrlStyle FS3UrlStyle;
  223. bool FIsWorkspace;
  224. UnicodeString FLink;
  225. UnicodeString FNameOverride;
  226. UnicodeString FHostKey;
  227. bool FFingerprintScan;
  228. bool FOverrideCachedHostKey;
  229. UnicodeString FNote;
  230. UnicodeString FWinTitle;
  231. RawByteString FEncryptKey;
  232. UnicodeString FOrigHostName;
  233. int FOrigPortNumber;
  234. TProxyMethod FOrigProxyMethod;
  235. TSessionSource FSource;
  236. bool FSaveOnly;
  237. UnicodeString FLogicalHostName;
  238. void __fastcall SetHostName(UnicodeString value);
  239. UnicodeString __fastcall GetHostNameExpanded();
  240. void __fastcall SetPortNumber(int value);
  241. void __fastcall SetUserName(UnicodeString value);
  242. UnicodeString __fastcall GetUserNameExpanded();
  243. void __fastcall SetPassword(UnicodeString value);
  244. UnicodeString __fastcall GetPassword() const;
  245. void __fastcall SetNewPassword(UnicodeString value);
  246. UnicodeString __fastcall GetNewPassword() const;
  247. void __fastcall SetChangePassword(bool value);
  248. void __fastcall SetPingInterval(int value);
  249. void __fastcall SetTryAgent(bool value);
  250. void __fastcall SetAgentFwd(bool value);
  251. void __fastcall SetAuthTIS(bool value);
  252. void __fastcall SetAuthKI(bool value);
  253. void __fastcall SetAuthKIPassword(bool value);
  254. void __fastcall SetAuthGSSAPI(bool value);
  255. void __fastcall SetGSSAPIFwdTGT(bool value);
  256. void __fastcall SetChangeUsername(bool value);
  257. void __fastcall SetCompression(bool value);
  258. void __fastcall SetSshProt(TSshProt value);
  259. void __fastcall SetSsh2DES(bool value);
  260. void __fastcall SetSshNoUserAuth(bool value);
  261. void __fastcall SetCipher(int Index, TCipher value);
  262. TCipher __fastcall GetCipher(int Index) const;
  263. void __fastcall SetKex(int Index, TKex value);
  264. TKex __fastcall GetKex(int Index) const;
  265. void __fastcall SetHostKeys(int Index, THostKey value);
  266. THostKey __fastcall GetHostKeys(int Index) const;
  267. void __fastcall SetGssLib(int Index, TGssLib value);
  268. TGssLib __fastcall GetGssLib(int Index) const;
  269. void __fastcall SetGssLibCustom(UnicodeString value);
  270. void __fastcall SetPublicKeyFile(UnicodeString value);
  271. UnicodeString __fastcall GetPassphrase() const;
  272. void __fastcall SetPassphrase(UnicodeString value);
  273. void __fastcall SetPuttyProtocol(UnicodeString value);
  274. bool __fastcall GetCanLogin();
  275. void __fastcall SetPingIntervalDT(TDateTime value);
  276. TDateTime __fastcall GetPingIntervalDT();
  277. TDateTime __fastcall GetFtpPingIntervalDT();
  278. void __fastcall SetTimeDifference(TDateTime value);
  279. void __fastcall SetTimeDifferenceAuto(bool value);
  280. void __fastcall SetPingType(TPingType value);
  281. UnicodeString __fastcall GetSessionName();
  282. UnicodeString __fastcall GetDefaultSessionName();
  283. UnicodeString __fastcall GetProtocolUrl(bool HttpForWebDAV);
  284. void __fastcall SetFSProtocol(TFSProtocol value);
  285. UnicodeString __fastcall GetFSProtocolStr();
  286. void __fastcall SetLocalDirectory(UnicodeString value);
  287. UnicodeString __fastcall GetLocalDirectoryExpanded();
  288. void __fastcall SetRemoteDirectory(UnicodeString value);
  289. void __fastcall SetSynchronizeBrowsing(bool value);
  290. void __fastcall SetUpdateDirectories(bool value);
  291. void __fastcall SetCacheDirectories(bool value);
  292. void __fastcall SetCacheDirectoryChanges(bool value);
  293. void __fastcall SetPreserveDirectoryChanges(bool value);
  294. void __fastcall SetLockInHome(bool value);
  295. void __fastcall SetSpecial(bool value);
  296. UnicodeString __fastcall GetInfoTip();
  297. bool __fastcall GetDefaultShell();
  298. void __fastcall SetDetectReturnVar(bool value);
  299. bool __fastcall GetDetectReturnVar();
  300. void __fastcall SetListingCommand(UnicodeString value);
  301. void __fastcall SetClearAliases(bool value);
  302. void __fastcall SetDefaultShell(bool value);
  303. void __fastcall SetEOLType(TEOLType value);
  304. void __fastcall SetTrimVMSVersions(bool value);
  305. void __fastcall SetLookupUserGroups(TAutoSwitch value);
  306. void __fastcall SetReturnVar(UnicodeString value);
  307. void __fastcall SetExitCode1IsError(bool value);
  308. void __fastcall SetScp1Compatibility(bool value);
  309. void __fastcall SetShell(UnicodeString value);
  310. void __fastcall SetSftpServer(UnicodeString value);
  311. void __fastcall SetTimeout(int value);
  312. void __fastcall SetUnsetNationalVars(bool value);
  313. void __fastcall SetIgnoreLsWarnings(bool value);
  314. void __fastcall SetTcpNoDelay(bool value);
  315. void __fastcall SetSendBuf(int value);
  316. void __fastcall SetSourceAddress(const UnicodeString & value);
  317. void __fastcall SetSshSimple(bool value);
  318. UnicodeString __fastcall GetSshProtStr();
  319. bool __fastcall GetUsesSsh();
  320. void __fastcall SetCipherList(UnicodeString value);
  321. UnicodeString __fastcall GetCipherList() const;
  322. void __fastcall SetKexList(UnicodeString value);
  323. UnicodeString __fastcall GetKexList() const;
  324. void __fastcall SetHostKeyList(UnicodeString value);
  325. UnicodeString __fastcall GetHostKeyList() const;
  326. void __fastcall SetGssLibList(UnicodeString value);
  327. UnicodeString __fastcall GetGssLibList() const;
  328. void __fastcall SetProxyMethod(TProxyMethod value);
  329. void __fastcall SetProxyHost(UnicodeString value);
  330. void __fastcall SetProxyPort(int value);
  331. void __fastcall SetProxyUsername(UnicodeString value);
  332. void __fastcall SetProxyPassword(UnicodeString value);
  333. void __fastcall SetProxyTelnetCommand(UnicodeString value);
  334. void __fastcall SetProxyLocalCommand(UnicodeString value);
  335. void __fastcall SetProxyDNS(TAutoSwitch value);
  336. void __fastcall SetProxyLocalhost(bool value);
  337. UnicodeString __fastcall GetProxyPassword() const;
  338. void __fastcall SetFtpProxyLogonType(int value);
  339. void __fastcall SetBug(TSshBug Bug, TAutoSwitch value);
  340. TAutoSwitch __fastcall GetBug(TSshBug Bug) const;
  341. UnicodeString __fastcall GetSessionKey();
  342. void __fastcall SetPuttySettings(UnicodeString value);
  343. void __fastcall SetCustomParam1(UnicodeString value);
  344. void __fastcall SetCustomParam2(UnicodeString value);
  345. void __fastcall SetResolveSymlinks(bool value);
  346. void __fastcall SetFollowDirectorySymlinks(bool value);
  347. void __fastcall SetSFTPDownloadQueue(int value);
  348. void __fastcall SetSFTPUploadQueue(int value);
  349. void __fastcall SetSFTPListingQueue(int value);
  350. void __fastcall SetSFTPMaxVersion(int value);
  351. void __fastcall SetSFTPMaxPacketSize(unsigned long value);
  352. void __fastcall SetSFTPBug(TSftpBug Bug, TAutoSwitch value);
  353. TAutoSwitch __fastcall GetSFTPBug(TSftpBug Bug) const;
  354. void __fastcall SetSCPLsFullTime(TAutoSwitch value);
  355. void __fastcall SetFtpListAll(TAutoSwitch value);
  356. void __fastcall SetFtpHost(TAutoSwitch value);
  357. void __fastcall SetFtpDeleteFromCwd(TAutoSwitch value);
  358. void __fastcall SetSslSessionReuse(bool value);
  359. void __fastcall SetTlsCertificateFile(UnicodeString value);
  360. UnicodeString __fastcall GetStorageKey();
  361. UnicodeString __fastcall GetInternalStorageKey();
  362. UnicodeString __fastcall GetSiteKey();
  363. void __fastcall SetDSTMode(TDSTMode value);
  364. void __fastcall SetDeleteToRecycleBin(bool value);
  365. void __fastcall SetOverwrittenToRecycleBin(bool value);
  366. void __fastcall SetRecycleBinPath(UnicodeString value);
  367. void __fastcall SetPostLoginCommands(UnicodeString value);
  368. void __fastcall SetAddressFamily(TAddressFamily value);
  369. void __fastcall SetRekeyData(UnicodeString value);
  370. void __fastcall SetRekeyTime(unsigned int value);
  371. void __fastcall SetColor(int value);
  372. void __fastcall SetTunnel(bool value);
  373. void __fastcall SetTunnelHostName(UnicodeString value);
  374. void __fastcall SetTunnelPortNumber(int value);
  375. void __fastcall SetTunnelUserName(UnicodeString value);
  376. void __fastcall SetTunnelPassword(UnicodeString value);
  377. UnicodeString __fastcall GetTunnelPassword() const;
  378. void __fastcall SetTunnelPublicKeyFile(UnicodeString value);
  379. void __fastcall SetTunnelPortFwd(UnicodeString value);
  380. void __fastcall SetTunnelLocalPortNumber(int value);
  381. bool __fastcall GetTunnelAutoassignLocalPortNumber();
  382. void __fastcall SetTunnelHostKey(UnicodeString value);
  383. void __fastcall SetFtpPasvMode(bool value);
  384. void __fastcall SetFtpForcePasvIp(TAutoSwitch value);
  385. void __fastcall SetFtpUseMlsd(TAutoSwitch value);
  386. void __fastcall SetFtpAccount(UnicodeString value);
  387. void __fastcall SetFtpPingInterval(int value);
  388. void __fastcall SetFtpPingType(TPingType value);
  389. void __fastcall SetFtpTransferActiveImmediately(TAutoSwitch value);
  390. void __fastcall SetFtps(TFtps value);
  391. void __fastcall SetMinTlsVersion(TTlsVersion value);
  392. void __fastcall SetMaxTlsVersion(TTlsVersion value);
  393. void __fastcall SetNotUtf(TAutoSwitch value);
  394. void __fastcall SetInternalEditorEncoding(int value);
  395. void __fastcall SetS3DefaultRegion(UnicodeString value);
  396. void __fastcall SetS3UrlStyle(TS3UrlStyle value);
  397. void __fastcall SetLogicalHostName(UnicodeString value);
  398. void __fastcall SetIsWorkspace(bool value);
  399. void __fastcall SetLink(UnicodeString value);
  400. void __fastcall SetNameOverride(UnicodeString value);
  401. void __fastcall SetHostKey(UnicodeString value);
  402. void __fastcall SetNote(UnicodeString value);
  403. void __fastcall SetWinTitle(UnicodeString value);
  404. UnicodeString __fastcall GetEncryptKey() const;
  405. void __fastcall SetEncryptKey(UnicodeString value);
  406. TDateTime __fastcall GetTimeoutDT();
  407. void __fastcall SavePasswords(THierarchicalStorage * Storage, bool PuttyExport, bool DoNotEncryptPasswords, bool SaveAll);
  408. UnicodeString __fastcall GetLocalName();
  409. UnicodeString __fastcall GetFolderName();
  410. void __fastcall Modify();
  411. UnicodeString __fastcall GetSource();
  412. void __fastcall DoLoad(THierarchicalStorage * Storage, bool PuttyImport, bool & RewritePassword);
  413. void __fastcall DoSave(THierarchicalStorage * Storage,
  414. bool PuttyExport, const TSessionData * Default, bool DoNotEncryptPasswords);
  415. UnicodeString __fastcall ReadXmlNode(_di_IXMLNode Node, const UnicodeString & Name, const UnicodeString & Default);
  416. int __fastcall ReadXmlNode(_di_IXMLNode Node, const UnicodeString & Name, int Default);
  417. _di_IXMLNode __fastcall FindSettingsNode(_di_IXMLNode Node, const UnicodeString & Name);
  418. UnicodeString __fastcall ReadSettingsNode(_di_IXMLNode Node, const UnicodeString & Name, const UnicodeString & Default);
  419. int __fastcall ReadSettingsNode(_di_IXMLNode Node, const UnicodeString & Name, int Default);
  420. bool __fastcall IsSame(const TSessionData * Default, bool AdvancedOnly, TStrings * DifferentProperties, bool Decrypted);
  421. UnicodeString __fastcall GetNameWithoutHiddenPrefix();
  422. bool __fastcall HasStateData();
  423. void __fastcall CopyStateData(TSessionData * SourceData);
  424. void __fastcall CopyNonCoreData(TSessionData * SourceData);
  425. UnicodeString __fastcall GetNormalizedPuttyProtocol() const;
  426. static RawByteString __fastcall EncryptPassword(const UnicodeString & Password, UnicodeString Key);
  427. static UnicodeString __fastcall DecryptPassword(const RawByteString & Password, UnicodeString Key);
  428. static RawByteString __fastcall StronglyRecryptPassword(const RawByteString & Password, UnicodeString Key);
  429. static bool __fastcall DoIsProtocolUrl(const UnicodeString & Url, const UnicodeString & Protocol, int & ProtocolLen);
  430. static bool __fastcall IsProtocolUrl(const UnicodeString & Url, const UnicodeString & Protocol, int & ProtocolLen);
  431. static void __fastcall AddSwitch(UnicodeString & Result, const UnicodeString & Name, bool Rtf);
  432. static void __fastcall AddSwitch(
  433. UnicodeString & Result, const UnicodeString & Name, const UnicodeString & Value, bool Rtf);
  434. static void __fastcall AddSwitch(UnicodeString & Result, const UnicodeString & Name, int Value, bool Rtf);
  435. static void __fastcall AddAssemblyProperty(
  436. UnicodeString & Result, TAssemblyLanguage Language,
  437. const UnicodeString & Name, const UnicodeString & Value);
  438. static void __fastcall AddAssemblyProperty(
  439. UnicodeString & Result, TAssemblyLanguage Language,
  440. const UnicodeString & Name, const UnicodeString & Type,
  441. const UnicodeString & Member);
  442. static void __fastcall AddAssemblyProperty(
  443. UnicodeString & Result, TAssemblyLanguage Language,
  444. const UnicodeString & Name, int Value);
  445. void __fastcall AddAssemblyProperty(
  446. UnicodeString & Result, TAssemblyLanguage Language,
  447. const UnicodeString & Name, bool Value);
  448. TStrings * __fastcall GetRawSettingsForUrl();
  449. void __fastcall DoCopyData(TSessionData * SourceData, bool NoRecrypt);
  450. template<class AlgoT>
  451. void __fastcall SetAlgoList(AlgoT * List, const AlgoT * DefaultList, const UnicodeString * Names,
  452. int Count, AlgoT WarnAlgo, UnicodeString value);
  453. static void __fastcall Remove(THierarchicalStorage * Storage, const UnicodeString & Name);
  454. __property UnicodeString InternalStorageKey = { read = GetInternalStorageKey };
  455. public:
  456. __fastcall TSessionData(UnicodeString aName);
  457. virtual __fastcall ~TSessionData();
  458. TSessionData * __fastcall Clone();
  459. void __fastcall Default();
  460. void __fastcall DefaultSettings();
  461. void __fastcall NonPersistant();
  462. void __fastcall Load(THierarchicalStorage * Storage, bool PuttyImport);
  463. void __fastcall ApplyRawSettings(TStrings * RawSettings);
  464. void __fastcall ApplyRawSettings(THierarchicalStorage * Storage);
  465. void __fastcall ImportFromFilezilla(_di_IXMLNode Node, const UnicodeString & Path, _di_IXMLNode SettingsNode);
  466. void __fastcall Save(THierarchicalStorage * Storage, bool PuttyExport,
  467. const TSessionData * Default = NULL);
  468. void __fastcall SaveRecryptedPasswords(THierarchicalStorage * Storage);
  469. void __fastcall RecryptPasswords();
  470. bool __fastcall HasPassword();
  471. bool __fastcall HasAnySessionPassword();
  472. bool __fastcall HasAnyPassword();
  473. void __fastcall ClearSessionPasswords();
  474. void __fastcall MaskPasswords();
  475. void __fastcall Remove();
  476. void __fastcall CacheHostKeyIfNotCached();
  477. virtual void __fastcall Assign(TPersistent * Source);
  478. virtual int __fastcall Compare(TNamedObject * Other);
  479. void __fastcall CopyData(TSessionData * Source);
  480. void __fastcall CopyDataNoRecrypt(TSessionData * SourceData);
  481. void __fastcall CopyDirectoriesStateData(TSessionData * SourceData);
  482. bool __fastcall ParseUrl(UnicodeString Url, TOptions * Options,
  483. TStoredSessionList * StoredSessions, bool & DefaultsOnly,
  484. UnicodeString * FileName, bool * AProtocolDefined, UnicodeString * MaskedUrl, int Flags);
  485. TStrings * __fastcall SaveToOptions(const TSessionData * Default, bool SaveName, bool PuttyExport);
  486. void __fastcall ConfigureTunnel(int PortNumber);
  487. void __fastcall RollbackTunnel();
  488. void __fastcall ExpandEnvironmentVariables();
  489. void __fastcall DisableAuthentationsExceptPassword();
  490. bool __fastcall IsSame(const TSessionData * Default, bool AdvancedOnly);
  491. bool __fastcall IsSameDecrypted(const TSessionData * Default);
  492. bool __fastcall IsSameSite(const TSessionData * Default);
  493. bool __fastcall IsInFolderOrWorkspace(UnicodeString Name);
  494. UnicodeString __fastcall GenerateSessionUrl(unsigned int Flags);
  495. bool __fastcall HasRawSettingsForUrl();
  496. bool __fastcall HasSessionName();
  497. UnicodeString __fastcall GenerateOpenCommandArgs(bool Rtf);
  498. void __fastcall GenerateAssemblyCode(TAssemblyLanguage Language, UnicodeString & Head, UnicodeString & Tail, int & Indent);
  499. void __fastcall LookupLastFingerprint();
  500. bool __fastcall IsSecure();
  501. static void __fastcall ValidatePath(const UnicodeString Path);
  502. static void __fastcall ValidateName(const UnicodeString Name);
  503. static UnicodeString __fastcall MakeValidName(const UnicodeString & Name);
  504. static UnicodeString __fastcall ExtractLocalName(const UnicodeString & Name);
  505. static UnicodeString __fastcall ExtractFolderName(const UnicodeString & Name);
  506. static UnicodeString __fastcall ComposePath(const UnicodeString & Path, const UnicodeString & Name);
  507. static bool __fastcall IsSensitiveOption(const UnicodeString & Option);
  508. static bool __fastcall IsOptionWithParameters(const UnicodeString & Option);
  509. static bool __fastcall MaskPasswordInOptionParameter(const UnicodeString & Option, UnicodeString & Param);
  510. static UnicodeString __fastcall FormatSiteKey(const UnicodeString & HostName, int PortNumber);
  511. static TStrings * GetAllOptionNames(bool PuttyExport);
  512. __property UnicodeString HostName = { read=FHostName, write=SetHostName };
  513. __property UnicodeString HostNameExpanded = { read=GetHostNameExpanded };
  514. __property int PortNumber = { read=FPortNumber, write=SetPortNumber };
  515. __property UnicodeString UserName = { read=FUserName, write=SetUserName };
  516. __property UnicodeString UserNameExpanded = { read=GetUserNameExpanded };
  517. __property UnicodeString Password = { read=GetPassword, write=SetPassword };
  518. __property UnicodeString NewPassword = { read=GetNewPassword, write=SetNewPassword };
  519. __property bool ChangePassword = { read=FChangePassword, write=SetChangePassword };
  520. __property int PingInterval = { read=FPingInterval, write=SetPingInterval };
  521. __property bool TryAgent = { read=FTryAgent, write=SetTryAgent };
  522. __property bool AgentFwd = { read=FAgentFwd, write=SetAgentFwd };
  523. __property UnicodeString ListingCommand = { read = FListingCommand, write = SetListingCommand };
  524. __property bool AuthTIS = { read=FAuthTIS, write=SetAuthTIS };
  525. __property bool AuthKI = { read=FAuthKI, write=SetAuthKI };
  526. __property bool AuthKIPassword = { read=FAuthKIPassword, write=SetAuthKIPassword };
  527. __property bool AuthGSSAPI = { read=FAuthGSSAPI, write=SetAuthGSSAPI };
  528. __property bool GSSAPIFwdTGT = { read=FGSSAPIFwdTGT, write=SetGSSAPIFwdTGT };
  529. __property bool ChangeUsername = { read=FChangeUsername, write=SetChangeUsername };
  530. __property bool Compression = { read=FCompression, write=SetCompression };
  531. __property TSshProt SshProt = { read=FSshProt, write=SetSshProt };
  532. __property bool UsesSsh = { read = GetUsesSsh };
  533. __property bool Ssh2DES = { read=FSsh2DES, write=SetSsh2DES };
  534. __property bool SshNoUserAuth = { read=FSshNoUserAuth, write=SetSshNoUserAuth };
  535. __property TCipher Cipher[int Index] = { read=GetCipher, write=SetCipher };
  536. __property TKex Kex[int Index] = { read=GetKex, write=SetKex };
  537. __property THostKey HostKeys[int Index] = { read=GetHostKeys, write=SetHostKeys };
  538. __property TGssLib GssLib[int Index] = { read=GetGssLib, write=SetGssLib };
  539. __property UnicodeString GssLibCustom = { read=FGssLibCustom, write=SetGssLibCustom };
  540. __property UnicodeString PublicKeyFile = { read=FPublicKeyFile, write=SetPublicKeyFile };
  541. __property UnicodeString Passphrase = { read=GetPassphrase, write=SetPassphrase };
  542. __property UnicodeString PuttyProtocol = { read=FPuttyProtocol, write=SetPuttyProtocol };
  543. __property TFSProtocol FSProtocol = { read=FFSProtocol, write=SetFSProtocol };
  544. __property UnicodeString FSProtocolStr = { read=GetFSProtocolStr };
  545. __property bool Modified = { read=FModified, write=FModified };
  546. __property bool CanLogin = { read=GetCanLogin };
  547. __property bool ClearAliases = { read = FClearAliases, write = SetClearAliases };
  548. __property TDateTime PingIntervalDT = { read = GetPingIntervalDT, write = SetPingIntervalDT };
  549. __property TDateTime TimeDifference = { read = FTimeDifference, write = SetTimeDifference };
  550. __property bool TimeDifferenceAuto = { read = FTimeDifferenceAuto, write = SetTimeDifferenceAuto };
  551. __property TPingType PingType = { read = FPingType, write = SetPingType };
  552. __property UnicodeString SessionName = { read=GetSessionName };
  553. __property UnicodeString DefaultSessionName = { read=GetDefaultSessionName };
  554. __property UnicodeString LocalDirectory = { read=FLocalDirectory, write=SetLocalDirectory };
  555. __property UnicodeString LocalDirectoryExpanded = { read = GetLocalDirectoryExpanded };
  556. __property UnicodeString RemoteDirectory = { read=FRemoteDirectory, write=SetRemoteDirectory };
  557. __property bool SynchronizeBrowsing = { read=FSynchronizeBrowsing, write=SetSynchronizeBrowsing };
  558. __property bool UpdateDirectories = { read=FUpdateDirectories, write=SetUpdateDirectories };
  559. __property bool CacheDirectories = { read=FCacheDirectories, write=SetCacheDirectories };
  560. __property bool CacheDirectoryChanges = { read=FCacheDirectoryChanges, write=SetCacheDirectoryChanges };
  561. __property bool PreserveDirectoryChanges = { read=FPreserveDirectoryChanges, write=SetPreserveDirectoryChanges };
  562. __property bool LockInHome = { read=FLockInHome, write=SetLockInHome };
  563. __property bool Special = { read=FSpecial, write=SetSpecial };
  564. __property bool Selected = { read=FSelected, write=FSelected };
  565. __property UnicodeString InfoTip = { read=GetInfoTip };
  566. __property bool DefaultShell = { read = GetDefaultShell, write = SetDefaultShell };
  567. __property bool DetectReturnVar = { read = GetDetectReturnVar, write = SetDetectReturnVar };
  568. __property TEOLType EOLType = { read = FEOLType, write = SetEOLType };
  569. __property bool TrimVMSVersions = { read = FTrimVMSVersions, write = SetTrimVMSVersions };
  570. __property TAutoSwitch LookupUserGroups = { read = FLookupUserGroups, write = SetLookupUserGroups };
  571. __property UnicodeString ReturnVar = { read = FReturnVar, write = SetReturnVar };
  572. __property bool ExitCode1IsError = { read = FExitCode1IsError, write = SetExitCode1IsError };
  573. __property bool Scp1Compatibility = { read = FScp1Compatibility, write = SetScp1Compatibility };
  574. __property UnicodeString Shell = { read = FShell, write = SetShell };
  575. __property UnicodeString SftpServer = { read = FSftpServer, write = SetSftpServer };
  576. __property int Timeout = { read = FTimeout, write = SetTimeout };
  577. __property TDateTime TimeoutDT = { read = GetTimeoutDT };
  578. __property bool UnsetNationalVars = { read = FUnsetNationalVars, write = SetUnsetNationalVars };
  579. __property bool IgnoreLsWarnings = { read=FIgnoreLsWarnings, write=SetIgnoreLsWarnings };
  580. __property bool TcpNoDelay = { read=FTcpNoDelay, write=SetTcpNoDelay };
  581. __property int SendBuf = { read=FSendBuf, write=SetSendBuf };
  582. __property UnicodeString SourceAddress = { read=FSourceAddress, write=SetSourceAddress };
  583. __property bool SshSimple = { read=FSshSimple, write=SetSshSimple };
  584. __property UnicodeString SshProtStr = { read=GetSshProtStr };
  585. __property UnicodeString CipherList = { read=GetCipherList, write=SetCipherList };
  586. __property UnicodeString KexList = { read=GetKexList, write=SetKexList };
  587. __property UnicodeString HostKeyList = { read=GetHostKeyList, write=SetHostKeyList };
  588. __property UnicodeString GssLibList = { read=GetGssLibList, write=SetGssLibList };
  589. __property TProxyMethod ProxyMethod = { read=FProxyMethod, write=SetProxyMethod };
  590. __property UnicodeString ProxyHost = { read=FProxyHost, write=SetProxyHost };
  591. __property int ProxyPort = { read=FProxyPort, write=SetProxyPort };
  592. __property UnicodeString ProxyUsername = { read=FProxyUsername, write=SetProxyUsername };
  593. __property UnicodeString ProxyPassword = { read=GetProxyPassword, write=SetProxyPassword };
  594. __property UnicodeString ProxyTelnetCommand = { read=FProxyTelnetCommand, write=SetProxyTelnetCommand };
  595. __property UnicodeString ProxyLocalCommand = { read=FProxyLocalCommand, write=SetProxyLocalCommand };
  596. __property TAutoSwitch ProxyDNS = { read=FProxyDNS, write=SetProxyDNS };
  597. __property bool ProxyLocalhost = { read=FProxyLocalhost, write=SetProxyLocalhost };
  598. __property int FtpProxyLogonType = { read=FFtpProxyLogonType, write=SetFtpProxyLogonType };
  599. __property TAutoSwitch Bug[TSshBug Bug] = { read=GetBug, write=SetBug };
  600. __property UnicodeString PuttySettings = { read = FPuttySettings, write = SetPuttySettings };
  601. __property UnicodeString CustomParam1 = { read = FCustomParam1, write = SetCustomParam1 };
  602. __property UnicodeString CustomParam2 = { read = FCustomParam2, write = SetCustomParam2 };
  603. __property UnicodeString SessionKey = { read = GetSessionKey };
  604. __property bool ResolveSymlinks = { read = FResolveSymlinks, write = SetResolveSymlinks };
  605. __property bool FollowDirectorySymlinks = { read = FFollowDirectorySymlinks, write = SetFollowDirectorySymlinks };
  606. __property int SFTPDownloadQueue = { read = FSFTPDownloadQueue, write = SetSFTPDownloadQueue };
  607. __property int SFTPUploadQueue = { read = FSFTPUploadQueue, write = SetSFTPUploadQueue };
  608. __property int SFTPListingQueue = { read = FSFTPListingQueue, write = SetSFTPListingQueue };
  609. __property int SFTPMaxVersion = { read = FSFTPMaxVersion, write = SetSFTPMaxVersion };
  610. __property unsigned long SFTPMaxPacketSize = { read = FSFTPMaxPacketSize, write = SetSFTPMaxPacketSize };
  611. __property TAutoSwitch SFTPBug[TSftpBug Bug] = { read=GetSFTPBug, write=SetSFTPBug };
  612. __property TAutoSwitch SCPLsFullTime = { read = FSCPLsFullTime, write = SetSCPLsFullTime };
  613. __property TAutoSwitch FtpListAll = { read = FFtpListAll, write = SetFtpListAll };
  614. __property TAutoSwitch FtpHost = { read = FFtpHost, write = SetFtpHost };
  615. __property TAutoSwitch FtpDeleteFromCwd = { read = FFtpDeleteFromCwd, write = SetFtpDeleteFromCwd };
  616. __property bool SslSessionReuse = { read = FSslSessionReuse, write = SetSslSessionReuse };
  617. __property UnicodeString TlsCertificateFile = { read=FTlsCertificateFile, write=SetTlsCertificateFile };
  618. __property TDSTMode DSTMode = { read = FDSTMode, write = SetDSTMode };
  619. __property bool DeleteToRecycleBin = { read = FDeleteToRecycleBin, write = SetDeleteToRecycleBin };
  620. __property bool OverwrittenToRecycleBin = { read = FOverwrittenToRecycleBin, write = SetOverwrittenToRecycleBin };
  621. __property UnicodeString RecycleBinPath = { read = FRecycleBinPath, write = SetRecycleBinPath };
  622. __property UnicodeString PostLoginCommands = { read = FPostLoginCommands, write = SetPostLoginCommands };
  623. __property TAddressFamily AddressFamily = { read = FAddressFamily, write = SetAddressFamily };
  624. __property UnicodeString RekeyData = { read = FRekeyData, write = SetRekeyData };
  625. __property unsigned int RekeyTime = { read = FRekeyTime, write = SetRekeyTime };
  626. __property int Color = { read = FColor, write = SetColor };
  627. __property bool Tunnel = { read = FTunnel, write = SetTunnel };
  628. __property UnicodeString TunnelHostName = { read = FTunnelHostName, write = SetTunnelHostName };
  629. __property int TunnelPortNumber = { read = FTunnelPortNumber, write = SetTunnelPortNumber };
  630. __property UnicodeString TunnelUserName = { read = FTunnelUserName, write = SetTunnelUserName };
  631. __property UnicodeString TunnelPassword = { read = GetTunnelPassword, write = SetTunnelPassword };
  632. __property UnicodeString TunnelPublicKeyFile = { read = FTunnelPublicKeyFile, write = SetTunnelPublicKeyFile };
  633. __property bool TunnelAutoassignLocalPortNumber = { read = GetTunnelAutoassignLocalPortNumber };
  634. __property int TunnelLocalPortNumber = { read = FTunnelLocalPortNumber, write = SetTunnelLocalPortNumber };
  635. __property UnicodeString TunnelPortFwd = { read = FTunnelPortFwd, write = SetTunnelPortFwd };
  636. __property UnicodeString TunnelHostKey = { read = FTunnelHostKey, write = SetTunnelHostKey };
  637. __property bool FtpPasvMode = { read = FFtpPasvMode, write = SetFtpPasvMode };
  638. __property TAutoSwitch FtpForcePasvIp = { read = FFtpForcePasvIp, write = SetFtpForcePasvIp };
  639. __property TAutoSwitch FtpUseMlsd = { read = FFtpUseMlsd, write = SetFtpUseMlsd };
  640. __property UnicodeString FtpAccount = { read = FFtpAccount, write = SetFtpAccount };
  641. __property int FtpPingInterval = { read=FFtpPingInterval, write=SetFtpPingInterval };
  642. __property TDateTime FtpPingIntervalDT = { read=GetFtpPingIntervalDT };
  643. __property TPingType FtpPingType = { read = FFtpPingType, write = SetFtpPingType };
  644. __property TAutoSwitch FtpTransferActiveImmediately = { read = FFtpTransferActiveImmediately, write = SetFtpTransferActiveImmediately };
  645. __property TFtps Ftps = { read = FFtps, write = SetFtps };
  646. __property TTlsVersion MinTlsVersion = { read = FMinTlsVersion, write = SetMinTlsVersion };
  647. __property TTlsVersion MaxTlsVersion = { read = FMaxTlsVersion, write = SetMaxTlsVersion };
  648. __property UnicodeString LogicalHostName = { read = FLogicalHostName, write = SetLogicalHostName };
  649. __property TAutoSwitch NotUtf = { read = FNotUtf, write = SetNotUtf };
  650. __property int InternalEditorEncoding = { read = FInternalEditorEncoding, write = SetInternalEditorEncoding };
  651. __property UnicodeString S3DefaultRegion = { read = FS3DefaultRegion, write = SetS3DefaultRegion };
  652. __property TS3UrlStyle S3UrlStyle = { read = FS3UrlStyle, write = SetS3UrlStyle };
  653. __property bool IsWorkspace = { read = FIsWorkspace, write = SetIsWorkspace };
  654. __property UnicodeString Link = { read = FLink, write = SetLink };
  655. __property UnicodeString NameOverride = { read = FNameOverride, write = SetNameOverride };
  656. __property UnicodeString HostKey = { read = FHostKey, write = SetHostKey };
  657. __property bool FingerprintScan = { read = FFingerprintScan, write = FFingerprintScan };
  658. __property bool OverrideCachedHostKey = { read = FOverrideCachedHostKey };
  659. __property UnicodeString Note = { read = FNote, write = SetNote };
  660. __property UnicodeString WinTitle = { read = FWinTitle, write = SetWinTitle };
  661. __property UnicodeString EncryptKey = { read = GetEncryptKey, write = SetEncryptKey };
  662. __property UnicodeString StorageKey = { read = GetStorageKey };
  663. __property UnicodeString SiteKey = { read = GetSiteKey };
  664. __property UnicodeString OrigHostName = { read = FOrigHostName };
  665. __property int OrigPortNumber = { read = FOrigPortNumber };
  666. __property UnicodeString LocalName = { read = GetLocalName };
  667. __property UnicodeString FolderName = { read = GetFolderName };
  668. __property UnicodeString Source = { read = GetSource };
  669. __property bool SaveOnly = { read = FSaveOnly };
  670. };
  671. //---------------------------------------------------------------------------
  672. class TStoredSessionList : public TNamedObjectList
  673. {
  674. public:
  675. __fastcall TStoredSessionList(bool aReadOnly = false);
  676. void __fastcall Reload();
  677. void __fastcall Save(bool All, bool Explicit);
  678. void __fastcall Saved();
  679. void __fastcall ImportFromFilezilla(const UnicodeString FileName, const UnicodeString ConfigurationFileName);
  680. void __fastcall ImportFromKnownHosts(TStrings * Lines);
  681. void __fastcall Export(const UnicodeString FileName);
  682. void __fastcall Load(THierarchicalStorage * Storage, bool AsModified = false,
  683. bool UseDefaults = false, bool PuttyImport = false);
  684. void __fastcall Save(THierarchicalStorage * Storage, bool All = false);
  685. void __fastcall SelectAll(bool Select);
  686. void __fastcall Import(TStoredSessionList * From, bool OnlySelected, TList * Imported);
  687. void __fastcall RecryptPasswords(TStrings * RecryptPasswordErrors);
  688. TSessionData * __fastcall AtSession(int Index)
  689. { return (TSessionData*)AtObject(Index); }
  690. void __fastcall SelectSessionsToImport(TStoredSessionList * Dest, bool SSHOnly);
  691. void __fastcall Cleanup();
  692. void __fastcall UpdateStaticUsage();
  693. int __fastcall IndexOf(TSessionData * Data);
  694. TSessionData * __fastcall FindSame(TSessionData * Data);
  695. TSessionData * __fastcall NewSession(UnicodeString SessionName, TSessionData * Session);
  696. void __fastcall NewWorkspace(UnicodeString Name, TList * DataList);
  697. bool __fastcall IsFolder(const UnicodeString & Name);
  698. bool __fastcall IsWorkspace(const UnicodeString & Name);
  699. TSessionData * __fastcall ParseUrl(UnicodeString Url, TOptions * Options, bool & DefaultsOnly,
  700. UnicodeString * FileName = NULL, bool * ProtocolDefined = NULL, UnicodeString * MaskedUrl = NULL, int Flags = 0);
  701. bool __fastcall IsUrl(UnicodeString Url);
  702. bool __fastcall CanLogin(TSessionData * Data);
  703. void __fastcall GetFolderOrWorkspace(const UnicodeString & Name, TList * List);
  704. TStrings * __fastcall GetFolderOrWorkspaceList(const UnicodeString & Name);
  705. TStrings * __fastcall GetWorkspaces();
  706. bool __fastcall HasAnyWorkspace();
  707. TSessionData * __fastcall SaveWorkspaceData(TSessionData * Data, int Index);
  708. virtual __fastcall ~TStoredSessionList();
  709. __property TSessionData * Sessions[int Index] = { read=AtSession };
  710. __property TSessionData * DefaultSettings = { read=FDefaultSettings, write=SetDefaultSettings };
  711. static void __fastcall ImportHostKeys(
  712. THierarchicalStorage * SourceStorage, THierarchicalStorage * TargetStorage, TStoredSessionList * Sessions, bool OnlySelected);
  713. static void __fastcall ImportHostKeys(
  714. const UnicodeString & SourceKey, TStoredSessionList * Sessions, bool OnlySelected);
  715. static void __fastcall ImportSelectedKnownHosts(TStoredSessionList * Sessions);
  716. static bool __fastcall OpenHostKeysSubKey(THierarchicalStorage * Storage, bool CanCreate);
  717. private:
  718. TSessionData * FDefaultSettings;
  719. bool FReadOnly;
  720. std::unique_ptr<TStrings> FPendingRemovals;
  721. void __fastcall SetDefaultSettings(TSessionData * value);
  722. void __fastcall DoSave(THierarchicalStorage * Storage, bool All,
  723. bool RecryptPasswordOnly, TStrings * RecryptPasswordErrors);
  724. void __fastcall DoSave(bool All, bool Explicit, bool RecryptPasswordOnly,
  725. TStrings * RecryptPasswordErrors);
  726. void __fastcall DoSave(THierarchicalStorage * Storage,
  727. TSessionData * Data, bool All, bool RecryptPasswordOnly,
  728. TSessionData * FactoryDefaults);
  729. TSessionData * __fastcall ResolveWorkspaceData(TSessionData * Data);
  730. bool __fastcall IsFolderOrWorkspace(const UnicodeString & Name, bool Workspace);
  731. TSessionData * __fastcall CheckIsInFolderOrWorkspaceAndResolve(
  732. TSessionData * Data, const UnicodeString & Name);
  733. void __fastcall ImportLevelFromFilezilla(_di_IXMLNode Node, const UnicodeString & Path, _di_IXMLNode SettingsNode);
  734. void __fastcall DoGetFolderOrWorkspace(const UnicodeString & Name, TList * List, bool NoRecrypt);
  735. static THierarchicalStorage * __fastcall CreateHostKeysStorageForWritting();
  736. };
  737. //---------------------------------------------------------------------------
  738. UnicodeString GetExpandedLogFileName(UnicodeString LogFileName, TDateTime Started, TSessionData * SessionData);
  739. bool __fastcall IsSshProtocol(TFSProtocol FSProtocol);
  740. int __fastcall DefaultPort(TFSProtocol FSProtocol, TFtps Ftps);
  741. bool __fastcall IsIPv6Literal(const UnicodeString & HostName);
  742. UnicodeString __fastcall EscapeIPv6Literal(const UnicodeString & IP);
  743. TFSProtocol NormalizeFSProtocol(TFSProtocol FSProtocol);
  744. //---------------------------------------------------------------------------
  745. #endif