aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNakajima Akira <nakajima.akira@nttcom.co.jp>2015-02-13 01:35:58 -0500
committerSteve French <smfrench@gmail.com>2015-05-10 20:56:35 -0400
commitbc8ebdc4f54cc944b0ecc0fb0d18b0ffbaab0468 (patch)
tree1d442f43a1d50cec2c4f6ee8a0957b00a8950b97
parentf5d0684e848f01347ba510545822c205889f8acc (diff)
Fix that several functions handle incorrect value of mapchars
Cifs client has problem with reserved chars filename. [BUG1] : several functions handle incorrect value of mapchars - cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + cifs_remap(cifs_sb)); [BUG2] : forget to convert reserved chars when creating SymbolicLink. - CIFSUnixCreateSymLink() calls cifs_strtoUTF16 + CIFSUnixCreateSymLink() calls cifsConvertToUTF16() with remap [BUG3] : forget to convert reserved chars when getting SymbolicLink. - CIFSSMBUnixQuerySymLink() calls cifs_strtoUTF16 + CIFSSMBUnixQuerySymLink() calls cifsConvertToUTF16() with remap [BUG4] : /proc/mounts don't show "mapposix" when using mapposix mount option + cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR) + seq_puts(s, ",mapposix"); Reported-by: t.wede@kw-reneg.de Reported-by: Nakajima Akira <nakajima.akira@nttcom.co.jp> Signed-off-by: Nakajima Akira <nakajima.akira@nttcom.co.jp> Signed-off-by: Carl Schaefer <schaefer@trilug.org> Signed-off-by: Steve French <smfrench@gmail.com>
-rw-r--r--fs/cifs/cifs_dfs_ref.c3
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/cifs/cifsproto.h4
-rw-r--r--fs/cifs/cifssmb.c21
-rw-r--r--fs/cifs/dir.c3
-rw-r--r--fs/cifs/file.c3
-rw-r--r--fs/cifs/inode.c6
-rw-r--r--fs/cifs/link.c3
-rw-r--r--fs/cifs/smb1ops.c3
9 files changed, 25 insertions, 23 deletions
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 430e0348c99e..7dc886c9a78f 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -24,6 +24,7 @@
24#include "cifsfs.h" 24#include "cifsfs.h"
25#include "dns_resolve.h" 25#include "dns_resolve.h"
26#include "cifs_debug.h" 26#include "cifs_debug.h"
27#include "cifs_unicode.h"
27 28
28static LIST_HEAD(cifs_dfs_automount_list); 29static LIST_HEAD(cifs_dfs_automount_list);
29 30
@@ -312,7 +313,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
312 xid = get_xid(); 313 xid = get_xid();
313 rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls, 314 rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls,
314 &num_referrals, &referrals, 315 &num_referrals, &referrals,
315 cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); 316 cifs_remap(cifs_sb));
316 free_xid(xid); 317 free_xid(xid);
317 318
318 cifs_put_tlink(tlink); 319 cifs_put_tlink(tlink);
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index f5089bde3635..0a9fb6b53126 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -469,6 +469,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
469 seq_puts(s, ",nouser_xattr"); 469 seq_puts(s, ",nouser_xattr");
470 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR) 470 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
471 seq_puts(s, ",mapchars"); 471 seq_puts(s, ",mapchars");
472 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR)
473 seq_puts(s, ",mapposix");
472 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) 474 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)
473 seq_puts(s, ",sfu"); 475 seq_puts(s, ",sfu");
474 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL) 476 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index c31ce98c1704..c63fd1dde25b 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -361,11 +361,11 @@ extern int CIFSUnixCreateHardLink(const unsigned int xid,
361extern int CIFSUnixCreateSymLink(const unsigned int xid, 361extern int CIFSUnixCreateSymLink(const unsigned int xid,
362 struct cifs_tcon *tcon, 362 struct cifs_tcon *tcon,
363 const char *fromName, const char *toName, 363 const char *fromName, const char *toName,
364 const struct nls_table *nls_codepage); 364 const struct nls_table *nls_codepage, int remap);
365extern int CIFSSMBUnixQuerySymLink(const unsigned int xid, 365extern int CIFSSMBUnixQuerySymLink(const unsigned int xid,
366 struct cifs_tcon *tcon, 366 struct cifs_tcon *tcon,
367 const unsigned char *searchName, char **syminfo, 367 const unsigned char *searchName, char **syminfo,
368 const struct nls_table *nls_codepage); 368 const struct nls_table *nls_codepage, int remap);
369extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, 369extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
370 __u16 fid, char **symlinkinfo, 370 __u16 fid, char **symlinkinfo,
371 const struct nls_table *nls_codepage); 371 const struct nls_table *nls_codepage);
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 84650a51c7c4..1091affba425 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -2784,7 +2784,7 @@ copyRetry:
2784int 2784int
2785CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon, 2785CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
2786 const char *fromName, const char *toName, 2786 const char *fromName, const char *toName,
2787 const struct nls_table *nls_codepage) 2787 const struct nls_table *nls_codepage, int remap)
2788{ 2788{
2789 TRANSACTION2_SPI_REQ *pSMB = NULL; 2789 TRANSACTION2_SPI_REQ *pSMB = NULL;
2790 TRANSACTION2_SPI_RSP *pSMBr = NULL; 2790 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -2804,9 +2804,9 @@ createSymLinkRetry:
2804 2804
2805 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2805 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2806 name_len = 2806 name_len =
2807 cifs_strtoUTF16((__le16 *) pSMB->FileName, fromName, 2807 cifsConvertToUTF16((__le16 *) pSMB->FileName, fromName,
2808 /* find define for this maxpathcomponent */ 2808 /* find define for this maxpathcomponent */
2809 PATH_MAX, nls_codepage); 2809 PATH_MAX, nls_codepage, remap);
2810 name_len++; /* trailing null */ 2810 name_len++; /* trailing null */
2811 name_len *= 2; 2811 name_len *= 2;
2812 2812
@@ -2828,9 +2828,9 @@ createSymLinkRetry:
2828 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 2828 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
2829 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2829 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2830 name_len_target = 2830 name_len_target =
2831 cifs_strtoUTF16((__le16 *) data_offset, toName, PATH_MAX 2831 cifsConvertToUTF16((__le16 *) data_offset, toName,
2832 /* find define for this maxpathcomponent */ 2832 /* find define for this maxpathcomponent */
2833 , nls_codepage); 2833 PATH_MAX, nls_codepage, remap);
2834 name_len_target++; /* trailing null */ 2834 name_len_target++; /* trailing null */
2835 name_len_target *= 2; 2835 name_len_target *= 2;
2836 } else { /* BB improve the check for buffer overruns BB */ 2836 } else { /* BB improve the check for buffer overruns BB */
@@ -3034,7 +3034,7 @@ winCreateHardLinkRetry:
3034int 3034int
3035CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon, 3035CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
3036 const unsigned char *searchName, char **symlinkinfo, 3036 const unsigned char *searchName, char **symlinkinfo,
3037 const struct nls_table *nls_codepage) 3037 const struct nls_table *nls_codepage, int remap)
3038{ 3038{
3039/* SMB_QUERY_FILE_UNIX_LINK */ 3039/* SMB_QUERY_FILE_UNIX_LINK */
3040 TRANSACTION2_QPI_REQ *pSMB = NULL; 3040 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -3055,8 +3055,9 @@ querySymLinkRetry:
3055 3055
3056 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3056 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3057 name_len = 3057 name_len =
3058 cifs_strtoUTF16((__le16 *) pSMB->FileName, searchName, 3058 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3059 PATH_MAX, nls_codepage); 3059 searchName, PATH_MAX, nls_codepage,
3060 remap);
3060 name_len++; /* trailing null */ 3061 name_len++; /* trailing null */
3061 name_len *= 2; 3062 name_len *= 2;
3062 } else { /* BB improve the check for buffer overruns BB */ 3063 } else { /* BB improve the check for buffer overruns BB */
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 338d56936f6a..c3eb998a99bd 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -620,8 +620,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
620 } 620 }
621 rc = CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args, 621 rc = CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args,
622 cifs_sb->local_nls, 622 cifs_sb->local_nls,
623 cifs_sb->mnt_cifs_flags & 623 cifs_remap(cifs_sb));
624 CIFS_MOUNT_MAP_SPECIAL_CHR);
625 if (rc) 624 if (rc)
626 goto mknod_out; 625 goto mknod_out;
627 626
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index cafbf10521d5..5cfa7129d876 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -140,8 +140,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode,
140 posix_flags = cifs_posix_convert_flags(f_flags); 140 posix_flags = cifs_posix_convert_flags(f_flags);
141 rc = CIFSPOSIXCreate(xid, tcon, posix_flags, mode, pnetfid, presp_data, 141 rc = CIFSPOSIXCreate(xid, tcon, posix_flags, mode, pnetfid, presp_data,
142 poplock, full_path, cifs_sb->local_nls, 142 poplock, full_path, cifs_sb->local_nls,
143 cifs_sb->mnt_cifs_flags & 143 cifs_remap(cifs_sb));
144 CIFS_MOUNT_MAP_SPECIAL_CHR);
145 cifs_put_tlink(tlink); 144 cifs_put_tlink(tlink);
146 145
147 if (rc) 146 if (rc)
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
index 55b58112d122..ef71aa1515f6 100644
--- a/fs/cifs/inode.c
+++ b/fs/cifs/inode.c
@@ -373,8 +373,7 @@ int cifs_get_inode_info_unix(struct inode **pinode,
373 373
374 /* could have done a find first instead but this returns more info */ 374 /* could have done a find first instead but this returns more info */
375 rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data, 375 rc = CIFSSMBUnixQPathInfo(xid, tcon, full_path, &find_data,
376 cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & 376 cifs_sb->local_nls, cifs_remap(cifs_sb));
377 CIFS_MOUNT_MAP_SPECIAL_CHR);
378 cifs_put_tlink(tlink); 377 cifs_put_tlink(tlink);
379 378
380 if (!rc) { 379 if (!rc) {
@@ -2215,8 +2214,7 @@ cifs_setattr_unix(struct dentry *direntry, struct iattr *attrs)
2215 pTcon = tlink_tcon(tlink); 2214 pTcon = tlink_tcon(tlink);
2216 rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args, 2215 rc = CIFSSMBUnixSetPathInfo(xid, pTcon, full_path, args,
2217 cifs_sb->local_nls, 2216 cifs_sb->local_nls,
2218 cifs_sb->mnt_cifs_flags & 2217 cifs_remap(cifs_sb));
2219 CIFS_MOUNT_MAP_SPECIAL_CHR);
2220 cifs_put_tlink(tlink); 2218 cifs_put_tlink(tlink);
2221 } 2219 }
2222 2220
diff --git a/fs/cifs/link.c b/fs/cifs/link.c
index 252e672d5604..e6c707cc62b3 100644
--- a/fs/cifs/link.c
+++ b/fs/cifs/link.c
@@ -717,7 +717,8 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
717 rc = create_mf_symlink(xid, pTcon, cifs_sb, full_path, symname); 717 rc = create_mf_symlink(xid, pTcon, cifs_sb, full_path, symname);
718 else if (pTcon->unix_ext) 718 else if (pTcon->unix_ext)
719 rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname, 719 rc = CIFSUnixCreateSymLink(xid, pTcon, full_path, symname,
720 cifs_sb->local_nls); 720 cifs_sb->local_nls,
721 cifs_remap(cifs_sb));
721 /* else 722 /* else
722 rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName, 723 rc = CIFSCreateReparseSymLink(xid, pTcon, fromName, toName,
723 cifs_sb_target->local_nls); */ 724 cifs_sb_target->local_nls); */
diff --git a/fs/cifs/smb1ops.c b/fs/cifs/smb1ops.c
index 7bfdd6066276..fc537c29044e 100644
--- a/fs/cifs/smb1ops.c
+++ b/fs/cifs/smb1ops.c
@@ -960,7 +960,8 @@ cifs_query_symlink(const unsigned int xid, struct cifs_tcon *tcon,
960 /* Check for unix extensions */ 960 /* Check for unix extensions */
961 if (cap_unix(tcon->ses)) { 961 if (cap_unix(tcon->ses)) {
962 rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, target_path, 962 rc = CIFSSMBUnixQuerySymLink(xid, tcon, full_path, target_path,
963 cifs_sb->local_nls); 963 cifs_sb->local_nls,
964 cifs_remap(cifs_sb));
964 if (rc == -EREMOTE) 965 if (rc == -EREMOTE)
965 rc = cifs_unix_dfs_readlink(xid, tcon, full_path, 966 rc = cifs_unix_dfs_readlink(xid, tcon, full_path,
966 target_path, 967 target_path,