From 8a4066930908e82ac593f616ebea67044ff267bb Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 10 Dec 2014 12:25:55 +0000 Subject: [PATCH] s3:winbindd: report our own name for PING_DC and internal domains This means "wbinfo --ping-dc" works fine on a DC. Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Reviewed-by: Andrew Bartlett --- source3/winbindd/winbindd_ping_dc.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/source3/winbindd/winbindd_ping_dc.c b/source3/winbindd/winbindd_ping_dc.c index 0a767d9e12d..b5a697779bc 100644 --- a/source3/winbindd/winbindd_ping_dc.c +++ b/source3/winbindd/winbindd_ping_dc.c @@ -54,10 +54,32 @@ struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } if (domain->internal) { + const char *d = lp_dnsdomain(); + const char *n = lp_netbios_name(); + /* * Internal domains are passdb based, we can always * contact them. */ + + if (d != NULL) { + char *h; + h = strlower_talloc(mem_ctx, n); + if (tevent_req_nomem(h, req)) { + return tevent_req_post(req, ev); + } + + state->dcname = talloc_asprintf(state, "%s.%s", h, d); + if (tevent_req_nomem(state->dcname, req)) { + return tevent_req_post(req, ev); + } + } else { + state->dcname = talloc_strdup(state, n); + if (tevent_req_nomem(state->dcname, req)) { + return tevent_req_post(req, ev); + } + } + tevent_req_done(req); return tevent_req_post(req, ev); }