SessionData.h 40 KB

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