Re: linux-cifs-client Digest, Vol 78, Issue 17
George Powers <[email protected]> Tue, 11 May 2010 07:54:34 -0700
| Newsgroups | gmane.linux.file-systems.cifs |
|---|---|
| Message-ID | <[email protected]> |
unsubscribe On May 11, 2010, at 7:03 AM, <[email protected]> wrote: > Send linux-cifs-client mailing list submissions to > [email protected] > > To subscribe or unsubscribe via the World Wide Web, visit > https://lists.samba.org/mailman/listinfo/linux-cifs-client > or, via email, send a message with subject or body 'help' to > [email protected] > > You can reach the person managing the list at > [email protected] > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of linux-cifs-client digest..." > > > Today's Topics: > > 1. Re: [PATCH] cifs: propagate cifs_new_fileinfo() error back to > the caller (Shirish Pargaonkar) > 2. Re: [PATCH] build mount.smb2 from mount.cifs (Jeff Layton) > 3. Re: [PATCH] Removed magic number for max username in > parse_options. (Jeff Layton) > 4. Re: [PATCH] cifs: add comments explaining cifs_new_fileinfo > behavior (Shirish Pargaonkar) > 5. Re: [PATCH] Clean up option parsing in mount.cifs (Jeff Layton) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 11 May 2010 08:23:11 -0500 > From: Shirish Pargaonkar <[email protected]> > To: Suresh Jayaraman <[email protected]> > Cc: Steve French <[email protected]>, > [email protected] > Subject: Re: [linux-cifs-client] [PATCH] cifs: propagate > cifs_new_fileinfo() error back to the caller > Message-ID: > <[email protected]> > Content-Type: text/plain; charset=ISO-8859-1 > > On Mon, May 10, 2010 at 11:16 PM, Suresh Jayaraman <[email protected]> wrote: >> ..otherwise memory allocation errors go undetected. >> >> Signed-off-by: Suresh Jayaraman <[email protected]> >> --- >> ?fs/cifs/dir.c | ? 17 +++++++++++++---- >> ?1 files changed, 13 insertions(+), 4 deletions(-) >> >> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c >> index bd363df..86d3c0c 100644 >> --- a/fs/cifs/dir.c >> +++ b/fs/cifs/dir.c >> @@ -261,8 +261,14 @@ int cifs_posix_open(char *full_path, struct inode **pinode, >> ? ? ? ? * cifs_fill_filedata() takes care of setting cifsFileInfo pointer to >> ? ? ? ? * file->private_data. >> ? ? ? ? */ >> - ? ? ? if (mnt) >> - ? ? ? ? ? ? ? cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, oflags); >> + ? ? ? if (mnt) { >> + ? ? ? ? ? ? ? struct cifsFileInfo *pfile_info; >> + >> + ? ? ? ? ? ? ? pfile_info = cifs_new_fileinfo(*pinode, *pnetfid, NULL, mnt, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?oflags); >> + ? ? ? ? ? ? ? if (pfile_info == NULL) >> + ? ? ? ? ? ? ? ? ? ? ? rc = -ENOMEM; >> + ? ? ? } >> >> ?posix_open_ret: >> ? ? ? ?kfree(presp_data); >> @@ -476,12 +482,15 @@ cifs_create_set_dentry: >> ? ? ? ? ? ? ? ?/* mknod case - do not leave file open */ >> ? ? ? ? ? ? ? ?CIFSSMBClose(xid, tcon, fileHandle); >> ? ? ? ?} else if (!(posix_create) && (newinode)) { >> + ? ? ? ? ? ? ? struct cifsFileInfo *pfile_info; >> ? ? ? ? ? ? ? ?/* >> ? ? ? ? ? ? ? ? * cifs_fill_filedata() takes care of setting cifsFileInfo >> ? ? ? ? ? ? ? ? * pointer to file->private_data. >> ? ? ? ? ? ? ? ? */ >> - ? ? ? ? ? ? ? cifs_new_fileinfo(newinode, fileHandle, NULL, nd->path.mnt, >> - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? oflags); >> + ? ? ? ? ? ? ? pfile_info = cifs_new_fileinfo(newinode, fileHandle, NULL, >> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?nd->path.mnt, oflags); >> + ? ? ? ? ? ? ? if (pfile_info == NULL) >> + ? ? ? ? ? ? ? ? ? ? ? rc = -ENOMEM; >> ? ? ? ?} >> ?cifs_create_out: >> ? ? ? ?kfree(buf); >> -- >> 1.6.4.2 >> >> _______________________________________________ >> linux-cifs-client mailing list >> [email protected] >> https://lists.samba.org/mailman/listinfo/linux-cifs-client >> > > Acked-by: Shirish S. Pargaonkar <[email protected]> > > > ------------------------------ > > Message: 2 > Date: Tue, 11 May 2010 09:24:54 -0400 > From: Jeff Layton <[email protected]> > To: Steve French <[email protected]> > Cc: [email protected] > Subject: Re: [linux-cifs-client] [PATCH] build mount.smb2 from > mount.cifs > Message-ID: <[email protected]> > Content-Type: text/plain; charset="iso-8859-1" > > On Fri, 7 May 2010 12:29:22 -0500 > Steve French <[email protected]> wrote: > >> Resending with updates from Jeff Layton comments included. >> >> On Fri, May 7, 2010 at 12:26 PM, Steve French <[email protected]> wrote: >>> mount.smb2 has different help (many fewer mount options) and different >>> fsname, but otherwise can reuse all of the good work Jeff did on >>> mount.cifs. ?This patch allow mount.cifs to detect if run as >>> mount.smb2 (to display different help and fsname). >> >> >> > > Looks good overall. A couple of small whitespace and formatting issues. > Does the attached patch look ok? Eventually we'll probably want to have > "make install" add a mount.smb2 symlink, but we probably shouldn't do > that until the filesystem is in mainline kernels. > > -- > Jeff Layton <[email protected]> > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: 0001-mount.cifs-turn-into-a-multicall-binary-for-smb2.patch > Type: text/x-patch > Size: 6329 bytes > Desc: not available > URL: <http://lists.samba.org/pipermail/linux-cifs-client/attachments/20100511/272f4b81/attachment.bin> > > ------------------------------ > > Message: 3 > Date: Tue, 11 May 2010 09:34:48 -0400 > From: Jeff Layton <[email protected]> > To: Scott Lovenberg <[email protected]> > Cc: [email protected] > Subject: Re: [linux-cifs-client] [PATCH] Removed magic number for max > username in parse_options. > Message-ID: <[email protected]> > Content-Type: text/plain; charset=US-ASCII > > On Thu, 29 Apr 2010 09:58:17 -0400 > Scott Lovenberg <[email protected]> wrote: > >> Replaced max username in parse_options with the sum of its potential parts for "domain/user%password" formatted values. Note that forward slashes still expand to a double back slash in the parse_username function, though. >> >> Signed-off-by: Scott Lovenberg <[email protected]> >> --- >> mount.cifs.c | 6 +++++- >> 1 files changed, 5 insertions(+), 1 deletions(-) >> >> diff --git a/mount.cifs.c b/mount.cifs.c >> index 155d594..c1944ac 100644 >> --- a/mount.cifs.c >> +++ b/mount.cifs.c >> @@ -858,7 +858,11 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> return EX_USAGE; >> } >> } else { >> - if (strnlen(value, 260) >= 260) { >> + /* domain/username%password */ >> + const int max = MAX_DOMAIN_SIZE + >> + MAX_USERNAME_SIZE + >> + MOUNT_PASSWD_SIZE + 2; >> + if (strnlen(value, max + 1) >= max + 1) { >> fprintf(stderr, "username too long\n"); >> return EX_USAGE; >> } > > Looks good. Committed. > > Thanks, > -- > Jeff Layton <[email protected]> > > > ------------------------------ > > Message: 4 > Date: Tue, 11 May 2010 08:57:32 -0500 > From: Shirish Pargaonkar <[email protected]> > To: Jeff Layton <[email protected]> > Cc: Steve French <[email protected]>, > [email protected] > Subject: Re: [linux-cifs-client] [PATCH] cifs: add comments explaining > cifs_new_fileinfo behavior > Message-ID: > <[email protected]> > Content-Type: text/plain; charset=ISO-8859-1 > > On Tue, May 11, 2010 at 6:33 AM, Jeff Layton <[email protected]> wrote: >> On Tue, 11 May 2010 16:33:44 +0530 >> Suresh Jayaraman <[email protected]> wrote: >> >>> On 05/11/2010 04:17 PM, Jeff Layton wrote: >>>> On Mon, 10 May 2010 20:00:05 +0530 >>>> Suresh Jayaraman <[email protected]> wrote: >>>> >>>>> The comments make it clear the otherwise subtle behavior of cifs_new_fileinfo(). >>>>> >>>>> Signed-off-by: Suresh Jayaraman <[email protected]> >>>>> -- >>>>> ?fs/cifs/dir.c | ? 18 ++++++++++++++++-- >>>>> ?1 files changed, 16 insertions(+), 2 deletions(-) >>>>> >>>>> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c >>>>> index d791d07..bd363df 100644 >>>>> --- a/fs/cifs/dir.c >>>>> +++ b/fs/cifs/dir.c >>>>> @@ -129,6 +129,12 @@ cifs_bp_rename_retry: >>>>> ? ?return full_path; >>>>> ?} >>>>> >>>>> +/* >>>>> + * When called with struct file pointer set to NULL, there is no way we could >>>>> + * update file->private_data, but getting it stuck on openFileList provides a >>>>> + * way to access it from cifs_fill_filedata and thereby set file->private_data >>>>> + * from cifs_open. >>>>> + */ >>> >>>> >>>> The comments help, but this code has bothered me for some time. Is it >>>> possible for the create to return success and for something else to >>>> happen such that the cifs_open is never called? I'd imagine that it is, >>>> and if so, then this this open file will be "leaked". >>> >>> I asked Shirish exactly the same question while discussing in the >>> #samba-technical irc channel. He does not see a leak, but thought you or >>> Steve will have a better idea.. >>> >>> Steve: ?is such a situation not possible at all? >>> >> >> I'm pretty sure it is possible and may even be somewhat likely. >> Consider this situation. vfs_create gets called from >> __open_namei_create. Something like this: >> >> do_last >> ?__open_namei_create >> ? ?vfs_create >> ? ? ? inode create operation >> >> ...after this, __open_namei_create calls may_open to check permissions >> and can return an error. If that occurs, then I don't think the open op >> will ever be called. >> > > If may_open can return error, cifs_posix_open will/is_likely to fail > at the server as well right? > In which case, so could other forms of open, so there would not be > an inode (allocated) and cifsFileInfo structure (created). > >> I think you can probably reproduce this by doing something like this: >> >> Have samba export a world-writable directory. Mount up the share with a >> user's credentials. Make sure that unix extensions are enabled. Have a >> different user do something like this into a file on the mount: >> >> ? ?echo foo > /path/to/share/testfile >> >> It's probable that the file will be created, but the open-for-write >> permission check will fail and the open file will be left dangling. >> >>>> I think we should be using lookup_instantiate_filp here instead and >>>> doing this similarly to the open on lookup code. There is some >>>> precedent for this -- fuse_create_open does this and it gets called via >>>> the .create operation. >>>> >>> >>> I thought about this briefly but was not sure whether it can be called >>> from cifs_create. I'll need to dig more. >>> >>> >>> Thanks, >>> >> >> >> -- >> Jeff Layton <[email protected]> >> _______________________________________________ >> linux-cifs-client mailing list >> [email protected] >> https://lists.samba.org/mailman/listinfo/linux-cifs-client >> > > > ------------------------------ > > Message: 5 > Date: Tue, 11 May 2010 10:05:03 -0400 > From: Jeff Layton <[email protected]> > To: Scott Lovenberg <[email protected]> > Cc: [email protected] > Subject: Re: [linux-cifs-client] [PATCH] Clean up option parsing in > mount.cifs > Message-ID: <[email protected]> > Content-Type: text/plain; charset=UTF-8 > > On Thu, 29 Apr 2010 09:58:16 -0400 > Scott Lovenberg <[email protected]> wrote: > >> Moved option string parsing to function parse_opt_token(char*). >> Main loop in parse_options(const char*, struct parsed_mount_info*) transplanted to a switch block. >> >> The parsing function folds common options to a single macro: >> 1.) 'unc','target', and 'path' -> 'OPT_UNC' >> 2.) 'dom*' and 'workg*' -> 'OPT_DOM' >> 3.) 'nobrl' and 'nolock' -> 'OPT_NO_LOCK' >> >> Kept 'fmask' and 'dmask' (OPT_FMASK, OPT_DMASK), which fall through to 'file_mode' and 'dir_mode' in the main loop. >> >> Signed-off-by: Scott Lovenberg <[email protected]> >> --- >> mount.cifs.c | 263 +++++++++++++++++++++++++++++++++++++++++---------------- >> 1 files changed, 189 insertions(+), 74 deletions(-) >> > > Looks like a definite improvement overall, but gcc complains: > > mount.cifs.c: In function ?parse_options?: > mount.cifs.c:843: warning: passing argument 1 of ?parse_opt_token? discards qualifiers from pointer target type > mount.cifs.c:733: note: expected ?char *? but argument is of type ?const char *? > > ...you can probably fix this by making parse_opt_token take a "const > char *" rather than a "char *". It's not altered so that should be safe. > >> diff --git a/mount.cifs.c b/mount.cifs.c >> index e621178..155d594 100644 >> --- a/mount.cifs.c >> +++ b/mount.cifs.c >> @@ -129,6 +129,38 @@ >> #define CRED_PASS 2 >> #define CRED_DOM 4 >> >> +/* >> + * Values for parsing command line options. >> + */ >> +#define OPT_ERROR -1 >> +#define OPT_USERS 1 >> +#define OPT_USER 2 >> +#define OPT_USER_XATTR 3 >> +#define OPT_PASS 4 >> +#define OPT_SEC 5 >> +#define OPT_IP 6 >> +#define OPT_UNC 7 >> +#define OPT_CRED 8 >> +#define OPT_UID 9 >> +#define OPT_GID 10 >> +#define OPT_FMASK 11 >> +#define OPT_FILE_MODE 12 >> +#define OPT_DMASK 13 >> +#define OPT_DIR_MODE 14 >> +#define OPT_DOM 15 >> +#define OPT_NO_SUID 16 >> +#define OPT_SUID 17 >> +#define OPT_NO_DEV 18 >> +#define OPT_DEV 19 >> +#define OPT_NO_LOCK 20 >> +#define OPT_NO_EXEC 21 >> +#define OPT_EXEC 22 >> +#define OPT_GUEST 23 >> +#define OPT_RO 24 >> +#define OPT_RW 25 >> +#define OPT_REMOUNT 26 >> + >> + > > Minor nit -- it's easier to read large lists of macros like this if > they are in columns. For instance: > > #define OPT_ERROR -1 > #define OPT_USERS 1 > #define OPT_USER 2 > > Since you need to fix the compiler warning, might as well fix this > too... > >> /* struct for holding parsed mount info for use by privleged process */ >> struct parsed_mount_info { >> unsigned long flags; >> @@ -694,17 +726,83 @@ get_pw_exit: >> return rc; >> } >> >> +/* >> + * Returns OPT_ERROR on unparsable token. >> + */ >> +static int parse_opt_token(char *token) >> +{ >> + if (token == NULL) >> + return OPT_ERROR; >> + >> + if (strncmp(token, "users", 5) == 0) >> + return OPT_USERS; >> + if (strncmp(token, "user_xattr", 10) == 0) >> + return OPT_USER_XATTR; >> + if (strncmp(token, "user", 4) == 0) >> + return OPT_USER; >> + if (strncmp(token, "pass", 4) == 0) >> + return OPT_PASS; >> + if (strncmp(token, "sec", 3) == 0) >> + return OPT_SEC; >> + if (strncmp(token, "ip", 2) == 0) >> + return OPT_IP; >> + if (strncmp(token, "unc", 3) == 0 || >> + strncmp(token, "target", 6) == 0 || >> + strncmp(token, "path", 4) == 0) >> + return OPT_UNC; >> + if (strncmp(token, "dom", 3) == 0 || strncmp(token, "workg", 5) == 0) >> + return OPT_DOM; >> + if (strncmp(token, "uid", 3) == 0) >> + return OPT_UID; >> + if (strncmp(token, "gid", 3) == 0) >> + return OPT_GID; >> + if (strncmp(token, "fmask", 5) == 0) >> + return OPT_FMASK; >> + if (strncmp(token, "file_mode", 9) == 0) >> + return OPT_FILE_MODE; >> + if (strncmp(token, "dmask", 5) == 0) >> + return OPT_DMASK; >> + if (strncmp(token, "dir_mode", 8) == 0) >> + return OPT_DIR_MODE; >> + if (strncmp(token, "nosuid", 6) == 0) >> + return OPT_NO_SUID; >> + if (strncmp(token, "suid", 4) == 0) >> + return OPT_SUID; >> + if (strncmp(token, "nodev", 5) == 0) >> + return OPT_NO_DEV; >> + if (strncmp(token, "nobrl", 5) == 0 || strncmp(token, "nolock", 6) == 0) >> + return OPT_NO_LOCK; >> + if (strncmp(token, "dev", 3) == 0) >> + return OPT_DEV; >> + if (strncmp(token, "noexec", 6) == 0) >> + return OPT_NO_EXEC; >> + if (strncmp(token, "exec", 4) == 0) >> + return OPT_EXEC; >> + if (strncmp(token, "guest", 5) == 0) >> + return OPT_GUEST; >> + if (strncmp(token, "ro", 2) == 0) >> + return OPT_RO; >> + if (strncmp(token, "rw", 2) == 0) >> + return OPT_RW; >> + if (strncmp(token, "remount", 7) == 0) >> + return OPT_REMOUNT; >> + >> + return OPT_ERROR; >> +} >> + >> static int >> parse_options(const char *data, struct parsed_mount_info *parsed_info) >> { >> - char *value = NULL, *equals = NULL; >> + char *value = NULL; >> + char *equals = NULL; >> char *next_keyword = NULL; >> char *out = parsed_info->options; >> unsigned long *filesys_flags = &parsed_info->flags; >> int out_len = 0; >> int word_len; >> int rc = 0; >> - int got_uid = 0, got_gid = 0; >> + int got_uid = 0; >> + int got_gid = 0; >> char user[32]; >> char group[32]; >> >> @@ -741,15 +839,15 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> value = equals + 1; >> } >> >> - /* FIXME: turn into a token parser? */ >> - if (strncmp(data, "users", 5) == 0) { >> + switch(parse_opt_token(data)) { >> + case OPT_USERS: >> if (!value || !*value) { >> *filesys_flags |= MS_USERS; >> goto nocopy; >> } >> - } else if (strncmp(data, "user_xattr", 10) == 0) { >> - /* do nothing - need to skip so not parsed as user name */ >> - } else if (strncmp(data, "user", 4) == 0) { >> + break; >> + >> + case OPT_USER: >> if (!value || !*value) { >> if (data[4] == '\0') { >> *filesys_flags |= MS_USER; >> @@ -772,7 +870,8 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> } >> goto nocopy; >> } >> - } else if (strncmp(data, "pass", 4) == 0) { >> + >> + case OPT_PASS: >> if (parsed_info->got_password) { >> fprintf(stderr, >> "password specified twice, ignoring second\n"); >> @@ -786,18 +885,21 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> if (rc) >> return rc; >> goto nocopy; >> - } else if (strncmp(data, "sec", 3) == 0) { >> + >> + case OPT_SEC: >> if (value) { >> if (!strncmp(value, "none", 4) || >> !strncmp(value, "krb5", 4)) >> parsed_info->got_password = 1; >> } >> - } else if (strncmp(data, "ip", 2) == 0) { >> + break; >> + >> + case OPT_IP: >> if (!value || !*value) { >> fprintf(stderr, >> - "target ip address argument missing"); >> + "target ip address argument missing\n"); >> } else if (strnlen(value, MAX_ADDRESS_LEN) <= >> - MAX_ADDRESS_LEN) { >> + MAX_ADDRESS_LEN) { >> if (parsed_info->verboseflag) >> fprintf(stderr, >> "ip address %s override specified\n", >> @@ -805,23 +907,24 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> } else { >> fprintf(stderr, "ip address too long\n"); >> return EX_USAGE; >> + >> } >> - } else if ((strncmp(data, "unc", 3) == 0) >> - || (strncmp(data, "target", 6) == 0) >> - || (strncmp(data, "path", 4) == 0)) { >> + break; >> + >> + /* unc || target || path */ >> + case OPT_UNC: >> if (!value || !*value) { >> fprintf(stderr, >> "invalid path to network resource\n"); >> - return EX_USAGE; /* needs_arg; */ >> + return EX_USAGE; >> } >> rc = parse_unc(value, parsed_info); >> if (rc) >> return rc; >> - } else if ((strncmp(data, "dom" /* domain */ , 3) == 0) >> - || (strncmp(data, "workg", 5) == 0)) { >> - /* note this allows for synonyms of "domain" >> - such as "DOM" and "dom" and "workgroup" >> - and "WORKGRP" etc. */ >> + break; >> + >> + /* dom || workgroup */ >> + case OPT_DOM: >> if (!value || !*value) { >> fprintf(stderr, "CIFS: invalid domain name\n"); >> return EX_USAGE; >> @@ -834,21 +937,23 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> strlcpy(parsed_info->domain, value, >> sizeof(parsed_info->domain)); >> goto nocopy; >> - } else if (strncmp(data, "cred", 4) == 0) { >> - if (value && *value) { >> - rc = open_cred_file(value, parsed_info); >> - if (rc) { >> - fprintf(stderr, >> - "error %d (%s) opening credential file %s\n", >> - rc, strerror(rc), value); >> - return rc; >> - } >> - } else { >> + >> + case OPT_CRED: >> + if (!value || !*value) { >> fprintf(stderr, >> "invalid credential file name specified\n"); >> return EX_USAGE; >> } >> - } else if (strncmp(data, "uid", 3) == 0) { >> + rc = open_cred_file(value, parsed_info); >> + if (rc) { >> + fprintf(stderr, >> + "error %d (%s) opening credential file %s\n", >> + rc, strerror(rc), value); >> + return rc; >> + } >> + break; >> + >> + case OPT_UID: >> if (value && *value) { >> got_uid = 1; >> if (!isdigit(*value)) { >> @@ -862,12 +967,13 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> } >> snprintf(user, sizeof(user), "%u", >> pw->pw_uid); >> - } else { >> - strlcpy(user, value, sizeof(user)); >> } >> + else >> + strlcpy(user, value, sizeof(user)); >> } >> goto nocopy; >> - } else if (strncmp(data, "gid", 3) == 0) { >> + >> + case OPT_GID: >> if (value && *value) { >> got_gid = 1; >> if (!isdigit(*value)) { >> @@ -881,14 +987,19 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> } >> snprintf(group, sizeof(group), "%u", >> gr->gr_gid); >> - } else { >> - strlcpy(group, value, sizeof(group)); >> } >> + else >> + strlcpy(group, value, sizeof(group)); >> } >> goto nocopy; >> - /* fmask and dmask synonyms for people used to smbfs syntax */ >> - } else if (strcmp(data, "file_mode") == 0 >> - || strcmp(data, "fmask") == 0) { >> + >> + /* fmask fall through to file_mode */ >> + case OPT_FMASK: >> + fprintf(stderr, >> + "WARNING: CIFS mount option 'fmask' is\ >> + deprecated. Use 'file_mode' instead.\n"); >> + data = "file_mode"; /* BB fix this */ >> + case OPT_FILE_MODE: >> if (!value || !*value) { >> fprintf(stderr, >> "Option '%s' requires a numerical argument\n", >> @@ -896,19 +1007,19 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> return EX_USAGE; >> } >> >> - if (value[0] != '0') { >> + if (value[0] != '0') >> fprintf(stderr, >> "WARNING: '%s' not expressed in octal.\n", >> data); >> - } >> + break; >> >> - if (strcmp(data, "fmask") == 0) { >> - fprintf(stderr, >> - "WARNING: CIFS mount option 'fmask' is deprecated. Use 'file_mode' instead.\n"); >> - data = "file_mode"; /* BB fix this */ >> - } >> - } else if (strcmp(data, "dir_mode") == 0 >> - || strcmp(data, "dmask") == 0) { >> + /* dmask falls through to dir_mode */ >> + case OPT_DMASK: >> + fprintf(stderr, >> + "WARNING: CIFS mount option 'dmask' is\ >> + deprecated. Use 'dir_mode' instead.\n"); >> + data = "dir_mode"; >> + case OPT_DIR_MODE: >> if (!value || !*value) { >> fprintf(stderr, >> "Option '%s' requires a numerical argument\n", >> @@ -916,49 +1027,53 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) >> return EX_USAGE; >> } >> >> - if (value[0] != '0') { >> + if (value[0] != '0') >> fprintf(stderr, >> "WARNING: '%s' not expressed in octal.\n", >> data); >> - } >> + break; >> >> - if (strcmp(data, "dmask") == 0) { >> - fprintf(stderr, >> - "WARNING: CIFS mount option 'dmask' is deprecated. Use 'dir_mode' instead.\n"); >> - data = "dir_mode"; >> - } >> - /* the following eight mount options should be >> - stripped out from what is passed into the kernel >> - since these eight options are best passed as the >> - mount flags rather than redundantly to the kernel >> - and could generate spurious warnings depending on the >> - level of the corresponding cifs vfs kernel code */ >> - } else if (strncmp(data, "nosuid", 6) == 0) { >> + /* the following mount options should be >> + stripped out from what is passed into the kernel >> + since these options are best passed as the >> + mount flags rather than redundantly to the kernel >> + and could generate spurious warnings depending on the >> + level of the corresponding cifs vfs kernel code */ >> + case OPT_NO_SUID: >> *filesys_flags |= MS_NOSUID; >> - } else if (strncmp(data, "suid", 4) == 0) { >> + break; >> + case OPT_SUID: >> *filesys_flags &= ~MS_NOSUID; >> - } else if (strncmp(data, "nodev", 5) == 0) { >> + break; >> + case OPT_NO_DEV: >> *filesys_flags |= MS_NODEV; >> - } else if ((strncmp(data, "nobrl", 5) == 0) || >> - (strncmp(data, "nolock", 6) == 0)) { >> + break; >> + /* nolock || nobrl */ >> + case OPT_NO_LOCK: >> *filesys_flags &= ~MS_MANDLOCK; >> - } else if (strncmp(data, "dev", 3) == 0) { >> + break; >> + case OPT_DEV: >> *filesys_flags &= ~MS_NODEV; >> - } else if (strncmp(data, "noexec", 6) == 0) { >> + break; >> + case OPT_NO_EXEC: >> *filesys_flags |= MS_NOEXEC; >> - } else if (strncmp(data, "exec", 4) == 0) { >> + break; >> + case OPT_EXEC: >> *filesys_flags &= ~MS_NOEXEC; >> - } else if (strncmp(data, "guest", 5) == 0) { >> + break; >> + case OPT_GUEST: >> parsed_info->got_user = 1; >> parsed_info->got_password = 1; >> - } else if (strncmp(data, "ro", 2) == 0) { >> + break; >> + case OPT_RO: >> *filesys_flags |= MS_RDONLY; >> goto nocopy; >> - } else if (strncmp(data, "rw", 2) == 0) { >> + case OPT_RW: >> *filesys_flags &= ~MS_RDONLY; >> goto nocopy; >> - } else if (strncmp(data, "remount", 7) == 0) { >> + case OPT_REMOUNT: >> *filesys_flags |= MS_REMOUNT; >> + break; >> } >> >> /* check size before copying option to buffer */ > > -- > Jeff Layton <[email protected]> > > > ------------------------------ > > _______________________________________________ > linux-cifs-client mailing list > [email protected] > https://lists.samba.org/mailman/listinfo/linux-cifs-client > > > End of linux-cifs-client Digest, Vol 78, Issue 17 > ************************************************* >