0 Replies Latest reply on Dec 29, 2006 8:24 AM by Bernard Tison

    Problem with FTP Gateway

    Bernard Tison Newbie

      Hi,

      I think there might be a problem with the way user/password information is parsed from the FTP URL for a FTP Gateway.
      This is based on the static router quickstart example.

      The jbossesb.xml contains the following provider definition:

      <ftp-provider name="FTPprovider" hostname="localhost" >
       <ftp-bus busid="StaticRouterFtpGW" >
       <ftp-message-filter
       username="ftpuser"
       password="ftppassword"
       passive="false"
       directory="/tmp/esbInput"
       input-suffix=".dat"
       />
       </ftp-bus>
       </ftp-provider>
      

      This results in the following definition in the jbossesb-gateway.xml:
      <Ftp-Gateway URL="ftp://ftpuser:ftppassword@localhost:/tmp/esbInput"
       errorDelete="true" gatewayClass="org.jboss.soa.esb.listeners.gateway.RemoteGatewayListener"
       ...(non-relevant portion removed) "/>
      

      When the gateway is initialized, the org.jboss.internal.soa.esb.util.EdtFtpImpl class will parse the URL and connect to the FTP server.
      To parse the username/password out of the URL, the checkParms() method of the EdtFtpImpl class uses the following code (lines 190-198):
       String[] sa = (null == url) ? null
       : url.getAuthority().split(":");
       m_sUser = (null!=sa) ? sa[0] :m_oParms.getAttribute(PARMS_USER);
       if (null == m_sUser)
       throw new Exception("No username specified for FTP");
      
       m_sPasswd = (null!=sa) ? sa[1] :m_oParms.getAttribute(PARMS_PASSWD);
      

      The url.getAuthority() method returns ftpuser:ftppassword@localhost, which results in m_sUser="ftpuser" and m_sPasswd="ftppassword@localhost". This should be: m_sUser="ftpuser" and m_sPasswd="ftppassword".

      Suggestion for fix: use url.getUserInfo() to get the user/password out of the FTP URL. This is how it is done in the EdtFtpImpl(FTPEpr p_oP, boolean p_bConnect) constructor.

      Bernard