[krbdev.mit.edu #6534] getaddrinfo in src/util/support/fake-addrinfo.c causes leak

Greg Hudson via RT rt-comment at krbdev.mit.edu
Thu Feb 28 12:02:47 EST 2013


In hindsight, I believe this patch's description was incorrect and I 
accepted it too uncritically.  Accepting this patch did fix a memory 
leak, but I believe also caused rdns=false to be broken on Linux from 
1.7.1 to 1.10.2.

The bug report's description claims that COPY_FIRST_CANONNAME was 
working around a historical glibc problem related to memory allocation, 
fixed in 2004-08-17.  Actually reading Ken's comment reveals that 
COPY_FIRST_CANONNAME actually works around glibc's sometimes-use of PTR 
lookups to set the canonname.  The 2004-08-17 glibc change caused our 
workaround to start leaking memory, but didn't fix the problem of using 
PTR lookups.

We later worked around the same problem in a different way, by using an 
invocation of getaddrinfo which doesn't result in PTR lookups.  That 
workaround was in #7124, after a failed attempt in #6922.

Part of my confusion at the time likely came from the fact that the bug 
report mentioned in Ken's comment (http://bugs.debian.org/cgi-
bin/bugreport.cgi?bug=133668) was closed on 2004-12-19 because his test 
case no longer revealed the problem.  The test case called getaddrinfo 
without AI_ADDRCONFIG or an address family, which I guess used PTR 
records in the past but doesn't now.  However, getaddrinfo with 
AI_ADDRCONFIG or an address family still uses PTR records.


More information about the krb5-bugs mailing list