s4-dns: avoid search domains expansion in DNS resolver
authorAndrew Tridgell <tridge@samba.org>
Mon, 27 Sep 2010 21:34:43 +0000 (14:34 -0700)
committerAndrew Tridgell <tridge@samba.org>
Mon, 27 Sep 2010 23:18:23 +0000 (23:18 +0000)
add a '.' if the name contains a '.' already, but not at the end

source4/libcli/resolve/dns_ex.c

index 76dd10315406e90b41e50505a45474f6f5e740ef..711eb0abf182adcb62f5f24e35b5e9ed5cd24f88 100644 (file)
@@ -92,6 +92,14 @@ static void run_child_dns_lookup(struct dns_ex_state *state, int fd)
        uint32_t i;
        bool do_srv = (state->flags & RESOLVE_NAME_FLAG_DNS_SRV);
 
+       if (strchr(state->name.name, '.') && state->name.name[strlen(state->name.name)-1] != '.') {
+               /* we are asking for a fully qualified name, but the
+                  name doesn't end in a '.'. We need to prevent the
+                  DNS library trying the search domains configured in
+                  resolv.conf */
+               state->name.name = talloc_strdup_append(state->name.name, ".");
+       }
+
        /* this is the blocking call we are going to lots of trouble
           to avoid in the parent */
        reply = rk_dns_lookup(state->name.name, do_srv?"SRV":"A");