diff options
author | Volker Lendecke <vl@samba.org> | 2009-08-22 15:29:03 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2009-08-23 10:19:32 +0200 |
commit | fced9dfc1ea45f902e9281679f479ae18d229c17 (patch) | |
tree | ec0e9ac41a09e4ed9ed405258159e50d1ee0c300 /source3 | |
parent | 1603c608c9c8c6b42a18dd5545c5d15fc2f0af48 (diff) | |
download | samba-fced9dfc1ea45f902e9281679f479ae18d229c17.tar.gz samba-fced9dfc1ea45f902e9281679f479ae18d229c17.tar.bz2 samba-fced9dfc1ea45f902e9281679f479ae18d229c17.zip |
s3:winbind: Fallback to the forest root for lookupname
Thanks to Steven Danneman for watching me closely :-)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/winbindd/wb_lookupname.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/source3/winbindd/wb_lookupname.c b/source3/winbindd/wb_lookupname.c index d4e9b9ae6c..12e1babcda 100644 --- a/source3/winbindd/wb_lookupname.c +++ b/source3/winbindd/wb_lookupname.c @@ -22,11 +22,16 @@ #include "librpc/gen_ndr/cli_wbint.h" struct wb_lookupname_state { + struct tevent_context *ev; + const char *dom_name; + const char *name; + uint32_t flags; struct dom_sid sid; enum lsa_SidType type; }; static void wb_lookupname_done(struct tevent_req *subreq); +static void wb_lookupname_root_done(struct tevent_req *subreq); struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev, @@ -42,6 +47,10 @@ struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx, 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) { @@ -73,6 +82,46 @@ static void wb_lookupname_done(struct tevent_req *subreq) subreq, struct tevent_req); struct wb_lookupname_state *state = tevent_req_data( req, struct wb_lookupname_state); + struct winbindd_domain *root_domain; + NTSTATUS status, result; + + status = rpccli_wbint_LookupName_recv(subreq, state, &result); + TALLOC_FREE(subreq); + if (!NT_STATUS_IS_OK(status)) { + tevent_req_nterror(req, status); + return; + } + if (NT_STATUS_IS_OK(result)) { + tevent_req_done(req); + return; + } + + /* + * "our" DC did not find it, lets retry with the forest root + * domain + */ + + root_domain = find_root_domain(); + if (root_domain == NULL) { + tevent_req_nterror(req, result); + return; + } + + subreq = rpccli_wbint_LookupName_send( + state, state->ev, root_domain->child.rpccli, state->dom_name, + state->name, state->flags, &state->type, &state->sid); + if (tevent_req_nomem(subreq, req)) { + return; + } + tevent_req_set_callback(subreq, wb_lookupname_root_done, req); +} + +static void wb_lookupname_root_done(struct tevent_req *subreq) +{ + struct tevent_req *req = tevent_req_callback_data( + subreq, struct tevent_req); + struct wb_lookupname_state *state = tevent_req_data( + req, struct wb_lookupname_state); NTSTATUS status, result; status = rpccli_wbint_LookupName_recv(subreq, state, &result); |