From 2dae6473fa0dabc2e12ffcf766f81117a10944b4 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Tue, 5 Nov 2019 12:14:37 +0100 Subject: [PATCH] smbdotconf: mark "usershare path" with substitution="1" Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- docs-xml/smbdotconf/misc/usersharepath.xml | 1 + source3/param/service.c | 2 +- source3/utils/net_usershare.c | 14 ++++++++++---- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/docs-xml/smbdotconf/misc/usersharepath.xml b/docs-xml/smbdotconf/misc/usersharepath.xml index 446b1fdef61..99fea946c00 100644 --- a/docs-xml/smbdotconf/misc/usersharepath.xml +++ b/docs-xml/smbdotconf/misc/usersharepath.xml @@ -1,6 +1,7 @@ This parameter specifies the absolute path of the directory on the diff --git a/source3/param/service.c b/source3/param/service.c index 76c12bd591d..09b8228daad 100644 --- a/source3/param/service.c +++ b/source3/param/service.c @@ -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; diff --git a/source3/utils/net_usershare.c b/source3/utils/net_usershare.c index f5b126aa3d1..637ef801352 100644 --- a/source3/utils/net_usershare.c +++ b/source3/utils/net_usershare.c @@ -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 " -- 2.47.3