reduced memory usage in winbindd with a rpc backend by using a
authorAndrew Tridgell <tridge@samba.org>
Thu, 31 Jan 2002 12:47:42 +0000 (12:47 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 31 Jan 2002 12:47:42 +0000 (12:47 +0000)
separate talloc context for each partial fetch

source/nsswitch/winbindd_rpc.c

index 2057a85fa3acd8131ee9986e5131ad54e7543c73..5e766cd9eb78d1af4900348aced693183b8814d6 100644 (file)
@@ -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: