aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/inode.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2008-04-18 19:26:26 -0400
committerSteve French <sfrench@us.ibm.com>2008-04-18 19:26:26 -0400
commit076d8423a98659a92837b07aa494cb74bfefe77c (patch)
treeed6776db97202bac41f8a1f4ff68188e16373eec /fs/cifs/inode.c
parent2302aca8508ee727a0c5edde3a7518a4ee03da1b (diff)
[CIFS] Fix UNC path prefix on QueryUnixPathInfo to have correct slash
When a share was in DFS and the server was Unix/Linux, we were sending paths of the form \\server\share/dir/file rather than //server/share/dir/file There was some discussion between me and jra over whether we should use /server/share/dir/file as MS sometimes says - but the documentation for this claims it should be doubleslash for this type of UNC-like path format and that works, so leaving it as doubleslash but converting the \ to / in the the //server/share portion. This gets Samba to now correctly return STATUS_PATH_NOT_COVERED when it is supposed to (Windows already did since the direction of the slash was not an issue for them). Still need another minor change to fully enable DFS (need to finish some chages to SMBGetDFSRefer Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/inode.c')
-rw-r--r--fs/cifs/inode.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index bc673c8c1e6b..e1031b9e2c55 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -161,12 +161,14 @@ static void cifs_unix_info_to_inode(struct inode *inode,
161 spin_unlock(&inode->i_lock); 161 spin_unlock(&inode->i_lock);
162} 162}
163 163
164static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon, 164static const unsigned char *cifs_get_search_path(struct cifs_sb_info *cifs_sb,
165 const char *search_path) 165 const char *search_path)
166{ 166{
167 int tree_len; 167 int tree_len;
168 int path_len; 168 int path_len;
169 int i;
169 char *tmp_path; 170 char *tmp_path;
171 struct cifsTconInfo *pTcon = cifs_sb->tcon;
170 172
171 if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS)) 173 if (!(pTcon->Flags & SMB_SHARE_IS_IN_DFS))
172 return search_path; 174 return search_path;
@@ -180,6 +182,11 @@ static const unsigned char *cifs_get_search_path(struct cifsTconInfo *pTcon,
180 return search_path; 182 return search_path;
181 183
182 strncpy(tmp_path, pTcon->treeName, tree_len); 184 strncpy(tmp_path, pTcon->treeName, tree_len);
185 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS)
186 for (i = 0; i < tree_len; i++) {
187 if (tmp_path[i] == '\\')
188 tmp_path[i] = '/';
189 }
183 strncpy(tmp_path+tree_len, search_path, path_len); 190 strncpy(tmp_path+tree_len, search_path, path_len);
184 tmp_path[tree_len+path_len] = 0; 191 tmp_path[tree_len+path_len] = 0;
185 return tmp_path; 192 return tmp_path;
@@ -199,7 +206,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
199 pTcon = cifs_sb->tcon; 206 pTcon = cifs_sb->tcon;
200 cFYI(1, ("Getting info on %s", search_path)); 207 cFYI(1, ("Getting info on %s", search_path));
201 208
202 full_path = cifs_get_search_path(pTcon, search_path); 209 full_path = cifs_get_search_path(cifs_sb, search_path);
203 210
204try_again_CIFSSMBUnixQPathInfo: 211try_again_CIFSSMBUnixQPathInfo:
205 /* could have done a find first instead but this returns more info */ 212 /* could have done a find first instead but this returns more info */
@@ -402,7 +409,7 @@ int cifs_get_inode_info(struct inode **pinode,
402 return -ENOMEM; 409 return -ENOMEM;
403 pfindData = (FILE_ALL_INFO *)buf; 410 pfindData = (FILE_ALL_INFO *)buf;
404 411
405 full_path = cifs_get_search_path(pTcon, search_path); 412 full_path = cifs_get_search_path(cifs_sb, search_path);
406 413
407try_again_CIFSSMBQPathInfo: 414try_again_CIFSSMBQPathInfo:
408 /* could do find first instead but this returns more info */ 415 /* could do find first instead but this returns more info */