From bd23c8f1ce1caf61a0596c47795d6a21c2234826 Mon Sep 17 00:00:00 2001 From: Christof Schmitt Date: Fri, 10 Aug 2012 08:10:42 -0700 Subject: [PATCH] s3-winbind: Return the DC name from DC_PING The DC that was attempted to ping is useful for troubleshooting. Return the DC name in the response to the wbclient. Signed-off-by: Andrew Bartlett --- source3/librpc/idl/wbint.idl | 1 + source3/winbindd/winbindd_dual_srv.c | 5 +++++ source3/winbindd/winbindd_ping_dc.c | 9 ++++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/source3/librpc/idl/wbint.idl b/source3/librpc/idl/wbint.idl index cb8a4e42a35..159af76a820 100644 --- a/source3/librpc/idl/wbint.idl +++ b/source3/librpc/idl/wbint.idl @@ -177,5 +177,6 @@ interface wbint ); NTSTATUS wbint_PingDc( + [out,string,charset(UTF8)] char **dcname ); } diff --git a/source3/winbindd/winbindd_dual_srv.c b/source3/winbindd/winbindd_dual_srv.c index e9a964b70b7..d39454399e5 100644 --- a/source3/winbindd/winbindd_dual_srv.c +++ b/source3/winbindd/winbindd_dual_srv.c @@ -714,6 +714,11 @@ NTSTATUS _wbint_PingDc(struct pipes_struct *p, struct wbint_PingDc *r) b = netlogon_pipe->binding_handle; fstr_sprintf(logon_server, "\\\\%s", domain->dcname); + *r->out.dcname = talloc_strdup(p->mem_ctx, domain->dcname); + if (r->out.dcname == NULL) { + DEBUG(2, ("Could not allocate memory\n")); + return NT_STATUS_NO_MEMORY; + } /* * This provokes a WERR_NOT_SUPPORTED error message. This is diff --git a/source3/winbindd/winbindd_ping_dc.c b/source3/winbindd/winbindd_ping_dc.c index 7f52040a04a..93b16cda8c3 100644 --- a/source3/winbindd/winbindd_ping_dc.c +++ b/source3/winbindd/winbindd_ping_dc.c @@ -22,6 +22,7 @@ #include "librpc/gen_ndr/ndr_wbint_c.h" struct winbindd_ping_dc_state { + const char *dcname; NTSTATUS result; }; @@ -61,7 +62,8 @@ struct tevent_req *winbindd_ping_dc_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } - subreq = dcerpc_wbint_PingDc_send(state, ev, dom_child_handle(domain)); + subreq = dcerpc_wbint_PingDc_send(state, ev, dom_child_handle(domain), + &state->dcname); if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } @@ -96,5 +98,10 @@ NTSTATUS winbindd_ping_dc_recv(struct tevent_req *req, set_auth_errors(presp, state->result); } + if (state->dcname) { + presp->extra_data.data = talloc_strdup(presp, state->dcname); + presp->length += strlen((char *)presp->extra_data.data) + 1; + } + return tevent_req_simple_recv_ntstatus(req); } -- 2.11.4.GIT