incubator-ftpserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n..@apache.org
Subject svn commit: r596658 - in /incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver: DefaultFtpServerContext.java command/PASS.java
Date Tue, 20 Nov 2007 13:36:12 GMT
Author: ngn
Date: Tue Nov 20 05:36:12 2007
New Revision: 596658

URL: http://svn.apache.org/viewvc?rev=596658&view=rev
Log:
Fixed potential NPE in PASS. Thanks to Dave Roberts for the report and patch (FTPSERVER-115)

Modified:
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultFtpServerContext.java
    incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultFtpServerContext.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultFtpServerContext.java?rev=596658&r1=596657&r2=596658&view=diff
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultFtpServerContext.java
(original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/DefaultFtpServerContext.java
Tue Nov 20 05:36:12 2007
@@ -250,6 +250,13 @@
             listenerBean.destroyBean();
         }
         
+//        Iterator listenerIter = listeners.values().iterator();
+//        while (listenerIter.hasNext()) {
+//            Listener listenerBean = (Listener) listenerIter.next();
+//            listenerBean.stop();
+//        }
+
+        
         if(connectionManager != null && connectionManager instanceof Component) {
             ((Component)connectionManager).dispose();
         }

Modified: incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java
URL: http://svn.apache.org/viewvc/incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java?rev=596658&r1=596657&r2=596658&view=diff
==============================================================================
--- incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java (original)
+++ incubator/ftpserver/trunk/core/src/java/org/apache/ftpserver/command/PASS.java Tue Nov
20 05:36:12 2007
@@ -93,7 +93,6 @@
             // already logged-in
             if(session.isLoggedIn()) {
                 out.write(FtpReplyUtil.translate(session, FtpReply.REPLY_202_COMMAND_NOT_IMPLEMENTED,
"PASS", null));
-                success = true;
                 return;
             }
             
@@ -133,14 +132,11 @@
                     auth = new UsernamePasswordAuthentication(userName, password, userMetadata);
                 }
                 authenticatedUser = userManager.authenticate(auth);
-                success = true;
             } catch(AuthenticationFailedException e) { 
-                success = false;
                 authenticatedUser = null;
                 LOG.warn("User failed to log in", e);                
             }
             catch(Exception e) {
-                success = false;
                 authenticatedUser = null;
                 LOG.warn("PASS.execute()", e);
             }
@@ -153,10 +149,11 @@
             String oldUserArgument = session.getUserArgument();
             int oldMaxIdleTime = session.getMaxIdleTime();
 
-            if(success) {
+            if(authenticatedUser != null) {
                 session.setUser(authenticatedUser);
                 session.setUserArgument(null);
                 session.setMaxIdleTime(authenticatedUser.getMaxIdleTime());
+                success = true;
             } else {
                 session.setUser(null);
             }



Mime
View raw message