You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2011/03/30 05:16:09 UTC

[jira] [Created] (NET-397) FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated

FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated 
----------------------------------------------------------------------------------------------------------

                 Key: NET-397
                 URL: https://issues.apache.org/jira/browse/NET-397
             Project: Commons Net
          Issue Type: Bug
            Reporter: Sebb


FTPSClient does not provide any code to handle AUTH or ADAT, and does not provide support for handling a reduced buffer size provided by the server.

FTPSCommand defines int values for AUTH and ADAT, but if the integer values are used by client code, the value will be passed to FTPClient, which uses its own array of command strings, and FTPSCommand.AUTH will translate to "USER" and ADAT => "PASS", similarly for PBSZ, PROT and CCC.

These commands all need special handling, so should be dealt with by FTPSClient only.
FTPSClient can override the sendCommand(int) and sendCommand(int, String) methods in FTPClient which will help prevent problems.
Since most of these commands need additional special handling, there should be execNAME() methods for each.
FTPSCommand should be deprecated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Resolved] (NET-397) FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated

Posted by "Sebb (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved NET-397.
----------------------

       Resolution: Fixed
    Fix Version/s: 3.0

Applied patch with a few changes. Moved isProtectedReplyCode() to FTPReply class; made public constants private as users should not be encouraged to issue the commands directly.
Had to keep sendCommand() override for backward compat, which means execCCC now delegates to it (via FTP class)
Added parsePBSZ method to handle PBSZ reply.

> FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: NET-397
>                 URL: https://issues.apache.org/jira/browse/NET-397
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: ftps-rfc2228.diff
>
>
> FTPSClient does not provide any code to handle AUTH or ADAT, and does not provide support for handling a reduced buffer size provided by the server.
> FTPSCommand defines int values for AUTH and ADAT, but if the integer values are used by client code, the value will be passed to FTPClient, which uses its own array of command strings, and FTPSCommand.AUTH will translate to "USER" and ADAT => "PASS", similarly for PBSZ, PROT and CCC.
> These commands all need special handling, so should be dealt with by FTPSClient only.
> FTPSClient can override the sendCommand(int) and sendCommand(int, String) methods in FTPClient which will help prevent problems.
> Since most of these commands need additional special handling, there should be execNAME() methods for each.
> FTPSCommand should be deprecated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (NET-397) FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014051#comment-13014051 ] 

Sebb commented on NET-397:
--------------------------

Thanks again!

Cannot remove FTPSCommand without breaking binary compat. and I don't want to do that.

I've just realised that overriding sendCommand(int) and sendCommand(int, String) cannot be made to work properly, as it cannot distinguish between int values from FTPCommand and int values from FTPSCommand. For the values that overlap, there's no way to know what the caller intended. I suppose the method could reject all duplicate values, but that might break existing code (which uses the FTPCommand strings). [Had enums been used, this would not have been an issue]

Good suggestion re sendFTPSCommand(); that would solve the problem of differentiating the different int ranges. 
However I think it might make the API more confusing, so I think deprecation is better. If FTPSClient provides exec() methods for all the FTPS commands there is then no need to use the integers (and anyway, FTPSCommand.getCommand() can be used to convert the int to String)

I've no idea about PBSZ either, beyond extracting the minimum value for use by client code. Could start with that.

> FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: NET-397
>                 URL: https://issues.apache.org/jira/browse/NET-397
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: ftps-rfc2228.diff
>
>
> FTPSClient does not provide any code to handle AUTH or ADAT, and does not provide support for handling a reduced buffer size provided by the server.
> FTPSCommand defines int values for AUTH and ADAT, but if the integer values are used by client code, the value will be passed to FTPClient, which uses its own array of command strings, and FTPSCommand.AUTH will translate to "USER" and ADAT => "PASS", similarly for PBSZ, PROT and CCC.
> These commands all need special handling, so should be dealt with by FTPSClient only.
> FTPSClient can override the sendCommand(int) and sendCommand(int, String) methods in FTPClient which will help prevent problems.
> Since most of these commands need additional special handling, there should be execNAME() methods for each.
> FTPSCommand should be deprecated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Updated] (NET-397) FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated

Posted by "Bogdan Drozdowski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/NET-397?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bogdan Drozdowski updated NET-397:
----------------------------------

    Attachment: ftps-rfc2228.diff

This patch adds the support for 5 missing commands from RFC2228: AUTH, ADAT, MIC, ENC and CONF. PROT, CCC and PBSZ were already supported. The patch also adds a convenience method for CCC, so that the overridden sendCommand (which looks for CCC) can probably be removed.

The user still has to provide the data and potentially browse the replies if necessary, but base64-encoding is done automatically. There also is a method for getting ADAT data from the response.

FTPSCommand could be removed or a new method, say sendFTPSCommand(), added to FTPSClient. This patch does not provide sendFTPSCommand() or other overridden versions of sendCommand() in case FTPSCommand is removed.

Don't know how to fix PBSZ. Setting the buffer size in the Socket is probably not enough?

> FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: NET-397
>                 URL: https://issues.apache.org/jira/browse/NET-397
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>         Attachments: ftps-rfc2228.diff
>
>
> FTPSClient does not provide any code to handle AUTH or ADAT, and does not provide support for handling a reduced buffer size provided by the server.
> FTPSCommand defines int values for AUTH and ADAT, but if the integer values are used by client code, the value will be passed to FTPClient, which uses its own array of command strings, and FTPSCommand.AUTH will translate to "USER" and ADAT => "PASS", similarly for PBSZ, PROT and CCC.
> These commands all need special handling, so should be dealt with by FTPSClient only.
> FTPSClient can override the sendCommand(int) and sendCommand(int, String) methods in FTPClient which will help prevent problems.
> Since most of these commands need additional special handling, there should be execNAME() methods for each.
> FTPSCommand should be deprecated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (NET-397) FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated

Posted by "Sebb (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014827#comment-13014827 ] 

Sebb commented on NET-397:
--------------------------

Cannot change the values for the FTPSCommand entries now, as that's not backwards compatible, though that would have been a possible "solution" originally.

> FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: NET-397
>                 URL: https://issues.apache.org/jira/browse/NET-397
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: ftps-rfc2228.diff
>
>
> FTPSClient does not provide any code to handle AUTH or ADAT, and does not provide support for handling a reduced buffer size provided by the server.
> FTPSCommand defines int values for AUTH and ADAT, but if the integer values are used by client code, the value will be passed to FTPClient, which uses its own array of command strings, and FTPSCommand.AUTH will translate to "USER" and ADAT => "PASS", similarly for PBSZ, PROT and CCC.
> These commands all need special handling, so should be dealt with by FTPSClient only.
> FTPSClient can override the sendCommand(int) and sendCommand(int, String) methods in FTPClient which will help prevent problems.
> Since most of these commands need additional special handling, there should be execNAME() methods for each.
> FTPSCommand should be deprecated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

[jira] [Commented] (NET-397) FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated

Posted by "Bogdan Drozdowski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/NET-397?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13014783#comment-13014783 ] 

Bogdan Drozdowski commented on NET-397:
---------------------------------------

Deprecating FTPSCommand is probably a good idea, because commands shouldn't be spread among many files. But before the file gets removed, how about increasing the integer constants somewhere over the number of commands in FTPCOmmand? Like AUTH=100, ADAT=101 and so on. This would no more make conflicts. Then change the command array in FTPSCommand to have the right number of null entries before the right commands (static initializer block). And if the index given to getCommand() is too low, FTPSCommand could even delegate the call to FTPCommand.

You're right about sendCommand() not being able to distinguish what to use, but the new indices in FTPSCommand would fix this. Yes, if had been an enum from the beginning, there wouldn't be problems like this, because the sendCommand() methods would have different signatures. But still either the commands would be spread among 2 files or all would be in FTPCommand and the plain FTPClient would now have to accept FTP-only commands and FTPSClient - FTPS commands (and delegate the rest to FTPClient).

Now that we have execXXX() methods, FTPSCommand is unused.

Just parsing the PBSZ reply is still a good idea - the user can call setSendBufferSize()/setReceiveBufferSize() if this is the right thing to do.

Although isProtectedReplyCode() is FTPS-specific, it's a good idea that it's now in FTPReply - everything in one place.

I keep command names public, so the users can send them manually, if they want (like when they think Base64 or something else is buggy), but otherwise there are no other reasons to do this.

No other issues right now. If I find something about PBSZ that would be worth implementing separately, I'll let you know.

> FTPSClient does not handle AUTH or ADAT and only partially handles PBSZ. FTPSCommand should be deprecated 
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: NET-397
>                 URL: https://issues.apache.org/jira/browse/NET-397
>             Project: Commons Net
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: ftps-rfc2228.diff
>
>
> FTPSClient does not provide any code to handle AUTH or ADAT, and does not provide support for handling a reduced buffer size provided by the server.
> FTPSCommand defines int values for AUTH and ADAT, but if the integer values are used by client code, the value will be passed to FTPClient, which uses its own array of command strings, and FTPSCommand.AUTH will translate to "USER" and ADAT => "PASS", similarly for PBSZ, PROT and CCC.
> These commands all need special handling, so should be dealt with by FTPSClient only.
> FTPSClient can override the sendCommand(int) and sendCommand(int, String) methods in FTPClient which will help prevent problems.
> Since most of these commands need additional special handling, there should be execNAME() methods for each.
> FTPSCommand should be deprecated.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira