summaryrefslogtreecommitdiffstats
path: root/fs/cifs/readdir.c
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-28 22:41:05 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-28 22:41:05 -0700
commit6a0b48245a135cd132e747815854e3999967f8a7 (patch)
tree55fffb67b924fbca2a5a16e83100a5d1000daaf4 /fs/cifs/readdir.c
parentcbe0476fa6a76b01b79e7c117963d45ed0a28758 (diff)
[PATCH] cifs: Add new mount parm mapchars
For handling seven special characters that shells use for filenames. This first parts implements conversions from Unicode. Signed-off-by: Steve French Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r--fs/cifs/readdir.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index 07838a5ba3a..4a33add24d5 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -600,7 +600,14 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
if(unicode) {
/* BB fixme - test with long names */
/* Note converted filename can be longer than in unicode */
- pqst->len = cifs_strfromUCS_le((char *)pqst->name,(wchar_t *)filename,len/2,nlt);
+#ifdef CONFIG_CIFS_EXPERIMENTAL
+ if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
+ pqst->len = cifs_convertUCSpath((char *)pqst->name,
+ (__le16 *)filename, len/2, nlt);
+ else
+#endif /* CIFS_EXPERIMENTAL */
+ pqst->len = cifs_strfromUCS_le((char *)pqst->name,
+ (wchar_t *)filename,len/2,nlt);
} else {
pqst->name = filename;
pqst->len = len;
@@ -829,7 +836,11 @@ int cifs_readdir(struct file *file, void *direntry, filldir_t filldir)
end_of_smb = cifsFile->srch_inf.ntwrk_buf_start +
smbCalcSize((struct smb_hdr *)
cifsFile->srch_inf.ntwrk_buf_start);
- tmp_buf = kmalloc(NAME_MAX+1,GFP_KERNEL);
+ /* To be safe - for UCS to UTF-8 with strings loaded
+ with the rare long characters alloc more to account for
+ such multibyte target UTF-8 characters. cifs_unicode.c,
+ which actually does the conversion, has the same limit */
+ tmp_buf = kmalloc((2 * NAME_MAX) + 4, GFP_KERNEL);
for(i=0;(i<num_to_fill) && (rc == 0);i++) {
if(current_entry == NULL) {
/* evaluate whether this case is an error */