SessionData.h 45 KB

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