diff options
author | Stefan Metzmacher <metze@samba.org> | 2005-08-23 09:45:38 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:34:24 -0500 |
commit | 7b211a11c34d15aa51d40bab34080e31e48140d9 (patch) | |
tree | 2851fb4686ed1894da62362499edeaab2607bf5e /source4/libcli/security | |
parent | aaa0aff2d6cea65b07320790c16fff127c12a65b (diff) | |
download | samba-7b211a11c34d15aa51d40bab34080e31e48140d9.tar.gz samba-7b211a11c34d15aa51d40bab34080e31e48140d9.tar.bz2 samba-7b211a11c34d15aa51d40bab34080e31e48140d9.zip |
r9511: - fix the memory trees
- add a note about a possible talloc_free()
metze
(This used to be commit 550e3030f0e02720b527f3b4923457f05f484e6e)
Diffstat (limited to 'source4/libcli/security')
-rw-r--r-- | source4/libcli/security/security_descriptor.c | 5 | ||||
-rw-r--r-- | source4/libcli/security/security_token.c | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/source4/libcli/security/security_descriptor.c b/source4/libcli/security/security_descriptor.c index 703abf7970..c28960be80 100644 --- a/source4/libcli/security/security_descriptor.c +++ b/source4/libcli/security/security_descriptor.c @@ -317,14 +317,14 @@ struct security_descriptor *security_descriptor_create(TALLOC_CTX *mem_ctx, if (sd == NULL) return NULL; if (owner_sid) { - sd->owner_sid = dom_sid_parse_talloc(mem_ctx, owner_sid); + sd->owner_sid = dom_sid_parse_talloc(sd, owner_sid); if (sd->owner_sid == NULL) { talloc_free(sd); return NULL; } } if (group_sid) { - sd->group_sid = dom_sid_parse_talloc(mem_ctx, group_sid); + sd->group_sid = dom_sid_parse_talloc(sd, group_sid); if (sd->group_sid == NULL) { talloc_free(sd); return NULL; @@ -353,6 +353,7 @@ struct security_descriptor *security_descriptor_create(TALLOC_CTX *mem_ctx, } ace->trustee = *sid; status = security_descriptor_dacl_add(sd, ace); + /* TODO: check: would talloc_free(ace) here be correct? */ if (!NT_STATUS_IS_OK(status)) { va_end(ap); talloc_free(sd); diff --git a/source4/libcli/security/security_token.c b/source4/libcli/security/security_token.c index ea1fae0c33..a23aa92bf3 100644 --- a/source4/libcli/security/security_token.c +++ b/source4/libcli/security/security_token.c @@ -78,14 +78,14 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, * The only difference between guest and "anonymous" * is the addition of Authenticated_Users. */ - ptoken->sids[2] = dom_sid_parse_talloc(mem_ctx, SID_WORLD); + ptoken->sids[2] = dom_sid_parse_talloc(ptoken->sids, SID_WORLD); NT_STATUS_HAVE_NO_MEMORY(ptoken->sids[2]); - ptoken->sids[3] = dom_sid_parse_talloc(mem_ctx, SID_NT_NETWORK); + ptoken->sids[3] = dom_sid_parse_talloc(ptoken->sids, SID_NT_NETWORK); NT_STATUS_HAVE_NO_MEMORY(ptoken->sids[3]); ptoken->num_sids = 4; if (is_authenticated) { - ptoken->sids[4] = dom_sid_parse_talloc(mem_ctx, SID_NT_AUTHENTICATED_USERS); + ptoken->sids[4] = dom_sid_parse_talloc(ptoken->sids, SID_NT_AUTHENTICATED_USERS); NT_STATUS_HAVE_NO_MEMORY(ptoken->sids[4]); ptoken->num_sids++; } @@ -99,9 +99,9 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, break; } } - + if (check_sid_idx == ptoken->num_sids) { - ptoken->sids[ptoken->num_sids++] = talloc_reference(ptoken, groupSIDs[i]); + ptoken->sids[ptoken->num_sids++] = talloc_reference(ptoken->sids, groupSIDs[i]); } } |