summaryrefslogtreecommitdiff
path: root/source3/groupdb/mapping_tdb.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-09 02:58:18 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:24 -0500
commit63609fbb04d2ce620338b4b79e7c1abf39f08ef8 (patch)
treec036fe84a97efbee490c470051cf1de360d502d3 /source3/groupdb/mapping_tdb.c
parent19ddef3dd9065b04896c626e7b4c691c7bbbec53 (diff)
downloadsamba-63609fbb04d2ce620338b4b79e7c1abf39f08ef8.tar.gz
samba-63609fbb04d2ce620338b4b79e7c1abf39f08ef8.tar.bz2
samba-63609fbb04d2ce620338b4b79e7c1abf39f08ef8.zip
r20090: Fix a class of bugs found by James Peach. Ensure
we never mix malloc and talloc'ed contexts in the add_XX_to_array() and add_XX_to_array_unique() calls. Ensure that these calls always return False on out of memory, True otherwise and always check them. Ensure that the relevent parts of the conn struct and the nt_user_tokens are TALLOC_DESTROYED not SAFE_FREE'd. James - this should fix your crash bug in both branches. Jeremy. (This used to be commit 0ffca7559e07500bd09a64b775e230d448ce5c24)
Diffstat (limited to 'source3/groupdb/mapping_tdb.c')
-rw-r--r--source3/groupdb/mapping_tdb.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/source3/groupdb/mapping_tdb.c b/source3/groupdb/mapping_tdb.c
index 12b7c682fb..cff557ff13 100644
--- a/source3/groupdb/mapping_tdb.c
+++ b/source3/groupdb/mapping_tdb.c
@@ -429,10 +429,9 @@ BOOL enum_group_mapping(const DOM_SID *domsid, enum lsa_SidType sid_name_use, GR
if (!string_to_sid(&alias, string_sid))
continue;
- add_sid_to_array_unique(NULL, &alias, sids, num);
-
- if (sids == NULL)
+ if (!add_sid_to_array_unique(NULL, &alias, sids, num)) {
return NT_STATUS_NO_MEMORY;
+ }
}
SAFE_FREE(dbuf.dptr);
@@ -577,7 +576,10 @@ static int collect_aliasmem(TDB_CONTEXT *tdb_ctx, TDB_DATA key, TDB_DATA data,
if (!string_to_sid(&member, member_string))
continue;
- add_sid_to_array(NULL, &member, closure->sids, closure->num);
+ if (!add_sid_to_array(NULL, &member, closure->sids, closure->num)) {
+ /* talloc fail. */
+ break;
+ }
}
return 0;