summaryrefslogtreecommitdiff
path: root/source3/lib/util_sid.c
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-05-28 11:18:22 +0200
committerVolker Lendecke <vl@samba.org>2009-05-28 11:33:21 +0200
commit0dbecbbee5018108131869b13db649a058f4359d (patch)
treee49b14064ea1f1e27b55f65a9c32ab6a70151fd6 /source3/lib/util_sid.c
parent01ea4249da246b0b99a4b89eb36aa6b1c0d46994 (diff)
downloadsamba-0dbecbbee5018108131869b13db649a058f4359d.tar.gz
samba-0dbecbbee5018108131869b13db649a058f4359d.tar.bz2
samba-0dbecbbee5018108131869b13db649a058f4359d.zip
Make sid_binstring & friends take a talloc context
Diffstat (limited to 'source3/lib/util_sid.c')
-rw-r--r--source3/lib/util_sid.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 97284afae7..9e5d4d38a5 100644
--- a/source3/lib/util_sid.c
+++ b/source3/lib/util_sid.c
@@ -520,16 +520,18 @@ bool non_mappable_sid(DOM_SID *sid)
Caller must free.
*****************************************************************/
-char *sid_binstring(const DOM_SID *sid)
+char *sid_binstring(TALLOC_CTX *mem_ctx, const DOM_SID *sid)
{
- char *buf, *s;
+ uint8_t *buf;
+ char *s;
int len = ndr_size_dom_sid(sid, NULL, 0);
- buf = (char *)SMB_MALLOC(len);
- if (!buf)
+ buf = talloc_array(mem_ctx, uint8_t, len);
+ if (!buf) {
return NULL;
- sid_linearize(buf, len, sid);
- s = binary_string_rfc2254(buf, len);
- free(buf);
+ }
+ sid_linearize((char *)buf, len, sid);
+ s = binary_string_rfc2254(mem_ctx, buf, len);
+ TALLOC_FREE(buf);
return s;
}