[PATCH] resolve_sockaddr: Fix domain stripping on initial lookup.
When looking up a hostname, we were only setting the 'positive' bool during lookup, so it was only set when the host already existed in the cache. When it didn't, and we just put it there right after the failed lookup, the bool remained false. This resulted in the domain part not being stripped even when use_fqdn(no) was set. The fix implemented in this patch is dead simple: if we managed to resolve a host, we set the bool to TRUE. Signed-off-by: Gergely Nagy <algernon@balabit.hu> --- lib/misc.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/lib/misc.c b/lib/misc.c index 80f5877..82c2d1b 100644 --- a/lib/misc.c +++ b/lib/misc.c @@ -211,7 +211,10 @@ resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean us hp = gethostbyaddr(addr, addr_len, saddr->sa.sa_family); hname = (hp && hp->h_name) ? hp->h_name : NULL; - + + if (hname) + positive = TRUE; + if (use_dns_cache && hname) { /* resolution success, store this as a positive match in the cache */ -- 1.7.7.1
Hi, Thanks Gergely, applied to 3.3. On Wed, 2011-11-02 at 11:58 +0100, Gergely Nagy wrote:
When looking up a hostname, we were only setting the 'positive' bool during lookup, so it was only set when the host already existed in the cache. When it didn't, and we just put it there right after the failed lookup, the bool remained false.
This resulted in the domain part not being stripped even when use_fqdn(no) was set.
The fix implemented in this patch is dead simple: if we managed to resolve a host, we set the bool to TRUE.
-- Bazsi
participants (2)
-
Balazs Scheidler
-
Gergely Nagy