Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NAS-122455 / s3/winbindd - prevent lookup_name recursion #299

Open
wants to merge 1 commit into
base: SCALE-v4-18-stable
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions source3/winbindd/wb_lookupname.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#include "includes.h"
#include "winbindd.h"
#include "librpc/gen_ndr/ndr_winbind_c.h"
#include "passdb/lookup_sid.h" /* only for LOOKUP flags */
#include "passdb/machine_sid.h"
#include "../libcli/security/security.h"

struct wb_lookupname_state {
Expand Down Expand Up @@ -74,6 +76,20 @@ struct tevent_req *wb_lookupname_send(TALLOC_CTX *mem_ctx,
return tevent_req_post(req, ev);
}

if (flags == (LOOKUP_NAME_NO_NSS | LOOKUP_NAME_REMOTE)) {
if (dom_sid_compare_domain(&domain->sid,
get_global_sam_sid()) == 0) {
D_NOTICE("Domain [%s] is our local domain, "
"skipping recursive lookup\n",
dom_name);

tevent_req_nterror(req, NT_STATUS_NONE_MAPPED);
return tevent_req_post(req, ev);
}

flags &= ~LOOKUP_NAME_REMOTE;
}

subreq = dcerpc_wbint_LookupName_send(
state, ev, dom_child_handle(domain),
state->dom_name, state->name,
Expand Down
2 changes: 1 addition & 1 deletion source3/winbindd/winbindd_getgroups.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct tevent_req *winbindd_getgroups_send(TALLOC_CTX *mem_ctx,
state->namespace,
state->domname,
state->username,
LOOKUP_NAME_NO_NSS);
LOOKUP_NAME_NO_NSS | LOOKUP_NAME_REMOTE);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
Expand Down
2 changes: 1 addition & 1 deletion source3/winbindd/winbindd_getpwnam.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ struct tevent_req *winbindd_getpwnam_send(TALLOC_CTX *mem_ctx,
state->namespace,
state->domname,
state->username,
LOOKUP_NAME_NO_NSS);
LOOKUP_NAME_NO_NSS | LOOKUP_NAME_REMOTE);
if (tevent_req_nomem(subreq, req)) {
return tevent_req_post(req, ev);
}
Expand Down