[jboss-jira] [JBoss JIRA] Created: (JBESB-298) URL parsing in EdtFtpImpl.checkParms()

Bernard Tison (JIRA) jira-events at jboss.com
Fri Dec 29 10:10:26 EST 2006


URL parsing in EdtFtpImpl.checkParms()
--------------------------------------

                 Key: JBESB-298
                 URL: http://jira.jboss.com/jira/browse/JBESB-298
             Project: JBoss ESB
          Issue Type: Bug
      Security Level: Public (Everyone can see)
            Reporter: Bernard Tison
         Assigned To: Mark Little


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 at localhost, which results in m_sUser="ftpuser" and m_sPasswd="ftppassword at 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. 

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

        



More information about the jboss-jira mailing list