summaryrefslogtreecommitdiff
path: root/source4/libcli/security/dom_sid.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-29 03:19:28 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:06:11 -0500
commit3342a53c0f20af2f255152bc9077294e18376b09 (patch)
treee895f21509903b67936bc2b27bf65a3b563bc973 /source4/libcli/security/dom_sid.c
parent05def77d801544aeb43f1d05fd080bcd608299ef (diff)
downloadsamba-3342a53c0f20af2f255152bc9077294e18376b09.tar.gz
samba-3342a53c0f20af2f255152bc9077294e18376b09.tar.bz2
samba-3342a53c0f20af2f255152bc9077294e18376b09.zip
r3988: made dom_sid_add_rid() allocate the new sid with proper parent/child talloc
relationship (This used to be commit 5db0eb1fe3abb5150bef27bfed4b7da723e4a287)
Diffstat (limited to 'source4/libcli/security/dom_sid.c')
-rw-r--r--source4/libcli/security/dom_sid.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/source4/libcli/security/dom_sid.c b/source4/libcli/security/dom_sid.c
index dbd03108e4..108e2f5500 100644
--- a/source4/libcli/security/dom_sid.c
+++ b/source4/libcli/security/dom_sid.c
@@ -217,7 +217,8 @@ struct dom_sid *dom_sid_dup(TALLOC_CTX *mem_ctx, const struct dom_sid *dom_sid)
}
/*
- add a rid to a domain dom_sid to make a full dom_sid
+ add a rid to a domain dom_sid to make a full dom_sid. This function
+ returns a new sid in the suppplied memory context
*/
struct dom_sid *dom_sid_add_rid(TALLOC_CTX *mem_ctx,
const struct dom_sid *domain_sid,
@@ -229,14 +230,15 @@ struct dom_sid *dom_sid_add_rid(TALLOC_CTX *mem_ctx,
if (!sid) return NULL;
*sid = *domain_sid;
- /*TODO: use realloc! */
- sid->sub_auths = talloc_array_p(mem_ctx, uint32_t, sid->num_auths+1);
+
+ sid->sub_auths = talloc_array_p(sid, uint32_t, sid->num_auths+1);
if (!sid->sub_auths) {
return NULL;
}
memcpy(sid->sub_auths, domain_sid->sub_auths, sid->num_auths*sizeof(uint32_t));
sid->sub_auths[sid->num_auths] = rid;
sid->num_auths++;
+
return sid;
}