[esb-issues] [JBoss JIRA] Updated: (JBESB-3293) FtpImpl getFileListFromRemoteDir() bad suffix handling, listing subdir contents

Tom Eicher (JIRA) jira-events at lists.jboss.org
Tue Apr 27 07:43:17 EDT 2010


     [ https://jira.jboss.org/jira/browse/JBESB-3293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tom Eicher updated JBESB-3293:
------------------------------

    Description: 
- RemoteFileSystem.getFileListFromRemoteDir(p_sSuffix) is meant to return the listing of the files of the current directory.
- however, due to the "suffix enforcing" in FtpImpl, even calls like "getFileListFromRemoteDir(null)" and "getFileListFromRemoteDir("")" will be executed as getFileListFromRemoteDir("*"), making this a FTP "NLST *" command.
- (and "getFileListFromRemoteDir(".")" will be "getFileListFromRemoteDir("*.")"...)
- now, when your target directory contains only one entry, and that entry is a directory, the NLST will glob the "*" and return the listing of the subdir(!)
- so, you will get unexpected results like "tmp/file1", "tmp/file2", when all you wanted was to receive the "tmp".
- even when giving a suffix like "*.xml", this will return "tmp/file1.xml".
- tested against Microsoft ftp server, but the behaviour is as expected, so will be identical with many ftp servers

- fix: when no suffix given, call "listNames()", not "listNames("*")".
- see also: FTPClient.listNames(String) docu, which says "The server may or may not expand glob expressions". For ftp servers not doing globbing, this means all downloads will fail.

  was:
- RemoteFileSystem.getFileListFromRemoteDir(p_sSuffix) is meant to return the listing of the files of the current directory.
- however, due to the "suffix enforcing" in FtpImpl, even calls like "getFileListFromRemoteDir(null)" and "getFileListFromRemoteDir("")" will be executed as getFileListFromRemoteDir("*"), making this a FTP "NLST *" command.
- (and "getFileListFromRemoteDir(".")" will be "getFileListFromRemoteDir("*.")"...)
- now, when your target directory contains only one entry, and that entry is a file, the NLST will glob the "*" and return the listing of the subdir(!)
- so, you will get unexpected results like "tmp/file1", "tmp/file2", when all you wanted was to receive the "tmp".
- even when giving a suffix like "*.xml", this will return "tmp/file1.xml".
- tested against Microsoft ftp server, but the behaviour is as expected, so will be identical with many ftp servers

- fix: when no suffix given, call "listNames()", not "listNames("*")".
- see also: FTPClient.listNames(String) docu, which says "The server may or may not expand glob expressions". For ftp servers not doing globbing, this means all downloads will fail.



> FtpImpl getFileListFromRemoteDir() bad suffix handling, listing subdir contents
> -------------------------------------------------------------------------------
>
>                 Key: JBESB-3293
>                 URL: https://jira.jboss.org/jira/browse/JBESB-3293
>             Project: JBoss ESB
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Adapters
>    Affects Versions: 4.6, 4.7, 4.7 CP1, 4.8
>            Reporter: Tom Eicher
>
> - RemoteFileSystem.getFileListFromRemoteDir(p_sSuffix) is meant to return the listing of the files of the current directory.
> - however, due to the "suffix enforcing" in FtpImpl, even calls like "getFileListFromRemoteDir(null)" and "getFileListFromRemoteDir("")" will be executed as getFileListFromRemoteDir("*"), making this a FTP "NLST *" command.
> - (and "getFileListFromRemoteDir(".")" will be "getFileListFromRemoteDir("*.")"...)
> - now, when your target directory contains only one entry, and that entry is a directory, the NLST will glob the "*" and return the listing of the subdir(!)
> - so, you will get unexpected results like "tmp/file1", "tmp/file2", when all you wanted was to receive the "tmp".
> - even when giving a suffix like "*.xml", this will return "tmp/file1.xml".
> - tested against Microsoft ftp server, but the behaviour is as expected, so will be identical with many ftp servers
> - fix: when no suffix given, call "listNames()", not "listNames("*")".
> - see also: FTPClient.listNames(String) docu, which says "The server may or may not expand glob expressions". For ftp servers not doing globbing, this means all downloads will fail.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the esb-issues mailing list