Browse Source

Updating code to PuTTY 0.77 proxy-password-prompt (Interactive username/password prompts for proxy authentication)

Source commit: 3812211a6544bc17e24c192137f0a5ae97c65e7f
Martin Prikryl 3 years ago
parent
commit
58be45f390

+ 2 - 1
source/core/Interface.h

@@ -141,7 +141,8 @@ enum TPromptKind
   pkCryptoCard,
   pkKeybInteractive,
   pkPassword,
-  pkNewPassword
+  pkNewPassword,
+  pkProxyAuth
 };
 
 enum TPromptUserParam { pupEcho = 0x01, pupRemember = 0x02 };

+ 15 - 0
source/core/SecureShell.cpp

@@ -701,6 +701,7 @@ TPromptKind __fastcall TSecureShell::IdentifyPromptKind(UnicodeString & Name)
     { L"SSH server authentication", SERVER_PROMPT_TITLE },
     { L"SSH password", PASSWORD_TITLE },
     { L"New SSH password", NEW_PASSWORD_TITLE },
+    { L"SOCKS proxy authentication", PROXY_AUTH_TITLE },
   };
 
   int Index = TranslatePuttyMessage(NameTranslation, LENOF(NameTranslation), Name);
@@ -734,6 +735,10 @@ TPromptKind __fastcall TSecureShell::IdentifyPromptKind(UnicodeString & Name)
   {
     PromptKind = pkNewPassword;
   }
+  else if (Index == 8)
+  {
+    PromptKind = pkProxyAuth;
+  }
   else
   {
     PromptKind = pkPrompt;
@@ -838,6 +843,16 @@ bool __fastcall TSecureShell::PromptUser(bool /*ToServer*/,
     PromptTranslationCount = LENOF(NewPasswordPromptTranslation);
     PromptDesc = L"new password";
   }
+  else if (PromptKind == pkProxyAuth)
+  {
+    static const TPuttyTranslation ProxyAuthPromptTranslation[] = {
+      { L"Proxy username: ", PROXY_AUTH_USERNAME_PROMPT },
+      { L"Proxy password: ", PROXY_AUTH_PASSWORD_PROMPT },
+    };
+    PromptTranslation = ProxyAuthPromptTranslation;
+    PromptTranslationCount = LENOF(ProxyAuthPromptTranslation);
+    PromptDesc = L"proxy authentication";
+  }
   else
   {
     PromptDesc = L"unknown";

+ 2 - 1
source/putty/proxy/interactor.c

@@ -116,7 +116,8 @@ InteractionReadySeat interactor_announce(Interactor *itr)
         sfree(adjective);
         sfree(desc);
 
-        seat_antispoof_msg(iseat, msg);
+        // WINSCP We could comment out whole this function
+        // WINSCP seat_antispoof_msg(iseat, msg);
         sfree(msg);
 
         itr_top->last_to_talk = itr;

+ 3 - 0
source/resource/TextsCore.h

@@ -334,6 +334,9 @@
 #define DUPLICATE_FOLDER_NOT_SUPPORTED 360
 #define MISSING_TARGET_BUCKET   361
 #define TIMEOUT_ERROR           362
+#define PROXY_AUTH_TITLE        363
+#define PROXY_AUTH_USERNAME_PROMPT 364
+#define PROXY_AUTH_PASSWORD_PROMPT 365
 
 #define CORE_INFORMATION_STRINGS 400
 #define YES_STR                 401

+ 3 - 0
source/resource/TextsCore1.rc

@@ -303,6 +303,9 @@ BEGIN
   S3_ACCESS_KEY_ID_PROMPT, "A&ccess key ID:"
   S3_SECRET_ACCESS_KEY_TITLE, "Secret access key"
   S3_SECRET_ACCESS_KEY_PROMPT, "Secret access &key:"
+  PROXY_AUTH_TITLE, "Proxy authentication"
+  PROXY_AUTH_USERNAME_PROMPT, "Proxy &username:"
+  PROXY_AUTH_PASSWORD_PROMPT, "Proxy &password:"
 
   CORE_INFORMATION_STRINGS, "CORE_INFORMATION"
   YES_STR, "Yes"