]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbdotconf: mark "comment" with substitution="1"
authorStefan Metzmacher <metze@samba.org>
Tue, 15 Oct 2019 14:54:45 +0000 (16:54 +0200)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Nov 2019 10:25:32 +0000 (10:25 +0000)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
docs-xml/smbdotconf/base/comment.xml
source3/rpc_server/spoolss/srv_spoolss_nt.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/lanman.c
source3/smbd/msdfs.c

index b0dd91c8839c682b3beb568a79b08c8975b24998..c5aba83451a6be4443b9160c3f3ad51020136dfc 100644 (file)
@@ -1,6 +1,7 @@
 <samba:parameter name="comment"
                  context="S"
                  type="string"
+                 substitution="1"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
     <para>This is a text field that is seen next to a share 
index f32b465afb674d8cce22f1f8c6e58beba6822b65..c80996532ad52d961775a94c54b81362f3309b37 100644 (file)
@@ -2805,10 +2805,12 @@ static void spoolss_notify_comment(struct messaging_context *msg_ctx,
                                   struct spoolss_PrinterInfo2 *pinfo2,
                                   TALLOC_CTX *mem_ctx)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        const char *p;
 
        if (*pinfo2->comment == '\0') {
-               p = lp_comment(talloc_tos(), snum);
+               p = lp_comment(talloc_tos(), lp_sub, snum);
        } else {
                p = pinfo2->comment;
        }
@@ -3970,12 +3972,14 @@ static WERROR construct_printer_info1(TALLOC_CTX *mem_ctx,
                                      struct spoolss_PrinterInfo1 *r,
                                      int snum)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        WERROR result;
 
        r->flags                = flags;
 
        if (info2->comment == NULL || info2->comment[0] == '\0') {
-               r->comment      = lp_comment(mem_ctx, snum);
+               r->comment      = lp_comment(mem_ctx, lp_sub, snum);
        } else {
                r->comment      = talloc_strdup(mem_ctx, info2->comment); /* saved comment */
        }
@@ -4007,6 +4011,8 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
                                      struct spoolss_PrinterInfo2 *r,
                                      int snum)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        int count;
        print_status_struct status;
        WERROR result;
@@ -4033,7 +4039,7 @@ static WERROR construct_printer_info2(TALLOC_CTX *mem_ctx,
        W_ERROR_HAVE_NO_MEMORY(r->drivername);
 
        if (info2->comment[0] == '\0') {
-               r->comment      = lp_comment(mem_ctx, snum);
+               r->comment      = lp_comment(mem_ctx, lp_sub, snum);
        } else {
                r->comment      = talloc_strdup(mem_ctx, info2->comment);
        }
index c0d74bb7af4b1085939e89ca5e0ea989384e5087..1280cc90f69f96a7179d824e0039a7cbf633a89c 100644 (file)
@@ -221,8 +221,10 @@ static void init_srv_share_info_1(struct pipes_struct *p,
                                  struct srvsvc_NetShareInfo1 *r,
                                  int snum)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        char *net_name = lp_servicename(talloc_tos(), snum);
-       char *remark = lp_comment(p->mem_ctx, snum);
+       char *remark = lp_comment(p->mem_ctx, lp_sub, snum);
 
        if (remark) {
                remark = talloc_sub_full(
@@ -245,13 +247,15 @@ static void init_srv_share_info_2(struct pipes_struct *p,
                                  struct srvsvc_NetShareInfo2 *r,
                                  int snum)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        char *remark = NULL;
        char *path = NULL;
        int max_connections = lp_max_connections(snum);
        uint32_t max_uses = max_connections!=0 ? max_connections : (uint32_t)-1;
        char *net_name = lp_servicename(talloc_tos(), snum);
 
-       remark = lp_comment(p->mem_ctx, snum);
+       remark = lp_comment(p->mem_ctx, lp_sub, snum);
        if (remark) {
                remark = talloc_sub_full(
                        p->mem_ctx, lp_servicename(talloc_tos(), snum),
@@ -314,8 +318,10 @@ static void map_generic_share_sd_bits(struct security_descriptor *psd)
 static void init_srv_share_info_501(struct pipes_struct *p,
                                    struct srvsvc_NetShareInfo501 *r, int snum)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        const char *net_name = lp_servicename(talloc_tos(), snum);
-       char *remark = lp_comment(p->mem_ctx, snum);
+       char *remark = lp_comment(p->mem_ctx, lp_sub, snum);
 
        if (remark) {
                remark = talloc_sub_full(
@@ -343,13 +349,15 @@ static void init_srv_share_info_501(struct pipes_struct *p,
 static void init_srv_share_info_502(struct pipes_struct *p,
                                    struct srvsvc_NetShareInfo502 *r, int snum)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        const char *net_name = lp_servicename(talloc_tos(), snum);
        char *path = NULL;
        struct security_descriptor *sd = NULL;
        struct sec_desc_buf *sd_buf = NULL;
        size_t sd_size = 0;
        TALLOC_CTX *ctx = p->mem_ctx;
-       char *remark = lp_comment(ctx, snum);
+       char *remark = lp_comment(ctx, lp_sub, snum);
 
        if (remark) {
                remark = talloc_sub_full(
@@ -390,7 +398,9 @@ static void init_srv_share_info_1004(struct pipes_struct *p,
                                     struct srvsvc_NetShareInfo1004 *r,
                                     int snum)
 {
-       char *remark = lp_comment(p->mem_ctx, snum);
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
+       char *remark = lp_comment(p->mem_ctx, lp_sub, snum);
 
        if (remark) {
                remark = talloc_sub_full(
@@ -1711,6 +1721,8 @@ WERROR _srvsvc_NetShareGetInfo(struct pipes_struct *p,
 WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
                               struct srvsvc_NetShareSetInfo *r)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        char *command = NULL;
        char *share_name = NULL;
        char *comment = NULL;
@@ -1831,7 +1843,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
                }
 
                pathname = lp_path(ctx, snum);
-               comment = lp_comment(ctx, snum);
+               comment = lp_comment(ctx, lp_sub, snum);
                type = STYPE_DISKTREE;
                break;
        case 1006:
@@ -1839,7 +1851,7 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
                return WERR_ACCESS_DENIED;
        case 1501:
                pathname = lp_path(ctx, snum);
-               comment = lp_comment(ctx, snum);
+               comment = lp_comment(ctx, lp_sub, snum);
                psd = info->info1501->sd;
                map_generic_share_sd_bits(psd);
                type = STYPE_DISKTREE;
@@ -1879,7 +1891,8 @@ WERROR _srvsvc_NetShareSetInfo(struct pipes_struct *p,
 
        /* Only call modify function if something changed. */
 
-       if (strcmp(path, lp_path(talloc_tos(), snum)) || strcmp(comment, lp_comment(talloc_tos(), snum))
+       if (strcmp(path, lp_path(talloc_tos(), snum))
+                       || strcmp(comment, lp_comment(talloc_tos(), lp_sub, snum))
                        || (lp_max_connections(snum) != max_connections)
                        || csc_policy_changed) {
 
index ee6e9a481e27dddb9fd915e7fe63bebe6c8a4478..0a3e1073eb6cdca71c07669600b0815b954277db 100644 (file)
@@ -1888,6 +1888,8 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
                           char** buf, int* buflen,
                           char** stringbuf, int* stringspace, char* baseaddr)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        int struct_len;
        char* p;
        char* p2;
@@ -1915,7 +1917,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
                len = 0;
 
                if (uLevel > 0) {
-                       len += StrlenExpanded(conn,snum,lp_comment(talloc_tos(), snum));
+                       len += StrlenExpanded(conn,snum,lp_comment(talloc_tos(), lp_sub, snum));
                }
                if (uLevel > 1) {
                        len += strlen(lp_path(talloc_tos(), snum)) + 1;
@@ -1962,7 +1964,7 @@ static int fill_share_info(connection_struct *conn, int snum, int uLevel,
                }
                SSVAL(p,14,type);               /* device type */
                SIVAL(p,16,PTR_DIFF(p2,baseaddr));
-               len += CopyExpanded(conn,snum,&p2,lp_comment(talloc_tos(),snum),&l2);
+               len += CopyExpanded(conn,snum,&p2,lp_comment(talloc_tos(), lp_sub, snum),&l2);
        }
 
        if (uLevel > 1) {
index fe8553215a42e38a82ff57131242f9b36d380eda..7ef368240d5ce8d8c413e45f6756016a3a3630bd 100644 (file)
@@ -1264,6 +1264,8 @@ bool create_junction(TALLOC_CTX *ctx,
                bool allow_broken_path,
                struct junction_map *jucn)
 {
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
        int snum;
        bool dummy;
        struct dfs_path *pdp = talloc(ctx,struct dfs_path);
@@ -1299,7 +1301,7 @@ bool create_junction(TALLOC_CTX *ctx,
 
        jucn->service_name = talloc_strdup(ctx, pdp->servicename);
        jucn->volume_name = talloc_strdup(ctx, pdp->reqpath);
-       jucn->comment = lp_comment(ctx, snum);
+       jucn->comment = lp_comment(ctx, lp_sub, snum);
 
        TALLOC_FREE(pdp);
        if (!jucn->service_name || !jucn->volume_name || ! jucn->comment) {