]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbdotconf: mark "postexec" with substitution="1"
authorRalph Boehme <slow@samba.org>
Mon, 4 Nov 2019 10:23:18 +0000 (11:23 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 27 Nov 2019 10:25:33 +0000 (10:25 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
docs-xml/smbdotconf/misc/postexec.xml
source3/smbd/service.c

index c65ee1b2bca8d1fa4ad1c3037bd704c9bd295183..ca1522123ceaf047817ac7d1f3054413f8730a33 100644 (file)
@@ -1,6 +1,7 @@
 <samba:parameter name="postexec"
                  context="S"
                  type="string"
+                 substitution="1"
                  xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
 <description>
        <para>This option specifies a command to be run 
index 0d220903decd1c4eec0a958edcb45b07c4164857..10a215e999e69f9f8ca7403bc648153207d2e4b9 100644 (file)
@@ -1151,6 +1151,8 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
 {
        char rootpath[2] = { '/', '\0'};
        struct smb_filename root_fname = { .base_name = rootpath };
+       const struct loadparm_substitution *lp_sub =
+               loadparm_s3_global_substitution();
 
        file_close_conn(conn);
 
@@ -1169,7 +1171,7 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
        SMB_VFS_DISCONNECT(conn);
 
        /* execute any "postexec = " line */
-       if (*lp_postexec(talloc_tos(), SNUM(conn)) &&
+       if (*lp_postexec(talloc_tos(), lp_sub, SNUM(conn)) &&
            change_to_user_and_service(conn, vuid))  {
                char *cmd = talloc_sub_full(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
@@ -1178,7 +1180,7 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
                                        conn->session_info->unix_token->gid,
                                        conn->session_info->unix_info->sanitized_username,
                                        conn->session_info->info->domain_name,
-                                       lp_postexec(talloc_tos(), SNUM(conn)));
+                                       lp_postexec(talloc_tos(), lp_sub, SNUM(conn)));
                smbrun(cmd, NULL, NULL);
                TALLOC_FREE(cmd);
                change_to_root_user();