[syslog-ng] [Bug 240] host() in filters fail to match if using use_dns(yes)

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Mon Jul 22 17:37:41 CEST 2013


https://bugzilla.balabit.com/show_bug.cgi?id=240





--- Comment #1 from Balazs Scheidler <bazsi at balabit.hu>  2013-07-22 17:37:41 ---
I've just pushed a fix to the f/fix-fqdn-processing-for-numeric-hosts branch on github.com/balabit/syslog-ng-3.4.

commit f8507a653d2779d9f82c445e4a649d4ee025535b
Author: Balazs Scheidler <bazsi at balabit.hu>
Date:   Mon Jul 22 17:35:48 2013 +0200

    misc: fixed truncated IP addresses set in $HOST

    In case getnameinfo() fails to resolve an address, it automatically returns
    the numeric IP address without setting an error condition, which messes up
    the logic in resolve_sockaddr() and causes the IP address to be truncated if
    use_fqdn() is set to no.  This patch instructs getnameinfo() to return
    failure instead by passing NI_NAMEREQD in flags.

    References: bugzilla #240
    Signed-off-by: Balazs Scheidler <bazsi at balabit.hu>

diff --git a/lib/misc.c b/lib/misc.c
index 2c8e67d..9ff8d6b 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -218,7 +218,7 @@ resolve_sockaddr(gchar *result, gsize *result_len, GSockAddr *saddr, gboolean us
               if ((!use_dns_cache || !dns_cache_lookup(saddr->sa.sa_family, addr, (const gchar **) &hname, &positive)) && usedns != 2)
                 {
 #ifdef HAVE_GETNAMEINFO
-                  if (getnameinfo(&saddr->sa, saddr->salen, buf, sizeof(buf), NULL, 0, 0) == 0)
+                  if (getnameinfo(&saddr->sa, saddr->salen, buf, sizeof(buf), NULL, 0, NI_NAMEREQD) == 0)
                     hname = buf;
 #else
                   struct hostent *hp;

This seems to resolve the issue for me.  Can you check if it really does?

@Algernon: can you please merge this to master? Thanks


-- 
Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the syslog-ng mailing list