1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

r25175: Change to talloc_asprintf_append_buffer().

Jeremy.
(This used to be commit 0844dbf597)
This commit is contained in:
Jeremy Allison 2007-09-14 23:21:00 +00:00 committed by Gerald (Jerry) Carter
parent 6f37a17d4a
commit 9a012df08e
22 changed files with 62 additions and 62 deletions

View File

@ -507,7 +507,7 @@ static void do_list_helper(struct clilist_file_info *f, const char *mask, void *
p = strrchr_m(mask2,'\\'); p = strrchr_m(mask2,'\\');
if (!p) return; if (!p) return;
p[1] = 0; p[1] = 0;
mask2 = talloc_asprintf_append(mask2, "%s\\*", f->name); mask2 = talloc_asprintf_append_buffer(mask2, "%s\\*", f->name);
add_to_do_list_queue(mask2); add_to_do_list_queue(mask2);
} }
return; return;
@ -861,7 +861,7 @@ static void do_mget(struct smbclient_context *ctx, struct clilist_file_info *fin
/* handle directories */ /* handle directories */
saved_curdir = talloc_strdup(NULL, ctx->remote_cur_dir); saved_curdir = talloc_strdup(NULL, ctx->remote_cur_dir);
ctx->remote_cur_dir = talloc_asprintf_append(NULL, "%s\\", finfo->name); ctx->remote_cur_dir = talloc_asprintf_append_buffer(NULL, "%s\\", finfo->name);
string_replace(discard_const_p(char, finfo->name), '\\', '/'); string_replace(discard_const_p(char, finfo->name), '\\', '/');
if (ctx->lowercase) { if (ctx->lowercase) {

View File

@ -419,15 +419,15 @@ static bool test_misc(void)
p2 = talloc_strndup(p1, "foo", 2); p2 = talloc_strndup(p1, "foo", 2);
torture_assert("misc", strcmp("fo", p2) == 0, torture_assert("misc", strcmp("fo", p2) == 0,
"strndup doesn't work\n"); "strndup doesn't work\n");
p2 = talloc_asprintf_append(p2, "o%c", 'd'); p2 = talloc_asprintf_append_buffer(p2, "o%c", 'd');
torture_assert("misc", strcmp("food", p2) == 0, torture_assert("misc", strcmp("food", p2) == 0,
"talloc_asprintf_append doesn't work\n"); "talloc_asprintf_append_buffer doesn't work\n");
CHECK_BLOCKS("misc", p2, 1); CHECK_BLOCKS("misc", p2, 1);
CHECK_BLOCKS("misc", p1, 3); CHECK_BLOCKS("misc", p1, 3);
p2 = talloc_asprintf_append(NULL, "hello %s", "world"); p2 = talloc_asprintf_append_buffer(NULL, "hello %s", "world");
torture_assert("misc", strcmp("hello world", p2) == 0, torture_assert("misc", strcmp("hello world", p2) == 0,
"talloc_asprintf_append doesn't work\n"); "talloc_asprintf_append_buffer doesn't work\n");
CHECK_BLOCKS("misc", p2, 1); CHECK_BLOCKS("misc", p2, 1);
CHECK_BLOCKS("misc", p1, 3); CHECK_BLOCKS("misc", p1, 3);
talloc_free(p2); talloc_free(p2);

View File

@ -151,7 +151,7 @@ _PUBLIC_ char *str_list_join(TALLOC_CTX *mem_ctx, const char **list, char sepera
ret = talloc_strdup(mem_ctx, list[0]); ret = talloc_strdup(mem_ctx, list[0]);
for (i = 1; list[i]; i++) { for (i = 1; list[i]; i++) {
ret = talloc_asprintf_append(ret, "%c%s", seperator, list[i]); ret = talloc_asprintf_append_buffer(ret, "%c%s", seperator, list[i]);
} }
return ret; return ret;
@ -174,9 +174,9 @@ _PUBLIC_ char *str_list_join_shell(TALLOC_CTX *mem_ctx, const char **list, char
for (i = 1; list[i]; i++) { for (i = 1; list[i]; i++) {
if (strchr(list[i], ' ') || strlen(list[i]) == 0) if (strchr(list[i], ' ') || strlen(list[i]) == 0)
ret = talloc_asprintf_append(ret, "%c\"%s\"", sep, list[i]); ret = talloc_asprintf_append_buffer(ret, "%c\"%s\"", sep, list[i]);
else else
ret = talloc_asprintf_append(ret, "%c%s", sep, list[i]); ret = talloc_asprintf_append_buffer(ret, "%c%s", sep, list[i]);
} }
return ret; return ret;

View File

@ -536,26 +536,26 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
ldap_encode_ndr_uint32(tmp_ctx, io->in.version)); ldap_encode_ndr_uint32(tmp_ctx, io->in.version));
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
if (io->in.user) { if (io->in.user) {
filter = talloc_asprintf_append(filter, "(User=%s)", io->in.user); filter = talloc_asprintf_append_buffer(filter, "(User=%s)", io->in.user);
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
} }
if (io->in.host) { if (io->in.host) {
filter = talloc_asprintf_append(filter, "(Host=%s)", io->in.host); filter = talloc_asprintf_append_buffer(filter, "(Host=%s)", io->in.host);
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
} }
if (io->in.realm) { if (io->in.realm) {
filter = talloc_asprintf_append(filter, "(DnsDomain=%s)", io->in.realm); filter = talloc_asprintf_append_buffer(filter, "(DnsDomain=%s)", io->in.realm);
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
} }
if (io->in.acct_control != -1) { if (io->in.acct_control != -1) {
filter = talloc_asprintf_append(filter, "(AAC=%s)", filter = talloc_asprintf_append_buffer(filter, "(AAC=%s)",
ldap_encode_ndr_uint32(tmp_ctx, io->in.acct_control)); ldap_encode_ndr_uint32(tmp_ctx, io->in.acct_control));
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
} }
if (io->in.domain_sid) { if (io->in.domain_sid) {
struct dom_sid *sid = dom_sid_parse_talloc(tmp_ctx, io->in.domain_sid); struct dom_sid *sid = dom_sid_parse_talloc(tmp_ctx, io->in.domain_sid);
if (sid == NULL) goto failed; if (sid == NULL) goto failed;
filter = talloc_asprintf_append(filter, "(domainSid=%s)", filter = talloc_asprintf_append_buffer(filter, "(domainSid=%s)",
ldap_encode_ndr_dom_sid(tmp_ctx, sid)); ldap_encode_ndr_dom_sid(tmp_ctx, sid));
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
} }
@ -564,11 +564,11 @@ struct cldap_request *cldap_netlogon_send(struct cldap_socket *cldap,
NTSTATUS status; NTSTATUS status;
status = GUID_from_string(io->in.domain_guid, &guid); status = GUID_from_string(io->in.domain_guid, &guid);
if (!NT_STATUS_IS_OK(status)) goto failed; if (!NT_STATUS_IS_OK(status)) goto failed;
filter = talloc_asprintf_append(filter, "(DomainGuid=%s)", filter = talloc_asprintf_append_buffer(filter, "(DomainGuid=%s)",
ldap_encode_ndr_GUID(tmp_ctx, &guid)); ldap_encode_ndr_GUID(tmp_ctx, &guid));
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
} }
filter = talloc_asprintf_append(filter, ")"); filter = talloc_asprintf_append_buffer(filter, ")");
if (filter == NULL) goto failed; if (filter == NULL) goto failed;
search.in.dest_address = io->in.dest_address; search.in.dest_address = io->in.dest_address;

View File

@ -111,7 +111,7 @@ _PUBLIC_ NTSTATUS ndr_pull_nbt_string(struct ndr_pull *ndr, int ndr_flags, const
NT_STATUS_NOT_OK_RETURN(status); NT_STATUS_NOT_OK_RETURN(status);
if (component == NULL) break; if (component == NULL) break;
if (name) { if (name) {
name = talloc_asprintf_append(name, ".%s", component); name = talloc_asprintf_append_buffer(name, ".%s", component);
NT_STATUS_HAVE_NO_MEMORY(name); NT_STATUS_HAVE_NO_MEMORY(name);
} else { } else {
name = (char *)component; name = (char *)component;

View File

@ -405,7 +405,7 @@ static char *sddl_flags_to_string(TALLOC_CTX *mem_ctx, const struct flag_map *ma
/* now by bits */ /* now by bits */
for (i=0;map[i].name;i++) { for (i=0;map[i].name;i++) {
if ((flags & map[i].flag) != 0) { if ((flags & map[i].flag) != 0) {
s = talloc_asprintf_append(s, "%s", map[i].name); s = talloc_asprintf_append_buffer(s, "%s", map[i].name);
if (s == NULL) goto failed; if (s == NULL) goto failed;
flags &= ~map[i].flag; flags &= ~map[i].flag;
} }
@ -532,7 +532,7 @@ static char *sddl_encode_acl(TALLOC_CTX *mem_ctx, const struct security_acl *acl
for (i=0;i<acl->num_aces;i++) { for (i=0;i<acl->num_aces;i++) {
char *ace = sddl_encode_ace(sddl, &acl->aces[i], domain_sid); char *ace = sddl_encode_ace(sddl, &acl->aces[i], domain_sid);
if (ace == NULL) goto failed; if (ace == NULL) goto failed;
sddl = talloc_asprintf_append(sddl, "(%s)", ace); sddl = talloc_asprintf_append_buffer(sddl, "(%s)", ace);
if (sddl == NULL) goto failed; if (sddl == NULL) goto failed;
talloc_free(ace); talloc_free(ace);
} }
@ -563,28 +563,28 @@ char *sddl_encode(TALLOC_CTX *mem_ctx, const struct security_descriptor *sd,
if (sd->owner_sid != NULL) { if (sd->owner_sid != NULL) {
char *sid = sddl_encode_sid(tmp_ctx, sd->owner_sid, domain_sid); char *sid = sddl_encode_sid(tmp_ctx, sd->owner_sid, domain_sid);
if (sid == NULL) goto failed; if (sid == NULL) goto failed;
sddl = talloc_asprintf_append(sddl, "O:%s", sid); sddl = talloc_asprintf_append_buffer(sddl, "O:%s", sid);
if (sddl == NULL) goto failed; if (sddl == NULL) goto failed;
} }
if (sd->group_sid != NULL) { if (sd->group_sid != NULL) {
char *sid = sddl_encode_sid(tmp_ctx, sd->group_sid, domain_sid); char *sid = sddl_encode_sid(tmp_ctx, sd->group_sid, domain_sid);
if (sid == NULL) goto failed; if (sid == NULL) goto failed;
sddl = talloc_asprintf_append(sddl, "G:%s", sid); sddl = talloc_asprintf_append_buffer(sddl, "G:%s", sid);
if (sddl == NULL) goto failed; if (sddl == NULL) goto failed;
} }
if ((sd->type & SEC_DESC_DACL_PRESENT) && sd->dacl != NULL) { if ((sd->type & SEC_DESC_DACL_PRESENT) && sd->dacl != NULL) {
char *acl = sddl_encode_acl(tmp_ctx, sd->dacl, sd->type, domain_sid); char *acl = sddl_encode_acl(tmp_ctx, sd->dacl, sd->type, domain_sid);
if (acl == NULL) goto failed; if (acl == NULL) goto failed;
sddl = talloc_asprintf_append(sddl, "D:%s", acl); sddl = talloc_asprintf_append_buffer(sddl, "D:%s", acl);
if (sddl == NULL) goto failed; if (sddl == NULL) goto failed;
} }
if ((sd->type & SEC_DESC_SACL_PRESENT) && sd->sacl != NULL) { if ((sd->type & SEC_DESC_SACL_PRESENT) && sd->sacl != NULL) {
char *acl = sddl_encode_acl(tmp_ctx, sd->sacl, sd->type>>1, domain_sid); char *acl = sddl_encode_acl(tmp_ctx, sd->sacl, sd->type>>1, domain_sid);
if (acl == NULL) goto failed; if (acl == NULL) goto failed;
sddl = talloc_asprintf_append(sddl, "S:%s", acl); sddl = talloc_asprintf_append_buffer(sddl, "S:%s", acl);
if (sddl == NULL) goto failed; if (sddl == NULL) goto failed;
} }

View File

@ -514,13 +514,13 @@ BOOL ber_read_OID_String(TALLOC_CTX *mem_ctx, DATA_BLOB blob, const char **OID)
tmp_oid = talloc_asprintf(mem_ctx, "%u", b[0]/40); tmp_oid = talloc_asprintf(mem_ctx, "%u", b[0]/40);
if (!tmp_oid) goto nomem; if (!tmp_oid) goto nomem;
tmp_oid = talloc_asprintf_append(tmp_oid, ".%u", b[0]%40); tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", b[0]%40);
if (!tmp_oid) goto nomem; if (!tmp_oid) goto nomem;
for(i = 1, v = 0; i < blob.length; i++) { for(i = 1, v = 0; i < blob.length; i++) {
v = (v<<7) | (b[i]&0x7f); v = (v<<7) | (b[i]&0x7f);
if ( ! (b[i] & 0x80)) { if ( ! (b[i] & 0x80)) {
tmp_oid = talloc_asprintf_append(tmp_oid, ".%u", v); tmp_oid = talloc_asprintf_append_buffer(tmp_oid, ".%u", v);
v = 0; v = 0;
} }
if (!tmp_oid) goto nomem; if (!tmp_oid) goto nomem;

View File

@ -2910,7 +2910,7 @@ struct composite_context *libnet_BecomeDC_send(struct libnet_context *ctx, TALLO
/* Destination DSA dns_name construction */ /* Destination DSA dns_name construction */
tmp_name = strlower_talloc(s, s->dest_dsa.netbios_name); tmp_name = strlower_talloc(s, s->dest_dsa.netbios_name);
if (composite_nomem(tmp_name, c)) return c; if (composite_nomem(tmp_name, c)) return c;
tmp_name = talloc_asprintf_append(tmp_name, ".%s",s->domain.dns_name); tmp_name = talloc_asprintf_append_buffer(tmp_name, ".%s",s->domain.dns_name);
if (composite_nomem(tmp_name, c)) return c; if (composite_nomem(tmp_name, c)) return c;
s->dest_dsa.dns_name = tmp_name; s->dest_dsa.dns_name = tmp_name;

View File

@ -698,7 +698,7 @@ struct composite_context *libnet_UnbecomeDC_send(struct libnet_context *ctx, TAL
/* Destination DSA dns_name construction */ /* Destination DSA dns_name construction */
tmp_name = strlower_talloc(s, s->dest_dsa.netbios_name); tmp_name = strlower_talloc(s, s->dest_dsa.netbios_name);
if (composite_nomem(tmp_name, c)) return c; if (composite_nomem(tmp_name, c)) return c;
s->dest_dsa.dns_name = talloc_asprintf_append(tmp_name, ".%s", s->dest_dsa.dns_name = talloc_asprintf_append_buffer(tmp_name, ".%s",
s->domain.dns_name); s->domain.dns_name);
if (composite_nomem(s->dest_dsa.dns_name, c)) return c; if (composite_nomem(s->dest_dsa.dns_name, c)) return c;

View File

@ -200,15 +200,15 @@ _PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format,
int i; int i;
for (i=0;i<ndr->depth;i++) { for (i=0;i<ndr->depth;i++) {
ndr->private_data = talloc_asprintf_append( ndr->private_data = talloc_asprintf_append_buffer(
(char *)ndr->private_data, " "); (char *)ndr->private_data, " ");
} }
va_start(ap, format); va_start(ap, format);
ndr->private_data = talloc_vasprintf_append((char *)ndr->private_data, ndr->private_data = talloc_vasprintf_append_buffer((char *)ndr->private_data,
format, ap); format, ap);
va_end(ap); va_end(ap);
ndr->private_data = talloc_asprintf_append((char *)ndr->private_data, ndr->private_data = talloc_asprintf_append_buffer((char *)ndr->private_data,
"\n"); "\n");
} }

View File

@ -255,42 +255,42 @@ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
} }
if (t_name != NULL) { if (t_name != NULL) {
s = talloc_asprintf_append(s, "%s:", t_name); s = talloc_asprintf_append_buffer(s, "%s:", t_name);
if (s == NULL) { if (s == NULL) {
return NULL; return NULL;
} }
} }
if (b->host) { if (b->host) {
s = talloc_asprintf_append(s, "%s", b->host); s = talloc_asprintf_append_buffer(s, "%s", b->host);
} }
if (!b->endpoint && !b->options && !b->flags) { if (!b->endpoint && !b->options && !b->flags) {
return s; return s;
} }
s = talloc_asprintf_append(s, "["); s = talloc_asprintf_append_buffer(s, "[");
if (b->endpoint) { if (b->endpoint) {
s = talloc_asprintf_append(s, "%s", b->endpoint); s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
} }
/* this is a *really* inefficent way of dealing with strings, /* this is a *really* inefficent way of dealing with strings,
but this is rarely called and the strings are always short, but this is rarely called and the strings are always short,
so I don't care */ so I don't care */
for (i=0;b->options && b->options[i];i++) { for (i=0;b->options && b->options[i];i++) {
s = talloc_asprintf_append(s, ",%s", b->options[i]); s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
if (!s) return NULL; if (!s) return NULL;
} }
for (i=0;i<ARRAY_SIZE(ncacn_options);i++) { for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
if (b->flags & ncacn_options[i].flag) { if (b->flags & ncacn_options[i].flag) {
s = talloc_asprintf_append(s, ",%s", ncacn_options[i].name); s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
if (!s) return NULL; if (!s) return NULL;
} }
} }
s = talloc_asprintf_append(s, "]"); s = talloc_asprintf_append_buffer(s, "]");
return s; return s;
} }

View File

@ -67,7 +67,7 @@ void wins_hook(struct winsdb_handle *h, const struct winsdb_record *rec,
if (!cmd) goto failed; if (!cmd) goto failed;
for (i=0; rec->addresses[i]; i++) { for (i=0; rec->addresses[i]; i++) {
cmd = talloc_asprintf_append(cmd, " %s", rec->addresses[i]->address); cmd = talloc_asprintf_append_buffer(cmd, " %s", rec->addresses[i]->address);
if (!cmd) goto failed; if (!cmd) goto failed;
} }

View File

@ -238,7 +238,7 @@ static int ejs_join(MprVarHandle eid, int argc, struct MprVar **argv)
goto failed; goto failed;
} }
for (i=1;list[i];i++) { for (i=1;list[i];i++) {
ret = talloc_asprintf_append(ret, "%s%s", separator, list[i]); ret = talloc_asprintf_append_buffer(ret, "%s%s", separator, list[i]);
if (ret == NULL) { if (ret == NULL) {
goto failed; goto failed;
} }
@ -275,7 +275,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
ret = talloc_strdup(tmp_ctx, ""); ret = talloc_strdup(tmp_ctx, "");
/* avoid all the format string warnings */ /* avoid all the format string warnings */
_asprintf_append = (_asprintf_append_t)talloc_asprintf_append; _asprintf_append = (_asprintf_append_t)talloc_asprintf_append_buffer;
/* /*
hackity hack ... hackity hack ...
@ -284,7 +284,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
char *fmt2; char *fmt2;
int len, len_count=0; int len, len_count=0;
char *tstr; char *tstr;
ret = talloc_asprintf_append(ret, "%*.*s", ret = talloc_asprintf_append_buffer(ret, "%*.*s",
(int)(p-format), (int)(p-format), (int)(p-format), (int)(p-format),
format); format);
if (ret == NULL) goto failed; if (ret == NULL) goto failed;
@ -299,7 +299,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
tstr--; tstr--;
} }
if (strcmp(tstr, "%") == 0) { if (strcmp(tstr, "%") == 0) {
ret = talloc_asprintf_append(ret, "%%"); ret = talloc_asprintf_append_buffer(ret, "%%");
if (ret == NULL) { if (ret == NULL) {
goto failed; goto failed;
} }
@ -372,7 +372,7 @@ static int ejs_sprintf(MprVarHandle eid, int argc, struct MprVar **argv)
format += len+1; format += len+1;
} }
ret = talloc_asprintf_append(ret, "%s", format); ret = talloc_asprintf_append_buffer(ret, "%s", format);
mpr_Return(eid, mprString(ret)); mpr_Return(eid, mprString(ret));
talloc_free(tmp_ctx); talloc_free(tmp_ctx);
return 0; return 0;

View File

@ -1645,7 +1645,7 @@ static const char *bit_string(TALLOC_CTX *mem_ctx, const struct bit_value *bv, i
if (ret == NULL) { if (ret == NULL) {
ret = talloc_asprintf(mem_ctx, "%s", bv[i].name); ret = talloc_asprintf(mem_ctx, "%s", bv[i].name);
} else { } else {
ret = talloc_asprintf_append(ret, " | %s", bv[i].name); ret = talloc_asprintf_append_buffer(ret, " | %s", bv[i].name);
} }
} }
} }

View File

@ -345,7 +345,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid); tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
tmp_dns_name = talloc_asprintf_append(tmp_dns_name, "._msdcs.%s", c->forest->dns_name); tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
s_dsa->other_info->dns_name = tmp_dns_name; s_dsa->other_info->dns_name = tmp_dns_name;
@ -642,7 +642,7 @@ static NTSTATUS test_become_dc_store_chunk(void *private_data,
tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid); tmp_dns_name = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
tmp_dns_name = talloc_asprintf_append(tmp_dns_name, "._msdcs.%s", c->forest->dns_name); tmp_dns_name = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name); NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
s_dsa->other_info->dns_name = tmp_dns_name; s_dsa->other_info->dns_name = tmp_dns_name;

View File

@ -192,13 +192,13 @@ static struct torture_tcase *add_test(struct torture_suite *suite, uint32_t bind
else else
name = talloc_strdup(suite, "unknown"); name = talloc_strdup(suite, "unknown");
name = talloc_asprintf_append(name, " keyexchange:%s", keyexchange?"yes":"no"); name = talloc_asprintf_append_buffer(name, " keyexchange:%s", keyexchange?"yes":"no");
settings->keyexchange = keyexchange; settings->keyexchange = keyexchange;
name = talloc_asprintf_append(name, " ntlm2:%s", ntlm2?"yes":"no"); name = talloc_asprintf_append_buffer(name, " ntlm2:%s", ntlm2?"yes":"no");
settings->ntlm2 = ntlm2; settings->ntlm2 = ntlm2;
name = talloc_asprintf_append(name, " lm_key:%s", lm_key?"yes":"no"); name = talloc_asprintf_append_buffer(name, " lm_key:%s", lm_key?"yes":"no");
settings->lm_key = lm_key; settings->lm_key = lm_key;
return torture_suite_add_simple_tcase(suite, name, test_secrets, settings); return torture_suite_add_simple_tcase(suite, name, test_secrets, settings);

View File

@ -938,7 +938,7 @@ again:
} }
if (!W_ERROR_IS_OK(r.out.result)) { if (!W_ERROR_IS_OK(r.out.result)) {
invalidc = talloc_asprintf_append(invalidc, "%c", (char)n); invalidc = talloc_asprintf_append_buffer(invalidc, "%c", (char)n);
} }
talloc_free(name); talloc_free(name);

View File

@ -86,16 +86,16 @@ static char *node_status_flags(TALLOC_CTX *mem_ctx, uint16_t flags)
ret = talloc_asprintf(mem_ctx, "%s %s", group, type); ret = talloc_asprintf(mem_ctx, "%s %s", group, type);
if (flags & NBT_NM_DEREGISTER) { if (flags & NBT_NM_DEREGISTER) {
ret = talloc_asprintf_append(ret, " <DEREGISTERING>"); ret = talloc_asprintf_append_buffer(ret, " <DEREGISTERING>");
} }
if (flags & NBT_NM_CONFLICT) { if (flags & NBT_NM_CONFLICT) {
ret = talloc_asprintf_append(ret, " <CONFLICT>"); ret = talloc_asprintf_append_buffer(ret, " <CONFLICT>");
} }
if (flags & NBT_NM_ACTIVE) { if (flags & NBT_NM_ACTIVE) {
ret = talloc_asprintf_append(ret, " <ACTIVE>"); ret = talloc_asprintf_append_buffer(ret, " <ACTIVE>");
} }
if (flags & NBT_NM_PERMANENT) { if (flags & NBT_NM_PERMANENT) {
ret = talloc_asprintf_append(ret, " <PERMANENT>"); ret = talloc_asprintf_append_buffer(ret, " <PERMANENT>");
} }
return ret; return ret;

View File

@ -569,7 +569,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
struct security_token *token = session_info->security_token; struct security_token *token = session_info->security_token;
const char *sidstr = dom_sid_string(session_info, const char *sidstr = dom_sid_string(session_info,
token->sids[i]); token->sids[i]);
grouplist = talloc_asprintf_append(grouplist, "%s,", sidstr); grouplist = talloc_asprintf_append_buffer(grouplist, "%s,", sidstr);
} }
mux_printf(mux_id, "GL %s\n", grouplist); mux_printf(mux_id, "GL %s\n", grouplist);

View File

@ -82,7 +82,7 @@ static void http_output_headers(struct websrv_context *web)
web->output.response_code, response_string); web->output.response_code, response_string);
if (s == NULL) return; if (s == NULL) return;
for (i=0;web->output.headers[i];i++) { for (i=0;web->output.headers[i];i++) {
s = talloc_asprintf_append(s, "%s\r\n", web->output.headers[i]); s = talloc_asprintf_append_buffer(s, "%s\r\n", web->output.headers[i]);
} }
/* work out the content length */ /* work out the content length */
@ -92,7 +92,7 @@ static void http_output_headers(struct websrv_context *web)
fstat(web->output.fd, &st); fstat(web->output.fd, &st);
content_length += st.st_size; content_length += st.st_size;
} }
s = talloc_asprintf_append(s, "Content-Length: %u\r\n\r\n", content_length); s = talloc_asprintf_append_buffer(s, "Content-Length: %u\r\n\r\n", content_length);
if (s == NULL) return; if (s == NULL) return;
b = web->output.content; b = web->output.content;
@ -125,7 +125,7 @@ static const char *http_local_path(struct websrv_context *web,
if (path == NULL) return NULL; if (path == NULL) return NULL;
if (directory_exist(path)) { if (directory_exist(path)) {
path = talloc_asprintf_append(path, "/index.esp"); path = talloc_asprintf_append_buffer(path, "/index.esp");
} }
return path; return path;
} }

View File

@ -143,7 +143,7 @@ static void cmd_list_users_recv_user_list(struct composite_context *ctx)
for (i = 0; i < user_list->out.count; ++i) { for (i = 0; i < user_list->out.count; ++i) {
DEBUG(5, ("Appending user '%s'\n", user_list->out.users[i].username)); DEBUG(5, ("Appending user '%s'\n", user_list->out.users[i].username));
state->result = talloc_asprintf_append(state->result, "%s,", state->result = talloc_asprintf_append_buffer(state->result, "%s,",
user_list->out.users[i].username); user_list->out.users[i].username);
} }

View File

@ -252,7 +252,7 @@ static void userdomgroups_recv_groups(struct composite_context *ctx)
} }
for (i=0; i<num_sids; i++) { for (i=0; i<num_sids; i++) {
sids_string = talloc_asprintf_append( sids_string = talloc_asprintf_append_buffer(
sids_string, "%s\n", dom_sid_string(s3call, sids[i])); sids_string, "%s\n", dom_sid_string(s3call, sids[i]));
} }
@ -319,7 +319,7 @@ static void usersids_recv_sids(struct composite_context *ctx)
} }
for (i=0; i<num_sids; i++) { for (i=0; i<num_sids; i++) {
sids_string = talloc_asprintf_append( sids_string = talloc_asprintf_append_buffer(
sids_string, "%s\n", dom_sid_string(s3call, sids[i])); sids_string, "%s\n", dom_sid_string(s3call, sids[i]));
if (sids_string == NULL) { if (sids_string == NULL) {
status = NT_STATUS_NO_MEMORY; status = NT_STATUS_NO_MEMORY;
@ -620,7 +620,7 @@ static void list_trustdom_recv_doms(struct composite_context *ctx)
} }
for (i=0; i<num_domains; i++) { for (i=0; i<num_domains; i++) {
result = talloc_asprintf_append( result = talloc_asprintf_append_buffer(
result, "%s\\%s\\%s", result, "%s\\%s\\%s",
domains[i]->name, domains[i]->name, domains[i]->name, domains[i]->name,
dom_sid_string(s3call, domains[i]->sid)); dom_sid_string(s3call, domains[i]->sid));