JBoss ESB
  1. JBoss ESB
  2. JBESB-298

URL parsing in EdtFtpImpl.checkParms()

    Details

    • Type: Bug Bug
    • Status: Closed Closed (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: None
    • Security Level: Public (Everyone can see)
    • Labels:
      None
    • Similar Issues:
      Show 10 results 

      Description

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

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

      <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):
      Code:

      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.

        Activity

        Hide
        Esteban Schifman
        added a comment -

        Fixed following Bernard's suggestion. Thank you Bernard !

        Show
        Esteban Schifman
        added a comment - Fixed following Bernard's suggestion. Thank you Bernard !

          People

          • Assignee:
            Esteban Schifman
            Reporter:
            Bernard Tison
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: