Browse Source

Merge branch 'master' into dev

Source commit: ad7c8d57322684db3980a9c60ad9e3e7162c0a09
Martin Prikryl 9 years ago
parent
commit
2d46662cae

+ 1 - 1
dotnet/Session.cs

@@ -445,7 +445,7 @@ namespace WinSCP
                 // Need to use guarded method for the listing, see a comment in EnumerateRemoteFiles
                 directoryInfo = ListDirectory(path);
             }
-            catch (SessionRemoteException e)
+            catch (SessionRemoteException)
             {
                 if (throwReadErrors)
                 {

+ 5 - 0
libs/neon/src/ne_auth.c

@@ -1680,7 +1680,12 @@ static void auth_register(ne_session *sess, int isproxy, unsigned protomask,
             ne_fill_server_uri(sess, &uri);
         }
 
+#ifdef WINSCP
+        // bug fix
+        ahs->sspi_host = ne_strdup(uri.host);
+#else
         ahs->sspi_host = uri.host;
+#endif
 
         uri.host = NULL;
 

+ 6 - 2
source/core/FtpFileSystem.cpp

@@ -3789,9 +3789,13 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
       if (FLastCode == 215)
       {
         FSystem = FLastResponse->Text.TrimRight();
-        // full name is "Personal FTP Server PRO K6.0"
         if ((FListAll == asAuto) &&
-            (FSystem.Pos(L"Personal FTP Server") > 0))
+             // full name is "Personal FTP Server PRO K6.0"
+            ((FSystem.Pos(L"Personal FTP Server") > 0) ||
+             // full name is "MVS is the operating system of this server. FTP Server is running on ..."
+             // (the ... can be "z/OS")
+             // https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.cs3cod0/ftp215-02.htm
+             (FSystem.SubString(1, 3) == L"MVS")))
         {
           FTerminal->LogEvent(L"Server is known not to support LIST -a");
           FListAll = asOff;

+ 4 - 0
source/core/Script.cpp

@@ -2576,6 +2576,10 @@ void __fastcall TManagementScript::Connect(const UnicodeString Session,
       {
         std::unique_ptr<TSessionData> DataWithFingerprint(Data->Clone());
         DataWithFingerprint->LookupLastFingerprint();
+        if (!DataWithFingerprint->Password.IsEmpty())
+        {
+          DataWithFingerprint->Password = PasswordMask;
+        }
 
         PrintLine(LoadStr(SCRIPT_SITE_WARNING));
         PrintLine(L"open " + DataWithFingerprint->GenerateOpenCommandArgs(false));

+ 1 - 1
source/core/SecureShell.cpp

@@ -813,7 +813,7 @@ bool __fastcall TSecureShell::PromptUser(bool /*ToServer*/,
     TranslatePuttyMessage(InstructionTranslation, 1, Instructions);
   }
 
-  // some servers add leading blank line to make the prompt look prettier
+  // some servers add leading or trailing blank line to make the prompt look prettier
   // on terminal console
   Instructions = Instructions.Trim();
 

+ 10 - 10
source/core/SessionData.cpp

@@ -721,34 +721,34 @@ void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool & Rewr
 
 #ifdef TEST
   #define KEX_TEST(VALUE, EXPECTED) KexList = VALUE; DebugAssert(KexList == EXPECTED);
-  #define KEX_DEFAULT L"ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN"
+  #define KEX_DEFAULT L"ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1"
   // Empty source should result in default list
   KEX_TEST(L"", KEX_DEFAULT);
-  // Default of pre 5.8.1 should result in new default
-  KEX_TEST(L"dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN", KEX_DEFAULT);
-  // Missing first two priority algos, and last non-priority algo => default
+  // Default of pre 5.8.1
+  KEX_TEST(L"dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN", L"ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN");
+  // Missing first two priority algos, and last non-priority algo
   KEX_TEST(L"dh-group14-sha1,dh-group1-sha1,WARN", L"ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN");
-  // Missing first two priority algos, last non-priority algo and WARN => default
+  // Missing first two priority algos, last non-priority algo and WARN
   KEX_TEST(L"dh-group14-sha1,dh-group1-sha1", L"ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN");
   // Old algos, with all but the first below WARN
   KEX_TEST(L"dh-gex-sha1,WARN,dh-group14-sha1,dh-group1-sha1,rsa", L"ecdh,dh-gex-sha1,WARN,dh-group14-sha1,dh-group1-sha1,rsa");
   // Unknown algo at front
-  KEX_TEST(L"unknown,ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN", KEX_DEFAULT);
+  KEX_TEST(L"unknown,ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1", KEX_DEFAULT);
   // Unknown algo at back
-  KEX_TEST(L"ecdh,dh-gex-sha1,dh-group14-sha1,dh-group1-sha1,rsa,WARN,unknown", KEX_DEFAULT);
+  KEX_TEST(L"ecdh,dh-gex-sha1,dh-group14-sha1,rsa,WARN,dh-group1-sha1,unknown", KEX_DEFAULT);
   // Unknown algo in the middle
-  KEX_TEST(L"ecdh,dh-gex-sha1,dh-group14-sha1,unknown,dh-group1-sha1,rsa,WARN", KEX_DEFAULT);
+  KEX_TEST(L"ecdh,dh-gex-sha1,dh-group14-sha1,unknown,rsa,WARN,dh-group1-sha1", KEX_DEFAULT);
   #undef KEX_DEFAULT
   #undef KEX_TEST
 
   #define CIPHER_TEST(VALUE, EXPECTED) CipherList = VALUE; DebugAssert(CipherList == EXPECTED);
-  #define CIPHER_DEFAULT L"aes,blowfish,chacha20,3des,WARN,arcfour,des"
+  #define CIPHER_DEFAULT L"aes,chacha20,blowfish,3des,WARN,arcfour,des"
   // Empty source should result in default list
   CIPHER_TEST(L"", CIPHER_DEFAULT);
   // Default of pre 5.8.1
   CIPHER_TEST(L"aes,blowfish,3des,WARN,arcfour,des", L"aes,blowfish,3des,chacha20,WARN,arcfour,des");
   // Missing priority algo
-  CIPHER_TEST(L"blowfish,chacha20,3des,WARN,arcfour,des", CIPHER_DEFAULT);
+  CIPHER_TEST(L"chacha20,blowfish,3des,WARN,arcfour,des", CIPHER_DEFAULT);
   // Missing non-priority algo
   CIPHER_TEST(L"aes,chacha20,3des,WARN,arcfour,des", L"aes,chacha20,3des,blowfish,WARN,arcfour,des");
   // Missing last warn algo

+ 3 - 0
source/forms/Authenticate.cpp

@@ -205,6 +205,9 @@ TLabel * __fastcall TAuthenticateForm::GenerateLabel(int Current, UnicodeString
   Result->Caption = Caption;
   int Width = FPromptParent->ClientWidth - FPromptLeft - FPromptRight;
   Result->Width = Width;
+  Result->AutoSize = true;
+  Result->AutoSize = false;
+  Result->Width = Width;
 
   return Result;
 }

+ 7 - 4
source/forms/Preferences.cpp

@@ -1180,6 +1180,7 @@ void __fastcall TPreferencesDialog::UpdateControls()
     EnableControl(UpdatesProxyPortLabel, UpdatesProxyPortEdit->Enabled);
 
     bool IsSiteCommand = false;
+    bool IsPasswordCommand = false;
     try
     {
       TRemoteCustomCommand RemoteCustomCommand;
@@ -1187,17 +1188,19 @@ void __fastcall TPreferencesDialog::UpdateControls()
       UnicodeString PuttyPath = PuttyPathEdit->Text;
       PuttyPath = InteractiveCustomCommand.Complete(PuttyPath, false);
       IsSiteCommand = RemoteCustomCommand.IsSiteCommand(PuttyPath);
+      IsPasswordCommand = RemoteCustomCommand.IsPasswordCommand(PuttyPath);
     }
     catch (...)
     {
       // noop
     }
-    EnableControl(PuttyPasswordCheck2, !PuttyPathEdit->Text.IsEmpty());
-    EnableControl(AutoOpenInPuttyCheck, PuttyPasswordCheck2->Enabled);
+    bool AnyPuttyPath = !PuttyPathEdit->Text.IsEmpty();
+    EnableControl(PuttyPasswordCheck2, AnyPuttyPath && !IsPasswordCommand);
+    EnableControl(AutoOpenInPuttyCheck, AnyPuttyPath);
     EnableControl(TelnetForFtpInPuttyCheck,
-      PuttyPasswordCheck2->Enabled && !IsSiteCommand);
+      AnyPuttyPath && !IsSiteCommand);
     EnableControl(PuttyRegistryStorageKeyEdit,
-      PuttyPasswordCheck2->Enabled && !IsSiteCommand);
+      AnyPuttyPath && !IsSiteCommand);
     EnableControl(PuttyRegistryStorageKeyLabel, PuttyRegistryStorageKeyEdit->Enabled);
 
     EnableControl(SetMasterPasswordButton, WinConfiguration->UseMasterPassword);

+ 1 - 1
source/resource/TextsCore1.rc

@@ -76,7 +76,7 @@ BEGIN
   SFTP_NON_ONE_FXP_NAME_PACKET, "Received SSH_FXP_NAME packet with zero or multiple records."
   SFTP_REALPATH_ERROR, "Cannot get real path for '%s'."
   CHANGE_PROPERTIES_ERROR, "Cannot change properties of file '%s'."
-  SFTP_INITIALIZE_ERROR, "Cannot initialize SFTP protocol. Is the host running a SFTP server?"
+  SFTP_INITIALIZE_ERROR, "Cannot initialize SFTP protocol. Is the host running an SFTP server?"
   TIMEZONE_ERROR, "Cannot read time zone information"
   SFTP_CREATE_FILE_ERROR, "Cannot create remote file '%s'."
   SFTP_OPEN_FILE_ERROR, "Cannot open remote file '%s'."

+ 18 - 1
source/windows/GUIConfiguration.cpp

@@ -1107,7 +1107,24 @@ void __fastcall TGUIConfiguration::SetDefaultCopyParam(const TGUICopyParamType &
 //---------------------------------------------------------------------------
 bool __fastcall TGUIConfiguration::GetRememberPassword()
 {
-  return SessionRememberPassword || PuttyPassword;
+  bool Result = SessionRememberPassword || PuttyPassword;
+
+  if (!Result)
+  {
+    try
+    {
+      TRemoteCustomCommand RemoteCustomCommand;
+      TInteractiveCustomCommand InteractiveCustomCommand(&RemoteCustomCommand);
+      UnicodeString APuttyPath = InteractiveCustomCommand.Complete(PuttyPath, false);
+      Result = RemoteCustomCommand.IsPasswordCommand(PuttyPath);
+    }
+    catch (...)
+    {
+      // noop
+    }
+  }
+
+  return Result;
 }
 //---------------------------------------------------------------------------
 const TCopyParamList * __fastcall TGUIConfiguration::GetCopyParamList()

+ 1 - 1
source/windows/GUITools.cpp

@@ -740,7 +740,7 @@ void __fastcall HideComponentsPanel(TForm * Form)
     TControl * Control = Form->Controls[Index];
 
     // Shift back bottom-anchored controls
-    // (needed for toolbar panel on Progress window and butons on Preferences dialog),
+    // (needed for toolbar panel on Progress window and buttons on Preferences dialog),
     if ((Control->Align == alNone) &&
         Control->Anchors.Contains(akBottom) &&
         !Control->Anchors.Contains(akTop))