Re: how to mask @ in ftp username?



Hi!

There is patch for CVS.  I want to receive some feedbacks before commit.

-- 
Regards,
Andrew V. Samoilov.
vfs/ChangeLog:

	* utilvfs.h: Define URL_AT_IN_USRNAME flag - allow "@" in username
	for vfs_split_url().
	* utilvfs.c (vfs_split_url): Handle "@" in username if 
	flags & URL_AT_IN_USRNAME.
	* ftpfs.c (ftpfs_split_url): Use URL_AT_IN_USRNAME.
	

--- utilvfs.h~	Mon Sep 27 18:49:30 2004
+++ utilvfs.h	Mon Sep 27 15:36:29 2004
@@ -10,6 +10,7 @@
 /* Flags for vfs_split_url() */
 #define URL_ALLOW_ANON 1
 #define URL_NOSLASH 2
+#define URL_AT_IN_USRNAME 4
 
 int vfs_finduid (const char *name);
 int vfs_findgid (const char *name);
--- utilvfs.c.orig	Mon Sep 27 09:29:54 2004
+++ utilvfs.c	Mon Sep 27 15:33:38 2004
@@ -74,6 +74,12 @@ vfs_split_url (const char *path, char **
 
     /* We have a username */
     if (at) {
+	if (flags & URL_AT_IN_USRNAME) {
+	    char *other_at = strchr (at + 1, '@');
+	    char *slash =  strchr (at, PATH_SEP);
+	    if (other_at && (!slash || (other_at < slash)))
+		at = other_at;
+	}
 	*at = 0;
 	inner_colon = strchr (pcopy, ':');
 	if (inner_colon) {
--- ftpfs.c.orig	Mon Sep 27 09:28:52 2004
+++ ftpfs.c	Mon Sep 27 15:33:38 2004
@@ -217,7 +217,7 @@ ftpfs_split_url(char *path, char **host,
     char *p;
 
     p = vfs_split_url (path, host, user, port, pass, FTP_COMMAND_PORT,
-		       URL_ALLOW_ANON);
+		       URL_ALLOW_ANON|URL_AT_IN_USRNAME);
 
     if (!*user) {
 	/* Look up user and password in netrc */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]