From: Michael Adam Date: Wed, 30 May 2007 22:04:42 +0000 (+0000) Subject: r23252: Complete the reworking of the ads lookup_groupmem function X-Git-Tag: samba-4.0.0alpha6~801^2~5735 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=55e50c8470af2beecc3244aa94247eed1d629fe6;p=thirdparty%2Fsamba.git r23252: Complete the reworking of the ads lookup_groupmem function started in r23070, r23072, r23073, r23078, r23081 and r23082: After retrieving the list of sids with the extended dn ldap query, instead of passing all sids to the lsa_lookup_sids call, now while extracting the sids from the extended dn member entries, we first try to lookup the sid from cache and only pass the sids that were not in cache to the lsa_lookup_sids call. Michael (This used to be commit 5520c7d8557fe48957c2a85eaba8c3a0e9d8b9e2) --- diff --git a/source3/nsswitch/winbindd_ads.c b/source3/nsswitch/winbindd_ads.c index 042c871314d..6aa0947ffcd 100644 --- a/source3/nsswitch/winbindd_ads.c +++ b/source3/nsswitch/winbindd_ads.c @@ -907,9 +907,13 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, int i; size_t num_members = 0; ads_control args; - char **domains = NULL; /* only needed for rpccli_lsa_lookup_sids */ struct rpc_pipe_client *cli; POLICY_HND lsa_policy; + DOM_SID *sid_mem_nocache = NULL; + char **names_nocache = NULL; + uint32 *name_types_nocache = NULL; + char **domains_nocache = NULL; /* only needed for rpccli_lsa_lookup_sids */ + uint32 num_nocache = 0; DEBUG(10,("ads: lookup_groupmem %s sid=%s\n", domain->name, @@ -957,74 +961,115 @@ static NTSTATUS lookup_groupmem(struct winbindd_domain *domain, goto done; } - (*sid_mem) = TALLOC_ZERO_ARRAY(mem_ctx, DOM_SID, num_members); - if ((num_members != 0) && - ((members == NULL) || (*sid_mem == NULL))) { - DEBUG(1, ("talloc failed\n")); - status = NT_STATUS_NO_MEMORY; - goto done; - } - - for (i=0; i