diff --git a/selftest/knownfail.d/upn_handling b/selftest/knownfail.d/upn_handling index 308c2948e8d..0fa2aa35f30 100644 --- a/selftest/knownfail.d/upn_handling +++ b/selftest/knownfail.d/upn_handling @@ -1,10 +1,8 @@ -^samba3\.wbinfo_user_info\.name_to_sid\.upn\.jane\.doe.ad_member ^samba3\.wbinfo_user_info\.user_info\.upn\.jane\.doe.ad_member ^samba3\.wbinfo_user_info\.name_to_sid\.upn\.testdenied_upn.ad_member ^samba3\.wbinfo_user_info\.user_info\.upn\.testdenied_upn.ad_member ^samba3\.wbinfo_user_info\.user_info\.domain\.alice.fl2008r2dc ^samba3\.wbinfo_user_info\.user_info\.upn\.alice.fl2008r2dc -^samba3\.wbinfo_user_info\.name_to_sid\.upn\.jane\.doe.fl2008r2dc ^samba3\.wbinfo_user_info\.user_info\.domain\.jane.fl2008r2dc ^samba3\.wbinfo_user_info\.user_info\.upn\.jane\.doe.fl2008r2dc ^samba3\.wbinfo_user_info\.name_to_sid\.upn\.testdenied_upn.fl2008r2dc diff --git a/source3/winbindd/wb_lookupname.c b/source3/winbindd/wb_lookupname.c index 1dd6b68334e..c7b027be801 100644 --- a/source3/winbindd/wb_lookupname.c +++ b/source3/winbindd/wb_lookupname.c @@ -35,7 +35,9 @@ static void wb_lookupname_done(struct tevent_req *subreq); struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - const char *dom_name, const char *name, + const char *namespace, + const char *dom_name, + const char *name, uint32_t flags) { struct tevent_req *req, *subreq; @@ -61,9 +63,9 @@ struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - domain = find_lookup_domain_from_name(state->dom_name); + domain = find_lookup_domain_from_name(namespace); if (domain == NULL) { - DEBUG(5, ("Could not find domain for %s\n", state->dom_name)); + DEBUG(5, ("Could not find domain for %s\n", namespace)); tevent_req_nterror(req, NT_STATUS_NONE_MAPPED); return tevent_req_post(req, ev); } diff --git a/source3/winbindd/wb_xids2sids.c b/source3/winbindd/wb_xids2sids.c index a2a4493bde8..0d21e55c25d 100644 --- a/source3/winbindd/wb_xids2sids.c +++ b/source3/winbindd/wb_xids2sids.c @@ -185,6 +185,7 @@ static void wb_xids2sids_init_dom_maps_lookupname_next( subreq = wb_lookupname_send(state, state->ev, dom_maps[state->dom_idx].name, + dom_maps[state->dom_idx].name, "", LOOKUP_NAME_NO_NSS); if (tevent_req_nomem(subreq, state->req)) { diff --git a/source3/winbindd/winbindd_getgrnam.c b/source3/winbindd/winbindd_getgrnam.c index 02d9abc28a2..1d9a8b94d48 100644 --- a/source3/winbindd/winbindd_getgrnam.c +++ b/source3/winbindd/winbindd_getgrnam.c @@ -76,7 +76,10 @@ struct tevent_req *winbindd_getgrnam_send(TALLOC_CTX *mem_ctx, fstrcpy(state->name_domain, get_global_sam_name()); } - subreq = wb_lookupname_send(state, ev, state->name_domain, state->name_group, + subreq = wb_lookupname_send(state, ev, + state->name_domain, + state->name_domain, + state->name_group, 0); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_getgroups.c b/source3/winbindd/winbindd_getgroups.c index 8bf670654e1..68b470d6dad 100644 --- a/source3/winbindd/winbindd_getgroups.c +++ b/source3/winbindd/winbindd_getgroups.c @@ -75,7 +75,10 @@ struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - subreq = wb_lookupname_send(state, ev, state->domname, state->username, + subreq = wb_lookupname_send(state, ev, + state->domname, + state->domname, + state->username, LOOKUP_NAME_NO_NSS); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_getpwnam.c b/source3/winbindd/winbindd_getpwnam.c index 73d3b3317ad..26686bf9f0f 100644 --- a/source3/winbindd/winbindd_getpwnam.c +++ b/source3/winbindd/winbindd_getpwnam.c @@ -71,7 +71,10 @@ struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - subreq = wb_lookupname_send(state, ev, state->domname, state->username, + subreq = wb_lookupname_send(state, ev, + state->domname, + state->domname, + state->username, LOOKUP_NAME_NO_NSS); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); diff --git a/source3/winbindd/winbindd_irpc.c b/source3/winbindd/winbindd_irpc.c index 731b0574ad7..1e34fdfc2d0 100644 --- a/source3/winbindd/winbindd_irpc.c +++ b/source3/winbindd/winbindd_irpc.c @@ -466,6 +466,7 @@ static void wb_irpc_lsa_LookupSids3_done(struct tevent_req *subreq) struct wb_irpc_lsa_LookupNames4_name { void *state; uint32_t idx; + const char *namespace; const char *domain; char *name; struct dom_sid sid; @@ -553,11 +554,12 @@ static NTSTATUS wb_irpc_lsa_LookupNames4_call(struct irpc_message *msg, if (p != NULL) { *p = 0; nstate->domain = nstate->name; + nstate->namespace = nstate->domain; nstate->name = p+1; } else if ((p = strchr(nstate->name, '@')) != NULL) { /* upn */ - nstate->domain = p + 1; - *p = 0; + nstate->domain = ""; + nstate->namespace = p + 1; } else { /* * TODO: select the domain based on @@ -572,6 +574,7 @@ static NTSTATUS wb_irpc_lsa_LookupNames4_call(struct irpc_message *msg, subreq = wb_lookupname_send(msg, server_event_context(), + nstate->namespace, nstate->domain, nstate->name, LOOKUP_NAME_NO_NSS); diff --git a/source3/winbindd/winbindd_lookupname.c b/source3/winbindd/winbindd_lookupname.c index b02269155f1..c5a7c135973 100644 --- a/source3/winbindd/winbindd_lookupname.c +++ b/source3/winbindd/winbindd_lookupname.c @@ -35,8 +35,10 @@ struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx, { struct tevent_req *req, *subreq; struct winbindd_lookupname_state *state; - const char *domname = NULL, *name = NULL; char *p = NULL; + const char *domname = NULL; + const char *name = NULL; + const char *namespace = NULL; req = tevent_req_create(mem_ctx, &state, struct winbindd_lookupname_state); @@ -56,28 +58,29 @@ struct tevent_req *winbindd_lookupname_send(TALLOC_CTX *mem_ctx, if (p != NULL) { *p = '\0'; domname = request->data.name.name; + namespace = domname; name = p + 1; } else { p = strchr(request->data.name.name, '@'); if (p != NULL) { /* upn */ - domname = p + 1; - *p = '\0'; - name = request->data.name.name; + namespace = p + 1; } else { - domname = ""; - name = request->data.name.name; + namespace = ""; } + domname = ""; + name = request->data.name.name; } } else { domname = request->data.name.dom_name; + namespace = domname; name = request->data.name.name; } DEBUG(3, ("lookupname %s%s%s\n", domname, lp_winbind_separator(), name)); - subreq = wb_lookupname_send(state, ev, domname, name, 0); + subreq = wb_lookupname_send(state, ev, namespace, domname, name, 0); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } diff --git a/source3/winbindd/winbindd_proto.h b/source3/winbindd/winbindd_proto.h index bbc6841e004..6243f313b3a 100644 --- a/source3/winbindd/winbindd_proto.h +++ b/source3/winbindd/winbindd_proto.h @@ -561,7 +561,9 @@ NTSTATUS winbindd_lookupsids_recv(struct tevent_req *req, struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, - const char *dom_name, const char *name, + const char *namespace, + const char *dom_name, + const char *name, uint32_t flags); NTSTATUS wb_lookupname_recv(struct tevent_req *req, struct dom_sid *sid, enum lsa_SidType *type);