]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:util:net_conf - allow empty path for [homes]
authorAndrew <awalker@ixsystems.com>
Fri, 4 Sep 2020 17:24:41 +0000 (13:24 -0400)
committerJeremy Allison <jra@samba.org>
Thu, 24 Sep 2020 21:41:12 +0000 (21:41 +0000)
Validation for "net conf addshare" is overly strict. Empty string for
path for homes share is valid.

Signed-off-by: Andrew <awalker@ixsystems.com>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 24 21:41:12 UTC 2020 on sn-devel-184

source3/utils/net_conf.c

index 267c4c802df869ed6a976931d3c8c0762fb594ac..c16f240634c4e80f47df525fc120300c96ef70af 100644 (file)
@@ -648,10 +648,18 @@ static int net_conf_addshare(struct net_context *c,
        /* validate path */
 
        if (path[0] != '/') {
-               d_fprintf(stderr,
-                         _("Error: path '%s' is not an absolute path.\n"),
-                         path);
-               goto done;
+               bool ok = false;
+
+               if (strequal(sharename, HOMES_NAME) && path[0] == '\0') {
+                       /* The homes share can be an empty path. */
+                       ok = true;
+               }
+               if (!ok) {
+                       d_fprintf(stderr,
+                                 _("Error: path '%s' is not an absolute path.\n"),
+                                path);
+                       goto done;
+               }
        }
 
        /*