From dbb9500448ada04094db854aa81118d95cdc687a Mon Sep 17 00:00:00 2001 From: Andrew Tridgell <tridge@samba.org> Date: Sat, 27 Nov 2010 12:59:51 +1100 Subject: [PATCH] s4-libnet: use the full DNS domain for CLDAP lookups if possible many of the internal libnet interfaces use the short domain name, which leads to unreliable NBT lookups. If we are trying to look for our workgroup, then look for our DNS domain instead Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org> Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Sat Nov 27 03:47:52 CET 2010 on sn-devel-104 --- source4/libnet/libnet_lookup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source4/libnet/libnet_lookup.c b/source4/libnet/libnet_lookup.c index 66750706d81..272a3fad412 100644 --- a/source4/libnet/libnet_lookup.c +++ b/source4/libnet/libnet_lookup.c @@ -195,7 +195,12 @@ struct tevent_req *libnet_LookupDCs_send(struct libnet_context *ctx, struct finddcs finddcs_io; ZERO_STRUCT(finddcs_io); - finddcs_io.in.domain_name = io->in.domain_name; + + if (strcasecmp_m(io->in.domain_name, lpcfg_workgroup(ctx->lp_ctx)) == 0) { + finddcs_io.in.domain_name = lpcfg_dnsdomain(ctx->lp_ctx); + } else { + finddcs_io.in.domain_name = io->in.domain_name; + } finddcs_io.in.minimum_dc_flags = NBT_SERVER_LDAP | NBT_SERVER_DS | NBT_SERVER_WRITABLE; finddcs_io.in.server_address = ctx->server_address;