smbdotconf: mark "usershare path" with substitution="1"
authorRalph Boehme <slow@samba.org>
Tue, 5 Nov 2019 11:14:37 +0000 (12:14 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Nov 2019 10:25:36 +0000 (10:25 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
docs-xml/smbdotconf/misc/usersharepath.xml
source3/param/service.c
source3/utils/net_usershare.c

index 446b1fdef6194d6c9eea51ce6827739d9b3ce4f9..99fea946c00e6322551eb514ff76bf2f10eed268 100644 (file)
@@ -1,6 +1,7 @@
 <samba:parameter name="usershare path"
                  context="G"
                  type="string"
+                 substitution="1"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
        <para>This parameter specifies the absolute path of the directory on the
index 76c12bd591d22ae25cdc11b189e37142376818e2..09b8228daadbbe7ae4a6dd9b5792e58fc7bb0d6d 100644 (file)
@@ -191,7 +191,7 @@ int find_service(TALLOC_CTX *ctx, const char *service_in, char **p_service_out)
        }
 
        /* Is it a usershare service ? */
-       if (iService < 0 && *lp_usershare_path(talloc_tos())) {
+       if (iService < 0 && *lp_usershare_path(talloc_tos(), lp_sub)) {
                /* Ensure the name is canonicalized. */
                if (!strlower_m(*p_service_out)) {
                        goto fail;
index f5b126aa3d1a2b759513a34b0a1bd6fd5c4b56b7..637ef80135206dec9668123889694048264edfa7 100644 (file)
@@ -135,7 +135,9 @@ int net_usershare_usage(struct net_context *c, int argc, const char **argv)
 
 static char *get_basepath(TALLOC_CTX *ctx)
 {
-       char *basepath = lp_usershare_path(ctx);
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
+       char *basepath = lp_usershare_path(ctx, lp_sub);
 
        if (!basepath) {
                return NULL;
@@ -152,6 +154,8 @@ static char *get_basepath(TALLOC_CTX *ctx)
 
 static int net_usershare_delete(struct net_context *c, int argc, const char **argv)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        char *us_path;
        char *sharename;
 
@@ -174,7 +178,7 @@ static int net_usershare_delete(struct net_context *c, int argc, const char **ar
 
        us_path = talloc_asprintf(talloc_tos(),
                                "%s/%s",
-                               lp_usershare_path(talloc_tos()),
+                               lp_usershare_path(talloc_tos(), lp_sub),
                                sharename);
        if (!us_path) {
                TALLOC_FREE(sharename);
@@ -1075,6 +1079,8 @@ static int net_usershare_list(struct net_context *c, int argc,
 
 int net_usershare(struct net_context *c, int argc, const char **argv)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        DIR *dp;
 
        struct functable func[] = {
@@ -1120,13 +1126,13 @@ int net_usershare(struct net_context *c, int argc, const char **argv)
                return -1;
        }
 
-       dp = opendir(lp_usershare_path(talloc_tos()));
+       dp = opendir(lp_usershare_path(talloc_tos(), lp_sub));
        if (!dp) {
                int err = errno;
                d_fprintf(stderr,
                        _("net usershare: cannot open usershare directory %s. "
                          "Error %s\n"),
-                       lp_usershare_path(talloc_tos()), strerror(err) );
+                       lp_usershare_path(talloc_tos(), lp_sub), strerror(err) );
                if (err == EACCES) {
                        d_fprintf(stderr,
                                _("You do not have permission to create a "