1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

s3:winbind: Remove the manual caching for the async wb_ functions

The generic NDR-based cache in winbindd_dual_ndr.c replaces this.
This commit is contained in:
Volker Lendecke 2009-08-27 14:16:22 +02:00
parent 94948f7a40
commit c4a95f900a
6 changed files with 16 additions and 81 deletions

View File

@ -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; i<num_names; i++) {
struct wbint_GroupMember *m;
const char *name;
m = &state->members.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);

View File

@ -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);
/*
* 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);
}
domain = find_lookup_domain_from_name(state->dom_name);
if (domain == NULL) {
DEBUG(5, ("Could not find domain for %s\n", dom_name));
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);
}
status = wcache_name_to_sid(domain, dom_name, name,
&state->sid, &state->type);
if (NT_STATUS_IS_OK(status)) {
tevent_req_done(req);
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);
}

View File

@ -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);

View File

@ -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)) {

View File

@ -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)) {

View File

@ -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)) {