login in FTPClient does not always read the complete server response
--------------------------------------------------------------------

                 Key: NET-158
                 URL: https://issues.apache.org/jira/browse/NET-158
             Project: Commons Net
          Issue Type: Bug
    Affects Versions: 1.4
            Reporter: Gilles Gaillard
            Priority: Trivial


When a password is require to connect the FTP server, the implementation of 
method login in class FTPClient ends with:
  return FTPReply.isPositiveCompletion(pass(password))
which returns false for any code >= 300.

However, some servers send a code 451 before returning the code 530 
(NOT_LOGGED_IN). Ignoring this addtional answer,
leads to desynch the client with the server, hence leading to unexpected 
behaviors in next exchanges.

Threfore i propose to replace the above code in the end of the method with:

      _replyCode = p_Client.pass(p_Password);
      boolean result = FTPReply.isPositiveCompletion(_replyCode);
      if (!result && _replyCode==FTPReply.ACTION_ABORTED){
        try {
          _replyCode = p_Client.getReply();
        } catch (Exception e){
          e.printStackTrace();
        }
      }
      return result;


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to