From 9453a0f88f1d0c337a3c1b24a2567e2dde3466e8 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 21 May 2010 16:01:34 +1000 Subject: s4:auth Fix previous commit - segfault in determinging a user's groups The previous commit didn't include these vital fixes. Andrew Bartlett --- source4/auth/sam.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source4/auth/sam.c') diff --git a/source4/auth/sam.c b/source4/auth/sam.c index 2cc8118fe1..d6d1a50522 100644 --- a/source4/auth/sam.c +++ b/source4/auth/sam.c @@ -27,8 +27,6 @@ #include "../lib/util/util_ldb.h" #include "dsdb/samdb/samdb.h" #include "libcli/security/security.h" -#include "libcli/ldap/ldap.h" -#include "../libcli/ldap/ldap_ndr.h" #include "librpc/gen_ndr/ndr_netlogon.h" #include "librpc/gen_ndr/ndr_security.h" #include "param/param.h" @@ -367,8 +365,9 @@ NTSTATUS authsam_expand_nested_groups(struct ldb_context *sam_ctx, if (!only_childs) { *res_sids = talloc_realloc(res_sids_ctx, *res_sids, struct dom_sid *, *num_res_sids + 1); - NT_STATUS_HAVE_NO_MEMORY(*res_sids); - (*res_sids)[*num_res_sids] = talloc_steal(*res_sids, &sid); + NT_STATUS_HAVE_NO_MEMORY_AND_FREE(*res_sids, tmp_ctx); + (*res_sids)[*num_res_sids] = dom_sid_dup(*res_sids, &sid); + NT_STATUS_HAVE_NO_MEMORY_AND_FREE((*res_sids)[*num_res_sids], tmp_ctx); ++(*num_res_sids); } @@ -384,7 +383,6 @@ NTSTATUS authsam_expand_nested_groups(struct ldb_context *sam_ctx, } } - talloc_free(res); talloc_free(tmp_ctx); return NT_STATUS_OK; -- cgit