rpcclient: Use cmdline_messaging_context
[samba.git] / source3 / libsmb / dsgetdcname.c
index 9864900632400dddb7320cdff41fe0701dd58926..bf96a2433790b7ff04edae69054ba0bf16625811 100644 (file)
@@ -21,6 +21,7 @@
 */
 
 #include "includes.h"
+#include "libsmb/dsgetdcname.h"
 #include "libsmb/namequery.h"
 #include "libads/sitename_cache.h"
 #include "../librpc/gen_ndr/ndr_netlogon.h"
@@ -910,6 +911,8 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
        uint32_t nt_version = NETLOGON_NT_VERSION_1 |
                              NETLOGON_NT_VERSION_5 |
                              NETLOGON_NT_VERSION_5EX_WITH_IP;
+       size_t len = strlen(lp_netbios_name());
+       char my_acct_name[len+2];
 
        if (msg_ctx == NULL) {
                return NT_STATUS_INVALID_PARAMETER;
@@ -921,6 +924,11 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
 
        nt_version |= map_ds_flags_to_nt_version(flags);
 
+       snprintf(my_acct_name,
+                sizeof(my_acct_name),
+                "%s$",
+                lp_netbios_name());
+
        DEBUG(10,("process_dc_netbios\n"));
 
        for (i=0; i<num_dcs; i++) {
@@ -936,7 +944,7 @@ static NTSTATUS process_dc_netbios(TALLOC_CTX *mem_ctx,
                }
 
                status = nbt_getdc(msg_ctx, 10, &dclist[i].ss, domain_name,
-                                  NULL, nt_version,
+                                  NULL, my_acct_name, ACB_WSTRUST, nt_version,
                                   mem_ctx, &nt_version, &dc_name, &r);
                if (NT_STATUS_IS_OK(status)) {
                        store_cache = true;