From 8edf3d71318acdba73f7415ae2db7b7988e34029 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 27 Sep 2010 14:34:43 -0700 Subject: s4-dns: avoid search domains expansion in DNS resolver add a '.' if the name contains a '.' already, but not at the end --- source4/libcli/resolve/dns_ex.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source4/libcli/resolve/dns_ex.c') diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c index 76dd103154..711eb0abf1 100644 --- a/source4/libcli/resolve/dns_ex.c +++ b/source4/libcli/resolve/dns_ex.c @@ -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"); -- cgit