aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:06 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:06 -0400
commit737b758c965a9b223ac1243ab38d9e507ac86c64 (patch)
tree9dcdaf3b573a2a27d0d43c1477a18867b144e5f4 /fs/cifs
parent6c91d362f1e1ebbd4513adb68fc79d552c11e2c0 (diff)
[PATCH] cifs: character mapping of special characters (part 3 of 3)
Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/CHANGES2
-rw-r--r--fs/cifs/README4
-rw-r--r--fs/cifs/TODO3
-rw-r--r--fs/cifs/cifsfs.c4
-rw-r--r--fs/cifs/cifsproto.h103
-rw-r--r--fs/cifs/cifssmb.c226
-rw-r--r--fs/cifs/connect.c25
-rw-r--r--fs/cifs/dir.c108
-rw-r--r--fs/cifs/fcntl.c3
-rw-r--r--fs/cifs/file.c10
-rw-r--r--fs/cifs/inode.c106
-rw-r--r--fs/cifs/link.c18
-rw-r--r--fs/cifs/readdir.c22
-rw-r--r--fs/cifs/xattr.c35
14 files changed, 337 insertions, 332 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index 412b6d243d53..de8858028d64 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -9,7 +9,7 @@ POSIX ACL capability bit. Fix packet signing when multiuser mounting with
9different users from the same client to the same server. Fix oops in 9different users from the same client to the same server. Fix oops in
10cifs_close. Add mount option for remapping reserved characters in 10cifs_close. Add mount option for remapping reserved characters in
11filenames (also allow recognizing files with created by SFU which have any 11filenames (also allow recognizing files with created by SFU which have any
12of these seven reserved characters to be recognized). 12of these seven reserved characters, except backslash, to be recognized).
13 13
14Version 1.31 14Version 1.31
15------------ 15------------
diff --git a/fs/cifs/README b/fs/cifs/README
index 83e054576258..93900fc4adaa 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -376,8 +376,8 @@ A partial list of the supported mount options follows:
376 attributes) to the server (default) e.g. via setfattr 376 attributes) to the server (default) e.g. via setfattr
377 and getfattr utilities. 377 and getfattr utilities.
378 nouser_xattr Do not allow getfattr/setfattr to get/set xattrs 378 nouser_xattr Do not allow getfattr/setfattr to get/set xattrs
379 mapchars Translate the seven reserved characters 379 mapchars Translate six of the seven reserved characters (not backslash)
380 *?<>|:\ 380 *?<>|:
381 to the remap range (above 0xF000), which also 381 to the remap range (above 0xF000), which also
382 allows the CIFS client to recognize files created with 382 allows the CIFS client to recognize files created with
383 such characters by Windows's POSIX emulation. This can 383 such characters by Windows's POSIX emulation. This can
diff --git a/fs/cifs/TODO b/fs/cifs/TODO
index a69227415a73..1e8490ed6948 100644
--- a/fs/cifs/TODO
+++ b/fs/cifs/TODO
@@ -67,6 +67,9 @@ q) implement support for security and trusted categories of xattrs
67 67
68r) Implement O_DIRECT flag on open (already supported on mount) 68r) Implement O_DIRECT flag on open (already supported on mount)
69 69
70s) Allow remapping of last remaining character (\) to +0xF000 which
71(this character is valid for POSIX but not for Windows)
72
70KNOWN BUGS (updated April 3, 2005) 73KNOWN BUGS (updated April 3, 2005)
71==================================== 74====================================
72See http://bugzilla.samba.org - search on product "CifsVFS" for 75See http://bugzilla.samba.org - search on product "CifsVFS" for
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index ae48ef042977..3d5365b9f5ba 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -191,13 +191,13 @@ cifs_statfs(struct super_block *sb, struct kstatfs *buf)
191#ifdef CONFIG_CIFS_EXPERIMENTAL 191#ifdef CONFIG_CIFS_EXPERIMENTAL
192/* BB we could add a second check for a QFS Unix capability bit */ 192/* BB we could add a second check for a QFS Unix capability bit */
193 if (pTcon->ses->capabilities & CAP_UNIX) 193 if (pTcon->ses->capabilities & CAP_UNIX)
194 rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf, cifs_sb->local_nls); 194 rc = CIFSSMBQFSPosixInfo(xid, pTcon, buf);
195 195
196 /* Only need to call the old QFSInfo if failed 196 /* Only need to call the old QFSInfo if failed
197 on newer one */ 197 on newer one */
198 if(rc) 198 if(rc)
199#endif /* CIFS_EXPERIMENTAL */ 199#endif /* CIFS_EXPERIMENTAL */
200 rc = CIFSSMBQFSInfo(xid, pTcon, buf, cifs_sb->local_nls); 200 rc = CIFSSMBQFSInfo(xid, pTcon, buf);
201 201
202 /* 202 /*
203 int f_type; 203 int f_type;
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index b486ba738d95..0010511083fc 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -57,10 +57,11 @@ extern int decode_negTokenInit(unsigned char *security_blob, int length,
57extern int cifs_inet_pton(int, char * source, void *dst); 57extern int cifs_inet_pton(int, char * source, void *dst);
58extern int map_smb_to_linux_error(struct smb_hdr *smb); 58extern int map_smb_to_linux_error(struct smb_hdr *smb);
59extern void header_assemble(struct smb_hdr *, char /* command */ , 59extern void header_assemble(struct smb_hdr *, char /* command */ ,
60 const struct cifsTconInfo *, int 60 const struct cifsTconInfo *, int /* specifies length
61 /* length of fixed section (word count) in two byte units */ 61 of fixed section (word count) in two byte units */
62 ); 62 );
63extern struct oplock_q_entry * AllocOplockQEntry(struct inode *, u16, struct cifsTconInfo *); 63extern struct oplock_q_entry * AllocOplockQEntry(struct inode *, u16,
64 struct cifsTconInfo *);
64extern void DeleteOplockQEntry(struct oplock_q_entry *); 65extern void DeleteOplockQEntry(struct oplock_q_entry *);
65extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ ); 66extern struct timespec cifs_NTtimeToUnix(u64 /* utc nanoseconds since 1601 */ );
66extern u64 cifs_UnixTimeToNT(struct timespec); 67extern u64 cifs_UnixTimeToNT(struct timespec);
@@ -88,7 +89,7 @@ extern int CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
88 89
89extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon, 90extern int CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
90 const char *searchName, const struct nls_table *nls_codepage, 91 const char *searchName, const struct nls_table *nls_codepage,
91 __u16 *searchHandle, struct cifs_search_info * psrch_inf); 92 __u16 *searchHandle, struct cifs_search_info * psrch_inf, int map);
92 93
93extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon, 94extern int CIFSFindNext(const int xid, struct cifsTconInfo *tcon,
94 __u16 searchHandle, struct cifs_search_info * psrch_inf); 95 __u16 searchHandle, struct cifs_search_info * psrch_inf);
@@ -99,42 +100,42 @@ extern int CIFSFindClose(const int, struct cifsTconInfo *tcon,
99extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, 100extern int CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
100 const unsigned char *searchName, 101 const unsigned char *searchName,
101 FILE_ALL_INFO * findData, 102 FILE_ALL_INFO * findData,
102 const struct nls_table *nls_codepage); 103 const struct nls_table *nls_codepage, int remap);
103 104
104extern int CIFSSMBUnixQPathInfo(const int xid, 105extern int CIFSSMBUnixQPathInfo(const int xid,
105 struct cifsTconInfo *tcon, 106 struct cifsTconInfo *tcon,
106 const unsigned char *searchName, 107 const unsigned char *searchName,
107 FILE_UNIX_BASIC_INFO * pFindData, 108 FILE_UNIX_BASIC_INFO * pFindData,
108 const struct nls_table *nls_codepage); 109 const struct nls_table *nls_codepage, int remap);
109 110
110extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, 111extern int CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
111 const unsigned char *searchName, 112 const unsigned char *searchName,
112 unsigned char **targetUNCs, 113 unsigned char **targetUNCs,
113 unsigned int *number_of_UNC_in_array, 114 unsigned int *number_of_UNC_in_array,
114 const struct nls_table *nls_codepage); 115 const struct nls_table *nls_codepage, int remap);
115 116
116extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, 117extern int connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
117 const char *old_path, 118 const char *old_path,
118 const struct nls_table *nls_codepage); 119 const struct nls_table *nls_codepage, int remap);
119extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, 120extern int get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
120 const char *old_path, const struct nls_table *nls_codepage, 121 const char *old_path,
121 unsigned int *pnum_referrals, unsigned char ** preferrals); 122 const struct nls_table *nls_codepage,
123 unsigned int *pnum_referrals,
124 unsigned char ** preferrals,
125 int remap);
122extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, 126extern int CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon,
123 struct kstatfs *FSData, 127 struct kstatfs *FSData);
124 const struct nls_table *nls_codepage);
125extern int CIFSSMBQFSAttributeInfo(const int xid, 128extern int CIFSSMBQFSAttributeInfo(const int xid,
126 struct cifsTconInfo *tcon, 129 struct cifsTconInfo *tcon);
127 const struct nls_table *nls_codepage); 130extern int CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon);
128extern int CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon, 131extern int CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon);
129 const struct nls_table *nls_codepage);
130extern int CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon,
131 const struct nls_table *nls_codepage);
132extern int CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon, 132extern int CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon,
133 struct kstatfs *FSData, const struct nls_table *nls_codepage); 133 struct kstatfs *FSData);
134 134
135extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, 135extern int CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon,
136 const char *fileName, const FILE_BASIC_INFO * data, 136 const char *fileName, const FILE_BASIC_INFO * data,
137 const struct nls_table *nls_codepage); 137 const struct nls_table *nls_codepage,
138 int remap_special_chars);
138extern int CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, 139extern int CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon,
139 const FILE_BASIC_INFO * data, __u16 fid); 140 const FILE_BASIC_INFO * data, __u16 fid);
140#if 0 141#if 0
@@ -143,36 +144,49 @@ extern int CIFSSMBSetAttrLegacy(int xid, struct cifsTconInfo *tcon,
143 const struct nls_table *nls_codepage); 144 const struct nls_table *nls_codepage);
144#endif /* possibly unneeded function */ 145#endif /* possibly unneeded function */
145extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, 146extern int CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon,
146 const char *fileName, __u64 size,int setAllocationSizeFlag, 147 const char *fileName, __u64 size,
147 const struct nls_table *nls_codepage); 148 int setAllocationSizeFlag,
149 const struct nls_table *nls_codepage,
150 int remap_special_chars);
148extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, 151extern int CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon,
149 __u64 size, __u16 fileHandle,__u32 opener_pid, int AllocSizeFlag); 152 __u64 size, __u16 fileHandle,__u32 opener_pid,
153 int AllocSizeFlag);
150extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon, 154extern int CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *pTcon,
151 char *full_path, __u64 mode, __u64 uid, 155 char *full_path, __u64 mode, __u64 uid,
152 __u64 gid, dev_t dev, const struct nls_table *nls_codepage); 156 __u64 gid, dev_t dev,
157 const struct nls_table *nls_codepage,
158 int remap_special_chars);
153 159
154extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, 160extern int CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
155 const char *newName, 161 const char *newName,
156 const struct nls_table *nls_codepage); 162 const struct nls_table *nls_codepage,
163 int remap_special_chars);
157extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, 164extern int CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon,
158 const char *name, const struct nls_table *nls_codepage); 165 const char *name, const struct nls_table *nls_codepage,
166 int remap_special_chars);
159 167
160extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, 168extern int CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon,
161 const char *name, 169 const char *name,
162 const struct nls_table *nls_codepage); 170 const struct nls_table *nls_codepage,
171 int remap_special_chars);
163extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, 172extern int CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
164 const char *fromName, const char *toName, 173 const char *fromName, const char *toName,
165 const struct nls_table *nls_codepage); 174 const struct nls_table *nls_codepage,
175 int remap_special_chars);
166extern int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, 176extern int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
167 int netfid, char * target_name, const struct nls_table *nls_codepage); 177 int netfid, char * target_name,
178 const struct nls_table *nls_codepage,
179 int remap_special_chars);
168extern int CIFSCreateHardLink(const int xid, 180extern int CIFSCreateHardLink(const int xid,
169 struct cifsTconInfo *tcon, 181 struct cifsTconInfo *tcon,
170 const char *fromName, const char *toName, 182 const char *fromName, const char *toName,
171 const struct nls_table *nls_codepage); 183 const struct nls_table *nls_codepage,
184 int remap_special_chars);
172extern int CIFSUnixCreateHardLink(const int xid, 185extern int CIFSUnixCreateHardLink(const int xid,
173 struct cifsTconInfo *tcon, 186 struct cifsTconInfo *tcon,
174 const char *fromName, const char *toName, 187 const char *fromName, const char *toName,
175 const struct nls_table *nls_codepage); 188 const struct nls_table *nls_codepage,
189 int remap_special_chars);
176extern int CIFSUnixCreateSymLink(const int xid, 190extern int CIFSUnixCreateSymLink(const int xid,
177 struct cifsTconInfo *tcon, 191 struct cifsTconInfo *tcon,
178 const char *fromName, const char *toName, 192 const char *fromName, const char *toName,
@@ -192,7 +206,7 @@ extern int CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
192 const char *fileName, const int disposition, 206 const char *fileName, const int disposition,
193 const int access_flags, const int omode, 207 const int access_flags, const int omode,
194 __u16 * netfid, int *pOplock, FILE_ALL_INFO *, 208 __u16 * netfid, int *pOplock, FILE_ALL_INFO *,
195 const struct nls_table *nls_codepage); 209 const struct nls_table *nls_codepage, int remap);
196extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, 210extern int CIFSSMBClose(const int xid, struct cifsTconInfo *tcon,
197 const int smb_file_id); 211 const int smb_file_id);
198 212
@@ -211,10 +225,13 @@ extern int CIFSSMBWrite2(const int xid, struct cifsTconInfo *tcon,
211 const char __user *buf,const int long_op); 225 const char __user *buf,const int long_op);
212extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, 226extern int CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
213 const unsigned char *searchName, __u64 * inode_number, 227 const unsigned char *searchName, __u64 * inode_number,
214 const struct nls_table *nls_codepage); 228 const struct nls_table *nls_codepage,
229 int remap_special_chars);
230#endif /* CONFIG_CIFS_EXPERIMENTAL */
215extern int cifs_convertUCSpath(char *target, const __u16 *source, int maxlen, 231extern int cifs_convertUCSpath(char *target, const __u16 *source, int maxlen,
216 const struct nls_table * codepage); 232 const struct nls_table * codepage);
217#endif /* CONFIG_CIFS_EXPERIMENTAL */ 233extern int cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
234 const struct nls_table * cp, int mapChars);
218 235
219extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon, 236extern int CIFSSMBLock(const int xid, struct cifsTconInfo *tcon,
220 const __u16 netfid, const __u64 len, 237 const __u16 netfid, const __u64 len,
@@ -243,29 +260,31 @@ extern int CIFSSMBCopy(int xid,
243 const char *fromName, 260 const char *fromName,
244 const __u16 target_tid, 261 const __u16 target_tid,
245 const char *toName, const int flags, 262 const char *toName, const int flags,
246 const struct nls_table *nls_codepage); 263 const struct nls_table *nls_codepage,
264 int remap_special_chars);
247extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon, 265extern int CIFSSMBNotify(const int xid, struct cifsTconInfo *tcon,
248 const int notify_subdirs,const __u16 netfid,__u32 filter, 266 const int notify_subdirs,const __u16 netfid,
249 const struct nls_table *nls_codepage); 267 __u32 filter, const struct nls_table *nls_codepage);
250extern ssize_t CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, 268extern ssize_t CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
251 const unsigned char *searchName, char * EAData, 269 const unsigned char *searchName, char * EAData,
252 size_t bufsize, const struct nls_table *nls_codepage); 270 size_t bufsize, const struct nls_table *nls_codepage,
271 int remap_special_chars);
253extern ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon, 272extern ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
254 const unsigned char * searchName,const unsigned char * ea_name, 273 const unsigned char * searchName,const unsigned char * ea_name,
255 unsigned char * ea_value, size_t buf_size, 274 unsigned char * ea_value, size_t buf_size,
256 const struct nls_table *nls_codepage); 275 const struct nls_table *nls_codepage, int remap_special_chars);
257extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, 276extern int CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon,
258 const char *fileName, const char * ea_name, 277 const char *fileName, const char * ea_name,
259 const void * ea_value, const __u16 ea_value_len, 278 const void * ea_value, const __u16 ea_value_len,
260 const struct nls_table *nls_codepage); 279 const struct nls_table *nls_codepage, int remap_special_chars);
261extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, 280extern int CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
262 const unsigned char *searchName, 281 const unsigned char *searchName,
263 char *acl_inf, const int buflen,const int acl_type, 282 char *acl_inf, const int buflen,const int acl_type,
264 const struct nls_table *nls_codepage); 283 const struct nls_table *nls_codepage, int remap_special_chars);
265extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon, 284extern int CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
266 const unsigned char *fileName, 285 const unsigned char *fileName,
267 const char *local_acl, const int buflen, const int acl_type, 286 const char *local_acl, const int buflen, const int acl_type,
268 const struct nls_table *nls_codepage); 287 const struct nls_table *nls_codepage, int remap_special_chars);
269extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon, 288extern int CIFSGetExtAttr(const int xid, struct cifsTconInfo *tcon,
270 const int netfid, __u64 * pExtAttrBits, __u64 *pMask); 289 const int netfid, __u64 * pExtAttrBits, __u64 *pMask);
271#endif /* _CIFSPROTO_H */ 290#endif /* _CIFSPROTO_H */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 237e3bf94bfe..f7c4914c3dd9 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -538,8 +538,8 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
538} 538}
539 539
540int 540int
541CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, 541CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, const char *fileName,
542 const char *fileName, const struct nls_table *nls_codepage) 542 const struct nls_table *nls_codepage, int remap)
543{ 543{
544 DELETE_FILE_REQ *pSMB = NULL; 544 DELETE_FILE_REQ *pSMB = NULL;
545 DELETE_FILE_RSP *pSMBr = NULL; 545 DELETE_FILE_RSP *pSMBr = NULL;
@@ -555,9 +555,8 @@ DelFileRetry:
555 555
556 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 556 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
557 name_len = 557 name_len =
558 cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, PATH_MAX 558 cifsConvertToUCS((__u16 *) pSMB->fileName, fileName,
559 /* find define for this maxpathcomponent */ 559 PATH_MAX, nls_codepage, remap);
560 , nls_codepage);
561 name_len++; /* trailing null */ 560 name_len++; /* trailing null */
562 name_len *= 2; 561 name_len *= 2;
563 } else { /* BB improve the check for buffer overruns BB */ 562 } else { /* BB improve the check for buffer overruns BB */
@@ -589,8 +588,8 @@ DelFileRetry:
589} 588}
590 589
591int 590int
592CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, 591CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, const char *dirName,
593 const char *dirName, const struct nls_table *nls_codepage) 592 const struct nls_table *nls_codepage, int remap)
594{ 593{
595 DELETE_DIRECTORY_REQ *pSMB = NULL; 594 DELETE_DIRECTORY_REQ *pSMB = NULL;
596 DELETE_DIRECTORY_RSP *pSMBr = NULL; 595 DELETE_DIRECTORY_RSP *pSMBr = NULL;
@@ -606,9 +605,8 @@ RmDirRetry:
606 return rc; 605 return rc;
607 606
608 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 607 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
609 name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, PATH_MAX 608 name_len = cifsConvertToUCS((__le16 *) pSMB->DirName, dirName,
610 /* find define for this maxpathcomponent */ 609 PATH_MAX, nls_codepage, remap);
611 , nls_codepage);
612 name_len++; /* trailing null */ 610 name_len++; /* trailing null */
613 name_len *= 2; 611 name_len *= 2;
614 } else { /* BB improve the check for buffer overruns BB */ 612 } else { /* BB improve the check for buffer overruns BB */
@@ -639,7 +637,7 @@ RmDirRetry:
639 637
640int 638int
641CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, 639CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
642 const char *name, const struct nls_table *nls_codepage) 640 const char *name, const struct nls_table *nls_codepage, int remap)
643{ 641{
644 int rc = 0; 642 int rc = 0;
645 CREATE_DIRECTORY_REQ *pSMB = NULL; 643 CREATE_DIRECTORY_REQ *pSMB = NULL;
@@ -655,9 +653,8 @@ MkDirRetry:
655 return rc; 653 return rc;
656 654
657 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 655 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
658 name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, PATH_MAX 656 name_len = cifsConvertToUCS((__u16 *) pSMB->DirName, name,
659 /* find define for this maxpathcomponent */ 657 PATH_MAX, nls_codepage, remap);
660 , nls_codepage);
661 name_len++; /* trailing null */ 658 name_len++; /* trailing null */
662 name_len *= 2; 659 name_len *= 2;
663 } else { /* BB improve the check for buffer overruns BB */ 660 } else { /* BB improve the check for buffer overruns BB */
@@ -690,7 +687,7 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
690 const char *fileName, const int openDisposition, 687 const char *fileName, const int openDisposition,
691 const int access_flags, const int create_options, __u16 * netfid, 688 const int access_flags, const int create_options, __u16 * netfid,
692 int *pOplock, FILE_ALL_INFO * pfile_info, 689 int *pOplock, FILE_ALL_INFO * pfile_info,
693 const struct nls_table *nls_codepage) 690 const struct nls_table *nls_codepage, int remap)
694{ 691{
695 int rc = -EACCES; 692 int rc = -EACCES;
696 OPEN_REQ *pSMB = NULL; 693 OPEN_REQ *pSMB = NULL;
@@ -710,10 +707,8 @@ openRetry:
710 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 707 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
711 count = 1; /* account for one byte pad to word boundary */ 708 count = 1; /* account for one byte pad to word boundary */
712 name_len = 709 name_len =
713 cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1), 710 cifsConvertToUCS((__u16 *) (pSMB->fileName + 1),
714 fileName, PATH_MAX 711 fileName, PATH_MAX, nls_codepage, remap);
715 /* find define for this maxpathcomponent */
716 , nls_codepage);
717 name_len++; /* trailing null */ 712 name_len++; /* trailing null */
718 name_len *= 2; 713 name_len *= 2;
719 pSMB->NameLength = cpu_to_le16(name_len); 714 pSMB->NameLength = cpu_to_le16(name_len);
@@ -1108,7 +1103,7 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1108int 1103int
1109CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, 1104CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
1110 const char *fromName, const char *toName, 1105 const char *fromName, const char *toName,
1111 const struct nls_table *nls_codepage) 1106 const struct nls_table *nls_codepage, int remap)
1112{ 1107{
1113 int rc = 0; 1108 int rc = 0;
1114 RENAME_REQ *pSMB = NULL; 1109 RENAME_REQ *pSMB = NULL;
@@ -1131,18 +1126,16 @@ renameRetry:
1131 1126
1132 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1127 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1133 name_len = 1128 name_len =
1134 cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX 1129 cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName,
1135 /* find define for this maxpathcomponent */ 1130 PATH_MAX, nls_codepage, remap);
1136 , nls_codepage);
1137 name_len++; /* trailing null */ 1131 name_len++; /* trailing null */
1138 name_len *= 2; 1132 name_len *= 2;
1139 pSMB->OldFileName[name_len] = 0x04; /* pad */ 1133 pSMB->OldFileName[name_len] = 0x04; /* pad */
1140 /* protocol requires ASCII signature byte on Unicode string */ 1134 /* protocol requires ASCII signature byte on Unicode string */
1141 pSMB->OldFileName[name_len + 1] = 0x00; 1135 pSMB->OldFileName[name_len + 1] = 0x00;
1142 name_len2 = 1136 name_len2 =
1143 cifs_strtoUCS((wchar_t *) & pSMB-> 1137 cifsConvertToUCS((__u16 *) &pSMB->OldFileName[name_len + 2],
1144 OldFileName[name_len + 2], toName, PATH_MAX, 1138 toName, PATH_MAX, nls_codepage, remap);
1145 nls_codepage);
1146 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1139 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1147 name_len2 *= 2; /* convert to bytes */ 1140 name_len2 *= 2; /* convert to bytes */
1148 } else { /* BB improve the check for buffer overruns BB */ 1141 } else { /* BB improve the check for buffer overruns BB */
@@ -1182,7 +1175,8 @@ renameRetry:
1182} 1175}
1183 1176
1184int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, 1177int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1185 int netfid, char * target_name, const struct nls_table * nls_codepage) 1178 int netfid, char * target_name,
1179 const struct nls_table * nls_codepage, int remap)
1186{ 1180{
1187 struct smb_com_transaction2_sfi_req *pSMB = NULL; 1181 struct smb_com_transaction2_sfi_req *pSMB = NULL;
1188 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; 1182 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
@@ -1227,9 +1221,11 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1227 /* unicode only call */ 1221 /* unicode only call */
1228 if(target_name == NULL) { 1222 if(target_name == NULL) {
1229 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); 1223 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid);
1230 len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, dummy_string, 24, nls_codepage); 1224 len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name,
1225 dummy_string, 24, nls_codepage, remap);
1231 } else { 1226 } else {
1232 len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, PATH_MAX, nls_codepage); 1227 len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name,
1228 target_name, PATH_MAX, nls_codepage, remap);
1233 } 1229 }
1234 rename_info->target_name_len = cpu_to_le32(2 * len_of_str); 1230 rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
1235 count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; 1231 count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2;
@@ -1263,7 +1259,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1263int 1259int
1264CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, 1260CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
1265 const __u16 target_tid, const char *toName, const int flags, 1261 const __u16 target_tid, const char *toName, const int flags,
1266 const struct nls_table *nls_codepage) 1262 const struct nls_table *nls_codepage, int remap)
1267{ 1263{
1268 int rc = 0; 1264 int rc = 0;
1269 COPY_REQ *pSMB = NULL; 1265 COPY_REQ *pSMB = NULL;
@@ -1285,18 +1281,16 @@ copyRetry:
1285 pSMB->Flags = cpu_to_le16(flags & COPY_TREE); 1281 pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
1286 1282
1287 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1283 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1288 name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, 1284 name_len = cifsConvertToUCS((__u16 *) pSMB->OldFileName,
1289 fromName, 1285 fromName, PATH_MAX, nls_codepage,
1290 PATH_MAX /* find define for this maxpathcomponent */, 1286 remap);
1291 nls_codepage);
1292 name_len++; /* trailing null */ 1287 name_len++; /* trailing null */
1293 name_len *= 2; 1288 name_len *= 2;
1294 pSMB->OldFileName[name_len] = 0x04; /* pad */ 1289 pSMB->OldFileName[name_len] = 0x04; /* pad */
1295 /* protocol requires ASCII signature byte on Unicode string */ 1290 /* protocol requires ASCII signature byte on Unicode string */
1296 pSMB->OldFileName[name_len + 1] = 0x00; 1291 pSMB->OldFileName[name_len + 1] = 0x00;
1297 name_len2 = cifs_strtoUCS((wchar_t *) & pSMB-> 1292 name_len2 = cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2],
1298 OldFileName[name_len + 2], toName, PATH_MAX, 1293 toName, PATH_MAX, nls_codepage, remap);
1299 nls_codepage);
1300 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1294 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1301 name_len2 *= 2; /* convert to bytes */ 1295 name_len2 *= 2; /* convert to bytes */
1302 } else { /* BB improve the check for buffer overruns BB */ 1296 } else { /* BB improve the check for buffer overruns BB */
@@ -1425,7 +1419,7 @@ createSymLinkRetry:
1425int 1419int
1426CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon, 1420CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon,
1427 const char *fromName, const char *toName, 1421 const char *fromName, const char *toName,
1428 const struct nls_table *nls_codepage) 1422 const struct nls_table *nls_codepage, int remap)
1429{ 1423{
1430 TRANSACTION2_SPI_REQ *pSMB = NULL; 1424 TRANSACTION2_SPI_REQ *pSMB = NULL;
1431 TRANSACTION2_SPI_RSP *pSMBr = NULL; 1425 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -1444,9 +1438,8 @@ createHardLinkRetry:
1444 return rc; 1438 return rc;
1445 1439
1446 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1440 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1447 name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, PATH_MAX 1441 name_len = cifsConvertToUCS((__u16 *) pSMB->FileName, toName,
1448 /* find define for this maxpathcomponent */ 1442 PATH_MAX, nls_codepage, remap);
1449 , nls_codepage);
1450 name_len++; /* trailing null */ 1443 name_len++; /* trailing null */
1451 name_len *= 2; 1444 name_len *= 2;
1452 1445
@@ -1468,9 +1461,8 @@ createHardLinkRetry:
1468 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 1461 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
1469 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1462 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1470 name_len_target = 1463 name_len_target =
1471 cifs_strtoUCS((wchar_t *) data_offset, fromName, PATH_MAX 1464 cifsConvertToUCS((__u16 *) data_offset, fromName, PATH_MAX,
1472 /* find define for this maxpathcomponent */ 1465 nls_codepage, remap);
1473 , nls_codepage);
1474 name_len_target++; /* trailing null */ 1466 name_len_target++; /* trailing null */
1475 name_len_target *= 2; 1467 name_len_target *= 2;
1476 } else { /* BB improve the check for buffer overruns BB */ 1468 } else { /* BB improve the check for buffer overruns BB */
@@ -1512,7 +1504,7 @@ createHardLinkRetry:
1512int 1504int
1513CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon, 1505CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon,
1514 const char *fromName, const char *toName, 1506 const char *fromName, const char *toName,
1515 const struct nls_table *nls_codepage) 1507 const struct nls_table *nls_codepage, int remap)
1516{ 1508{
1517 int rc = 0; 1509 int rc = 0;
1518 NT_RENAME_REQ *pSMB = NULL; 1510 NT_RENAME_REQ *pSMB = NULL;
@@ -1539,17 +1531,15 @@ winCreateHardLinkRetry:
1539 1531
1540 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1532 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1541 name_len = 1533 name_len =
1542 cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX 1534 cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName,
1543 /* find define for this maxpathcomponent */ 1535 PATH_MAX, nls_codepage, remap);
1544 , nls_codepage);
1545 name_len++; /* trailing null */ 1536 name_len++; /* trailing null */
1546 name_len *= 2; 1537 name_len *= 2;
1547 pSMB->OldFileName[name_len] = 0; /* pad */ 1538 pSMB->OldFileName[name_len] = 0; /* pad */
1548 pSMB->OldFileName[name_len + 1] = 0x04; 1539 pSMB->OldFileName[name_len + 1] = 0x04;
1549 name_len2 = 1540 name_len2 =
1550 cifs_strtoUCS((wchar_t *) & pSMB-> 1541 cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2],
1551 OldFileName[name_len + 2], toName, PATH_MAX, 1542 toName, PATH_MAX, nls_codepage, remap);
1552 nls_codepage);
1553 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1543 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1554 name_len2 *= 2; /* convert to bytes */ 1544 name_len2 *= 2; /* convert to bytes */
1555 } else { /* BB improve the check for buffer overruns BB */ 1545 } else { /* BB improve the check for buffer overruns BB */
@@ -1659,6 +1649,7 @@ querySymLinkRetry:
1659 name_len = UniStrnlen((wchar_t *) ((char *) 1649 name_len = UniStrnlen((wchar_t *) ((char *)
1660 &pSMBr->hdr.Protocol +data_offset), 1650 &pSMBr->hdr.Protocol +data_offset),
1661 min_t(const int, buflen,count) / 2); 1651 min_t(const int, buflen,count) / 2);
1652 /* BB FIXME investigate remapping reserved chars here */
1662 cifs_strfromUCS_le(symlinkinfo, 1653 cifs_strfromUCS_le(symlinkinfo,
1663 (wchar_t *) ((char *)&pSMBr->hdr.Protocol + 1654 (wchar_t *) ((char *)&pSMBr->hdr.Protocol +
1664 data_offset), 1655 data_offset),
@@ -1793,7 +1784,8 @@ static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace
1793} 1784}
1794 1785
1795/* Convert ACL from CIFS POSIX wire format to local Linux POSIX ACL xattr */ 1786/* Convert ACL from CIFS POSIX wire format to local Linux POSIX ACL xattr */
1796static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen,const int acl_type,const int size_of_data_area) 1787static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen,
1788 const int acl_type,const int size_of_data_area)
1797{ 1789{
1798 int size = 0; 1790 int size = 0;
1799 int i; 1791 int i;
@@ -1912,7 +1904,7 @@ int
1912CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, 1904CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
1913 const unsigned char *searchName, 1905 const unsigned char *searchName,
1914 char *acl_inf, const int buflen, const int acl_type, 1906 char *acl_inf, const int buflen, const int acl_type,
1915 const struct nls_table *nls_codepage) 1907 const struct nls_table *nls_codepage, int remap)
1916{ 1908{
1917/* SMB_QUERY_POSIX_ACL */ 1909/* SMB_QUERY_POSIX_ACL */
1918 TRANSACTION2_QPI_REQ *pSMB = NULL; 1910 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -1932,8 +1924,8 @@ queryAclRetry:
1932 1924
1933 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1925 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1934 name_len = 1926 name_len =
1935 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 1927 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
1936 , nls_codepage); 1928 PATH_MAX, nls_codepage, remap);
1937 name_len++; /* trailing null */ 1929 name_len++; /* trailing null */
1938 name_len *= 2; 1930 name_len *= 2;
1939 pSMB->FileName[name_len] = 0; 1931 pSMB->FileName[name_len] = 0;
@@ -1997,8 +1989,9 @@ queryAclRetry:
1997int 1989int
1998CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon, 1990CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
1999 const unsigned char *fileName, 1991 const unsigned char *fileName,
2000 const char *local_acl, const int buflen, const int acl_type, 1992 const char *local_acl, const int buflen,
2001 const struct nls_table *nls_codepage) 1993 const int acl_type,
1994 const struct nls_table *nls_codepage, int remap)
2002{ 1995{
2003 struct smb_com_transaction2_spi_req *pSMB = NULL; 1996 struct smb_com_transaction2_spi_req *pSMB = NULL;
2004 struct smb_com_transaction2_spi_rsp *pSMBr = NULL; 1997 struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
@@ -2016,8 +2009,8 @@ setAclRetry:
2016 return rc; 2009 return rc;
2017 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2010 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2018 name_len = 2011 name_len =
2019 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 2012 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
2020 , nls_codepage); 2013 PATH_MAX, nls_codepage, remap);
2021 name_len++; /* trailing null */ 2014 name_len++; /* trailing null */
2022 name_len *= 2; 2015 name_len *= 2;
2023 } else { /* BB improve the check for buffer overruns BB */ 2016 } else { /* BB improve the check for buffer overruns BB */
@@ -2161,7 +2154,7 @@ int
2161CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, 2154CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
2162 const unsigned char *searchName, 2155 const unsigned char *searchName,
2163 FILE_ALL_INFO * pFindData, 2156 FILE_ALL_INFO * pFindData,
2164 const struct nls_table *nls_codepage) 2157 const struct nls_table *nls_codepage, int remap)
2165{ 2158{
2166/* level 263 SMB_QUERY_FILE_ALL_INFO */ 2159/* level 263 SMB_QUERY_FILE_ALL_INFO */
2167 TRANSACTION2_QPI_REQ *pSMB = NULL; 2160 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -2180,9 +2173,8 @@ QPathInfoRetry:
2180 2173
2181 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2174 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2182 name_len = 2175 name_len =
2183 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2176 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
2184 /* find define for this maxpathcomponent */ 2177 PATH_MAX, nls_codepage, remap);
2185 , nls_codepage);
2186 name_len++; /* trailing null */ 2178 name_len++; /* trailing null */
2187 name_len *= 2; 2179 name_len *= 2;
2188 } else { /* BB improve the check for buffer overruns BB */ 2180 } else { /* BB improve the check for buffer overruns BB */
@@ -2243,7 +2235,7 @@ int
2243CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, 2235CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
2244 const unsigned char *searchName, 2236 const unsigned char *searchName,
2245 FILE_UNIX_BASIC_INFO * pFindData, 2237 FILE_UNIX_BASIC_INFO * pFindData,
2246 const struct nls_table *nls_codepage) 2238 const struct nls_table *nls_codepage, int remap)
2247{ 2239{
2248/* SMB_QUERY_FILE_UNIX_BASIC */ 2240/* SMB_QUERY_FILE_UNIX_BASIC */
2249 TRANSACTION2_QPI_REQ *pSMB = NULL; 2241 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -2262,9 +2254,8 @@ UnixQPathInfoRetry:
2262 2254
2263 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2255 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2264 name_len = 2256 name_len =
2265 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2257 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
2266 /* find define for this maxpathcomponent */ 2258 PATH_MAX, nls_codepage, remap);
2267 , nls_codepage);
2268 name_len++; /* trailing null */ 2259 name_len++; /* trailing null */
2269 name_len *= 2; 2260 name_len *= 2;
2270 } else { /* BB improve the check for buffer overruns BB */ 2261 } else { /* BB improve the check for buffer overruns BB */
@@ -2344,7 +2335,7 @@ findUniqueRetry:
2344 2335
2345 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2336 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2346 name_len = 2337 name_len =
2347 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2338 cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
2348 /* find define for this maxpathcomponent */ 2339 /* find define for this maxpathcomponent */
2349 , nls_codepage); 2340 , nls_codepage);
2350 name_len++; /* trailing null */ 2341 name_len++; /* trailing null */
@@ -2408,7 +2399,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
2408 const char *searchName, 2399 const char *searchName,
2409 const struct nls_table *nls_codepage, 2400 const struct nls_table *nls_codepage,
2410 __u16 * pnetfid, 2401 __u16 * pnetfid,
2411 struct cifs_search_info * psrch_inf) 2402 struct cifs_search_info * psrch_inf, int remap)
2412{ 2403{
2413/* level 257 SMB_ */ 2404/* level 257 SMB_ */
2414 TRANSACTION2_FFIRST_REQ *pSMB = NULL; 2405 TRANSACTION2_FFIRST_REQ *pSMB = NULL;
@@ -2419,7 +2410,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
2419 int name_len; 2410 int name_len;
2420 __u16 params, byte_count; 2411 __u16 params, byte_count;
2421 2412
2422 cFYI(1, ("In FindFirst")); 2413 cFYI(1, ("In FindFirst for %s",searchName));
2423 2414
2424findFirstRetry: 2415findFirstRetry:
2425 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 2416 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
@@ -2429,12 +2420,20 @@ findFirstRetry:
2429 2420
2430 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2421 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2431 name_len = 2422 name_len =
2432 cifs_strtoUCS((wchar_t *) pSMB->FileName,searchName, 2423 cifsConvertToUCS((__u16 *) pSMB->FileName,searchName,
2433 PATH_MAX, nls_codepage); 2424 PATH_MAX, nls_codepage, remap);
2434 name_len++; /* trailing null */ 2425 /* We can not add the asterik earlier in case
2426 it got remapped to 0xF03A as if it were part of the
2427 directory name instead of a wildcard */
2435 name_len *= 2; 2428 name_len *= 2;
2429 pSMB->FileName[name_len] = '\\';
2430 pSMB->FileName[name_len+1] = 0;
2431 pSMB->FileName[name_len+2] = '*';
2432 pSMB->FileName[name_len+3] = 0;
2433 name_len += 4; /* now the trailing null */
2436 pSMB->FileName[name_len] = 0; /* null terminate just in case */ 2434 pSMB->FileName[name_len] = 0; /* null terminate just in case */
2437 pSMB->FileName[name_len+1] = 0; 2435 pSMB->FileName[name_len+1] = 0;
2436 name_len += 2;
2438 } else { /* BB add check for overrun of SMB buf BB */ 2437 } else { /* BB add check for overrun of SMB buf BB */
2439 name_len = strnlen(searchName, PATH_MAX); 2438 name_len = strnlen(searchName, PATH_MAX);
2440 name_len++; /* trailing null */ 2439 name_len++; /* trailing null */
@@ -2691,7 +2690,7 @@ int
2691CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, 2690CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
2692 const unsigned char *searchName, 2691 const unsigned char *searchName,
2693 __u64 * inode_number, 2692 __u64 * inode_number,
2694 const struct nls_table *nls_codepage) 2693 const struct nls_table *nls_codepage, int remap)
2695{ 2694{
2696 int rc = 0; 2695 int rc = 0;
2697 TRANSACTION2_QPI_REQ *pSMB = NULL; 2696 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -2712,8 +2711,8 @@ GetInodeNumberRetry:
2712 2711
2713 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2712 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2714 name_len = 2713 name_len =
2715 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 2714 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
2716 PATH_MAX,nls_codepage); 2715 PATH_MAX,nls_codepage, remap);
2717 name_len++; /* trailing null */ 2716 name_len++; /* trailing null */
2718 name_len *= 2; 2717 name_len *= 2;
2719 } else { /* BB improve the check for buffer overruns BB */ 2718 } else { /* BB improve the check for buffer overruns BB */
@@ -2787,7 +2786,7 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
2787 const unsigned char *searchName, 2786 const unsigned char *searchName,
2788 unsigned char **targetUNCs, 2787 unsigned char **targetUNCs,
2789 unsigned int *number_of_UNC_in_array, 2788 unsigned int *number_of_UNC_in_array,
2790 const struct nls_table *nls_codepage) 2789 const struct nls_table *nls_codepage, int remap)
2791{ 2790{
2792/* TRANS2_GET_DFS_REFERRAL */ 2791/* TRANS2_GET_DFS_REFERRAL */
2793 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; 2792 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL;
@@ -2823,10 +2822,8 @@ getDFSRetry:
2823 if (ses->capabilities & CAP_UNICODE) { 2822 if (ses->capabilities & CAP_UNICODE) {
2824 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; 2823 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
2825 name_len = 2824 name_len =
2826 cifs_strtoUCS((wchar_t *) pSMB->RequestFileName, 2825 cifsConvertToUCS((__u16 *) pSMB->RequestFileName,
2827 searchName, PATH_MAX 2826 searchName, PATH_MAX, nls_codepage, remap);
2828 /* find define for this maxpathcomponent */
2829 , nls_codepage);
2830 name_len++; /* trailing null */ 2827 name_len++; /* trailing null */
2831 name_len *= 2; 2828 name_len *= 2;
2832 } else { /* BB improve the check for buffer overruns BB */ 2829 } else { /* BB improve the check for buffer overruns BB */
@@ -2954,8 +2951,7 @@ GetDFSRefExit:
2954} 2951}
2955 2952
2956int 2953int
2957CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, 2954CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, struct kstatfs *FSData)
2958 struct kstatfs *FSData, const struct nls_table *nls_codepage)
2959{ 2955{
2960/* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */ 2956/* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */
2961 TRANSACTION2_QFSI_REQ *pSMB = NULL; 2957 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3038,8 +3034,7 @@ QFSInfoRetry:
3038} 3034}
3039 3035
3040int 3036int
3041CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon, 3037CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon)
3042 const struct nls_table *nls_codepage)
3043{ 3038{
3044/* level 0x105 SMB_QUERY_FILE_SYSTEM_INFO */ 3039/* level 0x105 SMB_QUERY_FILE_SYSTEM_INFO */
3045 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3040 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3107,8 +3102,7 @@ QFSAttributeRetry:
3107} 3102}
3108 3103
3109int 3104int
3110CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon, 3105CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon)
3111 const struct nls_table *nls_codepage)
3112{ 3106{
3113/* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */ 3107/* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */
3114 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3108 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3161,8 +3155,8 @@ QFSDeviceRetry:
3161 else { 3155 else {
3162 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 3156 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
3163 response_data = 3157 response_data =
3164 (FILE_SYSTEM_DEVICE_INFO 3158 (FILE_SYSTEM_DEVICE_INFO *)
3165 *) (((char *) &pSMBr->hdr.Protocol) + 3159 (((char *) &pSMBr->hdr.Protocol) +
3166 data_offset); 3160 data_offset);
3167 memcpy(&tcon->fsDevInfo, response_data, 3161 memcpy(&tcon->fsDevInfo, response_data,
3168 sizeof (FILE_SYSTEM_DEVICE_INFO)); 3162 sizeof (FILE_SYSTEM_DEVICE_INFO));
@@ -3177,8 +3171,7 @@ QFSDeviceRetry:
3177} 3171}
3178 3172
3179int 3173int
3180CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon, 3174CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
3181 const struct nls_table *nls_codepage)
3182{ 3175{
3183/* level 0x200 SMB_QUERY_CIFS_UNIX_INFO */ 3176/* level 0x200 SMB_QUERY_CIFS_UNIX_INFO */
3184 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3177 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3249,7 +3242,7 @@ QFSUnixRetry:
3249 3242
3250int 3243int
3251CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon, 3244CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon,
3252 struct kstatfs *FSData, const struct nls_table *nls_codepage) 3245 struct kstatfs *FSData)
3253{ 3246{
3254/* level 0x201 SMB_QUERY_CIFS_POSIX_INFO */ 3247/* level 0x201 SMB_QUERY_CIFS_POSIX_INFO */
3255 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3248 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3341,7 +3334,8 @@ QFSPosixRetry:
3341 3334
3342int 3335int
3343CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, 3336CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
3344 __u64 size, int SetAllocation, const struct nls_table *nls_codepage) 3337 __u64 size, int SetAllocation,
3338 const struct nls_table *nls_codepage, int remap)
3345{ 3339{
3346 struct smb_com_transaction2_spi_req *pSMB = NULL; 3340 struct smb_com_transaction2_spi_req *pSMB = NULL;
3347 struct smb_com_transaction2_spi_rsp *pSMBr = NULL; 3341 struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
@@ -3360,9 +3354,8 @@ SetEOFRetry:
3360 3354
3361 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3355 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3362 name_len = 3356 name_len =
3363 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 3357 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
3364 /* find define for this maxpathcomponent */ 3358 PATH_MAX, nls_codepage, remap);
3365 , nls_codepage);
3366 name_len++; /* trailing null */ 3359 name_len++; /* trailing null */
3367 name_len *= 2; 3360 name_len *= 2;
3368 } else { /* BB improve the check for buffer overruns BB */ 3361 } else { /* BB improve the check for buffer overruns BB */
@@ -3595,7 +3588,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
3595int 3588int
3596CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName, 3589CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
3597 const FILE_BASIC_INFO * data, 3590 const FILE_BASIC_INFO * data,
3598 const struct nls_table *nls_codepage) 3591 const struct nls_table *nls_codepage, int remap)
3599{ 3592{
3600 TRANSACTION2_SPI_REQ *pSMB = NULL; 3593 TRANSACTION2_SPI_REQ *pSMB = NULL;
3601 TRANSACTION2_SPI_RSP *pSMBr = NULL; 3594 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -3615,9 +3608,8 @@ SetTimesRetry:
3615 3608
3616 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3609 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3617 name_len = 3610 name_len =
3618 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 3611 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
3619 /* find define for this maxpathcomponent */ 3612 PATH_MAX, nls_codepage, remap);
3620 , nls_codepage);
3621 name_len++; /* trailing null */ 3613 name_len++; /* trailing null */
3622 name_len *= 2; 3614 name_len *= 2;
3623 } else { /* BB improve the check for buffer overruns BB */ 3615 } else { /* BB improve the check for buffer overruns BB */
@@ -3697,7 +3689,7 @@ SetAttrLgcyRetry:
3697 3689
3698 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3690 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3699 name_len = 3691 name_len =
3700 cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, 3692 ConvertToUCS((wchar_t *) pSMB->fileName, fileName,
3701 PATH_MAX, nls_codepage); 3693 PATH_MAX, nls_codepage);
3702 name_len++; /* trailing null */ 3694 name_len++; /* trailing null */
3703 name_len *= 2; 3695 name_len *= 2;
@@ -3727,8 +3719,9 @@ SetAttrLgcyRetry:
3727 3719
3728int 3720int
3729CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon, 3721CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
3730 char *fileName, __u64 mode, __u64 uid, __u64 gid, 3722 char *fileName, __u64 mode, __u64 uid, __u64 gid,
3731 dev_t device, const struct nls_table *nls_codepage) 3723 dev_t device, const struct nls_table *nls_codepage,
3724 int remap)
3732{ 3725{
3733 TRANSACTION2_SPI_REQ *pSMB = NULL; 3726 TRANSACTION2_SPI_REQ *pSMB = NULL;
3734 TRANSACTION2_SPI_RSP *pSMBr = NULL; 3727 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -3747,9 +3740,8 @@ setPermsRetry:
3747 3740
3748 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3741 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3749 name_len = 3742 name_len =
3750 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 3743 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
3751 /* find define for this maxpathcomponent */ 3744 PATH_MAX, nls_codepage, remap);
3752 , nls_codepage);
3753 name_len++; /* trailing null */ 3745 name_len++; /* trailing null */
3754 name_len *= 2; 3746 name_len *= 2;
3755 } else { /* BB improve the check for buffer overruns BB */ 3747 } else { /* BB improve the check for buffer overruns BB */
@@ -3872,7 +3864,7 @@ ssize_t
3872CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, 3864CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
3873 const unsigned char *searchName, 3865 const unsigned char *searchName,
3874 char * EAData, size_t buf_size, 3866 char * EAData, size_t buf_size,
3875 const struct nls_table *nls_codepage) 3867 const struct nls_table *nls_codepage, int remap)
3876{ 3868{
3877 /* BB assumes one setup word */ 3869 /* BB assumes one setup word */
3878 TRANSACTION2_QPI_REQ *pSMB = NULL; 3870 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -3893,9 +3885,8 @@ QAllEAsRetry:
3893 3885
3894 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3886 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3895 name_len = 3887 name_len =
3896 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 3888 cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName,
3897 /* find define for this maxpathcomponent */ 3889 PATH_MAX, nls_codepage, remap);
3898 , nls_codepage);
3899 name_len++; /* trailing null */ 3890 name_len++; /* trailing null */
3900 name_len *= 2; 3891 name_len *= 2;
3901 } else { /* BB improve the check for buffer overruns BB */ 3892 } else { /* BB improve the check for buffer overruns BB */
@@ -4017,7 +4008,7 @@ QAllEAsRetry:
4017ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon, 4008ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
4018 const unsigned char * searchName,const unsigned char * ea_name, 4009 const unsigned char * searchName,const unsigned char * ea_name,
4019 unsigned char * ea_value, size_t buf_size, 4010 unsigned char * ea_value, size_t buf_size,
4020 const struct nls_table *nls_codepage) 4011 const struct nls_table *nls_codepage, int remap)
4021{ 4012{
4022 TRANSACTION2_QPI_REQ *pSMB = NULL; 4013 TRANSACTION2_QPI_REQ *pSMB = NULL;
4023 TRANSACTION2_QPI_RSP *pSMBr = NULL; 4014 TRANSACTION2_QPI_RSP *pSMBr = NULL;
@@ -4037,9 +4028,8 @@ QEARetry:
4037 4028
4038 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4029 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4039 name_len = 4030 name_len =
4040 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 4031 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
4041 /* find define for this maxpathcomponent */ 4032 PATH_MAX, nls_codepage, remap);
4042 , nls_codepage);
4043 name_len++; /* trailing null */ 4033 name_len++; /* trailing null */
4044 name_len *= 2; 4034 name_len *= 2;
4045 } else { /* BB improve the check for buffer overruns BB */ 4035 } else { /* BB improve the check for buffer overruns BB */
@@ -4165,7 +4155,8 @@ QEARetry:
4165int 4155int
4166CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName, 4156CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName,
4167 const char * ea_name, const void * ea_value, 4157 const char * ea_name, const void * ea_value,
4168 const __u16 ea_value_len, const struct nls_table *nls_codepage) 4158 const __u16 ea_value_len, const struct nls_table *nls_codepage,
4159 int remap)
4169{ 4160{
4170 struct smb_com_transaction2_spi_req *pSMB = NULL; 4161 struct smb_com_transaction2_spi_req *pSMB = NULL;
4171 struct smb_com_transaction2_spi_rsp *pSMBr = NULL; 4162 struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
@@ -4184,9 +4175,8 @@ SetEARetry:
4184 4175
4185 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4176 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4186 name_len = 4177 name_len =
4187 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 4178 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
4188 /* find define for this maxpathcomponent */ 4179 PATH_MAX, nls_codepage, remap);
4189 , nls_codepage);
4190 name_len++; /* trailing null */ 4180 name_len++; /* trailing null */
4191 name_len *= 2; 4181 name_len *= 2;
4192 } else { /* BB improve the check for buffer overruns BB */ 4182 } else { /* BB improve the check for buffer overruns BB */
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 3d036bf689d8..1f22b85324cf 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -924,14 +924,15 @@ find_unc(__be32 new_target_ip_addr, char *uncName, char *userName)
924 924
925int 925int
926connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo, 926connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
927 const char *old_path, const struct nls_table *nls_codepage) 927 const char *old_path, const struct nls_table *nls_codepage,
928 int remap)
928{ 929{
929 unsigned char *referrals = NULL; 930 unsigned char *referrals = NULL;
930 unsigned int num_referrals; 931 unsigned int num_referrals;
931 int rc = 0; 932 int rc = 0;
932 933
933 rc = get_dfs_path(xid, pSesInfo,old_path, nls_codepage, 934 rc = get_dfs_path(xid, pSesInfo,old_path, nls_codepage,
934 &num_referrals, &referrals); 935 &num_referrals, &referrals, remap);
935 936
936 /* BB Add in code to: if valid refrl, if not ip address contact 937 /* BB Add in code to: if valid refrl, if not ip address contact
937 the helper that resolves tcp names, mount to it, try to 938 the helper that resolves tcp names, mount to it, try to
@@ -946,7 +947,8 @@ connect_to_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
946int 947int
947get_dfs_path(int xid, struct cifsSesInfo *pSesInfo, 948get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
948 const char *old_path, const struct nls_table *nls_codepage, 949 const char *old_path, const struct nls_table *nls_codepage,
949 unsigned int *pnum_referrals, unsigned char ** preferrals) 950 unsigned int *pnum_referrals,
951 unsigned char ** preferrals, int remap)
950{ 952{
951 char *temp_unc; 953 char *temp_unc;
952 int rc = 0; 954 int rc = 0;
@@ -971,7 +973,7 @@ get_dfs_path(int xid, struct cifsSesInfo *pSesInfo,
971 } 973 }
972 if (rc == 0) 974 if (rc == 0)
973 rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals, 975 rc = CIFSGetDFSRefer(xid, pSesInfo, old_path, preferrals,
974 pnum_referrals, nls_codepage); 976 pnum_referrals, nls_codepage, remap);
975 977
976 return rc; 978 return rc;
977} 979}
@@ -1456,11 +1458,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1456 if ((strchr(volume_info.UNC + 3, '\\') == NULL) 1458 if ((strchr(volume_info.UNC + 3, '\\') == NULL)
1457 && (strchr(volume_info.UNC + 3, '/') == 1459 && (strchr(volume_info.UNC + 3, '/') ==
1458 NULL)) { 1460 NULL)) {
1459 rc = connect_to_dfs_path(xid, 1461 rc = connect_to_dfs_path(xid, pSesInfo,
1460 pSesInfo, 1462 "", cifs_sb->local_nls,
1461 "", 1463 cifs_sb->mnt_cifs_flags &
1462 cifs_sb-> 1464 CIFS_MOUNT_MAP_SPECIAL_CHR);
1463 local_nls);
1464 if(volume_info.UNC) 1465 if(volume_info.UNC)
1465 kfree(volume_info.UNC); 1466 kfree(volume_info.UNC);
1466 FreeXid(xid); 1467 FreeXid(xid);
@@ -1523,10 +1524,10 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1523 tcon->ses = pSesInfo; 1524 tcon->ses = pSesInfo;
1524 1525
1525 /* do not care if following two calls succeed - informational only */ 1526 /* do not care if following two calls succeed - informational only */
1526 CIFSSMBQFSDeviceInfo(xid, tcon, cifs_sb->local_nls); 1527 CIFSSMBQFSDeviceInfo(xid, tcon);
1527 CIFSSMBQFSAttributeInfo(xid, tcon, cifs_sb->local_nls); 1528 CIFSSMBQFSAttributeInfo(xid, tcon);
1528 if (tcon->ses->capabilities & CAP_UNIX) { 1529 if (tcon->ses->capabilities & CAP_UNIX) {
1529 if(!CIFSSMBQFSUnixInfo(xid, tcon, cifs_sb->local_nls)) { 1530 if(!CIFSSMBQFSUnixInfo(xid, tcon)) {
1530 if(!volume_info.no_psx_acl) { 1531 if(!volume_info.no_psx_acl) {
1531 if(CIFS_UNIX_POSIX_ACL_CAP & 1532 if(CIFS_UNIX_POSIX_ACL_CAP &
1532 le64_to_cpu(tcon->fsUnixInfo.Capability)) 1533 le64_to_cpu(tcon->fsUnixInfo.Capability))
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 12ba81d7b07f..e3137aa48cdd 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -101,68 +101,15 @@ cifs_bp_rename_retry:
101 return full_path; 101 return full_path;
102} 102}
103 103
104/* Note: caller must free return buffer */ 104/* char * build_wildcard_path_from_dentry(struct dentry *direntry)
105char *
106build_wildcard_path_from_dentry(struct dentry *direntry)
107{ 105{
108 struct dentry *temp;
109 int namelen = 0;
110 char *full_path;
111
112 if(direntry == NULL)
113 return NULL; /* not much we can do if dentry is freed and
114 we need to reopen the file after it was closed implicitly
115 when the server crashed */
116
117cifs_bwp_rename_retry:
118 for (temp = direntry; !IS_ROOT(temp);) {
119 namelen += (1 + temp->d_name.len);
120 temp = temp->d_parent;
121 if(temp == NULL) {
122 cERROR(1,("corrupt dentry"));
123 return NULL;
124 }
125 }
126
127 full_path = kmalloc(namelen+3, GFP_KERNEL);
128 if(full_path == NULL) 106 if(full_path == NULL)
129 return full_path; 107 return full_path;
130 108
131 full_path[namelen] = '\\'; 109 full_path[namelen] = '\\';
132 full_path[namelen+1] = '*'; 110 full_path[namelen+1] = '*';
133 full_path[namelen+2] = 0; /* trailing null */ 111 full_path[namelen+2] = 0;
134 112BB remove above eight lines BB */
135 for (temp = direntry; !IS_ROOT(temp);) {
136 namelen -= 1 + temp->d_name.len;
137 if (namelen < 0) {
138 break;
139 } else {
140 full_path[namelen] = '\\';
141 strncpy(full_path + namelen + 1, temp->d_name.name,
142 temp->d_name.len);
143 cFYI(0, (" name: %s ", full_path + namelen));
144 }
145 temp = temp->d_parent;
146 if(temp == NULL) {
147 cERROR(1,("corrupt dentry"));
148 kfree(full_path);
149 return NULL;
150 }
151 }
152 if (namelen != 0) {
153 cERROR(1,
154 ("We did not end path lookup where we expected namelen is %d",
155 namelen));
156 /* presumably this is only possible if we were racing with a rename
157 of one of the parent directories (we can not lock the dentries
158 above us to prevent this, but retrying should be harmless) */
159 kfree(full_path);
160 namelen = 0;
161 goto cifs_bwp_rename_retry;
162 }
163
164 return full_path;
165}
166 113
167/* Inode operations in similar order to how they appear in the Linux file fs.h */ 114/* Inode operations in similar order to how they appear in the Linux file fs.h */
168 115
@@ -235,7 +182,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
235 182
236 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, 183 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition,
237 desiredAccess, CREATE_NOT_DIR, 184 desiredAccess, CREATE_NOT_DIR,
238 &fileHandle, &oplock, buf, cifs_sb->local_nls); 185 &fileHandle, &oplock, buf, cifs_sb->local_nls,
186 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
239 if (rc) { 187 if (rc) {
240 cFYI(1, ("cifs_create returned 0x%x ", rc)); 188 cFYI(1, ("cifs_create returned 0x%x ", rc));
241 } else { 189 } else {
@@ -248,13 +196,17 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
248 (__u64)current->euid, 196 (__u64)current->euid,
249 (__u64)current->egid, 197 (__u64)current->egid,
250 0 /* dev */, 198 0 /* dev */,
251 cifs_sb->local_nls); 199 cifs_sb->local_nls,
200 cifs_sb->mnt_cifs_flags &
201 CIFS_MOUNT_MAP_SPECIAL_CHR);
252 } else { 202 } else {
253 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, 203 CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
254 (__u64)-1, 204 (__u64)-1,
255 (__u64)-1, 205 (__u64)-1,
256 0 /* dev */, 206 0 /* dev */,
257 cifs_sb->local_nls); 207 cifs_sb->local_nls,
208 cifs_sb->mnt_cifs_flags &
209 CIFS_MOUNT_MAP_SPECIAL_CHR);
258 } 210 }
259 else { 211 else {
260 /* BB implement via Windows security descriptors */ 212 /* BB implement via Windows security descriptors */
@@ -356,11 +308,15 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
356 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { 308 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
357 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, 309 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
358 mode,(__u64)current->euid,(__u64)current->egid, 310 mode,(__u64)current->euid,(__u64)current->egid,
359 device_number, cifs_sb->local_nls); 311 device_number, cifs_sb->local_nls,
312 cifs_sb->mnt_cifs_flags &
313 CIFS_MOUNT_MAP_SPECIAL_CHR);
360 } else { 314 } else {
361 rc = CIFSSMBUnixSetPerms(xid, pTcon, 315 rc = CIFSSMBUnixSetPerms(xid, pTcon,
362 full_path, mode, (__u64)-1, (__u64)-1, 316 full_path, mode, (__u64)-1, (__u64)-1,
363 device_number, cifs_sb->local_nls); 317 device_number, cifs_sb->local_nls,
318 cifs_sb->mnt_cifs_flags &
319 CIFS_MOUNT_MAP_SPECIAL_CHR);
364 } 320 }
365 321
366 if(!rc) { 322 if(!rc) {
@@ -447,36 +403,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
447 return ERR_PTR(rc); 403 return ERR_PTR(rc);
448} 404}
449 405
450int
451cifs_dir_open(struct inode *inode, struct file *file)
452{ /* NB: currently unused since searches are opened in readdir */
453 int rc = 0;
454 int xid;
455 struct cifs_sb_info *cifs_sb;
456 struct cifsTconInfo *pTcon;
457 char *full_path = NULL;
458
459 xid = GetXid();
460
461 cifs_sb = CIFS_SB(inode->i_sb);
462 pTcon = cifs_sb->tcon;
463
464 if(file->f_dentry) {
465 down(&file->f_dentry->d_sb->s_vfs_rename_sem);
466 full_path = build_wildcard_path_from_dentry(file->f_dentry);
467 up(&file->f_dentry->d_sb->s_vfs_rename_sem);
468 } else {
469 FreeXid(xid);
470 return -EIO;
471 }
472
473 cFYI(1, ("inode = 0x%p and full path is %s", inode, full_path));
474
475 kfree(full_path);
476 FreeXid(xid);
477 return rc;
478}
479
480static int 406static int
481cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd) 407cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
482{ 408{
diff --git a/fs/cifs/fcntl.c b/fs/cifs/fcntl.c
index 9d24c40f1967..7d2a9202c39a 100644
--- a/fs/cifs/fcntl.c
+++ b/fs/cifs/fcntl.c
@@ -92,7 +92,8 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
92 cERROR(1,("cifs dir notify on file %s with arg 0x%lx",full_path,arg)); /* BB removeme BB */ 92 cERROR(1,("cifs dir notify on file %s with arg 0x%lx",full_path,arg)); /* BB removeme BB */
93 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, 93 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
94 GENERIC_READ | SYNCHRONIZE, 0 /* create options */, 94 GENERIC_READ | SYNCHRONIZE, 0 /* create options */,
95 &netfid, &oplock,NULL, cifs_sb->local_nls); 95 &netfid, &oplock,NULL, cifs_sb->local_nls,
96 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
96 /* BB fixme - add this handle to a notify handle list */ 97 /* BB fixme - add this handle to a notify handle list */
97 if(rc) { 98 if(rc) {
98 cERROR(1,("Could not open directory for notify")); /* BB remove BB */ 99 cERROR(1,("Could not open directory for notify")); /* BB remove BB */
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 9c7755053099..1df26ddf68b1 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -254,7 +254,8 @@ int cifs_open(struct inode *inode, struct file *file)
254 } 254 }
255 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess, 255 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess,
256 CREATE_NOT_DIR, &netfid, &oplock, buf, 256 CREATE_NOT_DIR, &netfid, &oplock, buf,
257 cifs_sb->local_nls); 257 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags
258 & CIFS_MOUNT_MAP_SPECIAL_CHR);
258 if (rc) { 259 if (rc) {
259 cFYI(1, ("cifs_open returned 0x%x ", rc)); 260 cFYI(1, ("cifs_open returned 0x%x ", rc));
260 goto out; 261 goto out;
@@ -287,7 +288,9 @@ int cifs_open(struct inode *inode, struct file *file)
287 CIFSSMBUnixSetPerms(xid, pTcon, full_path, 288 CIFSSMBUnixSetPerms(xid, pTcon, full_path,
288 inode->i_mode, 289 inode->i_mode,
289 (__u64)-1, (__u64)-1, 0 /* dev */, 290 (__u64)-1, (__u64)-1, 0 /* dev */,
290 cifs_sb->local_nls); 291 cifs_sb->local_nls,
292 cifs_sb->mnt_cifs_flags &
293 CIFS_MOUNT_MAP_SPECIAL_CHR);
291 } else { 294 } else {
292 /* BB implement via Windows security descriptors eg 295 /* BB implement via Windows security descriptors eg
293 CIFSSMBWinSetPerms(xid, pTcon, full_path, mode, 296 CIFSSMBWinSetPerms(xid, pTcon, full_path, mode,
@@ -387,7 +390,8 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
387 } */ 390 } */
388 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess, 391 rc = CIFSSMBOpen(xid, pTcon, full_path, disposition, desiredAccess,
389 CREATE_NOT_DIR, &netfid, &oplock, NULL, 392 CREATE_NOT_DIR, &netfid, &oplock, NULL,
390 cifs_sb->local_nls); 393 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
394 CIFS_MOUNT_MAP_SPECIAL_CHR);
391 if (rc) { 395 if (rc) {
392 up(&pCifsFile->fh_sem); 396 up(&pCifsFile->fh_sem);
393 cFYI(1, ("cifs_open returned 0x%x ", rc)); 397 cFYI(1, ("cifs_open returned 0x%x ", rc));
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index d73b0aa86775..670947288262 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -44,7 +44,8 @@ int cifs_get_inode_info_unix(struct inode **pinode,
44 cFYI(1, (" Getting info on %s ", search_path)); 44 cFYI(1, (" Getting info on %s ", search_path));
45 /* could have done a find first instead but this returns more info */ 45 /* could have done a find first instead but this returns more info */
46 rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData, 46 rc = CIFSSMBUnixQPathInfo(xid, pTcon, search_path, &findData,
47 cifs_sb->local_nls); 47 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
48 CIFS_MOUNT_MAP_SPECIAL_CHR);
48/* dump_mem("\nUnixQPathInfo return data", &findData, 49/* dump_mem("\nUnixQPathInfo return data", &findData,
49 sizeof(findData)); */ 50 sizeof(findData)); */
50 if (rc) { 51 if (rc) {
@@ -63,7 +64,9 @@ int cifs_get_inode_info_unix(struct inode **pinode,
63 strncat(tmp_path, search_path, MAX_PATHCONF); 64 strncat(tmp_path, search_path, MAX_PATHCONF);
64 rc = connect_to_dfs_path(xid, pTcon->ses, 65 rc = connect_to_dfs_path(xid, pTcon->ses,
65 /* treename + */ tmp_path, 66 /* treename + */ tmp_path,
66 cifs_sb->local_nls); 67 cifs_sb->local_nls,
68 cifs_sb->mnt_cifs_flags &
69 CIFS_MOUNT_MAP_SPECIAL_CHR);
67 kfree(tmp_path); 70 kfree(tmp_path);
68 71
69 /* BB fix up inode etc. */ 72 /* BB fix up inode etc. */
@@ -210,7 +213,8 @@ int cifs_get_inode_info(struct inode **pinode,
210 pfindData = (FILE_ALL_INFO *)buf; 213 pfindData = (FILE_ALL_INFO *)buf;
211 /* could do find first instead but this returns more info */ 214 /* could do find first instead but this returns more info */
212 rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData, 215 rc = CIFSSMBQPathInfo(xid, pTcon, search_path, pfindData,
213 cifs_sb->local_nls); 216 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags &
217 CIFS_MOUNT_MAP_SPECIAL_CHR);
214 } 218 }
215 /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */ 219 /* dump_mem("\nQPathInfo return data",&findData, sizeof(findData)); */
216 if (rc) { 220 if (rc) {
@@ -230,7 +234,9 @@ int cifs_get_inode_info(struct inode **pinode,
230 strncat(tmp_path, search_path, MAX_PATHCONF); 234 strncat(tmp_path, search_path, MAX_PATHCONF);
231 rc = connect_to_dfs_path(xid, pTcon->ses, 235 rc = connect_to_dfs_path(xid, pTcon->ses,
232 /* treename + */ tmp_path, 236 /* treename + */ tmp_path,
233 cifs_sb->local_nls); 237 cifs_sb->local_nls,
238 cifs_sb->mnt_cifs_flags &
239 CIFS_MOUNT_MAP_SPECIAL_CHR);
234 kfree(tmp_path); 240 kfree(tmp_path);
235 /* BB fix up inode etc. */ 241 /* BB fix up inode etc. */
236 } else if (rc) { 242 } else if (rc) {
@@ -268,7 +274,9 @@ int cifs_get_inode_info(struct inode **pinode,
268 274
269 rc1 = CIFSGetSrvInodeNumber(xid, pTcon, 275 rc1 = CIFSGetSrvInodeNumber(xid, pTcon,
270 search_path, &inode_num, 276 search_path, &inode_num,
271 cifs_sb->local_nls); 277 cifs_sb->local_nls,
278 cifs_sb->mnt_cifs_flags &
279 CIFS_MOUNT_MAP_SPECIAL_CHR);
272 if(rc1) { 280 if(rc1) {
273 cFYI(1,("GetSrvInodeNum rc %d", rc1)); 281 cFYI(1,("GetSrvInodeNum rc %d", rc1));
274 /* BB EOPNOSUPP disable SERVER_INUM? */ 282 /* BB EOPNOSUPP disable SERVER_INUM? */
@@ -410,7 +418,8 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
410 FreeXid(xid); 418 FreeXid(xid);
411 return -ENOMEM; 419 return -ENOMEM;
412 } 420 }
413 rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls); 421 rc = CIFSSMBDelFile(xid, pTcon, full_path, cifs_sb->local_nls,
422 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
414 423
415 if (!rc) { 424 if (!rc) {
416 direntry->d_inode->i_nlink--; 425 direntry->d_inode->i_nlink--;
@@ -422,10 +431,14 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
422 431
423 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE, 432 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, DELETE,
424 CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE, 433 CREATE_NOT_DIR | CREATE_DELETE_ON_CLOSE,
425 &netfid, &oplock, NULL, cifs_sb->local_nls); 434 &netfid, &oplock, NULL, cifs_sb->local_nls,
435 cifs_sb->mnt_cifs_flags &
436 CIFS_MOUNT_MAP_SPECIAL_CHR);
426 if (rc==0) { 437 if (rc==0) {
427 CIFSSMBRenameOpenFile(xid, pTcon, netfid, NULL, 438 CIFSSMBRenameOpenFile(xid, pTcon, netfid, NULL,
428 cifs_sb->local_nls); 439 cifs_sb->local_nls,
440 cifs_sb->mnt_cifs_flags &
441 CIFS_MOUNT_MAP_SPECIAL_CHR);
429 CIFSSMBClose(xid, pTcon, netfid); 442 CIFSSMBClose(xid, pTcon, netfid);
430 direntry->d_inode->i_nlink--; 443 direntry->d_inode->i_nlink--;
431 } 444 }
@@ -439,7 +452,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
439 if (!(pTcon->ses->flags & CIFS_SES_NT4)) 452 if (!(pTcon->ses->flags & CIFS_SES_NT4))
440 rc = CIFSSMBSetTimes(xid, pTcon, full_path, 453 rc = CIFSSMBSetTimes(xid, pTcon, full_path,
441 pinfo_buf, 454 pinfo_buf,
442 cifs_sb->local_nls); 455 cifs_sb->local_nls,
456 cifs_sb->mnt_cifs_flags &
457 CIFS_MOUNT_MAP_SPECIAL_CHR);
443 else 458 else
444 rc = -EOPNOTSUPP; 459 rc = -EOPNOTSUPP;
445 460
@@ -461,7 +476,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
461 FILE_OPEN, SYNCHRONIZE | 476 FILE_OPEN, SYNCHRONIZE |
462 FILE_WRITE_ATTRIBUTES, 0, 477 FILE_WRITE_ATTRIBUTES, 0,
463 &netfid, &oplock, NULL, 478 &netfid, &oplock, NULL,
464 cifs_sb->local_nls); 479 cifs_sb->local_nls,
480 cifs_sb->mnt_cifs_flags &
481 CIFS_MOUNT_MAP_SPECIAL_CHR);
465 if (rc==0) { 482 if (rc==0) {
466 rc = CIFSSMBSetFileTimes(xid, pTcon, 483 rc = CIFSSMBSetFileTimes(xid, pTcon,
467 pinfo_buf, 484 pinfo_buf,
@@ -472,8 +489,10 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
472 kfree(pinfo_buf); 489 kfree(pinfo_buf);
473 } 490 }
474 if (rc==0) { 491 if (rc==0) {
475 rc = CIFSSMBDelFile(xid, pTcon, full_path, 492 rc = CIFSSMBDelFile(xid, pTcon, full_path,
476 cifs_sb->local_nls); 493 cifs_sb->local_nls,
494 cifs_sb->mnt_cifs_flags &
495 CIFS_MOUNT_MAP_SPECIAL_CHR);
477 if (!rc) { 496 if (!rc) {
478 direntry->d_inode->i_nlink--; 497 direntry->d_inode->i_nlink--;
479 } else if (rc == -ETXTBSY) { 498 } else if (rc == -ETXTBSY) {
@@ -485,11 +504,15 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
485 CREATE_NOT_DIR | 504 CREATE_NOT_DIR |
486 CREATE_DELETE_ON_CLOSE, 505 CREATE_DELETE_ON_CLOSE,
487 &netfid, &oplock, NULL, 506 &netfid, &oplock, NULL,
488 cifs_sb->local_nls); 507 cifs_sb->local_nls,
508 cifs_sb->mnt_cifs_flags &
509 CIFS_MOUNT_MAP_SPECIAL_CHR);
489 if (rc==0) { 510 if (rc==0) {
490 CIFSSMBRenameOpenFile(xid, pTcon, 511 CIFSSMBRenameOpenFile(xid, pTcon,
491 netfid, NULL, 512 netfid, NULL,
492 cifs_sb->local_nls); 513 cifs_sb->local_nls,
514 cifs_sb->mnt_cifs_flags &
515 CIFS_MOUNT_MAP_SPECIAL_CHR);
493 CIFSSMBClose(xid, pTcon, netfid); 516 CIFSSMBClose(xid, pTcon, netfid);
494 direntry->d_inode->i_nlink--; 517 direntry->d_inode->i_nlink--;
495 } 518 }
@@ -534,7 +557,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
534 return -ENOMEM; 557 return -ENOMEM;
535 } 558 }
536 /* BB add setting the equivalent of mode via CreateX w/ACLs */ 559 /* BB add setting the equivalent of mode via CreateX w/ACLs */
537 rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls); 560 rc = CIFSSMBMkDir(xid, pTcon, full_path, cifs_sb->local_nls,
561 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
538 if (rc) { 562 if (rc) {
539 cFYI(1, ("cifs_mkdir returned 0x%x ", rc)); 563 cFYI(1, ("cifs_mkdir returned 0x%x ", rc));
540 d_drop(direntry); 564 d_drop(direntry);
@@ -558,12 +582,16 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
558 (__u64)current->euid, 582 (__u64)current->euid,
559 (__u64)current->egid, 583 (__u64)current->egid,
560 0 /* dev_t */, 584 0 /* dev_t */,
561 cifs_sb->local_nls); 585 cifs_sb->local_nls,
586 cifs_sb->mnt_cifs_flags &
587 CIFS_MOUNT_MAP_SPECIAL_CHR);
562 } else { 588 } else {
563 CIFSSMBUnixSetPerms(xid, pTcon, full_path, 589 CIFSSMBUnixSetPerms(xid, pTcon, full_path,
564 mode, (__u64)-1, 590 mode, (__u64)-1,
565 (__u64)-1, 0 /* dev_t */, 591 (__u64)-1, 0 /* dev_t */,
566 cifs_sb->local_nls); 592 cifs_sb->local_nls,
593 cifs_sb->mnt_cifs_flags &
594 CIFS_MOUNT_MAP_SPECIAL_CHR);
567 } 595 }
568 else { 596 else {
569 /* BB to be implemented via Windows secrty descriptors 597 /* BB to be implemented via Windows secrty descriptors
@@ -600,7 +628,8 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
600 return -ENOMEM; 628 return -ENOMEM;
601 } 629 }
602 630
603 rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls); 631 rc = CIFSSMBRmDir(xid, pTcon, full_path, cifs_sb->local_nls,
632 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
604 633
605 if (!rc) { 634 if (!rc) {
606 inode->i_nlink--; 635 inode->i_nlink--;
@@ -653,7 +682,9 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
653 } 682 }
654 683
655 rc = CIFSSMBRename(xid, pTcon, fromName, toName, 684 rc = CIFSSMBRename(xid, pTcon, fromName, toName,
656 cifs_sb_source->local_nls); 685 cifs_sb_source->local_nls,
686 cifs_sb_source->mnt_cifs_flags &
687 CIFS_MOUNT_MAP_SPECIAL_CHR);
657 if (rc == -EEXIST) { 688 if (rc == -EEXIST) {
658 /* check if they are the same file because rename of hardlinked 689 /* check if they are the same file because rename of hardlinked
659 files is a noop */ 690 files is a noop */
@@ -665,11 +696,16 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
665 if (info_buf_source != NULL) { 696 if (info_buf_source != NULL) {
666 info_buf_target = info_buf_source + 1; 697 info_buf_target = info_buf_source + 1;
667 rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName, 698 rc = CIFSSMBUnixQPathInfo(xid, pTcon, fromName,
668 info_buf_source, cifs_sb_source->local_nls); 699 info_buf_source, cifs_sb_source->local_nls,
700 cifs_sb_source->mnt_cifs_flags &
701 CIFS_MOUNT_MAP_SPECIAL_CHR);
669 if (rc == 0) { 702 if (rc == 0) {
670 rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName, 703 rc = CIFSSMBUnixQPathInfo(xid, pTcon, toName,
671 info_buf_target, 704 info_buf_target,
672 cifs_sb_target->local_nls); 705 cifs_sb_target->local_nls,
706 /* remap based on source sb */
707 cifs_sb_source->mnt_cifs_flags &
708 CIFS_MOUNT_MAP_SPECIAL_CHR);
673 } 709 }
674 if ((rc == 0) && 710 if ((rc == 0) &&
675 (info_buf_source->UniqueId == 711 (info_buf_source->UniqueId ==
@@ -685,7 +721,9 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
685 cifs_unlink(target_inode, target_direntry); 721 cifs_unlink(target_inode, target_direntry);
686 rc = CIFSSMBRename(xid, pTcon, fromName, 722 rc = CIFSSMBRename(xid, pTcon, fromName,
687 toName, 723 toName,
688 cifs_sb_source->local_nls); 724 cifs_sb_source->local_nls,
725 cifs_sb_source->mnt_cifs_flags
726 & CIFS_MOUNT_MAP_SPECIAL_CHR);
689 } 727 }
690 kfree(info_buf_source); 728 kfree(info_buf_source);
691 } /* if we can not get memory just leave rc as EEXIST */ 729 } /* if we can not get memory just leave rc as EEXIST */
@@ -705,10 +743,14 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
705 might not right be right access to request */ 743 might not right be right access to request */
706 rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ, 744 rc = CIFSSMBOpen(xid, pTcon, fromName, FILE_OPEN, GENERIC_READ,
707 CREATE_NOT_DIR, &netfid, &oplock, NULL, 745 CREATE_NOT_DIR, &netfid, &oplock, NULL,
708 cifs_sb_source->local_nls); 746 cifs_sb_source->local_nls,
747 cifs_sb_source->mnt_cifs_flags &
748 CIFS_MOUNT_MAP_SPECIAL_CHR);
709 if (rc==0) { 749 if (rc==0) {
710 CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName, 750 CIFSSMBRenameOpenFile(xid, pTcon, netfid, toName,
711 cifs_sb_source->local_nls); 751 cifs_sb_source->local_nls,
752 cifs_sb_source->mnt_cifs_flags &
753 CIFS_MOUNT_MAP_SPECIAL_CHR);
712 CIFSSMBClose(xid, pTcon, netfid); 754 CIFSSMBClose(xid, pTcon, netfid);
713 } 755 }
714 } 756 }
@@ -962,7 +1004,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
962 it by handle */ 1004 it by handle */
963 rc = CIFSSMBSetEOF(xid, pTcon, full_path, 1005 rc = CIFSSMBSetEOF(xid, pTcon, full_path,
964 attrs->ia_size, FALSE, 1006 attrs->ia_size, FALSE,
965 cifs_sb->local_nls); 1007 cifs_sb->local_nls,
1008 cifs_sb->mnt_cifs_flags &
1009 CIFS_MOUNT_MAP_SPECIAL_CHR);
966 cFYI(1, (" SetEOF by path (setattrs) rc = %d", rc)); 1010 cFYI(1, (" SetEOF by path (setattrs) rc = %d", rc));
967 } 1011 }
968 1012
@@ -999,7 +1043,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
999 if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX) 1043 if ((cifs_sb->tcon->ses->capabilities & CAP_UNIX)
1000 && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID))) 1044 && (attrs->ia_valid & (ATTR_MODE | ATTR_GID | ATTR_UID)))
1001 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid, 1045 rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, uid, gid,
1002 0 /* dev_t */, cifs_sb->local_nls); 1046 0 /* dev_t */, cifs_sb->local_nls,
1047 cifs_sb->mnt_cifs_flags &
1048 CIFS_MOUNT_MAP_SPECIAL_CHR);
1003 else if (attrs->ia_valid & ATTR_MODE) { 1049 else if (attrs->ia_valid & ATTR_MODE) {
1004 if ((mode & S_IWUGO) == 0) /* not writeable */ { 1050 if ((mode & S_IWUGO) == 0) /* not writeable */ {
1005 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0) 1051 if ((cifsInode->cifsAttrs & ATTR_READONLY) == 0)
@@ -1048,7 +1094,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1048 via Handle (SetFileInfo) instead of by path */ 1094 via Handle (SetFileInfo) instead of by path */
1049 if (!(pTcon->ses->flags & CIFS_SES_NT4)) 1095 if (!(pTcon->ses->flags & CIFS_SES_NT4))
1050 rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf, 1096 rc = CIFSSMBSetTimes(xid, pTcon, full_path, &time_buf,
1051 cifs_sb->local_nls); 1097 cifs_sb->local_nls,
1098 cifs_sb->mnt_cifs_flags &
1099 CIFS_MOUNT_MAP_SPECIAL_CHR);
1052 else 1100 else
1053 rc = -EOPNOTSUPP; 1101 rc = -EOPNOTSUPP;
1054 1102
@@ -1063,7 +1111,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
1063 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, 1111 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN,
1064 SYNCHRONIZE | FILE_WRITE_ATTRIBUTES, 1112 SYNCHRONIZE | FILE_WRITE_ATTRIBUTES,
1065 CREATE_NOT_DIR, &netfid, &oplock, 1113 CREATE_NOT_DIR, &netfid, &oplock,
1066 NULL, cifs_sb->local_nls); 1114 NULL, cifs_sb->local_nls,
1115 cifs_sb->mnt_cifs_flags &
1116 CIFS_MOUNT_MAP_SPECIAL_CHR);
1067 if (rc==0) { 1117 if (rc==0) {
1068 rc = CIFSSMBSetFileTimes(xid, pTcon, &time_buf, 1118 rc = CIFSSMBSetFileTimes(xid, pTcon, &time_buf,
1069 netfid); 1119 netfid);
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 1455810ba1cb..bde0fabfece0 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -59,10 +59,14 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
59 59
60 if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX) 60 if (cifs_sb_target->tcon->ses->capabilities & CAP_UNIX)
61 rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName, 61 rc = CIFSUnixCreateHardLink(xid, pTcon, fromName, toName,
62 cifs_sb_target->local_nls); 62 cifs_sb_target->local_nls,
63 cifs_sb_target->mnt_cifs_flags &
64 CIFS_MOUNT_MAP_SPECIAL_CHR);
63 else { 65 else {
64 rc = CIFSCreateHardLink(xid, pTcon, fromName, toName, 66 rc = CIFSCreateHardLink(xid, pTcon, fromName, toName,
65 cifs_sb_target->local_nls); 67 cifs_sb_target->local_nls,
68 cifs_sb_target->mnt_cifs_flags &
69 CIFS_MOUNT_MAP_SPECIAL_CHR);
66 if(rc == -EIO) 70 if(rc == -EIO)
67 rc = -EOPNOTSUPP; 71 rc = -EOPNOTSUPP;
68 } 72 }
@@ -260,7 +264,10 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
260 cifs_sb->local_nls); 264 cifs_sb->local_nls);
261 else { 265 else {
262 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ, 266 rc = CIFSSMBOpen(xid, pTcon, full_path, FILE_OPEN, GENERIC_READ,
263 OPEN_REPARSE_POINT,&fid, &oplock, NULL, cifs_sb->local_nls); 267 OPEN_REPARSE_POINT,&fid, &oplock, NULL,
268 cifs_sb->local_nls,
269 cifs_sb->mnt_cifs_flags &
270 CIFS_MOUNT_MAP_SPECIAL_CHR);
264 if(!rc) { 271 if(!rc) {
265 rc = CIFSSMBQueryReparseLinkInfo(xid, pTcon, full_path, 272 rc = CIFSSMBQueryReparseLinkInfo(xid, pTcon, full_path,
266 tmpbuffer, 273 tmpbuffer,
@@ -279,7 +286,10 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
279 strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE); 286 strncpy(tmp_path, pTcon->treeName, MAX_TREE_SIZE);
280 strncat(tmp_path, full_path, MAX_PATHCONF); 287 strncat(tmp_path, full_path, MAX_PATHCONF);
281 rc = get_dfs_path(xid, pTcon->ses, tmp_path, 288 rc = get_dfs_path(xid, pTcon->ses, tmp_path,
282 cifs_sb->local_nls, &num_referrals, &referrals); 289 cifs_sb->local_nls,
290 &num_referrals, &referrals,
291 cifs_sb->mnt_cifs_flags &
292 CIFS_MOUNT_MAP_SPECIAL_CHR);
283 cFYI(1,("Get DFS for %s rc = %d ",tmp_path, rc)); 293 cFYI(1,("Get DFS for %s rc = %d ",tmp_path, rc));
284 if((num_referrals == 0) && (rc == 0)) 294 if((num_referrals == 0) && (rc == 0))
285 rc = -EACCES; 295 rc = -EACCES;
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 4a33add24d53..7ca876b6f2ab 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -314,7 +314,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
314 return -EINVAL; 314 return -EINVAL;
315 315
316 down(&file->f_dentry->d_sb->s_vfs_rename_sem); 316 down(&file->f_dentry->d_sb->s_vfs_rename_sem);
317 full_path = build_wildcard_path_from_dentry(file->f_dentry); 317 full_path = build_path_from_dentry(file->f_dentry);
318 up(&file->f_dentry->d_sb->s_vfs_rename_sem); 318 up(&file->f_dentry->d_sb->s_vfs_rename_sem);
319 319
320 if(full_path == NULL) { 320 if(full_path == NULL) {
@@ -333,8 +333,9 @@ ffirst_retry:
333 cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO; 333 cifsFile->srch_inf.info_level = SMB_FIND_FILE_DIRECTORY_INFO;
334 } 334 }
335 335
336 rc = CIFSFindFirst(xid, pTcon,full_path,cifs_sb->local_nls, 336 rc = CIFSFindFirst(xid, pTcon,full_path,cifs_sb->local_nls,
337 &cifsFile->netfid, &cifsFile->srch_inf); 337 &cifsFile->netfid, &cifsFile->srch_inf,
338 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
338 if(rc == 0) 339 if(rc == 0)
339 cifsFile->invalidHandle = FALSE; 340 cifsFile->invalidHandle = FALSE;
340 if((rc == -EOPNOTSUPP) && 341 if((rc == -EOPNOTSUPP) &&
@@ -600,12 +601,10 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
600 if(unicode) { 601 if(unicode) {
601 /* BB fixme - test with long names */ 602 /* BB fixme - test with long names */
602 /* Note converted filename can be longer than in unicode */ 603 /* Note converted filename can be longer than in unicode */
603#ifdef CONFIG_CIFS_EXPERIMENTAL
604 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) 604 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
605 pqst->len = cifs_convertUCSpath((char *)pqst->name, 605 pqst->len = cifs_convertUCSpath((char *)pqst->name,
606 (__le16 *)filename, len/2, nlt); 606 (__le16 *)filename, len/2, nlt);
607 else 607 else
608#endif /* CIFS_EXPERIMENTAL */
609 pqst->len = cifs_strfromUCS_le((char *)pqst->name, 608 pqst->len = cifs_strfromUCS_le((char *)pqst->name,
610 (wchar_t *)filename,len/2,nlt); 609 (wchar_t *)filename,len/2,nlt);
611 } else { 610 } else {
@@ -849,19 +848,6 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
849 break; 848 break;
850 } 849 }
851 850
852 /* BB FIXME - need to enable the below code BB */
853
854 /* if((!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM)) ||
855 (cifsFile->srch_inf.info_level !=
856 something that supports server inodes)) {
857 create dentry
858 create inode
859 fill in inode new_inode (getting local i_ino)
860 }
861 also create local inode for performance reasons (so we
862 have a cache of inode metadata) unless this new mount
863 parm says otherwise */
864
865 rc = cifs_filldir(current_entry, file, 851 rc = cifs_filldir(current_entry, file,
866 filldir, direntry,tmp_buf); 852 filldir, direntry,tmp_buf);
867 file->f_pos++; 853 file->f_pos++;
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c
index 9a41bee11c5a..c1e02eff1d25 100644
--- a/fs/cifs/xattr.c
+++ b/fs/cifs/xattr.c
@@ -83,7 +83,8 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
83 83
84 ea_name+=5; /* skip past user. prefix */ 84 ea_name+=5; /* skip past user. prefix */
85 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,NULL, 85 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,NULL,
86 (__u16)0, cifs_sb->local_nls); 86 (__u16)0, cifs_sb->local_nls,
87 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
87 } 88 }
88remove_ea_exit: 89remove_ea_exit:
89 if (full_path) 90 if (full_path)
@@ -147,14 +148,16 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
147 } 148 }
148 ea_name += 5; /* skip past user. prefix */ 149 ea_name += 5; /* skip past user. prefix */
149 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,ea_value, 150 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,ea_value,
150 (__u16)value_size, cifs_sb->local_nls); 151 (__u16)value_size, cifs_sb->local_nls,
152 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
151 } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) { 153 } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) {
152 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 154 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
153 goto set_ea_exit; 155 goto set_ea_exit;
154 156
155 ea_name += 4; /* skip past os2. prefix */ 157 ea_name += 4; /* skip past os2. prefix */
156 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,ea_value, 158 rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,ea_value,
157 (__u16)value_size, cifs_sb->local_nls); 159 (__u16)value_size, cifs_sb->local_nls,
160 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
158 } else { 161 } else {
159 int temp; 162 int temp;
160 temp = strncmp(ea_name,POSIX_ACL_XATTR_ACCESS, 163 temp = strncmp(ea_name,POSIX_ACL_XATTR_ACCESS,
@@ -164,7 +167,9 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
164 if(sb->s_flags & MS_POSIXACL) 167 if(sb->s_flags & MS_POSIXACL)
165 rc = CIFSSMBSetPosixACL(xid, pTcon,full_path, 168 rc = CIFSSMBSetPosixACL(xid, pTcon,full_path,
166 ea_value, (const int)value_size, 169 ea_value, (const int)value_size,
167 ACL_TYPE_ACCESS,cifs_sb->local_nls); 170 ACL_TYPE_ACCESS,cifs_sb->local_nls,
171 cifs_sb->mnt_cifs_flags &
172 CIFS_MOUNT_MAP_SPECIAL_CHR);
168 cFYI(1,("set POSIX ACL rc %d",rc)); 173 cFYI(1,("set POSIX ACL rc %d",rc));
169#else 174#else
170 cFYI(1,("set POSIX ACL not supported")); 175 cFYI(1,("set POSIX ACL not supported"));
@@ -174,7 +179,9 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
174 if(sb->s_flags & MS_POSIXACL) 179 if(sb->s_flags & MS_POSIXACL)
175 rc = CIFSSMBSetPosixACL(xid, pTcon,full_path, 180 rc = CIFSSMBSetPosixACL(xid, pTcon,full_path,
176 ea_value, (const int)value_size, 181 ea_value, (const int)value_size,
177 ACL_TYPE_DEFAULT, cifs_sb->local_nls); 182 ACL_TYPE_DEFAULT, cifs_sb->local_nls,
183 cifs_sb->mnt_cifs_flags &
184 CIFS_MOUNT_MAP_SPECIAL_CHR);
178 cFYI(1,("set POSIX default ACL rc %d",rc)); 185 cFYI(1,("set POSIX default ACL rc %d",rc));
179#else 186#else
180 cFYI(1,("set default POSIX ACL not supported")); 187 cFYI(1,("set default POSIX ACL not supported"));
@@ -240,20 +247,24 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
240 } /* BB add else when above is implemented */ 247 } /* BB add else when above is implemented */
241 ea_name += 5; /* skip past user. prefix */ 248 ea_name += 5; /* skip past user. prefix */
242 rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value, 249 rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value,
243 buf_size, cifs_sb->local_nls); 250 buf_size, cifs_sb->local_nls,
251 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
244 } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) { 252 } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) {
245 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) 253 if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR)
246 goto get_ea_exit; 254 goto get_ea_exit;
247 255
248 ea_name += 4; /* skip past os2. prefix */ 256 ea_name += 4; /* skip past os2. prefix */
249 rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value, 257 rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value,
250 buf_size, cifs_sb->local_nls); 258 buf_size, cifs_sb->local_nls,
259 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
251 } else if(strncmp(ea_name,POSIX_ACL_XATTR_ACCESS,strlen(POSIX_ACL_XATTR_ACCESS)) == 0) { 260 } else if(strncmp(ea_name,POSIX_ACL_XATTR_ACCESS,strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
252#ifdef CONFIG_CIFS_POSIX 261#ifdef CONFIG_CIFS_POSIX
253 if(sb->s_flags & MS_POSIXACL) 262 if(sb->s_flags & MS_POSIXACL)
254 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path, 263 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
255 ea_value, buf_size, ACL_TYPE_ACCESS, 264 ea_value, buf_size, ACL_TYPE_ACCESS,
256 cifs_sb->local_nls); 265 cifs_sb->local_nls,
266 cifs_sb->mnt_cifs_flags &
267 CIFS_MOUNT_MAP_SPECIAL_CHR);
257#else 268#else
258 cFYI(1,("query POSIX ACL not supported yet")); 269 cFYI(1,("query POSIX ACL not supported yet"));
259#endif /* CONFIG_CIFS_POSIX */ 270#endif /* CONFIG_CIFS_POSIX */
@@ -262,7 +273,9 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
262 if(sb->s_flags & MS_POSIXACL) 273 if(sb->s_flags & MS_POSIXACL)
263 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path, 274 rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
264 ea_value, buf_size, ACL_TYPE_DEFAULT, 275 ea_value, buf_size, ACL_TYPE_DEFAULT,
265 cifs_sb->local_nls); 276 cifs_sb->local_nls,
277 cifs_sb->mnt_cifs_flags &
278 CIFS_MOUNT_MAP_SPECIAL_CHR);
266#else 279#else
267 cFYI(1,("query POSIX default ACL not supported yet")); 280 cFYI(1,("query POSIX default ACL not supported yet"));
268#endif 281#endif
@@ -328,7 +341,9 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
328 search server for EAs or streams to 341 search server for EAs or streams to
329 returns as xattrs */ 342 returns as xattrs */
330 rc = CIFSSMBQAllEAs(xid,pTcon,full_path,data,buf_size, 343 rc = CIFSSMBQAllEAs(xid,pTcon,full_path,data,buf_size,
331 cifs_sb->local_nls); 344 cifs_sb->local_nls,
345 cifs_sb->mnt_cifs_flags &
346 CIFS_MOUNT_MAP_SPECIAL_CHR);
332 347
333 if (full_path) 348 if (full_path)
334 kfree(full_path); 349 kfree(full_path);