s4-libnet: use the full DNS domain for CLDAP lookups if possible
authorAndrew Tridgell <tridge@samba.org>
Sat, 27 Nov 2010 01:59:51 +0000 (12:59 +1100)
committerAndrew Tridgell <tridge@samba.org>
Sat, 27 Nov 2010 02:47:52 +0000 (03:47 +0100)
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

index 66750706d81f723e314dbd393797ec3f23000fe6..272a3fad4129acae0461e1f9cb15dd31ebcffb6a 100644 (file)
@@ -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;