Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc8ebdc4 authored by Nakajima Akira's avatar Nakajima Akira Committed by Steve French
Browse files

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: default avatar <t.wede@kw-reneg.de>
Reported-by: default avatarNakajima Akira <nakajima.akira@nttcom.co.jp>
Signed-off-by: default avatarNakajima Akira <nakajima.akira@nttcom.co.jp>
Signed-off-by: default avatarCarl Schaefer <schaefer@trilug.org>
Signed-off-by: default avatarSteve French <smfrench@gmail.com>
parent f5d0684e
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -24,6 +24,7 @@
#include "cifsfs.h"
#include "cifsfs.h"
#include "dns_resolve.h"
#include "dns_resolve.h"
#include "cifs_debug.h"
#include "cifs_debug.h"
#include "cifs_unicode.h"


static LIST_HEAD(cifs_dfs_automount_list);
static LIST_HEAD(cifs_dfs_automount_list);


@@ -312,7 +313,7 @@ static struct vfsmount *cifs_dfs_do_automount(struct dentry *mntpt)
	xid = get_xid();
	xid = get_xid();
	rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls,
	rc = get_dfs_path(xid, ses, full_path + 1, cifs_sb->local_nls,
		&num_referrals, &referrals,
		&num_referrals, &referrals,
		cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR);
		cifs_remap(cifs_sb));
	free_xid(xid);
	free_xid(xid);


	cifs_put_tlink(tlink);
	cifs_put_tlink(tlink);
+2 −0
Original line number Original line Diff line number Diff line
@@ -469,6 +469,8 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
		seq_puts(s, ",nouser_xattr");
		seq_puts(s, ",nouser_xattr");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR)
		seq_puts(s, ",mapchars");
		seq_puts(s, ",mapchars");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SFM_CHR)
		seq_puts(s, ",mapposix");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL)
		seq_puts(s, ",sfu");
		seq_puts(s, ",sfu");
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+2 −2
Original line number Original line Diff line number Diff line
@@ -361,11 +361,11 @@ extern int CIFSUnixCreateHardLink(const unsigned int xid,
extern int CIFSUnixCreateSymLink(const unsigned int xid,
extern int CIFSUnixCreateSymLink(const unsigned int xid,
			struct cifs_tcon *tcon,
			struct cifs_tcon *tcon,
			const char *fromName, const char *toName,
			const char *fromName, const char *toName,
			const struct nls_table *nls_codepage);
			const struct nls_table *nls_codepage, int remap);
extern int CIFSSMBUnixQuerySymLink(const unsigned int xid,
extern int CIFSSMBUnixQuerySymLink(const unsigned int xid,
			struct cifs_tcon *tcon,
			struct cifs_tcon *tcon,
			const unsigned char *searchName, char **syminfo,
			const unsigned char *searchName, char **syminfo,
			const struct nls_table *nls_codepage);
			const struct nls_table *nls_codepage, int remap);
extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
extern int CIFSSMBQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
			       __u16 fid, char **symlinkinfo,
			       __u16 fid, char **symlinkinfo,
			       const struct nls_table *nls_codepage);
			       const struct nls_table *nls_codepage);
+11 −10
Original line number Original line Diff line number Diff line
@@ -2784,7 +2784,7 @@ CIFSSMBCopy(const unsigned int xid, struct cifs_tcon *tcon,
int
int
CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
		      const char *fromName, const char *toName,
		      const char *fromName, const char *toName,
		      const struct nls_table *nls_codepage)
		      const struct nls_table *nls_codepage, int remap)
{
{
	TRANSACTION2_SPI_REQ *pSMB = NULL;
	TRANSACTION2_SPI_REQ *pSMB = NULL;
	TRANSACTION2_SPI_RSP *pSMBr = NULL;
	TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -2804,9 +2804,9 @@ CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,


	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
		name_len =
		name_len =
		    cifs_strtoUTF16((__le16 *) pSMB->FileName, fromName,
		    cifsConvertToUTF16((__le16 *) pSMB->FileName, fromName,
				/* find define for this maxpathcomponent */
				/* find define for this maxpathcomponent */
				    PATH_MAX, nls_codepage);
					PATH_MAX, nls_codepage, remap);
		name_len++;	/* trailing null */
		name_len++;	/* trailing null */
		name_len *= 2;
		name_len *= 2;


@@ -2828,9 +2828,9 @@ CIFSUnixCreateSymLink(const unsigned int xid, struct cifs_tcon *tcon,
	data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
	data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
		name_len_target =
		name_len_target =
		    cifs_strtoUTF16((__le16 *) data_offset, toName, PATH_MAX
		    cifsConvertToUTF16((__le16 *) data_offset, toName,
				/* find define for this maxpathcomponent */
				/* find define for this maxpathcomponent */
				    , nls_codepage);
					PATH_MAX, nls_codepage, remap);
		name_len_target++;	/* trailing null */
		name_len_target++;	/* trailing null */
		name_len_target *= 2;
		name_len_target *= 2;
	} else {	/* BB improve the check for buffer overruns BB */
	} else {	/* BB improve the check for buffer overruns BB */
@@ -3034,7 +3034,7 @@ CIFSCreateHardLink(const unsigned int xid, struct cifs_tcon *tcon,
int
int
CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,
			const unsigned char *searchName, char **symlinkinfo,
			const unsigned char *searchName, char **symlinkinfo,
			const struct nls_table *nls_codepage)
			const struct nls_table *nls_codepage, int remap)
{
{
/* SMB_QUERY_FILE_UNIX_LINK */
/* SMB_QUERY_FILE_UNIX_LINK */
	TRANSACTION2_QPI_REQ *pSMB = NULL;
	TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -3055,8 +3055,9 @@ CIFSSMBUnixQuerySymLink(const unsigned int xid, struct cifs_tcon *tcon,


	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
	if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
		name_len =
		name_len =
			cifs_strtoUTF16((__le16 *) pSMB->FileName, searchName,
			cifsConvertToUTF16((__le16 *) pSMB->FileName,
					PATH_MAX, nls_codepage);
					   searchName, PATH_MAX, nls_codepage,
					   remap);
		name_len++;	/* trailing null */
		name_len++;	/* trailing null */
		name_len *= 2;
		name_len *= 2;
	} else {	/* BB improve the check for buffer overruns BB */
	} else {	/* BB improve the check for buffer overruns BB */
+1 −2
Original line number Original line Diff line number Diff line
@@ -620,8 +620,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, umode_t mode,
		}
		}
		rc = CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args,
		rc = CIFSSMBUnixSetPathInfo(xid, tcon, full_path, &args,
					    cifs_sb->local_nls,
					    cifs_sb->local_nls,
					    cifs_sb->mnt_cifs_flags &
					    cifs_remap(cifs_sb));
						CIFS_MOUNT_MAP_SPECIAL_CHR);
		if (rc)
		if (rc)
			goto mknod_out;
			goto mknod_out;


Loading