Skip to contentSkip to conversation

mount.cifs: reinstate ip= as an override for address resolution

PATCH In review Jeff Layton 1 participant 4 messages Oct 8, 2010 – Oct 12, 2010 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount.cifs: reinstate ip= as an override for address resolution

The manpage says:

ip=arg
sets the destination IP address. This option is set automatically if the server name portion of the requested UNC name can be resolved so rarely needs to be specified by the user.

...but recent changes have made it not work anymore as an override if someone specifies an ip= option as part of the mount options. Reinstate that behavior by copying the ip= option verbatim into the addrlist of the parsed options struct and then skipping the name resolution. That should allow the ip= option to pass unadulterated to the kernel.

---
 mount.cifs.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
mount.cifs.c +5 -1
index ed27bba..df92d79 100644
@@ -958,10 +958,12 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 					"target ip address argument missing\n");
 			} else if (strnlen(value, MAX_ADDRESS_LEN) <=
 				MAX_ADDRESS_LEN) {
+				strcpy(parsed_info->addrlist, value);
 				if (parsed_info->verboseflag)
 					fprintf(stderr,
 						"ip address %s override specified\n",
 						value);
+				goto nocopy;
 			} else {
 				fprintf(stderr, "ip address too long\n");
 				return EX_USAGE;
@@ -1556,7 +1558,9 @@ assemble_mountinfo(struct parsed_mount_info *parsed_info,
 	if (rc)
 		goto assemble_exit;
 
-	rc = resolve_host(parsed_info->host, parsed_info->addrlist);
+	if (parsed_info->addrlist[0] == '\0')
+		rc = resolve_host(parsed_info->host, parsed_info->addrlist);
+
 	switch (rc) {
 	case EX_USAGE:
 		fprintf(stderr, "mount error: could not resolve address for "
Signature · 1 line
1.7.2.3

A message that is not in the archive (sent off-list or not yet received): 1286565306-32035-1-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org

#2 lore raw

PATCH 1/1 manpage: add mount.cifs manpage entry for "multiuser" option

---
 mount.cifs.8 |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
mount.cifs.8 +7 -0
index d01f2a3..7d2bf69 100644
@@ -396,6 +396,13 @@ Enable local disk caching using FS-Cache for CIFS\&. This option could be useful
 NOTE: This feature is available only in the recent kernels that have been built with the kernel config option CONFIG_CIFS_FSCACHE. You also need to have cachefilesd daemon installed and running to make the cache operational\&.
 .RE
 .PP
+multiuser
+.RS 4
+Map user accesses to individual credentials when accessing the server\&. By default, CIFS mounts only use a single set of user credentials (the mount credentials) when accessing a share\&. With this option, the client instead creates a new session with the server using the user's credentials whenever a new user accesses the mount. Further accesses by that user will also use those credentials\&. Because the kernel cannot prompt for passwords, multiuser mounts are limited to mounts using sec= options that don't require passwords.
+.sp
+With this change, it's feasible for the server to handle permissions enforcement, so this option also implies "noperm"\&. Furthermore, when unix extensions aren't in use and the administrator has not overriden ownership using the uid= or gid= options, ownership of files is presented as the current user accessing the share\&.
+.RE
+.PP
 \-\-verbose
 .RS 4
 Print additional debugging information for the mount\&. Note that this parameter must be specified before the \-o\&. For example:
Signature · 1 line
1.7.2.3

A message that is not in the archive (sent off-list or not yet received): 1286565306-32035-2-git-send-email-jlayton-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org

#4 lore raw

Re: [PATCH] manpage: add mount.cifs manpage entry for "multiuser" option

Quoted 13 lines · On Fri, 8 Oct 2010 15:15:06 -0400 Jeff Layton…
---
 mount.cifs.8 |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
mount.cifs.8 +0 -0
index d01f2a3..7d2bf69 100644
@@ -396,6 +396,13 @@ Enable local disk caching using FS-Cache for CIFS\&. This option could be useful
 NOTE: This feature is available only in the recent kernels that have been built with the kernel config option CONFIG_CIFS_FSCACHE. You also need to have cachefilesd daemon installed and running to make the cache operational\&.
 .RE
 .PP

mount.cifs.8 Enable local disk caching using FS-Cache for CIFS\&. This option could be useful · line 408

Quoted 10 lines
mount.cifs.8 +7 -0
+multiuser
+.RS 4
+Map user accesses to individual credentials when accessing the server\&. By default, CIFS mounts only use a single set of user credentials (the mount credentials) when accessing a share\&. With this option, the client instead creates a new session with the server using the user's credentials whenever a new user accesses the mount. Further accesses by that user will also use those credentials\&. Because the kernel cannot prompt for passwords, multiuser mounts are limited to mounts using sec= options that don't require passwords.
+.sp
+With this change, it's feasible for the server to handle permissions enforcement, so this option also implies "noperm"\&. Furthermore, when unix extensions aren't in use and the administrator has not overriden ownership using the uid= or gid= options, ownership of files is presented as the current user accessing the share\&.
+.RE
+.PP
 \-\-verbose
 .RS 4
 Print additional debugging information for the mount\&. Note that this parameter must be specified before the \-o\&. For example:

Committed...

I'll probably wait a few days to see if any more patches turn up and then do a new release later this week or next. Post 'em if you've got 'em.

Signature · 1 line
Jeff Layton <[email protected]>
#5 lore raw
In reply to a message not in the archive
Quoted 36 lines · On Fri, 8 Oct 2010 15:15:05 -0400 Jeff Layton…

The manpage says:

ip=arg
sets the destination IP address. This option is set automatically if the server name portion of the requested UNC name can be resolved so rarely needs to be specified by the user.

...but recent changes have made it not work anymore as an override if someone specifies an ip= option as part of the mount options. Reinstate that behavior by copying the ip= option verbatim into the addrlist of the parsed options struct and then skipping the name resolution. That should allow the ip= option to pass unadulterated to the kernel.

---
 mount.cifs.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
mount.cifs.c +2 -0
index ed27bba..df92d79 100644
@@ -958,10 +958,12 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
 					"target ip address argument missing\n");
 			} else if (strnlen(value, MAX_ADDRESS_LEN) <=
 				MAX_ADDRESS_LEN) {
+				strcpy(parsed_info->addrlist, value);
 				if (parsed_info->verboseflag)
 					fprintf(stderr,
 						"ip address %s override specified\n",
 						value);
+				goto nocopy;
 			} else {
 				fprintf(stderr, "ip address too long\n");
 				return EX_USAGE;

mount.cifs.c assemble_mountinfo(struct parsed_mount_info *parsed_info, · line 1566

Quoted 10 lines
mount.cifs.c +3 -1
@@ -1556,7 +1558,9 @@ assemble_mountinfo(struct parsed_mount_info *parsed_info,
 	if (rc)
 		goto assemble_exit;
 
-	rc = resolve_host(parsed_info->host, parsed_info->addrlist);
+	if (parsed_info->addrlist[0] == '\0')
+		rc = resolve_host(parsed_info->host, parsed_info->addrlist);
+
 	switch (rc) {
 	case EX_USAGE:
 		fprintf(stderr, "mount error: could not resolve address for "

Committed...

I'll probably wait a few days to see if any more patches turn up and then do a new release later this week or next. Post 'em if you've got 'em.

Signature · 1 line
Jeff Layton <[email protected]>