summaryrefslogtreecommitdiff
path: root/util-linux/mount.c
diff options
context:
space:
mode:
authorMartin Santesson2013-01-16 00:47:19 +0100
committerDenys Vlasenko2013-01-16 00:47:19 +0100
commit406ea15e2c108c949f8b1a3547eecf4dd9509724 (patch)
tree61e9b50dbe9f25aa39b13c872cdd5743912b2715 /util-linux/mount.c
parent970aa6b5bd95e435e537d123ec8be99c3077af1b (diff)
downloadbusybox-406ea15e2c108c949f8b1a3547eecf4dd9509724.zip
busybox-406ea15e2c108c949f8b1a3547eecf4dd9509724.tar.gz
mount: add unc option to CIFS mount (needed for Linux 3.4+)
unc option for CIFS mount is mandatory after CIFS option parsing was rewritten in Linux 3.4 Signed-off-by: Martin Santesson <martinsn@axis.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'util-linux/mount.c')
-rw-r--r--util-linux/mount.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c
index bcb298c..d473fd0 100644
--- a/util-linux/mount.c
+++ b/util-linux/mount.c
@@ -1822,10 +1822,24 @@ static int singlemount(struct mntent *mp, int ignore_busy)
hostname = mp->mnt_fsname + 2;
len = strcspn(hostname, "/\\");
- if (len == 0 || hostname[len] == '\0')
+ if (len == 0 // 1st char is a [back]slash (IOW: empty hostname)
+ || hostname[len] == '\0' // no [back]slash after hostname
+ || hostname[len+1] == '\0' // empty share name
+ ) {
goto report_error;
+ }
c = hostname[len];
hostname[len] = '\0';
+
+ // "unc=\\hostname\share" option is mandatory
+ // after CIFS option parsing was rewritten in Linux 3.4.
+ // Must pass it to the kernel. Must use backslashes.
+ {
+ char *unc = xasprintf("unc=\\\\%s\\%s", hostname, hostname + len + 1);
+ parse_mount_options(unc, &filteropts);
+ if (ENABLE_FEATURE_CLEAN_UP) free(unc);
+ }
+
lsa = host2sockaddr(hostname, 0);
hostname[len] = c;
if (!lsa)