From c4a95f900a64649527a0a299eb52c352c51a2ae7 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Thu, 27 Aug 2009 14:16:22 +0200 Subject: s3:winbind: Remove the manual caching for the async wb_ functions The generic NDR-based cache in winbindd_dual_ndr.c replaces this. --- source3/winbindd/wb_group_members.c | 31 ------------------------------- source3/winbindd/wb_lookupname.c | 28 +++++++++++++++------------- source3/winbindd/wb_lookupsid.c | 11 ----------- source3/winbindd/wb_lookupuseraliases.c | 9 --------- source3/winbindd/wb_lookupusergroups.c | 9 --------- source3/winbindd/wb_queryuser.c | 7 ------- 6 files changed, 15 insertions(+), 80 deletions(-) diff --git a/source3/winbindd/wb_group_members.c b/source3/winbindd/wb_group_members.c index 5de4d51e09..f37641bd0d 100644 --- a/source3/winbindd/wb_group_members.c +++ b/source3/winbindd/wb_group_members.c @@ -52,11 +52,6 @@ static struct tevent_req *wb_lookupgroupmem_send(TALLOC_CTX *mem_ctx, struct tevent_req *req, *subreq; struct wb_lookupgroupmem_state *state; struct winbindd_domain *domain; - uint32_t num_names; - struct dom_sid *sid_mem; - char **names; - uint32_t *name_types; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct wb_lookupgroupmem_state); @@ -71,32 +66,6 @@ static struct tevent_req *wb_lookupgroupmem_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - status = wcache_lookup_groupmem(domain, state, &state->sid, &num_names, - &sid_mem, &names, &name_types); - if (NT_STATUS_IS_OK(status)) { - int i; - state->members.members = talloc_array( - state, struct wbint_GroupMember, num_names); - if (tevent_req_nomem(state->members.members, req)) { - return tevent_req_post(req, ev); - } - state->members.num_members = num_names; - for (i=0; imembers.members[i]; - sid_copy(&m->sid, &sid_mem[i]); - name = names[i]; - m->name = talloc_move(state->members.members, &name); - m->type = (enum lsa_SidType)name_types[i]; - } - TALLOC_FREE(sid_mem); - TALLOC_FREE(names); - TALLOC_FREE(name_types); - tevent_req_done(req); - return tevent_req_post(req, ev); - } - subreq = rpccli_wbint_LookupGroupMembers_send( state, ev, domain->child.rpccli, &state->sid, type, &state->members); diff --git a/source3/winbindd/wb_lookupname.c b/source3/winbindd/wb_lookupname.c index 12e1babcda..6251d030be 100644 --- a/source3/winbindd/wb_lookupname.c +++ b/source3/winbindd/wb_lookupname.c @@ -41,34 +41,36 @@ struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx, struct tevent_req *req, *subreq; struct wb_lookupname_state *state; struct winbindd_domain *domain; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct wb_lookupname_state); if (req == NULL) { return NULL; } state->ev = ev; - state->dom_name = dom_name; - state->name = name; state->flags = flags; - domain = find_lookup_domain_from_name(dom_name); - if (domain == NULL) { - DEBUG(5, ("Could not find domain for %s\n", dom_name)); - tevent_req_nterror(req, NT_STATUS_NONE_MAPPED); + /* + * Uppercase domain and name so that we become cache-friendly + */ + state->dom_name = talloc_strdup_upper(state, dom_name); + if (tevent_req_nomem(state->dom_name, req)) { + return tevent_req_post(req, ev); + } + state->name = talloc_strdup_upper(state, name); + if (tevent_req_nomem(state->name, req)) { return tevent_req_post(req, ev); } - status = wcache_name_to_sid(domain, dom_name, name, - &state->sid, &state->type); - if (NT_STATUS_IS_OK(status)) { - tevent_req_done(req); + domain = find_lookup_domain_from_name(state->dom_name); + if (domain == NULL) { + DEBUG(5, ("Could not find domain for %s\n", state->dom_name)); + tevent_req_nterror(req, NT_STATUS_NONE_MAPPED); return tevent_req_post(req, ev); } subreq = rpccli_wbint_LookupName_send( - state, ev, domain->child.rpccli, dom_name, name, flags, - &state->type, &state->sid); + state, ev, domain->child.rpccli, state->dom_name, state->name, + flags, &state->type, &state->sid); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } diff --git a/source3/winbindd/wb_lookupsid.c b/source3/winbindd/wb_lookupsid.c index f258828048..80e0b80ca1 100644 --- a/source3/winbindd/wb_lookupsid.c +++ b/source3/winbindd/wb_lookupsid.c @@ -38,8 +38,6 @@ struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct wb_lookupsid_state *state; - char *dom_name, *name; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct wb_lookupsid_state); if (req == NULL) { @@ -56,15 +54,6 @@ struct tevent_req *wb_lookupsid_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - status = wcache_sid_to_name(state->lookup_domain, sid, state, - &dom_name, &name, &state->type); - if (NT_STATUS_IS_OK(status)) { - state->domname = dom_name; - state->name = name; - tevent_req_done(req); - return tevent_req_post(req, ev); - } - subreq = rpccli_wbint_LookupSid_send( state, ev, state->lookup_domain->child.rpccli, &state->sid, &state->type, &state->domname, &state->name); diff --git a/source3/winbindd/wb_lookupuseraliases.c b/source3/winbindd/wb_lookupuseraliases.c index e2e5e2da08..138eca9a81 100644 --- a/source3/winbindd/wb_lookupuseraliases.c +++ b/source3/winbindd/wb_lookupuseraliases.c @@ -37,7 +37,6 @@ struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct wb_lookupuseraliases_state *state; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct wb_lookupuseraliases_state); @@ -47,14 +46,6 @@ struct tevent_req *wb_lookupuseraliases_send(TALLOC_CTX *mem_ctx, state->sids.num_sids = num_sids; state->sids.sids = CONST_DISCARD(struct dom_sid *, sids); - status = wcache_lookup_useraliases(domain, state, num_sids, sids, - &state->rids.num_rids, - &state->rids.rids); - if (NT_STATUS_IS_OK(status)) { - tevent_req_done(req); - return tevent_req_post(req, ev); - } - subreq = rpccli_wbint_LookupUserAliases_send( state, ev, domain->child.rpccli, &state->sids, &state->rids); if (tevent_req_nomem(subreq, req)) { diff --git a/source3/winbindd/wb_lookupusergroups.c b/source3/winbindd/wb_lookupusergroups.c index 4e96b45c57..99c75b6060 100644 --- a/source3/winbindd/wb_lookupusergroups.c +++ b/source3/winbindd/wb_lookupusergroups.c @@ -36,7 +36,6 @@ struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct wb_lookupusergroups_state *state; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct wb_lookupusergroups_state); @@ -45,14 +44,6 @@ struct tevent_req *wb_lookupusergroups_send(TALLOC_CTX *mem_ctx, } sid_copy(&state->sid, sid); - status = wcache_lookup_usergroups(domain, state, sid, - &state->sids.num_sids, - &state->sids.sids); - if (NT_STATUS_IS_OK(status)) { - tevent_req_done(req); - return tevent_req_post(req, ev); - } - subreq = rpccli_wbint_LookupUserGroups_send( state, ev, domain->child.rpccli, &state->sid, &state->sids); if (tevent_req_nomem(subreq, req)) { diff --git a/source3/winbindd/wb_queryuser.c b/source3/winbindd/wb_queryuser.c index 7a2f1de17b..d85af78f3e 100644 --- a/source3/winbindd/wb_queryuser.c +++ b/source3/winbindd/wb_queryuser.c @@ -35,7 +35,6 @@ struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx, struct tevent_req *req, *subreq; struct wb_queryuser_state *state; struct winbindd_domain *domain; - NTSTATUS status; req = tevent_req_create(mem_ctx, &state, struct wb_queryuser_state); if (req == NULL) { @@ -54,12 +53,6 @@ struct tevent_req *wb_queryuser_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - status = wcache_query_user(domain, state, &state->sid, state->info); - if (NT_STATUS_IS_OK(status)) { - tevent_req_done(req); - return tevent_req_post(req, ev); - } - subreq = rpccli_wbint_QueryUser_send(state, ev, domain->child.rpccli, &state->sid, state->info); if (tevent_req_nomem(subreq, req)) { -- cgit