diff options
author | Igor Mammedov <niallain@gmail.com> | 2008-04-28 19:05:58 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-04-28 19:05:58 -0400 |
commit | bf62fd887cab230f5952b611bde25e8e15acb454 (patch) | |
tree | 776bde01427580a9ed0ed20377d07fa67c34a9f5 | |
parent | 39da9847113a870b20fee9a7c216a848b9a5e9f7 (diff) |
[CIFS] fixed compatibility issue with samba refferal request
treeName part is canonicalized to '/' path separator
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
-rw-r--r-- | 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 95024c066d89..f6fdecf6598c 100644 --- a/fs/cifs/cifs_dfs_ref.c +++ b/fs/cifs/cifs_dfs_ref.c | |||
@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name) | |||
93 | /* find sharename end */ | 93 | /* find sharename end */ |
94 | pSep++; | 94 | pSep++; |
95 | pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); | 95 | pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); |
96 | if (!pSep) { | 96 | if (pSep) { |
97 | cERROR(1, ("%s:2 cant find share name in node name: %s", | 97 | /* trim path up to sharename end |
98 | __func__, node_name)); | 98 | * now we have share name in UNC */ |
99 | kfree(UNC); | 99 | *pSep = 0; |
100 | return NULL; | ||
101 | } | 100 | } |
102 | /* trim path up to sharename end | ||
103 | * * now we have share name in UNC */ | ||
104 | *pSep = 0; | ||
105 | 101 | ||
106 | return UNC; | 102 | return UNC; |
107 | } | 103 | } |
@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata, | |||
188 | tkn_e = strchr(tkn_e+1, '\\'); | 184 | tkn_e = strchr(tkn_e+1, '\\'); |
189 | if (tkn_e) { | 185 | if (tkn_e) { |
190 | strcat(mountdata, ",prefixpath="); | 186 | strcat(mountdata, ",prefixpath="); |
191 | strcat(mountdata, tkn_e); | 187 | strcat(mountdata, tkn_e+1); |
192 | } | 188 | } |
193 | } | 189 | } |
194 | 190 | ||
@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | |||
244 | return NULL; | 240 | return NULL; |
245 | 241 | ||
246 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { | 242 | if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { |
247 | /* we should use full path name to correct working with DFS */ | 243 | int i; |
244 | /* we should use full path name for correct working with DFS */ | ||
248 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + | 245 | l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) + |
249 | strnlen(search_path, MAX_PATHCONF) + 1; | 246 | strnlen(search_path, MAX_PATHCONF) + 1; |
250 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); | 247 | tmp_path = kmalloc(l_max_len, GFP_KERNEL); |
@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) | |||
253 | return NULL; | 250 | return NULL; |
254 | } | 251 | } |
255 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); | 252 | strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); |
256 | strcat(tmp_path, search_path); | ||
257 | tmp_path[l_max_len-1] = 0; | 253 | tmp_path[l_max_len-1] = 0; |
254 | if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS) | ||
255 | for (i = 0; i < l_max_len; i++) { | ||
256 | if (tmp_path[i] == '\\') | ||
257 | tmp_path[i] = '/'; | ||
258 | } | ||
259 | strncat(tmp_path, search_path, l_max_len - strlen(tmp_path)); | ||
260 | |||
258 | full_path = tmp_path; | 261 | full_path = tmp_path; |
259 | kfree(search_path); | 262 | kfree(search_path); |
260 | } else { | 263 | } else { |