summaryrefslogtreecommitdiff
path: root/source3/lib/util_sid.c
diff options
context:
space:
mode:
authorVolker Lendecke <vlendec@samba.org>2005-03-27 16:33:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:20 -0500
commite84ead0cfdc5e45a577387cc54dceb4c3f32948a (patch)
tree98d8898697479b516a36e534d3b3c9e3ce8e76c7 /source3/lib/util_sid.c
parent0aa89db9471330fd02db395c2eb387ac2dfef54f (diff)
downloadsamba-e84ead0cfdc5e45a577387cc54dceb4c3f32948a.tar.gz
samba-e84ead0cfdc5e45a577387cc54dceb4c3f32948a.tar.bz2
samba-e84ead0cfdc5e45a577387cc54dceb4c3f32948a.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 (This used to be commit 3a6786516957d9f67af6d53a3167c88aa272972f)
Diffstat (limited to 'source3/lib/util_sid.c')
-rw-r--r--source3/lib/util_sid.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/source3/lib/util_sid.c b/source3/lib/util_sid.c
index 0ba774e184..00fb40cd73 100644
--- a/source3/lib/util_sid.c
+++ b/source3/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);
}
/********************************************************************