mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-20 22:59:34 -05:00
Initial inet_aton() detection.
This commit is contained in:
parent
1b41dfbce0
commit
2b79ff2c48
7 changed files with 115 additions and 44 deletions
|
|
@ -773,6 +773,33 @@ AC_DEFUN(OL_TYPE_SOCKLEN_T,
|
|||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl Define inet_aton is available
|
||||
AC_DEFUN(OL_FUNC_INET_ATON,
|
||||
[AC_CACHE_CHECK([for inet_aton()], ol_cv_func_inet_aton,
|
||||
[AC_TRY_COMPILE([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
# ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
# endif
|
||||
#endif
|
||||
], [struct in_addr in;
|
||||
int rc = inet_aton( "255.255.255.255", &in );],
|
||||
ol_cv_func_inet_aton=yes, ol_cv_func_inet_aton=no)])
|
||||
if test $ol_cv_func_inet_aton != no; then
|
||||
AC_DEFINE(HAVE_INET_ATON, 1,
|
||||
[define to you inet_aton(3) is available])
|
||||
fi
|
||||
])dnl
|
||||
dnl
|
||||
dnl ====================================================================
|
||||
dnl check no of arguments for ctime_r
|
||||
AC_DEFUN(OL_FUNC_CTIME_R_NARGS,
|
||||
[AC_CACHE_CHECK(number of arguments of ctime_r, ol_cv_func_ctime_r_nargs,
|
||||
|
|
|
|||
93
configure
vendored
93
configure
vendored
|
|
@ -12109,14 +12109,63 @@ fi
|
|||
fi
|
||||
|
||||
|
||||
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
|
||||
echo "configure:12114: checking for vprintf" >&5
|
||||
if eval "test \"\${ac_cv_func_vprintf+set}\" = set"; then
|
||||
echo $ac_n "checking for inet_aton()""... $ac_c" 1>&6
|
||||
echo "configure:12114: checking for inet_aton()" >&5
|
||||
if eval "test \"\${ol_cv_func_inet_aton+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12119 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
# include <sys/types.h>
|
||||
#endif
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
# include <sys/socket.h>
|
||||
# ifdef HAVE_SYS_SELECT_H
|
||||
# include <sys/select.h>
|
||||
# endif
|
||||
# include <netinet/in.h>
|
||||
# ifdef HAVE_ARPA_INET_H
|
||||
# include <arpa/inet.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
struct in_addr in;
|
||||
int rc = inet_aton( "255.255.255.255", &in );
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12141: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ol_cv_func_inet_aton=yes
|
||||
else
|
||||
echo "configure: failed program was:" >&5
|
||||
cat conftest.$ac_ext >&5
|
||||
rm -rf conftest*
|
||||
ol_cv_func_inet_aton=no
|
||||
fi
|
||||
rm -f conftest*
|
||||
fi
|
||||
|
||||
echo "$ac_t""$ol_cv_func_inet_aton" 1>&6
|
||||
if test $ol_cv_func_inet_aton != no; then
|
||||
cat >> confdefs.h <<\EOF
|
||||
#define HAVE_INET_ATON 1
|
||||
EOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
|
||||
echo "configure:12163: checking for vprintf" >&5
|
||||
if eval "test \"\${ac_cv_func_vprintf+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12168 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char vprintf(); below. */
|
||||
#include <assert.h>
|
||||
|
|
@ -12139,7 +12188,7 @@ f = vprintf;
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:12192: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_vprintf=yes"
|
||||
else
|
||||
|
|
@ -12163,12 +12212,12 @@ fi
|
|||
|
||||
if test "$ac_cv_func_vprintf" != yes; then
|
||||
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
|
||||
echo "configure:12167: checking for _doprnt" >&5
|
||||
echo "configure:12216: checking for _doprnt" >&5
|
||||
if eval "test \"\${ac_cv_func__doprnt+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12172 "configure"
|
||||
#line 12221 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char _doprnt(); below. */
|
||||
|
|
@ -12192,7 +12241,7 @@ f = _doprnt;
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12196: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:12245: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func__doprnt=yes"
|
||||
else
|
||||
|
|
@ -12221,12 +12270,12 @@ if test $ac_cv_func_vprintf = yes ; then
|
|||
for ac_func in vsnprintf vsprintf
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:12225: checking for $ac_func" >&5
|
||||
echo "configure:12274: checking for $ac_func" >&5
|
||||
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12230 "configure"
|
||||
#line 12279 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
|
@ -12250,7 +12299,7 @@ f = $ac_func;
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:12303: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
|
@ -12325,12 +12374,12 @@ for ac_func in \
|
|||
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:12329: checking for $ac_func" >&5
|
||||
echo "configure:12378: checking for $ac_func" >&5
|
||||
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12334 "configure"
|
||||
#line 12383 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
|
@ -12354,7 +12403,7 @@ f = $ac_func;
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:12407: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
|
@ -12382,12 +12431,12 @@ done
|
|||
for ac_func in getopt tempnam
|
||||
do
|
||||
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
|
||||
echo "configure:12386: checking for $ac_func" >&5
|
||||
echo "configure:12435: checking for $ac_func" >&5
|
||||
if eval "test \"\${ac_cv_func_$ac_func+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12391 "configure"
|
||||
#line 12440 "configure"
|
||||
#include "confdefs.h"
|
||||
/* System header to define __stub macros and hopefully few prototypes,
|
||||
which can conflict with char $ac_func(); below. */
|
||||
|
|
@ -12411,7 +12460,7 @@ f = $ac_func;
|
|||
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:12464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_func_$ac_func=yes"
|
||||
else
|
||||
|
|
@ -12440,13 +12489,13 @@ done
|
|||
|
||||
# Check Configuration
|
||||
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
|
||||
echo "configure:12444: checking declaration of sys_errlist" >&5
|
||||
echo "configure:12493: checking declaration of sys_errlist" >&5
|
||||
if eval "test \"\${ol_cv_dcl_sys_errlist+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12450 "configure"
|
||||
#line 12499 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
@ -12456,7 +12505,7 @@ int main() {
|
|||
char *c = (char *) *sys_errlist
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12460: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:12509: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ol_cv_dcl_sys_errlist=yes
|
||||
ol_cv_have_sys_errlist=yes
|
||||
|
|
@ -12479,20 +12528,20 @@ EOF
|
|||
|
||||
|
||||
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
|
||||
echo "configure:12483: checking existence of sys_errlist" >&5
|
||||
echo "configure:12532: checking existence of sys_errlist" >&5
|
||||
if eval "test \"\${ol_cv_have_sys_errlist+set}\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 12489 "configure"
|
||||
#line 12538 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <errno.h>
|
||||
int main() {
|
||||
char *c = (char *) *sys_errlist
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:12496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:12545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
ol_cv_have_sys_errlist=yes
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1798,6 +1798,8 @@ dnl AM_FUNC_MKTIME dnl checks for sys/time.h and unistd.h
|
|||
AC_FUNC_STRFTIME
|
||||
dnl AM_FUNC_STRTOD
|
||||
|
||||
OL_FUNC_INET_ATON
|
||||
|
||||
dnl we should use vfork instead of fork in a number of places...
|
||||
dnl AC_FUNC_VFORK
|
||||
AC_FUNC_VPRINTF
|
||||
|
|
|
|||
|
|
@ -101,6 +101,12 @@
|
|||
# define AC_SOCKET_INVALID (-1)
|
||||
#endif
|
||||
|
||||
#if !defined( HAVE_INET_ATON ) && !defined( inet_aton )
|
||||
#define inet_aton ldap_pvt_inet_aton
|
||||
struct in_addr;
|
||||
int ldap_pvt_inet_aton( const char *, struct in_addr * );
|
||||
#endif
|
||||
|
||||
#if defined(__WIN32) && defined(_ALPHA)
|
||||
/* NT on Alpha is hosed. */
|
||||
#define AC_HTONL( l ) \
|
||||
|
|
|
|||
|
|
@ -738,6 +738,9 @@
|
|||
/* define if cross compiling */
|
||||
#undef CROSS_COMPILING
|
||||
|
||||
/* define to you inet_aton(3) is available */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
/* define if sys_errlist is not declared in stdio.h or errno.h */
|
||||
#undef DECL_SYS_ERRLIST
|
||||
|
||||
|
|
|
|||
|
|
@ -257,23 +257,18 @@ ldap_pvt_connect(LDAP *ld, int s, struct sockaddr_in *sin, int async)
|
|||
return ( -1 );
|
||||
}
|
||||
|
||||
static int
|
||||
ldap_pvt_inet_aton( LDAP *ld, const char *host, struct in_addr *in)
|
||||
{
|
||||
#ifdef notyet
|
||||
/* #ifdef HAVE_INET_ATON */
|
||||
return inet_aton( host, in );
|
||||
#else
|
||||
#ifndef HAVE_INET_ATON
|
||||
int
|
||||
ldap_pvt_inet_aton( const char *host, struct in_addr *in)
|
||||
{
|
||||
unsigned long u = inet_addr( host );
|
||||
if ( u != 0xffffffff || u != (unsigned long) -1 ) {
|
||||
in->s_addr = u;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
int
|
||||
|
|
@ -291,7 +286,7 @@ ldap_connect_to_host(LDAP *ld, Sockbuf *sb, const char *host,
|
|||
osip_debug(ld, "ldap_connect_to_host\n",0,0,0);
|
||||
|
||||
if (host != NULL) {
|
||||
if (! ldap_pvt_inet_aton( ld, host, &in) ) {
|
||||
if (! inet_aton( host, &in) ) {
|
||||
rc = ldap_pvt_gethostbyname_a(host, &he_buf, &ha_buf,
|
||||
&hp, &local_h_errno);
|
||||
|
||||
|
|
|
|||
|
|
@ -251,13 +251,7 @@ open_listener(
|
|||
|
||||
} else {
|
||||
/* host or address was specified */
|
||||
|
||||
#ifdef HAVE_WINSOCK
|
||||
if((l.sl_addr.sin_addr.S_un.S_addr = inet_addr(lud->lud_host)) == INADDR_NONE)
|
||||
#else
|
||||
if(!inet_aton(lud->lud_host, &l.sl_addr.sin_addr))
|
||||
#endif
|
||||
{
|
||||
if( !inet_aton( lud->lud_host, &l.sl_addr.sin_addr ) ) {
|
||||
struct hostent *he = gethostbyname( lud->lud_host );
|
||||
if( he == NULL ) {
|
||||
Debug( LDAP_DEBUG_ANY, "invalid host (%s) in URL: %s",
|
||||
|
|
@ -266,13 +260,8 @@ open_listener(
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef HAVE_WINSOCK
|
||||
memcpy( &l.sl_addr.sin_addr.S_un.S_addr, he->h_addr,
|
||||
sizeof( l.sl_addr.sin_addr.S_un.S_addr ) );
|
||||
#else
|
||||
memcpy( &l.sl_addr.sin_addr, he->h_addr,
|
||||
sizeof( l.sl_addr.sin_addr ) );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue