s3: rename talloc_sub_advanced() to talloc_sub_full()
authorRalph Boehme <slow@samba.org>
Thu, 31 Oct 2019 11:45:44 +0000 (12:45 +0100)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 7 Nov 2019 14:16:41 +0000 (14:16 +0000)
We currently have the following substitution functions:

  talloc_sub_basic()
  talloc_sub_advanced()

talloc_sub_basic() currently substitutes a subset of talloc_sub_advanced().

We'll need a function X that only substitutes what talloc_sub_advanced()
substitutes *without* what talloc_sub_basic() does.

To get there rename talloc_sub_advanced() to talloc_sub_full(). A subsequent
commit will then bring back talloc_sub_advanced() as described above.

Examples with fictional replacement letters A and B. Currently:

  talloc_sub_basic:    A
  talloc_sub_advanced: AB

New:

  talloc_sub_basic:    A
  talloc_sub_advanced:  B
  talloc_sub_full:     AB

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13745

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/include/proto.h
source3/lib/substitute.c
source3/modules/vfs_expand_msdfs.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_recycle.c
source3/modules/vfs_virusfilter_utils.c
source3/printing/print_generic.c
source3/printing/printing.c
source3/rpc_server/srvsvc/srv_srvsvc_nt.c
source3/smbd/lanman.c
source3/smbd/service.c

index 856b41272ad244e5bdbae0366d9280bfc31d9771..e453669b433b44b1c234ad0064bcb77d982016a6 100644 (file)
@@ -180,7 +180,7 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
                        const char *domain,
                        uid_t uid,
                        gid_t gid);
-char *talloc_sub_advanced(TALLOC_CTX *mem_ctx,
+char *talloc_sub_full(TALLOC_CTX *mem_ctx,
                          const char *servicename, const char *user,
                          const char *connectpath, gid_t gid,
                          const char *smb_name, const char *domain_name,
index 8fd4fbf95192f1d1785b9a0f5c82df3e29c24144..e5cd0f28804dd73221e68b78a51c85dd83da449d 100644 (file)
@@ -790,7 +790,7 @@ char *talloc_sub_specified(TALLOC_CTX *mem_ctx,
 /****************************************************************************
 ****************************************************************************/
 
-char *talloc_sub_advanced(TALLOC_CTX *ctx,
+char *talloc_sub_full(TALLOC_CTX *ctx,
                        const char *servicename,
                        const char *user,
                        const char *connectpath,
@@ -804,7 +804,7 @@ char *talloc_sub_advanced(TALLOC_CTX *ctx,
 
        a_string = talloc_strdup(talloc_tos(), str);
        if (a_string == NULL) {
-               DEBUG(0, ("talloc_sub_advanced: Out of memory!\n"));
+               DBG_ERR("Out of memory!\n");
                return NULL;
        }
 
index 0923489f265d5a46f9830a6ded1a6250afb6d094..23ea136620cb288a5ecd6f28253aebb1a177d1dd 100644 (file)
@@ -154,7 +154,7 @@ static char *expand_msdfs_target(TALLOC_CTX *ctx,
                return NULL;
        }
 
-       targethost = talloc_sub_advanced(ctx,
+       targethost = talloc_sub_full(ctx,
                                lp_servicename(talloc_tos(), SNUM(conn)),
                                conn->session_info->unix_info->unix_name,
                                conn->connectpath,
index 8e46f983390f9b98750402b11d1b4de4af649594..b89996b7a56f25afefa88a4e740f27874286549f 100644 (file)
@@ -484,7 +484,7 @@ static char *audit_prefix(TALLOC_CTX *ctx, connection_struct *conn)
        if (!prefix) {
                return NULL;
        }
-       result = talloc_sub_advanced(ctx,
+       result = talloc_sub_full(ctx,
                        lp_servicename(talloc_tos(), SNUM(conn)),
                        conn->session_info->unix_info->unix_name,
                        conn->connectpath,
index b40544ace316d3510fe5babdd6b72580b02118e1..46a4fcb16bff36bd272f19b6cab3874a1c906c19 100644 (file)
@@ -467,7 +467,7 @@ static int recycle_unlink_internal(vfs_handle_struct *handle,
        bool exist;
        int rc = -1;
 
-       repository = talloc_sub_advanced(NULL, lp_servicename(talloc_tos(), SNUM(conn)),
+       repository = talloc_sub_full(NULL, lp_servicename(talloc_tos(), SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
                                        conn->connectpath,
                                        conn->session_info->unix_token->gid,
index 5da87ea4a001b62f5889aceba9db3f58bfe6c1cd..480279f90d6f5b45f70b769977e8135834c5e7a3 100644 (file)
@@ -35,7 +35,7 @@ char *virusfilter_string_sub(
        connection_struct *conn,
        const char *str)
 {
-       return talloc_sub_advanced(mem_ctx,
+       return talloc_sub_full(mem_ctx,
                lp_servicename(mem_ctx, SNUM(conn)),
                conn->session_info->unix_info->unix_name,
                conn->connectpath,
index b6b50062caf6fc90fa155d317f4b611cba88adc5..9c47d3ff7a51f4f587b6edfc9ef85c53a8af42b4 100644 (file)
@@ -72,7 +72,7 @@ static int print_run_command(int snum, const char* printername, bool do_sub,
        }
 
        if (do_sub && snum != -1) {
-               syscmd = talloc_sub_advanced(ctx,
+               syscmd = talloc_sub_full(ctx,
                                lp_servicename(talloc_tos(), snum),
                                current_user_info.unix_name,
                                "",
index 0ad070468505a0d768576388a5ff12c580064642..c6bf6ec69dd9a9235c2c7653b7094474123638ed 100644 (file)
@@ -1724,7 +1724,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
        if (!lpqcommand) {
                return;
        }
-       lpqcommand = talloc_sub_advanced(ctx,
+       lpqcommand = talloc_sub_full(ctx,
                        lp_servicename(talloc_tos(), snum),
                        current_user_info.unix_name,
                        "",
@@ -1744,7 +1744,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
        if (!lprmcommand) {
                return;
        }
-       lprmcommand = talloc_sub_advanced(ctx,
+       lprmcommand = talloc_sub_full(ctx,
                        lp_servicename(talloc_tos(), snum),
                        current_user_info.unix_name,
                        "",
@@ -2866,7 +2866,7 @@ WERROR print_job_start(const struct auth_session_info *server_info,
 
        fstrcpy(pjob.clientmachine, clientmachine);
 
-       userstr = talloc_sub_advanced(talloc_tos(),
+       userstr = talloc_sub_full(talloc_tos(),
                              sharename,
                              server_info->unix_info->sanitized_username,
                              path, server_info->unix_token->gid,
@@ -3035,7 +3035,7 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum,
                status = NT_STATUS_PRINT_CANCELLED;
                goto fail;
        }
-       lpq_cmd = talloc_sub_advanced(tmp_ctx,
+       lpq_cmd = talloc_sub_full(tmp_ctx,
                                      lp_servicename(talloc_tos(), snum),
                                      current_user_info.unix_name,
                                      "",
index d4de3cdcfdd5dd76fdf613ae04977c29fce6ec33..34a227c76e9eff2c49ddaaaf8b437c408859175b 100644 (file)
@@ -225,7 +225,7 @@ static void init_srv_share_info_1(struct pipes_struct *p,
        char *remark = lp_comment(p->mem_ctx, snum);
 
        if (remark) {
-               remark = talloc_sub_advanced(
+               remark = talloc_sub_full(
                        p->mem_ctx, lp_servicename(talloc_tos(), snum),
                        get_current_username(), lp_path(talloc_tos(), snum),
                        p->session_info->unix_token->uid, get_current_username(),
@@ -253,7 +253,7 @@ static void init_srv_share_info_2(struct pipes_struct *p,
 
        remark = lp_comment(p->mem_ctx, snum);
        if (remark) {
-               remark = talloc_sub_advanced(
+               remark = talloc_sub_full(
                        p->mem_ctx, lp_servicename(talloc_tos(), snum),
                        get_current_username(), lp_path(talloc_tos(), snum),
                        p->session_info->unix_token->uid, get_current_username(),
@@ -318,7 +318,7 @@ static void init_srv_share_info_501(struct pipes_struct *p,
        char *remark = lp_comment(p->mem_ctx, snum);
 
        if (remark) {
-               remark = talloc_sub_advanced(
+               remark = talloc_sub_full(
                        p->mem_ctx, lp_servicename(talloc_tos(), snum),
                        get_current_username(), lp_path(talloc_tos(), snum),
                        p->session_info->unix_token->uid, get_current_username(),
@@ -352,7 +352,7 @@ static void init_srv_share_info_502(struct pipes_struct *p,
        char *remark = lp_comment(ctx, snum);
 
        if (remark) {
-               remark = talloc_sub_advanced(
+               remark = talloc_sub_full(
                        p->mem_ctx, lp_servicename(talloc_tos(), snum),
                        get_current_username(), lp_path(talloc_tos(), snum),
                        p->session_info->unix_token->uid, get_current_username(),
@@ -393,7 +393,7 @@ static void init_srv_share_info_1004(struct pipes_struct *p,
        char *remark = lp_comment(p->mem_ctx, snum);
 
        if (remark) {
-               remark = talloc_sub_advanced(
+               remark = talloc_sub_full(
                        p->mem_ctx, lp_servicename(talloc_tos(), snum),
                        get_current_username(), lp_path(talloc_tos(), snum),
                        p->session_info->unix_token->uid, get_current_username(),
index 50451b2778dc8cf457bfe7f325613c0b0021c3f5..ee6e9a481e27dddb9fd915e7fe63bebe6c8a4478 100644 (file)
@@ -115,7 +115,7 @@ static int CopyExpanded(connection_struct *conn,
                *p_space_remaining = 0;
                return 0;
        }
-       buf = talloc_sub_advanced(ctx,
+       buf = talloc_sub_full(ctx,
                                  lp_servicename(ctx, SNUM(conn)),
                                conn->session_info->unix_info->unix_name,
                                conn->connectpath,
@@ -166,7 +166,7 @@ static int StrlenExpanded(connection_struct *conn, int snum, char *s)
        if (!buf) {
                return 0;
        }
-       buf = talloc_sub_advanced(ctx,
+       buf = talloc_sub_full(ctx,
                                  lp_servicename(ctx, SNUM(conn)),
                                conn->session_info->unix_info->unix_name,
                                conn->connectpath,
index 7e252a459b3a6fc0e527e748596aba2d3bc33bcd..1a708fc622c622f365be397ec9c1b18a850a8c9c 100644 (file)
@@ -611,7 +611,7 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
        conn->vuid = vuser->vuid;
 
        {
-               char *s = talloc_sub_advanced(talloc_tos(),
+               char *s = talloc_sub_full(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
                                        conn->connectpath,
@@ -727,7 +727,7 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
         * to below */
        /* execute any "root preexec = " line */
        if (*lp_root_preexec(talloc_tos(), snum)) {
-               char *cmd = talloc_sub_advanced(talloc_tos(),
+               char *cmd = talloc_sub_full(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
                                        conn->connectpath,
@@ -765,7 +765,7 @@ static NTSTATUS make_connection_snum(struct smbXsrv_connection *xconn,
 
        /* execute any "preexec = " line */
        if (*lp_preexec(talloc_tos(), snum)) {
-               char *cmd = talloc_sub_advanced(talloc_tos(),
+               char *cmd = talloc_sub_full(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
                                        conn->connectpath,
@@ -1163,7 +1163,7 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
        /* execute any "postexec = " line */
        if (*lp_postexec(talloc_tos(), SNUM(conn)) &&
            change_to_user_and_service(conn, vuid))  {
-               char *cmd = talloc_sub_advanced(talloc_tos(),
+               char *cmd = talloc_sub_full(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
                                        conn->connectpath,
@@ -1179,7 +1179,7 @@ void close_cnum(connection_struct *conn, uint64_t vuid)
        change_to_root_user();
        /* execute any "root postexec = " line */
        if (*lp_root_postexec(talloc_tos(), SNUM(conn)))  {
-               char *cmd = talloc_sub_advanced(talloc_tos(),
+               char *cmd = talloc_sub_full(talloc_tos(),
                                        lp_const_servicename(SNUM(conn)),
                                        conn->session_info->unix_info->unix_name,
                                        conn->connectpath,