Re: DFS patch series - fixed

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

 



Steve French wrote:
> I merged the first patch in your remaining cifs dfs series patch
> 0001-Adds-to-dns_resolver-checking-if-the-server-name-is.patch into
> the cifs tree, but isn't this section of the 2nd patch of three ie
> 0002-fixed-compatibility-issue-with-samba-a-refferal-req.patch
> incorrect? It is converting the slashes in the whole path (not in the
> UNC prefix) - so escape sequences in real posix directory and file
> names will be converted to separators.  This seems wrong.  We should
> be converting just the treename part here.
> 
> ...

Fixed, now it converts only treeName part of the path:
0003-fixed-compatibility-issue-with-samba-a-refferal-requ.patch

In my test setup it works.

-- 

Best regards,

-------------------------
Igor Mammedov,
niallain "at" gmail.com




>From 29f7313c1e594b5c2c9ff0e0672d551c23354c7d Mon Sep 17 00:00:00 2001
From: Igor Mammedov <niallain@xxxxxxxxx>
Date: Sat, 26 Apr 2008 21:20:28 +0400
Subject: [PATCH] fixed compatibility issue with samba:a refferal request treeName
 part is canonized to '/' path separator

Signed-off-by: Igor Mammedov <niallain@xxxxxxxxx>
---
 fs/cifs/cifs_dfs_ref.c |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index f53f41f..e0a3a56 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -81,15 +81,11 @@ static char *cifs_get_share_name(const char *node_name)
 	/* find sharename end */
 	pSep++;
 	pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC));
-	if (!pSep) {
-		cERROR(1, ("%s:2 cant find share name in node name: %s",
-			__func__, node_name));
-		kfree(UNC);
-		return NULL;
+	if (pSep) {
+		/* trim path up to sharename end
+		 * now we have share name in UNC */
+		*pSep = 0;
 	}
-	/* trim path up to sharename end
-	 *          * now we have share name in UNC */
-	*pSep = 0;
 
 	return UNC;
 }
@@ -176,7 +172,7 @@ static char *compose_mount_options(const char *sb_mountdata,
 		tkn_e = strchr(tkn_e+1, '\\');
 		if (tkn_e) {
 			strcat(mountdata, ",prefixpath=");
-			strcat(mountdata, tkn_e);
+			strcat(mountdata, tkn_e+1);
 		}
 	}
 
@@ -232,7 +228,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
 		return NULL;
 
 	if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) {
-		/* we should use full path name to correct working with DFS */
+		int i;
+		/* we should use full path name for correct working with DFS */
 		l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) +
 					strnlen(search_path, MAX_PATHCONF) + 1;
 		tmp_path = kmalloc(l_max_len, GFP_KERNEL);
@@ -241,8 +238,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
 			return NULL;
 		}
 		strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
-		strcat(tmp_path, search_path);
 		tmp_path[l_max_len-1] = 0;
+		if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
+			for (i = 0; i < l_max_len; i++) {
+				if (tmp_path[i] == '\\')
+					tmp_path[i] = '/';
+			}
+		strncat(tmp_path, search_path, l_max_len - strlen(tmp_path));
+
 		full_path = tmp_path;
 		kfree(search_path);
 	} else {
-- 
1.5.3.7


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux