From 279033fc1c2a7182b2cb0f83a99c082c44c56959 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Fri, 14 Oct 2005 03:40:03 +0000 Subject: [PATCH] ITS#3440: (blind) fix for VxWorks inet_ntoa(3) leak, use inet_ntoa_b(3) instead. --- configure | 4 +++- configure.in | 1 + include/portable.hin | 3 +++ libraries/libldap/os-ip.c | 10 ++++++++++ 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 0b36283a7a..f8dc1b0e91 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.600 2005/09/17 20:22:15 hallvard Exp . +# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.601 2005/10/13 21:52:21 kurt Exp . # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59. # @@ -41249,6 +41249,7 @@ fi + for ac_func in \ @@ -41270,6 +41271,7 @@ for ac_func in \ getspnam \ gettimeofday \ initgroups \ + inet_ntoa_b \ lockf \ memcpy \ memmove \ diff --git a/configure.in b/configure.in index 8c376899ae..ec8f749343 100644 --- a/configure.in +++ b/configure.in @@ -2531,6 +2531,7 @@ AC_CHECK_FUNCS( \ getspnam \ gettimeofday \ initgroups \ + inet_ntoa_b \ lockf \ memcpy \ memmove \ diff --git a/include/portable.hin b/include/portable.hin index 4a0ede1d64..10425199a3 100644 --- a/include/portable.hin +++ b/include/portable.hin @@ -277,6 +277,9 @@ /* define to you inet_aton(3) is available */ #undef HAVE_INET_ATON +/* Define to 1 if you have the `inet_ntoa_b' function. */ +#undef HAVE_INET_NTOA_B + /* Define to 1 if you have the `inet_ntop' function. */ #undef HAVE_INET_NTOP diff --git a/libraries/libldap/os-ip.c b/libraries/libldap/os-ip.c index 65341b5e84..0c5fb36b8b 100644 --- a/libraries/libldap/os-ip.c +++ b/libraries/libldap/os-ip.c @@ -529,8 +529,18 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, sizeof(sin.sin_addr) ); } +#ifdef HAVE_INET_NTOA_B + { + /* for VxWorks */ + char address[INET_ADDR_LEN]; + inet_ntoa_b(sin.sin_address, address); + osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", + address, port, 0); + } +#else osip_debug(ld, "ldap_connect_to_host: Trying %s:%d\n", inet_ntoa(sin.sin_addr), port, 0); +#endif rc = ldap_pvt_connect(ld, s, (struct sockaddr *)&sin, sizeof(sin), -- 2.39.5