commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Murdoch <adammurd...@apache.org>
Subject Re: [VFS] PATCH - URLEncode of password in FTP provider
Date Tue, 24 Jun 2003 10:14:23 GMT

Hi,

This has been committed, though in a slightly different form:  The decoding 
gets done in GenericFileName.parseUri(), so that 
GenericFileName.getUserName() and getPassword() always return the decoded 
username and password.

On Sat, 14 Jun 2003 05:51 am, Jeff Barrett wrote:
> Hello,
>
> I think this might be a small bug.
>
> If the FTP provider is being used, a normal url would look like so:
>
> ftp://user:pass@host/path
>
> A client of VFS should URL encode their user, pass, and path.  The problem
> is VFS doesn't unencode the user and pass before sending it to the FTP
> server.
>
> The small patch below will do so:
>
> Index: src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystem.java
> ===================================================================
> RCS file:
> /home/cvspublic/jakarta-commons-sandbox/vfs/src/java/org/apache/commons/vfs
>/provider/ftp/FtpFileSystem.java,v retrieving revision 1.21
> diff -u -r1.21 FtpFileSystem.java
> --- src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystem.java     14
> Apr 2003 01:09:25 -0000   1.21 +++
> src/java/org/apache/commons/vfs/provider/ftp/FtpFileSystem.java     13 Jun
> 2003 19:45:54 -0000 @@ -56,6 +56,8 @@
>  package org.apache.commons.vfs.provider.ftp;
>
>  import java.io.IOException;
> +import java.net.URLDecoder;
>  import java.util.Collection;
>  import org.apache.commons.net.ftp.FTP;
>  import org.apache.commons.net.ftp.FTPClient;
> @@ -97,7 +99,7 @@
>          }
>          else
>          {
> -            username = rootName.getUserName();
> +            username = URLDecoder.decode( rootName.getUserName() );
>          }
>          if ( rootName.getPassword() == null )
>          {
> @@ -105,7 +107,7 @@
>          }
>          else
>          {
> -            password = rootName.getPassword();
> +            password = URLDecoder.decode( rootName.getPassword() );
>          }
>      }
>
>
> The information in this email and subsequent attachments may contain
> confidential information that is intended solely for the attention and use
> of the named addressee(s). This message or any part thereof must not be
> disclosed, copied, distributed, or retained by any person without the
> authorization from the addressee.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org

-- 
Adam


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message