Package: gnats
Version: 4.1.0-0
Severity: important
Tags: patch

After installing gnats, I discovered that any attempts to connect to the
gnatsd resulted in two log file entries in syslog that look like this:
May 11 15:23:34 gaia gnatsd[13743]: connect from ::ffff:192.168.19.254 
(::ffff:192.168.19.254)
May 11 15:23:34 gaia gnatsd[13743]: ?: bad address family 10 

Upon looking up where this line came from, it appears to be because the
incoming socket is being treated as if it is AF_INET6 rather than
AF_INET, which is what gnatsd is expecting.  I conclude that this is
happening on my system because it is set up with IPv6 addresses as well
as IPv4 addresses.

I have patched my local copy to accept connections with an address
family of AF_INET6 and to look the name up properly.  If I can figure
out how to do it, I'll attach the patch.

-- System Information:
Debian Release: testing/unstable
  APT prefers hoary-backports
  APT policy: (500, 'hoary-backports'), (500, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-1-k7
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages gnats depends on:
ii  debconf                       1.5.0      Debian configuration management sy
ii  debianutils                   2.16       Miscellaneous utilities specific t
ii  exim [mail-transport-agent]   3.36-18    An MTA (Mail Transport Agent)
ii  gnats-user                    4.1.0-0    The GNU problem report management 
ii  libc6                         2.3.6-7    GNU C Library: Shared libraries

gnats recommends no packages.

-- no debconf information
diff -Naur gnats-4.1.0/gnats/gnatsd.c gnats-4.1.0-new/gnats/gnatsd.c
--- gnats-4.1.0/gnats/gnatsd.c	2005-02-24 14:22:46.000000000 -0600
+++ gnats-4.1.0-new/gnats/gnatsd.c	2006-05-11 16:17:10.000000000 -0500
@@ -287,7 +287,7 @@
 
 /*  */
 static char *
-get_name (struct in_addr *host)
+get_name (struct in_addr *host, int type)
 {
   char *buf;
   int i;
@@ -296,7 +296,7 @@
   char **pp;
 #endif
 
-  hp = gethostbyaddr ((char *) host, sizeof (*host), AF_INET);
+  hp = gethostbyaddr ((char *) host, sizeof (*host), type);
   if (hp == NULL)
     {
       return NULL;
@@ -617,7 +617,7 @@
     }
   else
     {
-      if (s.sin_family != AF_INET)
+      if ((s.sin_family != AF_INET) && (s.sin_family != AF_INET6))
 	{
 	  syslog (LOG_ERR, "%s: bad address family %ld",
 		  "?", (long) s.sin_family);
@@ -628,7 +628,7 @@
       else
 	{
 	  current_addr = (char *) inet_ntoa (s.sin_addr);
-	  current_host = get_name (&s.sin_addr);
+	  current_host = get_name (&s.sin_addr, s.sin_family);
 	  if (current_host == NULL)
 	    {
 	      current_host = current_addr;

Reply via email to