[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: GETADDRINFO -- core dumped slapd (ITS#1304)
Hi,
I think I have found one possible reason for some problems
with getaddrinfo() under Linux with GBU libc
Today (to be honest, it was 3 days ago), I had the same problem.
A freshly compiled slapd from openldap 2.0.17 crashed
during make test.
I played around a bit and extracted a test case from
tests/scripts/test000-rootdse:
LD_LIBRARY_PATH=..... ../servers/slapd/slapd ....
This was the offending command. When I only called
../servers/slapd/slapd ....
and used the already installed (older) libraries it magically
worked.
Three days of work with a debugger and searching through
the whole system, I found the reason for this strange behaviour:
I have libbind.a and the corresponding header files from
bind 8.2.x on my system !!!
Unfortunately the definition struct addrinfo from GNU libc
collides with the same struct of bind 8.2.x: the fields ai_addr and
ai_canonname are swapped.
When being compiled, libldap*.so and slapd use the
/isr/include/netdb.h hader file form the system library, but
since since libldap_r.so is being linked together with libbind.a,
it provides the wrong version of getaddrinfo() to slapd.
The correct version of the funktion is in libc.so and is not being
called, since libldap_r.so is first in the list of dynamic libraries.
I filed a bug report to the bind people.
It got the ticket number [BIND-BUGS #5027]
My workaround was wuite simple.
I simply changed the order in which libbind and libresolv
are checked for res_query and added a check for __res_query
in libresolv
So, libbind does not get included in the link list for libldap_r.so,
and everything works O.K.
This is the patch:
--- configure.in@@ -709,6 +709,16 @@
+++ configure.in Fri Oct 19 14:55:11 2001
ol_link_dnssrv=no
AC_CHECK_FUNC(res_query,:)
if test $ac_cv_func_res_query = no ; then
+ AC_CHECK_LIB(resolv, res_query)
+ ac_cv_func_res_query=$ac_cv_lib_resolv_res_query
+fi
+
+if test $ac_cv_func_res_query = no ; then
+ AC_CHECK_LIB(resolv, __res_query)
+ ac_cv_func_res_query=$ac_cv_lib_resolv___res_query
+fi
@@ -718,10 +728,6 @@
ac_cv_func_res_query=$ac_cv_lib_bind___res_query
fi
-if test $ac_cv_func_res_query = no ; then
- AC_CHECK_LIB(resolv, res_query)
- ac_cv_func_res_query=$ac_cv_lib_resolv_res_query
-fi
if test "$ac_cv_func_res_query" = yes ; then
AC_DEFINE(HAVE_RES_QUERY,1,
+
+if test $ac_cv_func_res_query = no ; then
AC_CHECK_LIB(bind, res_query)
ac_cv_func_res_query=$ac_cv_lib_bind_res_query
fi
Yours
Peter
PS: I read on the openldap ITS that one guy suggested writing
your own implementation of etaddrinfo().
Please do NOT do it !!!
The collisions between GNU libc and bind 8 show the dangers
of this approach !
--
Peter Marschall | eMail: peter.marschall@mayn.de
Scheffelstraße 15 | peter.marschall@is-energy.de
97072 Würzburg | Tel: 0931/14721
PGP: D7 FF 20 FE E6 6B 31 74 D1 10 88 E0 3C FE 28 35