From: Sumit Bose Date: Thu, 24 Nov 2011 17:22:57 +0000 (-0500) Subject: s3-netlogon: use dsgetdcname() instead of get_dc_name() X-Git-Tag: tevent-0.9.15~648 X-Git-Url: http://git.samba.org/samba.git/?p=nivanova%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=6765e7c2a6618be8fa2ddcb93800ef32c3f54830 s3-netlogon: use dsgetdcname() instead of get_dc_name() Sometimes the domain parameter might not contain the NetBIOS name of the remote domain but the DNS name. Autobuild-User: Andreas Schneider Autobuild-Date: Thu Dec 22 19:21:21 CET 2011 on sn-devel-104 --- diff --git a/source3/rpc_server/netlogon/srv_netlog_nt.c b/source3/rpc_server/netlogon/srv_netlog_nt.c index 086a0ea3c5a..fdbe9373a87 100644 --- a/source3/rpc_server/netlogon/srv_netlog_nt.c +++ b/source3/rpc_server/netlogon/srv_netlog_nt.c @@ -185,6 +185,8 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p, struct netr_NETLOGON_INFO_4 *info4; const char *fn; uint32_t acct_ctrl; + NTSTATUS status; + struct netr_DsRGetDCNameInfo *dc_info; switch (p->opnum) { case NDR_NETR_LOGONCONTROL: @@ -303,12 +305,15 @@ WERROR _netr_LogonControl2Ex(struct pipes_struct *p, break; } - if (!get_dc_name(domain, NULL, dc_name2, &dc_ss)) { + status = dsgetdcname(p->mem_ctx, p->msg_ctx, domain, NULL, NULL, + DS_FORCE_REDISCOVERY | DS_RETURN_FLAT_NAME, + &dc_info); + if (!NT_STATUS_IS_OK(status)) { tc_status = WERR_NO_LOGON_SERVERS; break; } - dc_name = talloc_asprintf(p->mem_ctx, "\\\\%s", dc_name2); + dc_name = talloc_asprintf(p->mem_ctx, "\\\\%s", dc_info->dc_unc); if (!dc_name) { return WERR_NOMEM; }