]> Pileus Git - ~andy/fetchmail/commitdiff
* Improve KAME/getnameinfo.c portability to Linux libc5 systems.
authorMatthias Andree <matthias.andree@gmx.de>
Mon, 15 May 2006 10:59:45 +0000 (10:59 -0000)
committerMatthias Andree <matthias.andree@gmx.de>
Mon, 15 May 2006 10:59:45 +0000 (10:59 -0000)
  Based on a patch by Dan Fandrich.
* Provide INET6 to KAME/getnameinfo.c (only useful on IPv6-enabled systems that
  lack getnameinfo, and there only visible in some Received: headers).
  Found by Dan Fandrich.

svn path=/branches/BRANCH_6-3/; revision=4839

KAME/getnameinfo.c
NEWS
configure.ac

index 9549600c95fc272400a92fad955b4402ed7f8fc8..fb97530ea40b8ef048c8fa16d2d7e115e2af898e 100644 (file)
@@ -71,7 +71,9 @@
 #include <stddef.h>
 #include <errno.h>
 
+#ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
+#endif
 #include "fetchmail.h"
 #include "getaddrinfo.h"
 
@@ -284,9 +286,16 @@ getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
                        }
 #endif
                        default:
+#ifdef HAVE_INET_NTOP
                                if (inet_ntop(afd->a_af, addr, host,
                                    hostlen) == NULL)
                                        return EAI_SYSTEM;
+#else
+                               if (afd->a_af == AF_INET)
+                                   strlcpy(host, inet_ntoa(addr), hostlen);
+                               else
+                                   return EAI_FAMILY;
+#endif
                                break;
                        }
                }
diff --git a/NEWS b/NEWS
index 9cfb104a90ff13dada988183e17a3bf000c62f7e..65ecf1d31187df0f7cf7cbbda9dc8c79e43681a6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,11 @@ fetchmail 6.3.5 (not yet released):
   guessing.
 * Improve --with-gssapi auto detection for /usr-based GSSAPI installs.
 * Fix --with-gssapi builds for NetBSD 3.0.
+* Improve KAME/getnameinfo.c portability to Linux libc5 systems.
+  Based on a patch by Dan Fandrich.
+* Provide INET6 to KAME/getnameinfo.c (only useful on IPv6-enabled systems that
+  lack getnameinfo, and there only visible in some Received: headers).
+  Found by Dan Fandrich.
 
 # CHANGES:
 * Rename all fetchmail-internal lock_* functions to fm_lock_*. Obsoletes
index 0a25f5a40844a98f0251927a5e26e6aee1aab607..d17ed383fc0f68dae5e192e042f48d33f97d850a 100644 (file)
@@ -142,6 +142,26 @@ AC_CHECK_FUNCS(tcsetattr stty setsid geteuid seteuid dnl
   sigaction strdup setlocale)
 
 AC_CHECK_DECLS(strerror)
+dnl INET6 is used by KAME/getnameinfo
+AC_CACHE_CHECK(for AF_INET6/PF_INET6,ac_cv_inet6,
+AC_COMPILE_IFELSE([
+  AC_LANG_PROGRAM([[
+    #ifdef HAVE_SYS_TYPES_H
+    #include <sys/types.h>
+    #endif
+    #ifdef HAVE_SYS_SOCKET_H
+    #include <sys/socket.h>
+    #endif
+  ]],[[
+    int foo = AF_INET6;
+    int bar = PF_INET6;
+  ]])],
+  ac_cv_inet6=yes , ac_cv_inet6=no
+))
+if test "x$ac_cv_inet6" = xyes
+then
+    AC_DEFINE(INET6,1,Define to 1 if your system defines AF_INET6 and PF_INET6.)
+fi
 
 # Under Red Hat 4.0 (and many other Linuxes) -lresolv is seriously flaky
 # and breaks gethostbyname(2).  It's better to use the bind stuff in the C
@@ -394,7 +414,7 @@ AC_ARG_ENABLE(opie,
 test "$with_opie" = "yes" && AC_DEFINE(OPIE_ENABLE,1,Define if you want OPIE support compiled in)
 
 AC_SEARCH_LIBS(getaddrinfo, inet6, [AC_DEFINE(HAVE_GETADDRINFO,1,[define to 1 if you have the getaddrinfo function])])
-AC_CHECK_FUNCS(getnameinfo)
+AC_CHECK_FUNCS(getnameinfo inet_ntop)
 
 # This version of the Kerberos 4 and 5 options addresses the follwing issues:
 #