From a674a3bbf3520cd8f93f35dcc8a4ec59c456e1ba Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Tue, 28 Oct 2008 01:23:04 +0100 Subject: s4-netlogon: merge netr_GetAnyDCName from s3 idl (untested). Guenther --- source4/librpc/idl/netlogon.idl | 2 +- source4/torture/rpc/netlogon.c | 10 +++++++--- source4/winbind/wb_cmd_getdcname.c | 3 ++- source4/winbind/wb_dom_info_trusted.c | 3 ++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl index 23be2e5667..34da844ce7 100644 --- a/source4/librpc/idl/netlogon.idl +++ b/source4/librpc/idl/netlogon.idl @@ -867,7 +867,7 @@ interface netlogon WERROR netr_GetAnyDCName( [in,unique] [string,charset(UTF16)] uint16 *logon_server, [in,unique] [string,charset(UTF16)] uint16 *domainname, - [out,unique] [string,charset(UTF16)] uint16 *dcname + [out,ref] [string,charset(UTF16)] uint16 **dcname ); diff --git a/source4/torture/rpc/netlogon.c b/source4/torture/rpc/netlogon.c index 378f9a21d5..41abfbc243 100644 --- a/source4/torture/rpc/netlogon.c +++ b/source4/torture/rpc/netlogon.c @@ -916,15 +916,17 @@ static bool test_GetAnyDCName(struct torture_context *tctx, { NTSTATUS status; struct netr_GetAnyDCName r; + const char *dcname = NULL; r.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); r.in.domainname = lp_workgroup(tctx->lp_ctx); + r.out.dcname = &dcname; status = dcerpc_netr_GetAnyDCName(p, tctx, &r); torture_assert_ntstatus_ok(tctx, status, "GetAnyDCName"); - if (r.out.dcname) { - torture_comment(tctx, "\tDC is at '%s'\n", r.out.dcname); + if (dcname) { + torture_comment(tctx, "\tDC is at '%s'\n", dcname); } return true; @@ -1569,6 +1571,7 @@ static bool test_ManyGetDCName(struct torture_context *tctx, struct lsa_EnumTrustDom t; uint32_t resume_handle = 0; struct netr_GetAnyDCName d; + const char *dcname = NULL; int i; @@ -1620,6 +1623,7 @@ static bool test_ManyGetDCName(struct torture_context *tctx, d.in.logon_server = talloc_asprintf(tctx, "\\\\%s", dcerpc_server_name(p)); + d.out.dcname = &dcname; for (i=0; iname.string, - d.out.dcname ? d.out.dcname : "unknown"); + dcname ? dcname : "unknown"); } return true; diff --git a/source4/winbind/wb_cmd_getdcname.c b/source4/winbind/wb_cmd_getdcname.c index 46d7f0d82f..2289243905 100644 --- a/source4/winbind/wb_cmd_getdcname.c +++ b/source4/winbind/wb_cmd_getdcname.c @@ -81,6 +81,7 @@ static void getdcname_recv_domain(struct composite_context *ctx) state, "\\\\%s", dcerpc_server_name(domain->netlogon_pipe)); state->g.in.domainname = state->domain_name; + state->g.out.dcname = talloc(state, const char **); req = dcerpc_netr_GetAnyDCName_send(domain->netlogon_pipe, state, &state->g); @@ -111,7 +112,7 @@ NTSTATUS wb_cmd_getdcname_recv(struct composite_context *c, talloc_get_type(c->private_data, struct cmd_getdcname_state); NTSTATUS status = composite_wait(c); if (NT_STATUS_IS_OK(status)) { - const char *p = state->g.out.dcname; + const char *p = *(state->g.out.dcname); if (*p == '\\') p += 1; if (*p == '\\') p += 1; *dcname = talloc_strdup(mem_ctx, p); diff --git a/source4/winbind/wb_dom_info_trusted.c b/source4/winbind/wb_dom_info_trusted.c index 46d3bf37f6..c3be5adb1f 100644 --- a/source4/winbind/wb_dom_info_trusted.c +++ b/source4/winbind/wb_dom_info_trusted.c @@ -161,6 +161,7 @@ static void trusted_dom_info_recv_dsr(struct rpc_request *req) state, "\\\\%s", dcerpc_server_name(state->my_domain->netlogon_pipe)); state->g.in.domainname = state->info->name; + state->g.out.dcname = talloc(state, const char *); req = dcerpc_netr_GetAnyDCName_send(state->my_domain->netlogon_pipe, state, &state->g); @@ -187,7 +188,7 @@ static void trusted_dom_info_recv_dcname(struct rpc_request *req) state->info->num_dcs = 1; state->info->dcs = talloc(state->info, struct nbt_dc_name); state->info->dcs[0].name = talloc_steal(state->info, - state->g.out.dcname); + *(state->g.out.dcname)); if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++; if (*state->info->dcs[0].name == '\\') state->info->dcs[0].name++; -- cgit