aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Yu <tlyu@mit.edu>2010-01-12 02:49:42 +0000
committerTom Yu <tlyu@mit.edu>2010-01-12 02:49:42 +0000
commit98f0a65646833156bf86112ddf7ca02c0cd3447f (patch)
treef7fb5999f4761ceaef36897bd1902b12bffe0d9d
parent6419f49ecd068cb116d1ebe6010ac03f22aa9f83 (diff)
downloadkrb5-98f0a65646833156bf86112ddf7ca02c0cd3447f.zip
krb5-98f0a65646833156bf86112ddf7ca02c0cd3447f.tar.gz
krb5-98f0a65646833156bf86112ddf7ca02c0cd3447f.tar.bz2
pull up r22643 from trunk
------------------------------------------------------------------------ r22643 | ghudson | 2009-08-28 12:00:54 -0400 (Fri, 28 Aug 2009) | 7 lines ticket: 6534 Disable the COPY_FIRST_CANONNAME workaround on Linux glibc 2.4 and later, since it leaks memory on fixed glibc versions. We will still leak memory on glibc 2.3.4 through 2.3.6 (e.g. RHEL 4) but that's harder to detect. ticket: 6534 version_fixed: 1.7.1 status: resolved git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-7@23630 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/util/support/fake-addrinfo.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/util/support/fake-addrinfo.c b/src/util/support/fake-addrinfo.c
index 4b628bb..34ce770 100644
--- a/src/util/support/fake-addrinfo.c
+++ b/src/util/support/fake-addrinfo.c
@@ -140,7 +140,15 @@ extern /*@dependent@*/ char *gai_strerror (int code) /*@*/;
#endif
#if defined (__linux__) && defined(HAVE_GETADDRINFO)
-# define COPY_FIRST_CANONNAME
+/* Define COPY_FIRST_CANONNAME for glibc 2.3 and prior. */
+#include <features.h>
+# ifdef __GLIBC_PREREQ
+# if ! __GLIBC_PREREQ(2, 4)
+# define COPY_FIRST_CANONNAME
+# endif
+# else
+# define COPY_FIRST_CANONNAME
+# endif
#endif
#ifdef _AIX
@@ -1157,7 +1165,7 @@ getaddrinfo (const char *name, const char *serv, const struct addrinfo *hint,
return aierr;
}
- /* Linux libc version 6 (libc-2.2.4.so on Debian) is broken.
+ /* Linux libc version 6 prior to 2.3.4 is broken.
RFC 2553 says that when AI_CANONNAME is set, the ai_canonname
flag of the first returned structure has the canonical name of
@@ -1188,9 +1196,12 @@ getaddrinfo (const char *name, const char *serv, const struct addrinfo *hint,
Ref: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=133668 .
Since it's dependent on the target hostname, it's hard to check
- for at configure time. Always do it on Linux for now. When
- they get around to fixing it, add a compile-time or run-time
- check for the glibc version in use.
+ for at configure time. The bug was fixed in glibc 2.3.4.
+ After the fix, the ai_canonname field is allocated, so our
+ workaround leaks memory. We disable the workaround for glibc
+ >= 2.4, but there is no easy way to test for glibc patch
+ versions, so we still leak memory under glibc 2.3.4 through
+ 2.3.6.
Some Windows documentation says that even when AI_CANONNAME is
set, the returned ai_canonname field can be null. The NetBSD