Commit bf62fd88 authored by Igor Mammedov's avatar Igor Mammedov Committed by Steve French

[CIFS] fixed compatibility issue with samba refferal request

treeName part is canonicalized to '/' path separator
Signed-off-by: default avatarIgor Mammedov <niallain@gmail.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 39da9847
...@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name) ...@@ -93,15 +93,11 @@ static char *cifs_get_share_name(const char *node_name)
/* find sharename end */ /* find sharename end */
pSep++; pSep++;
pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC)); pSep = memchr(UNC+(pSep-UNC), '\\', len-(pSep-UNC));
if (!pSep) { if (pSep) {
cERROR(1, ("%s:2 cant find share name in node name: %s", /* trim path up to sharename end
__func__, node_name)); * now we have share name in UNC */
kfree(UNC); *pSep = 0;
return NULL;
} }
/* trim path up to sharename end
* * now we have share name in UNC */
*pSep = 0;
return UNC; return UNC;
} }
...@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata, ...@@ -188,7 +184,7 @@ static char *compose_mount_options(const char *sb_mountdata,
tkn_e = strchr(tkn_e+1, '\\'); tkn_e = strchr(tkn_e+1, '\\');
if (tkn_e) { if (tkn_e) {
strcat(mountdata, ",prefixpath="); strcat(mountdata, ",prefixpath=");
strcat(mountdata, tkn_e); strcat(mountdata, tkn_e+1);
} }
} }
...@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) ...@@ -244,7 +240,8 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
return NULL; return NULL;
if (cifs_sb->tcon->Flags & SMB_SHARE_IS_IN_DFS) { 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) + l_max_len = strnlen(cifs_sb->tcon->treeName, MAX_TREE_SIZE+1) +
strnlen(search_path, MAX_PATHCONF) + 1; strnlen(search_path, MAX_PATHCONF) + 1;
tmp_path = kmalloc(l_max_len, GFP_KERNEL); tmp_path = kmalloc(l_max_len, GFP_KERNEL);
...@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry) ...@@ -253,8 +250,14 @@ static char *build_full_dfs_path_from_dentry(struct dentry *dentry)
return NULL; return NULL;
} }
strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len); strncpy(tmp_path, cifs_sb->tcon->treeName, l_max_len);
strcat(tmp_path, search_path);
tmp_path[l_max_len-1] = 0; 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; full_path = tmp_path;
kfree(search_path); kfree(search_path);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment