1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Bug 1654: Pass private key to PuTTY when installed from Microsoft Store + Passing also other options that PuTTY can accept on its command-line, like "Attempt authentication using Pageant", "Allow agent forwarding", "Enable compression", "SSH protocol version", "Logical name of remote host" and "Internal protocol version"

Source commit: 7c3470f6848b2d87ddb70403135fc7b29efbd34e
This commit is contained in:
Martin Prikryl
2018-06-20 07:33:08 +00:00
parent 4a25781942
commit 724f7488c6

View File

@@ -94,9 +94,10 @@ void __fastcall OpenSessionInPutty(const UnicodeString PuttyPath,
if (!RemoteCustomCommand.IsSiteCommand(AParams))
{
if (IsUWP())
if (true/*IsUWP()*/)
{
if ((SessionData->FSProtocol == fsFTP) && GUIConfiguration->TelnetForFtpInPutty)
bool Telnet = (SessionData->FSProtocol == fsFTP) && GUIConfiguration->TelnetForFtpInPutty;
if (Telnet)
{
AddToList(PuttyParams, L"-telnet", L" ");
// PuTTY does not allow -pw for telnet
@@ -111,6 +112,38 @@ void __fastcall OpenSessionInPutty(const UnicodeString PuttyPath,
{
AddToList(PuttyParams, FORMAT(L"-P %d", (SessionData->PortNumber)), L" ");
}
if (!Telnet)
{
if (!SessionData->PublicKeyFile.IsEmpty())
{
AddToList(PuttyParams, FORMAT(L"-i \"%s\"", (SessionData->PublicKeyFile)), L" ");
}
AddToList(PuttyParams, (SessionData->TryAgent ? L"-agent" : L"-noagent"), L" ");
if (SessionData->TryAgent)
{
AddToList(PuttyParams, (SessionData->AgentFwd ? L"-A" : L"-a"), L" ");
}
if (SessionData->Compression)
{
AddToList(PuttyParams, L"-C", L" ");
}
AddToList(PuttyParams,
((SessionData->SshProt == ssh1only || SessionData->SshProt == ssh1deprecated) ? L"-1" : L"-2"), L" ");
if (!SessionData->LogicalHostName.IsEmpty())
{
AddToList(PuttyParams, FORMAT(L"-loghost \"%s\"", (SessionData->LogicalHostName)), L" ");
}
}
if (SessionData->AddressFamily == afIPv4)
{
AddToList(PuttyParams, L"-4", L" ");
}
else if (SessionData->AddressFamily == afIPv6)
{
AddToList(PuttyParams, L"-6", L" ");
}
}
else
{