summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2010-10-08 15:11:57 -0400
committerJeff Layton <jlayton@samba.org>2010-10-08 15:11:57 -0400
commitd90691a283d0f2ed928476fc96970b1ef2a28662 (patch)
tree5cd1d5d86e54aaf7acdc7fd0a1ae39b4c67e14e6
parentf2daa2a08bf8706f90e1154272c5bfe6279895cd (diff)
downloadcifs-utils-d90691a283d0f2ed928476fc96970b1ef2a28662.tar.gz
cifs-utils-d90691a283d0f2ed928476fc96970b1ef2a28662.tar.bz2
cifs-utils-d90691a283d0f2ed928476fc96970b1ef2a28662.zip
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. Signed-off-by: Jeff Layton <jlayton@samba.org>
-rw-r--r--mount.cifs.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mount.cifs.c b/mount.cifs.c
index ed27bba..df92d79 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -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 "