[esb-issues] [JBoss JIRA] Commented: (JBESB-2469) Remote directory cannot be relative for (S)FTP(S) gateway

Tom Eicher (JIRA) jira-events at lists.jboss.org
Wed Apr 14 13:08:25 EDT 2010


    [ https://jira.jboss.org/jira/browse/JBESB-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12525700#action_12525700 ] 

Tom Eicher commented on JBESB-2469:
-----------------------------------

While this bug admittedly only occurs with relative paths, the problem is (as the original reporter wrote) that a CD is done for every operation,
even if the CD has been performed before.
Assuming that remoteDir is configured from the outside, and will not change during one invocation, a fix is trivial:

FtpImpl:
    private boolean remoteDirAlreadyChanged=false;
    private void changeRemoteDirectory() throws IOException, RemoteFileSystemException {
        if (remoteDirAlreadyChanged) {
            // see TRAC SOA #82, JBoss JBESB-2469
            return;
        }
        remoteDirAlreadyChanged=true;
        final String remoteDir = getRemoteDir();
        if ((remoteDir != null) && (remoteDir.length() > 0)) {
            if (!m_oConn.changeWorkingDirectory(remoteDir)) {
                throw new RemoteFileSystemException("Failed to change to remote directory: " + m_oConn.getReplyString());
            }
        }
    }

for SecureFtp impl, the fix looks identical, but the 7 or so calls to
            m_oSftpChannel.cd(getRemoteDir());
must be put in a separate method like above.

Of course nicer fixes exist:
- changeRemoteDirectory() could remember the last invocation, and call CD if the path is different
- could ask the server for the "home" (pwd) upon login/connect, remember that, and restore this path before CDing again...

Cheers, Tom.


> Remote directory cannot be relative for (S)FTP(S) gateway
> ---------------------------------------------------------
>
>                 Key: JBESB-2469
>                 URL: https://jira.jboss.org/jira/browse/JBESB-2469
>             Project: JBoss ESB
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: Documentation, Rosetta
>    Affects Versions: 4.4 CP2
>            Reporter: Martin Vecera
>             Fix For: 4.4 CP5
>
>
> FtpImpl, SecureFtpImpl and FtpsImpl are calling "cd" with the directory specified in jboss-esb.xml every time they are getting list of files. When the directory is specified relatively you would need structure like ftp_dir/ftp_dir/ftp_dir/ftp_dir...
> This must be at least documented, but doing cd every X seconds is waste of time. It should be sufficient only once IMHO.

-- 
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