SessionData.h 46 KB

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