The branch, master has been updated
       via  ac78cb71d69 libads: Save intermediate NULL checks with 
talloc_asprintf_addbuf()
       via  300ad4ff127 lib: Save intermediate NULL checks with 
talloc_asprintf_addbuf()
       via  4156d37db17 winbind: Save lines with talloc_asprintf_addbuf()
       via  f25b6de771d winbind: Save an intermediate NULL check with 
talloc_asprintf_addbuf()
       via  fa8a657b91c auth4: Save lines with talloc_asprintf_addbuf() in 
authsam_domain_group_filter()
       via  6b6f8debb5d libcldap: Save lines in cldap_netlogon_create_filter() 
with talloc_asprintf_addbuf()
       via  c86112fe90b dns_server: Use talloc_asprintf_addbuf() in b9_format()
       via  cbcf7f0d21b lib: Use talloc_asprintf_addbuf() in rdn_name_add()
       via  ffba59b5c0b lib: Use talloc_asprintf_addbuf() in 
ldb_module_call_chain()
       via  fe8895c83c5 lib: Use talloc_asprintf_addbuf() in 
print_socket_options()
       via  bcdbe6ef6b5 lib: Use talloc_asprintf_addbuf() in 
ldif_write_prefixMap()
       via  c692b5c95bd lib: Use talloc_asprintf_addbuf() in 
str_list_join_shell()
       via  2c7766c28f2 lib: Use talloc_asprintf_addbuf() in str_list_join()
       via  101396ab765 lib: Use talloc_asprintf_addbuf() in debug.c
       via  ccb5bafe93e lib: Move talloc_asprintf_addbuf() to talloc
       via  7870e82cb44 lib: Fix whitespace
      from  5955dc1e4fd smbd: set long process name of smbd child processes to 
"smbd: <CLIENT IP>"

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ac78cb71d69d0307a668311e94e7181db6ad840e
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Nov 30 14:48:33 2022 +0100

    libads: Save intermediate NULL checks with talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>
    
    Autobuild-User(master): Jeremy Allison <j...@samba.org>
    Autobuild-Date(master): Wed Dec 14 05:29:51 UTC 2022 on sn-devel-184

commit 300ad4ff1273b8656986e4e7853418c9238122ca
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Nov 30 14:44:13 2022 +0100

    lib: Save intermediate NULL checks with talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 4156d37db177b3b047fc0a448912d9bcb9354994
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Nov 30 14:28:54 2022 +0100

    winbind: Save lines with talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit f25b6de771df587e58a28ae417bb5a2f596ec5a2
Author: Volker Lendecke <v...@samba.org>
Date:   Wed Nov 30 14:23:26 2022 +0100

    winbind: Save an intermediate NULL check with talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit fa8a657b91c123849eb40f74dbce6974ec04338b
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Nov 29 10:48:25 2022 +0100

    auth4: Save lines with talloc_asprintf_addbuf() in 
authsam_domain_group_filter()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 6b6f8debb5dedf1520a7bedfa0277849f70683dd
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Nov 29 10:46:42 2022 +0100

    libcldap: Save lines in cldap_netlogon_create_filter() with 
talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit c86112fe90b6ebd2f4206c9c2f78b845543cb96e
Author: Volker Lendecke <v...@samba.org>
Date:   Tue Nov 29 10:37:03 2022 +0100

    dns_server: Use talloc_asprintf_addbuf() in b9_format()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit cbcf7f0d21b146b52bf472a3627b7ea8cd3d0b80
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 11:25:32 2022 +0100

    lib: Use talloc_asprintf_addbuf() in rdn_name_add()
    
    Add implicit NULL checks
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit ffba59b5c0b584d503f223dd5bcde84799b5d0c5
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 11:07:25 2022 +0100

    lib: Use talloc_asprintf_addbuf() in ldb_module_call_chain()
    
    This was exactly what talloc_asprintf_addbuf() does.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit fe8895c83c560f424edd35d9394414c2801127d2
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 11:01:16 2022 +0100

    lib: Use talloc_asprintf_addbuf() in print_socket_options()
    
    With the proper NULL checks we don't need the stackframe,
    use a passed in context instead.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit bcdbe6ef6b59ae3638f263fbd5ddf4107c3f52cf
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 10:58:46 2022 +0100

    lib: Use talloc_asprintf_addbuf() in ldif_write_prefixMap()
    
    The first call of talloc_asprintf_append() did not have a NULL check.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit c692b5c95bdc0d96ab7797a59b94addaa1c80d94
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 10:55:04 2022 +0100

    lib: Use talloc_asprintf_addbuf() in str_list_join_shell()
    
    This adds proper NULL checks via talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 2c7766c28f2801d0b103d6a5046098810a4f0bee
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 10:43:06 2022 +0100

    lib: Use talloc_asprintf_addbuf() in str_list_join()
    
    This adds intermediate NULL checks via talloc_asprintf_addbuf()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 101396ab765a5cad90b43165253c960b579a2f1d
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 10:38:50 2022 +0100

    lib: Use talloc_asprintf_addbuf() in debug.c
    
    Slightly simplify debug_list_class_names_and_levels()
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit ccb5bafe93eb431ba53569b5176317bcbdeae322
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 10:19:54 2022 +0100

    lib: Move talloc_asprintf_addbuf() to talloc
    
    I wanted to use this in debug.c, but this would have meant to pollute
    debug's deps with a lot of stuff. Also, looking through uses of
    talloc_asprint_append(), very many of those don't do NULL checks
    properly and could benefit from the _addbuf() flavor. We can add a
    vasprintf variant later if the need shows up.
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

commit 7870e82cb4405a983f106a119203f1e193cb2f12
Author: Volker Lendecke <v...@samba.org>
Date:   Mon Nov 28 08:35:57 2022 +0100

    lib: Fix whitespace
    
    Signed-off-by: Volker Lendecke <v...@samba.org>
    Reviewed-by: Jeremy Allison <j...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/ldb-samba/ldif_handlers.c                      | 69 +++++++++----------
 lib/ldb/common/ldb_dn.c                            | 14 ++--
 lib/ldb/common/ldb_modules.c                       |  9 +--
 lib/ldb/modules/rdn_name.c                         | 16 ++---
 ...oc-util-2.3.0.sigs => pytalloc-util-2.3.5.sigs} |  0
 .../ABI/{talloc-2.1.11.sigs => talloc-2.3.5.sigs}  |  1 +
 lib/talloc/talloc.c                                | 23 +++++++
 lib/talloc/talloc.h                                | 14 ++++
 lib/talloc/wscript                                 |  2 +-
 lib/util/debug.c                                   | 15 ++--
 lib/util/samba_util.h                              | 14 ----
 lib/util/util_net.c                                | 19 ++----
 lib/util/util_str.c                                | 23 -------
 lib/util/util_strlist.c                            | 55 +++++++--------
 libcli/cldap/cldap.c                               | 42 ++++--------
 source3/lib/substitute.c                           | 34 +++++-----
 source3/libads/ldap_schema.c                       | 79 ++++++++++------------
 source3/winbindd/idmap_ad.c                        | 11 +--
 source3/winbindd/winbindd_misc.c                   |  4 +-
 source3/winbindd/winbindd_wins_byname.c            | 11 ++-
 source4/auth/sam.c                                 | 18 ++---
 source4/dns_server/dlz_bind9.c                     |  2 +-
 22 files changed, 208 insertions(+), 267 deletions(-)
 copy lib/talloc/ABI/{pytalloc-util-2.3.0.sigs => pytalloc-util-2.3.5.sigs} 
(100%)
 copy lib/talloc/ABI/{talloc-2.1.11.sigs => talloc-2.3.5.sigs} (98%)


Changeset truncated at 500 lines:

diff --git a/lib/ldb-samba/ldif_handlers.c b/lib/ldb-samba/ldif_handlers.c
index 78a433748bb..b8f04747456 100644
--- a/lib/ldb-samba/ldif_handlers.c
+++ b/lib/ldb-samba/ldif_handlers.c
@@ -1,4 +1,4 @@
-/* 
+/*
    ldb database library - ldif handlers for Samba
 
    Copyright (C) Andrew Tridgell 2005
@@ -7,7 +7,7 @@
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
      ** under the LGPL
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -59,7 +59,7 @@ static int ldif_write_NDR(struct ldb_context *ldb, void 
*mem_ctx,
                return ldb_handler_copy(ldb, mem_ctx, in, out);
        }
        p = talloc_size(mem_ctx, struct_size);
-       err = ndr_pull_struct_blob(in, mem_ctx, 
+       err = ndr_pull_struct_blob(in, mem_ctx,
                                   p, pull_fn);
        if (err != NDR_ERR_SUCCESS) {
                /* fail in not in mask_error mode */
@@ -74,7 +74,7 @@ static int ldif_write_NDR(struct ldb_context *ldb, void 
*mem_ctx,
        out->data = (uint8_t *)ndr_print_struct_string(mem_ctx, print_fn, 
"NDR", p);
        talloc_free(p);
        if (out->data == NULL) {
-               return ldb_handler_copy(ldb, mem_ctx, in, out);         
+               return ldb_handler_copy(ldb, mem_ctx, in, out);
        }
        out->length = strlen((char *)out->data);
        return 0;
@@ -95,18 +95,18 @@ static int ldif_read_objectSid(struct ldb_context *ldb, 
void *mem_ctx,
                char p[in->length+1];
                memcpy(p, in->data, in->length);
                p[in->length] = '\0';
-               
+
                ret = dom_sid_parse(p, &sid);
                if (ret == false) {
                        return -1;
                }
-               
+
                *out = data_blob_talloc(mem_ctx, NULL,
                                        ndr_size_dom_sid(&sid, 0));
                if (out->data == NULL) {
                        return -1;
                }
-       
+
                ndr_err = ndr_push_struct_into_fixed_blob(out, &sid,
                                (ndr_push_flags_fn_t)ndr_push_dom_sid);
                if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -144,7 +144,7 @@ bool ldif_comparision_objectSid_isString(const struct 
ldb_val *v)
        }
 
        if (strncmp("S-", (const char *)v->data, 2) != 0) return false;
-       
+
        return true;
 }
 
@@ -208,7 +208,7 @@ static int extended_dn_read_SID(struct ldb_context *ldb, 
void *mem_ctx,
                        return 0;
                }
        }
-       
+
        /* Perhaps not a string after all */
        *out = data_blob_talloc(mem_ctx, NULL, in->length/2+1);
 
@@ -290,13 +290,13 @@ static int extended_dn_read_GUID(struct ldb_context *ldb, 
void *mem_ctx,
        if (in->length != 32) {
                return -1;
        }
-               
+
        *out = data_blob_talloc(mem_ctx, NULL, in->length/2+1);
-       
+
        if (!out->data) {
                return -1;
        }
-       
+
        (*out).length = strhex_to_str((char *)out->data, out->length,
                                      (const char *)in->data, in->length);
 
@@ -407,12 +407,12 @@ static int ldif_write_ntSecurityDescriptor(struct 
ldb_context *ldb, void *mem_ct
        enum ndr_err_code ndr_err;
 
        if (ldb_get_flags(ldb) & LDB_FLG_SHOW_BINARY) {
-               return ldif_write_NDR(ldb, mem_ctx, in, out, 
+               return ldif_write_NDR(ldb, mem_ctx, in, out,
                                      sizeof(struct security_descriptor),
                                      
(ndr_pull_flags_fn_t)ndr_pull_security_descriptor,
                                      
(ndr_print_fn_t)ndr_print_security_descriptor,
                                      true);
-                                     
+
        }
 
        sd = talloc(mem_ctx, struct security_descriptor);
@@ -457,7 +457,7 @@ static int ldif_write_sddlSecurityDescriptor(struct 
ldb_context *ldb, void *mem_
        return ldb_handler_copy(ldb, mem_ctx, in, out);
 }
 
-/* 
+/*
    canonicalise an objectCategory.  We use the long form as the canonical form:
    'person' becomes cn=Person,cn=Schema,cn=Configuration,<basedn>
 
@@ -588,7 +588,7 @@ static int ldif_read_prefixMap(struct ldb_context *ldb, 
void *mem_ctx,
 
        /* If this does not parse, then it is probably the text version, and we 
should try it that way */
        blob->version = PREFIX_MAP_VERSION_DSDB;
-       
+
        string = talloc_strndup(mem_ctx, (const char *)in->data, in->length);
        if (string == NULL) {
                talloc_free(blob);
@@ -612,9 +612,9 @@ static int ldif_read_prefixMap(struct ldb_context *ldb, 
void *mem_ctx,
                if (line == p) {
                        break;
                }
-               
-               blob->ctr.dsdb.mappings = talloc_realloc(blob, 
-                                                        
blob->ctr.dsdb.mappings, 
+
+               blob->ctr.dsdb.mappings = talloc_realloc(blob,
+                                                        
blob->ctr.dsdb.mappings,
                                                         struct 
drsuapi_DsReplicaOIDMapping,
                                                         
blob->ctr.dsdb.num_mappings+1);
                if (!blob->ctr.dsdb.mappings) {
@@ -650,7 +650,7 @@ static int ldif_read_prefixMap(struct ldb_context *ldb, 
void *mem_ctx,
                }
        }
 
-       ndr_err = ndr_push_struct_blob(out, mem_ctx, 
+       ndr_err = ndr_push_struct_blob(out, mem_ctx,
                                       blob,
                                       
(ndr_push_flags_fn_t)ndr_push_prefixMapBlob);
        talloc_free(tmp_ctx);
@@ -694,7 +694,7 @@ static int ldif_write_prefixMap(struct ldb_context *ldb, 
void *mem_ctx,
        if (blob == NULL) {
                return -1;
        }
-       ndr_err = ndr_pull_struct_blob_all(in, blob, 
+       ndr_err = ndr_pull_struct_blob_all(in, blob,
                                           blob,
                                           
(ndr_pull_flags_fn_t)ndr_pull_prefixMapBlob);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -713,7 +713,7 @@ static int ldif_write_prefixMap(struct ldb_context *ldb, 
void *mem_ctx,
                char *partial_oid = NULL;
 
                if (i > 0) {
-                       string = talloc_asprintf_append(string, ";"); 
+                       talloc_asprintf_addbuf(&string, ";");
                }
 
                oid_blob = 
data_blob_const(blob->ctr.dsdb.mappings[i].oid.binary_oid,
@@ -723,13 +723,10 @@ static int ldif_write_prefixMap(struct ldb_context *ldb, 
void *mem_ctx,
                                  blob->ctr.dsdb.mappings[i].id_prefix));
                        goto failed;
                }
-               string = talloc_asprintf_append(string, "%u:%s", 
-                                                  
blob->ctr.dsdb.mappings[i].id_prefix,
-                                                  partial_oid);
+               talloc_asprintf_addbuf(&string, "%u:%s",
+                                      blob->ctr.dsdb.mappings[i].id_prefix,
+                                      partial_oid);
                talloc_free(discard_const(partial_oid));
-               if (string == NULL) {
-                       goto failed;
-               }
        }
 
        talloc_free(blob);
@@ -750,7 +747,7 @@ static bool ldif_comparision_prefixMap_isString(const 
struct ldb_val *v)
        if (IVAL(v->data, 0) == PREFIX_MAP_VERSION_DSDB) {
                return false;
        }
-       
+
        return true;
 }
 
@@ -947,7 +944,7 @@ static int ldif_comparison_int64(struct ldb_context *ldb, 
void *mem_ctx,
 static int ldif_write_repsFromTo(struct ldb_context *ldb, void *mem_ctx,
                                 const struct ldb_val *in, struct ldb_val *out)
 {
-       return ldif_write_NDR(ldb, mem_ctx, in, out, 
+       return ldif_write_NDR(ldb, mem_ctx, in, out,
                              sizeof(struct repsFromToBlob),
                              (ndr_pull_flags_fn_t)ndr_pull_repsFromToBlob,
                              (ndr_print_fn_t)ndr_print_repsFromToBlob,
@@ -960,7 +957,7 @@ static int ldif_write_repsFromTo(struct ldb_context *ldb, 
void *mem_ctx,
 static int ldif_write_replPropertyMetaData(struct ldb_context *ldb, void 
*mem_ctx,
                                           const struct ldb_val *in, struct 
ldb_val *out)
 {
-       return ldif_write_NDR(ldb, mem_ctx, in, out, 
+       return ldif_write_NDR(ldb, mem_ctx, in, out,
                              sizeof(struct replPropertyMetaDataBlob),
                              
(ndr_pull_flags_fn_t)ndr_pull_replPropertyMetaDataBlob,
                              
(ndr_print_fn_t)ndr_print_replPropertyMetaDataBlob,
@@ -973,7 +970,7 @@ static int ldif_write_replPropertyMetaData(struct 
ldb_context *ldb, void *mem_ct
 static int ldif_write_replUpToDateVector(struct ldb_context *ldb, void 
*mem_ctx,
                                         const struct ldb_val *in, struct 
ldb_val *out)
 {
-       return ldif_write_NDR(ldb, mem_ctx, in, out, 
+       return ldif_write_NDR(ldb, mem_ctx, in, out,
                              sizeof(struct replUpToDateVectorBlob),
                              
(ndr_pull_flags_fn_t)ndr_pull_replUpToDateVectorBlob,
                              (ndr_print_fn_t)ndr_print_replUpToDateVectorBlob,
@@ -1314,7 +1311,7 @@ static int samba_syntax_operator_fn(struct ldb_context 
*ldb, enum ldb_parse_op o
 
 /*
   compare two binary objects.  This is correct for sorting as the sort order 
is:
-  
+
   a
   aa
   b
@@ -1326,7 +1323,7 @@ static int samba_syntax_operator_fn(struct ldb_context 
*ldb, enum ldb_parse_op o
   b
   aa
   bb
-  
+
 */
 static int samba_ldb_comparison_binary(struct ldb_context *ldb, void *mem_ctx,
                                       const struct ldb_val *v1, const struct 
ldb_val *v2)
@@ -1749,7 +1746,7 @@ const struct ldb_schema_syntax 
*ldb_samba_syntax_by_name(struct ldb_context *ldb
 {
        unsigned int j;
        const struct ldb_schema_syntax *s = NULL;
-       
+
        for (j=0; j < ARRAY_SIZE(samba_syntaxes); j++) {
                if (strcmp(name, samba_syntaxes[j].name) == 0) {
                        s = &samba_syntaxes[j];
@@ -1770,7 +1767,7 @@ const struct ldb_schema_syntax 
*ldb_samba_syntax_by_lDAPDisplayName(struct ldb_c
                        break;
                }
        }
-       
+
        return s;
 }
 
diff --git a/lib/ldb/common/ldb_dn.c b/lib/ldb/common/ldb_dn.c
index bba41d0b2c6..601da57a1b1 100644
--- a/lib/ldb/common/ldb_dn.c
+++ b/lib/ldb/common/ldb_dn.c
@@ -877,21 +877,17 @@ char *ldb_dn_get_extended_linearized(TALLOC_CTX *mem_ctx, 
struct ldb_dn *dn, int
                                            (int)val.length,
                                            val.data);
                } else {
-                       p = talloc_asprintf_append_buffer(p, ";<%s=%.*s>",
-                                                         name,
-                                                         (int)val.length,
-                                                         val.data);
+                       talloc_asprintf_addbuf(&p, ";<%s=%.*s>",
+                                              name,
+                                              (int)val.length,
+                                              val.data);
                }
 
                talloc_free(val.data);
-
-               if (!p) {
-                       return NULL;
-               }
        }
 
        if (dn->ext_comp_num && *linearized) {
-               p = talloc_asprintf_append_buffer(p, ";%s", linearized);
+               talloc_asprintf_addbuf(&p, ";%s", linearized);
        }
 
        if (!p) {
diff --git a/lib/ldb/common/ldb_modules.c b/lib/ldb/common/ldb_modules.c
index 2d0494a2123..53875ee216a 100644
--- a/lib/ldb/common/ldb_modules.c
+++ b/lib/ldb/common/ldb_modules.c
@@ -1193,13 +1193,8 @@ char *ldb_module_call_chain(struct ldb_request *req, 
TALLOC_CTX *mem_ctx)
        }
 
        while (req && req->handle) {
-               char *s = talloc_asprintf_append_buffer(ret, "req[%u] %p  : 
%s\n",
-                                                       i++, req, 
ldb_req_location(req));
-               if (s == NULL) {
-                       talloc_free(ret);
-                       return NULL;
-               }
-               ret = s;
+               talloc_asprintf_addbuf(&ret, "req[%u] %p  : %s\n",
+                                      i++, req, ldb_req_location(req));
                req = req->handle->parent;
        }
        return ret;
diff --git a/lib/ldb/modules/rdn_name.c b/lib/ldb/modules/rdn_name.c
index 3cb62bf567b..a49ce621c1b 100644
--- a/lib/ldb/modules/rdn_name.c
+++ b/lib/ldb/modules/rdn_name.c
@@ -1,4 +1,4 @@
-/* 
+/*
    ldb database library
 
    Copyright (C) Andrew Bartlett 2005-2009
@@ -7,7 +7,7 @@
      ** NOTE! The following LGPL license applies to the ldb
      ** library. This does NOT imply that all of Samba is released
      ** under the LGPL
-   
+
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
@@ -116,7 +116,7 @@ static int rdn_name_add(struct ldb_module *module, struct 
ldb_request *req)
        if (rdn_name == NULL) {
                return LDB_ERR_OPERATIONS_ERROR;
        }
-       
+
        rdn_val_p = ldb_dn_get_rdn_val(msg->dn);
        if (rdn_val_p == NULL) {
                return LDB_ERR_OPERATIONS_ERROR;
@@ -176,13 +176,13 @@ static int rdn_name_add(struct ldb_module *module, struct 
ldb_request *req)
                }
                if (i == attribute->num_values) {
                        char *rdn_errstring = talloc_asprintf(ac,
-                               "RDN mismatch on %s: %s (%.*s) should match one 
of:", 
-                               ldb_dn_get_linearized(msg->dn), rdn_name, 
+                               "RDN mismatch on %s: %s (%.*s) should match one 
of:",
+                               ldb_dn_get_linearized(msg->dn), rdn_name,
                                (int)rdn_val.length, (const char 
*)rdn_val.data);
                        for (i = 0; i < attribute->num_values; i++) {
-                               rdn_errstring = talloc_asprintf_append(
-                                       rdn_errstring, " (%.*s)",
-                                       (int)attribute->values[i].length, 
+                               talloc_asprintf_addbuf(
+                                       &rdn_errstring, " (%.*s)",
+                                       (int)attribute->values[i].length,
                                        (const char 
*)attribute->values[i].data);
                        }
                        ldb_set_errstring(ldb, rdn_errstring);
diff --git a/lib/talloc/ABI/pytalloc-util-2.3.0.sigs 
b/lib/talloc/ABI/pytalloc-util-2.3.5.sigs
similarity index 100%
copy from lib/talloc/ABI/pytalloc-util-2.3.0.sigs
copy to lib/talloc/ABI/pytalloc-util-2.3.5.sigs
diff --git a/lib/talloc/ABI/talloc-2.1.11.sigs 
b/lib/talloc/ABI/talloc-2.3.5.sigs
similarity index 98%
copy from lib/talloc/ABI/talloc-2.1.11.sigs
copy to lib/talloc/ABI/talloc-2.3.5.sigs
index 9969ce33389..ec3cee44d8f 100644
--- a/lib/talloc/ABI/talloc-2.1.11.sigs
+++ b/lib/talloc/ABI/talloc-2.3.5.sigs
@@ -13,6 +13,7 @@ _talloc_steal_loc: void *(const void *, const void *, const 
char *)
 _talloc_zero: void *(const void *, size_t, const char *)
 _talloc_zero_array: void *(const void *, size_t, unsigned int, const char *)
 talloc_asprintf: char *(const void *, const char *, ...)
+talloc_asprintf_addbuf: void (char **, const char *, ...)
 talloc_asprintf_append: char *(char *, const char *, ...)
 talloc_asprintf_append_buffer: char *(char *, const char *, ...)
 talloc_autofree_context: void *(void)
diff --git a/lib/talloc/talloc.c b/lib/talloc/talloc.c
index 29da190880a..0189fa03be0 100644
--- a/lib/talloc/talloc.c
+++ b/lib/talloc/talloc.c
@@ -2752,6 +2752,29 @@ _PUBLIC_ char *talloc_asprintf_append_buffer(char *s, 
const char *fmt, ...)
        return s;
 }
 
+_PUBLIC_ void talloc_asprintf_addbuf(char **ps, const char *fmt, ...)
+{
+       va_list ap;
+       char *s = *ps;
+       char *t = NULL;
+
+       if (s == NULL) {
+               return;
+       }
+
+       va_start(ap, fmt);
+       t = talloc_vasprintf_append_buffer(s, fmt, ap);
+       va_end(ap);
+
+       if (t == NULL) {
+               /* signal failure to the next caller */
+               TALLOC_FREE(s);
+               *ps = NULL;
+       } else {
+               *ps = t;
+       }
+}
+
 /*
   alloc an array, checking for integer overflow in the array size
 */
diff --git a/lib/talloc/talloc.h b/lib/talloc/talloc.h
index 06e81d7c999..dba9a3e9db9 100644
--- a/lib/talloc/talloc.h
+++ b/lib/talloc/talloc.h
@@ -1578,6 +1578,20 @@ _PUBLIC_ char *talloc_vasprintf_append(char *s, const 
char *fmt, va_list ap) PRI
  */
 _PUBLIC_ char *talloc_vasprintf_append_buffer(char *s, const char *fmt, 
va_list ap) PRINTF_ATTRIBUTE(2,0);
 
+/**
+ * @brief Build up a string buffer, handle allocation failure
+ *
+ * @param[in] ps Pointer to the talloc'ed string to be extended
+ * @param[in] fmt The format string
+ * @param[in] ... The parameters used to fill fmt.
+ *
+ * This does nothing if *ps is NULL and sets *ps to NULL if the
+ * intermediate reallocation fails. Useful when building up a string
+ * step by step, no intermediate NULL checks are required.
+ */
+_PUBLIC_ void talloc_asprintf_addbuf(char **ps, const char *fmt, ...) \
+       PRINTF_ATTRIBUTE(2,3);
+
 /**
  * @brief Format a string.
  *
diff --git a/lib/talloc/wscript b/lib/talloc/wscript
index 30896636404..5a9779cf2d8 100644
--- a/lib/talloc/wscript
+++ b/lib/talloc/wscript
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 APPNAME = 'talloc'
-VERSION = '2.3.4'
+VERSION = '2.3.5'
 
 import os
 import sys
diff --git a/lib/util/debug.c b/lib/util/debug.c
index 24d8281d27f..517157ef6a8 100644
--- a/lib/util/debug.c
+++ b/lib/util/debug.c
@@ -795,18 +795,15 @@ utility lists registered debug class names's
 
 char *debug_list_class_names_and_levels(void)
 {
-       char *buf = NULL;
+       char *buf = talloc_strdup(NULL, "");
        size_t i;
        /* prepare strings */
        for (i = 0; i < debug_num_classes; i++) {
-               buf = talloc_asprintf_append(buf,
-                                            "%s:%d%s",
-                                            classname_table[i],
-                                            dbgc_config[i].loglevel,
-                                            i == (debug_num_classes - 1) ? 
"\n" : " ");
-               if (buf == NULL) {
-                       return NULL;
-               }
+               talloc_asprintf_addbuf(&buf,
+                                      "%s:%d%s",
+                                      classname_table[i],
+                                      dbgc_config[i].loglevel,
+                                      i == (debug_num_classes - 1) ? "\n" : " 
");
        }
        return buf;
 }
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index 4762a7c523f..d8c8522616d 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -327,20 +327,6 @@ _PUBLIC_ bool conv_str_u64(const char * str, uint64_t * 
val);
  */
 _PUBLIC_ bool mem_equal_const_time(const void *s1, const void *s2, size_t n);
 
-/**
- * @brief Build up a string buffer, handle allocation failure
- *
- * @param[in] ps Pointer to the talloc'ed string to be extended
- * @param[in] fmt The format string
- * @param[in] ... The parameters used to fill fmt.
- *
- * This does nothing if *ps is NULL and sets *ps to NULL if the
- * intermediate reallocation fails. Useful when building up a string
- * step by step, no intermediate NULL checks are required.
- */
-
-_PUBLIC_ void talloc_asprintf_addbuf(char **ps, const char *fmt, ...) 
PRINTF_ATTRIBUTE(2,3);
-
 /**
 Do a case-insensitive, whitespace-ignoring string compare.
 **/
diff --git a/lib/util/util_net.c b/lib/util/util_net.c


-- 
Samba Shared Repository

Reply via email to