Explorar el Código

* Let the ftp method work with ftp servers which do not...
Author: mdz
Date: 2003-08-10 02:24:39 GMT
* Let the ftp method work with ftp servers which do not require a
password (Closes: #199425)

Arch Librarian hace 22 años
padre
commit
2391e7b57a
Se han modificado 2 ficheros con 10 adiciones y 6 borrados
  1. 2 0
      debian/changelog
  2. 8 6
      methods/ftp.cc

+ 2 - 0
debian/changelog

@@ -49,6 +49,8 @@ apt (0.5.9) unstable; urgency=low
     - echo 3 > debian/compat
     - Build-Depends: debhelper (>= 3)
   * Exclude '.#*' from cvs-build
+  * Let the ftp method work with ftp servers which do not require a
+    password (Closes: #199425)
 
  --
 

+ 8 - 6
methods/ftp.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
-// $Id: ftp.cc,v 1.30 2003/02/10 07:34:41 doogie Exp $
+// $Id: ftp.cc,v 1.31 2003/08/10 02:24:39 mdz Exp $
 /* ######################################################################
 
    FTP Aquire Method - This is the FTP aquire method for APT.
@@ -209,11 +209,13 @@ bool FTPConn::Login()
       if (Tag >= 400)
 	 return _error->Error(_("USER failed, server said: %s"),Msg.c_str());
       
-      // Send the Password
-      if (WriteMsg(Tag,Msg,"PASS %s",Pass.c_str()) == false)
-	 return false;
-      if (Tag >= 400)
-	 return _error->Error(_("PASS failed, server said: %s"),Msg.c_str());
+      if (Tag == 331) { // 331 User name okay, need password.
+         // Send the Password
+         if (WriteMsg(Tag,Msg,"PASS %s",Pass.c_str()) == false)
+            return false;
+         if (Tag >= 400)
+            return _error->Error(_("PASS failed, server said: %s"),Msg.c_str());
+      }
       
       // Enter passive mode
       if (_config->Exists("Acquire::FTP::Passive::" + ServerName.Host) == true)