[Date Prev][Date Next] [Chronological] [Thread] [Top]

ITS#2643




AC_GAI_STRERROR is defined iff HAVE_GETADDRINFO is also defined.  However, in
the code (in at least /libraries/libldap/util-int.c) uses of AC_GAI_STRERROR
appear in places which are not wrapped by ifdef HAVE_GETADDRINFO.

Since openLDAP supplies a local version of GAI_STRERROR, it seems to be safe
to simply remove the wrapping HAVE_GETADDRINFO from the symbol #definition in
socket.h and from the function definition in util-int.c (patch 1 below) 


If dinking with this define sets off anyone's warning radar, the other
alternative is chewing on all the AC_GAI_STRERROR uses:  

./libraries/libldap/os-ip.c:                    AC_GAI_STRERROR(err), 0, 0);
./libraries/libldap/util-int.c: if ( rc ) *err = AC_GAI_STRERROR( rc );
./servers/slapd/daemon.c:                                  AC_GAI_STRERROR(err), 0, 0 );
./servers/slapd/daemon.c:                               AC_GAI_STRERROR(err), 0, 0);

os-ip.c's and daemon.c's uses are all inside a ifdef of HAVE_GETADDRINFO.  Pass.

util-int.c uses AC_GAI_STRERROR inside a block which is dependent on the
definition of HAVE_GETNAMEINFO.  So, we could instead invoke the definition of
AC_GAI_STRERROR and ldap_pvt_gai_strerror based on HAVE_GETNAMEINFO -or-
HAVE_GETADDRINFO.   (patch 2 below)



Begin patch 1:-- 
- --- ./libraries/libldap/util-int.c.orig 2004-01-23 14:26:39.000000000 -0500
+++ ./libraries/libldap/util-int.c      2004-01-23 14:26:46.000000000 -0500
@@ -540,7 +540,7 @@
        return fqdn;
 }
 
- -#if defined( HAVE_GETADDRINFO ) && !defined( HAVE_GAI_STRERROR )
+#if !defined( HAVE_GAI_STRERROR )
 char *ldap_pvt_gai_strerror (int code) {
        static struct {
                int code;
- --- include/ac/socket.h.orig    2004-01-23 12:52:05.000000000 -0500
+++ include/ac/socket.h 2004-01-23 12:53:10.000000000 -0500
@@ -192,13 +192,11 @@
 #      define INET6_ADDRSTRLEN 46
 #endif
 
- -#ifdef HAVE_GETADDRINFO
- -#      ifdef HAVE_GAI_STRERROR
- -#              define AC_GAI_STRERROR(x)       (gai_strerror((x)))
- -#      else
- -#              define AC_GAI_STRERROR(x)       (ldap_pvt_gai_strerror((x)))
- -               LDAP_F (char *) ldap_pvt_gai_strerror( int );
- -#      endif
+#ifdef HAVE_GAI_STRERROR
+#      define AC_GAI_STRERROR(x)       (gai_strerror((x)))
+#else
+#      define AC_GAI_STRERROR(x)       (ldap_pvt_gai_strerror((x)))
+       LDAP_F (char *) ldap_pvt_gai_strerror( int );
 #endif
 
 #ifndef HAVE_GETPEEREID
End patch 1:-- 







Begin patch 2:-- 
- --- ./include/ac/socket.h.orig  2004-01-23 15:30:54.000000000 -0500
+++ ./include/ac/socket.h       2004-01-23 15:31:03.000000000 -0500
@@ -192,7 +192,7 @@
 #      define INET6_ADDRSTRLEN 46
 #endif
 
- -#ifdef HAVE_GETADDRINFO
+#if (defined(HAVE_GETADDRINFO) || defined(HAVE_GETNAMEINFO))
 #      ifdef HAVE_GAI_STRERROR
 #              define AC_GAI_STRERROR(x)       (gai_strerror((x)))
 #      else
- --- ./libraries/libldap/util-int.c.orig 2004-01-23 15:28:28.000000000 -0500
+++ ./libraries/libldap/util-int.c      2004-01-23 15:29:22.000000000 -0500
@@ -540,7 +540,7 @@
        return fqdn;
 }
 
- -#if defined( HAVE_GETADDRINFO ) && !defined( HAVE_GAI_STRERROR )
+#if (defined( HAVE_GETADDRINFO ) || defined(GAVE_GETNAMEINFO)) && !defined( HAVE_GAI_STRERROR )
 char *ldap_pvt_gai_strerror (int code) {
        static struct {
                int code;
End patch 2:--