s3-netlogon: use dsgetdcname() instead of get_dc_name()
authorSumit Bose <sbose@redhat.com>
Thu, 24 Nov 2011 17:22:57 +0000 (12:22 -0500)
committerAndreas Schneider <asn@cryptomilk.org>
Thu, 22 Dec 2011 18:21:21 +0000 (19:21 +0100)
Sometimes the domain parameter might not contain the NetBIOS name of the remote
domain but the DNS name.

Autobuild-User: Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date: Thu Dec 22 19:21:21 CET 2011 on sn-devel-104

source3/rpc_server/netlogon/srv_netlog_nt.c

index 086a0ea3c5ab90a59b76918aa3e2f6331a80208e..fdbe9373a8767f9ef5e30ba5f2e517ded36b846a 100644 (file)
@@ -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;
                }