From 0815cd63bd878d72c154caf5e121352b2af10a53 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 31 Jan 2002 12:47:42 +0000 Subject: reduced memory usage in winbindd with a rpc backend by using a separate talloc context for each partial fetch (This used to be commit 9c8a2fe4df21c29c90dc8493dade2b12314234c3) --- source3/nsswitch/winbindd_rpc.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'source3/nsswitch') diff --git a/source3/nsswitch/winbindd_rpc.c b/source3/nsswitch/winbindd_rpc.c index 2057a85fa3..5e766cd9eb 100644 --- a/source3/nsswitch/winbindd_rpc.c +++ b/source3/nsswitch/winbindd_rpc.c @@ -36,8 +36,6 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, POLICY_HND dom_pol; BOOL got_dom_pol = False; uint32 des_access = SEC_RIGHTS_MAXIMUM_ALLOWED; - SAM_DISPINFO_CTR ctr; - SAM_DISPINFO_1 info1; int i; *num_entries = 0; @@ -58,16 +56,21 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, got_dom_pol = True; - ctr.sam.info1 = &info1; - i = 0; do { + SAM_DISPINFO_CTR ctr; + SAM_DISPINFO_1 info1; uint32 count = 0, start=i; int j; - + TALLOC_CTX *ctx2; + + ctr.sam.info1 = &info1; + ctx2 = talloc_init_named("winbindd dispinfo"); + if (!ctx2) return NT_STATUS_NO_MEMORY; + /* Query display info level 1 */ - result = cli_samr_query_dispinfo(hnd->cli, mem_ctx, + result = cli_samr_query_dispinfo(hnd->cli, ctx2, &dom_pol, &start, 1, &count, 0xFFFF, &ctr); @@ -96,6 +99,8 @@ static NTSTATUS query_user_list(struct winbindd_domain *domain, something like that. */ (*info)[i].group_rid = DOMAIN_GROUP_RID_USERS; } + + talloc_destroy(ctx2); } while (NT_STATUS_EQUAL(result, STATUS_MORE_ENTRIES)); done: -- cgit