You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Gilles Gaillard (JIRA)" <ji...@apache.org> on 2007/04/18 12:37:15 UTC

[jira] Updated: (NET-158) login in FTPClient does not always read the complete server response

     [ https://issues.apache.org/jira/browse/NET-158?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gilles Gaillard updated NET-158:
--------------------------------

    Description: 
When a password is required 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;


  was:
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;



> 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 required 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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org