diff options
-rw-r--r-- | util-linux/mount.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/util-linux/mount.c b/util-linux/mount.c index bcb298c07..d473fd0a1 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c | |||
@@ -1822,10 +1822,24 @@ static int singlemount(struct mntent *mp, int ignore_busy) | |||
1822 | 1822 | ||
1823 | hostname = mp->mnt_fsname + 2; | 1823 | hostname = mp->mnt_fsname + 2; |
1824 | len = strcspn(hostname, "/\\"); | 1824 | len = strcspn(hostname, "/\\"); |
1825 | if (len == 0 || hostname[len] == '\0') | 1825 | if (len == 0 // 1st char is a [back]slash (IOW: empty hostname) |
1826 | || hostname[len] == '\0' // no [back]slash after hostname | ||
1827 | || hostname[len+1] == '\0' // empty share name | ||
1828 | ) { | ||
1826 | goto report_error; | 1829 | goto report_error; |
1830 | } | ||
1827 | c = hostname[len]; | 1831 | c = hostname[len]; |
1828 | hostname[len] = '\0'; | 1832 | hostname[len] = '\0'; |
1833 | |||
1834 | // "unc=\\hostname\share" option is mandatory | ||
1835 | // after CIFS option parsing was rewritten in Linux 3.4. | ||
1836 | // Must pass it to the kernel. Must use backslashes. | ||
1837 | { | ||
1838 | char *unc = xasprintf("unc=\\\\%s\\%s", hostname, hostname + len + 1); | ||
1839 | parse_mount_options(unc, &filteropts); | ||
1840 | if (ENABLE_FEATURE_CLEAN_UP) free(unc); | ||
1841 | } | ||
1842 | |||
1829 | lsa = host2sockaddr(hostname, 0); | 1843 | lsa = host2sockaddr(hostname, 0); |
1830 | hostname[len] = c; | 1844 | hostname[len] = c; |
1831 | if (!lsa) | 1845 | if (!lsa) |