s4-finddc: use NBT lookup for a 1C name if joining a short domain name
[kai/samba.git] / source4 / libnet / libnet_lookup.c
index c6af75b4e371e2b12e0d47b5f35a8c5e70aaa20e..3677c2a31e79125e242a4a0194d94226dfd9565b 100644 (file)
@@ -195,7 +195,10 @@ struct tevent_req *libnet_LookupDCs_send(struct libnet_context *ctx,
        struct finddcs finddcs_io;
 
        ZERO_STRUCT(finddcs_io);
-       finddcs_io.in.dns_domain_name = lpcfg_realm(ctx->lp_ctx);
+       finddcs_io.in.domain_name = lpcfg_realm(ctx->lp_ctx);
+       if (strcmp(finddcs_io.in.domain_name, "") == 0) {
+               finddcs_io.in.domain_name = lpcfg_workgroup(ctx->lp_ctx);
+       }
        finddcs_io.in.minimum_dc_flags = NBT_SERVER_LDAP | NBT_SERVER_DS | NBT_SERVER_WRITABLE;