commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Barrett" <JBarr...@sawyermedia.com>
Subject [VFS] PATCH - URLEncode of password in FTP provider
Date Fri, 13 Jun 2003 19:51:09 GMT
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


Mime
View raw message