diff options
author | Volker Lendecke <vlendec@samba.org> | 2005-03-27 16:33:04 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:56:20 -0500 |
commit | 3a6786516957d9f67af6d53a3167c88aa272972f (patch) | |
tree | a9323480d1f7297fc530e4cf04e7e3cd17f2b516 /source/lib/util_sid.c | |
parent | 0e29dc8aa384dfa6d2495beb8a9ffb5371e60a13 (diff) | |
download | samba-3a6786516957d9f67af6d53a3167c88aa272972f.tar.gz samba-3a6786516957d9f67af6d53a3167c88aa272972f.tar.xz samba-3a6786516957d9f67af6d53a3167c88aa272972f.zip |
r6080: Port some of the non-critical changes from HEAD to 3_0. The main one is the
change in pdb_enum_alias_memberships to match samr.idl a bit closer.
Volker
Diffstat (limited to 'source/lib/util_sid.c')
-rw-r--r-- | source/lib/util_sid.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/source/lib/util_sid.c b/source/lib/util_sid.c index 0ba774e184d..00fb40cd733 100644 --- a/source/lib/util_sid.c +++ b/source/lib/util_sid.c @@ -351,6 +351,19 @@ BOOL string_to_sid(DOM_SID *sidout, const char *sidstr) return True; } +DOM_SID *string_sid_talloc(TALLOC_CTX *mem_ctx, const char *sidstr) +{ + DOM_SID *result = TALLOC_P(mem_ctx, DOM_SID); + + if (result == NULL) + return NULL; + + if (!string_to_sid(result, sidstr)) + return NULL; + + return result; +} + /***************************************************************** Add a rid to the end of a sid *****************************************************************/ @@ -652,9 +665,14 @@ DOM_SID *sid_dup_talloc(TALLOC_CTX *ctx, const DOM_SID *src) Add SID to an array SIDs ********************************************************************/ -void add_sid_to_array(const DOM_SID *sid, DOM_SID **sids, int *num) +void add_sid_to_array(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + DOM_SID **sids, int *num) { - *sids = SMB_REALLOC_ARRAY(*sids, DOM_SID, (*num)+1); + if (mem_ctx != NULL) + *sids = TALLOC_REALLOC_ARRAY(mem_ctx, *sids, DOM_SID, + (*num)+1); + else + *sids = SMB_REALLOC_ARRAY(*sids, DOM_SID, (*num)+1); if (*sids == NULL) return; @@ -670,7 +688,8 @@ void add_sid_to_array(const DOM_SID *sid, DOM_SID **sids, int *num) Add SID to an array SIDs ensuring that it is not already there ********************************************************************/ -void add_sid_to_array_unique(const DOM_SID *sid, DOM_SID **sids, int *num_sids) +void add_sid_to_array_unique(TALLOC_CTX *mem_ctx, const DOM_SID *sid, + DOM_SID **sids, int *num_sids) { int i; @@ -679,7 +698,7 @@ void add_sid_to_array_unique(const DOM_SID *sid, DOM_SID **sids, int *num_sids) return; } - add_sid_to_array(sid, sids, num_sids); + add_sid_to_array(mem_ctx, sid, sids, num_sids); } /******************************************************************** |