Update PF_INET6 and PF_UNIX detection, both default to auto

This commit is contained in:
Kurt Zeilenga 2000-06-09 23:09:51 +00:00
parent ef89854944
commit 55dba4395f
8 changed files with 907 additions and 729 deletions

1498
configure vendored

File diff suppressed because it is too large Load diff

View file

@ -107,7 +107,8 @@ OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], yes)dnl
OL_ARG_ENABLE(kbind,[ --enable-kbind enable V2 Kerberos IV bind], auto)dnl OL_ARG_ENABLE(kbind,[ --enable-kbind enable V2 Kerberos IV bind], auto)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
OL_ARG_ENABLE(ldapi,[ --enable-ldapi enable domain socket (PF_LOCAL) ldap], no)dnl OL_ARG_ENABLE(ipv6,[ --enable-ipv6 enable IPv6 support], auto)dnl
OL_ARG_ENABLE(unix,[ --enable-unix enable UNIX domain socket support], auto)dnl
OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling], OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
no, [yes no])dnl no, [yes no])dnl
@ -600,6 +601,29 @@ AC_CHECK_LIB(s, afopen, [
AC_DEFINE(HAVE_AIX_SECURITY,1,[define if you have AIX security lib]) AC_DEFINE(HAVE_AIX_SECURITY,1,[define if you have AIX security lib])
]) ])
dnl ----------------------------------------------------------------
dnl PF_INET6 support requires getaddrinfo
dnl PF_UNIX may use getaddrinfo in available
AC_CHECK_FUNCS( getaddrinfo )
if test $ac_cv_func_getaddrinfo = no ; then
if test $ol_enable_ipv6 = yes ; then
AC_MSG_ERROR([IPv6 support requires getaddrinfo()])
fi
ol_enable_ipv6=no
fi
if test $ol_enable_unix != no ; then
AC_CHECK_HEADERS( sys/un.h )
if test $ol_enable_unix = auto ; then
ol_enable_unix=$ac_cv_header_sys_un_h
elif test $ac_cv_header_sys_un_h = no ; then
AC_MSG_ERROR([UNIX domain support requires sys/un.h])
fi
fi
dnl ---------------------------------------------------------------- dnl ----------------------------------------------------------------
dnl Check for module support dnl Check for module support
ol_link_modules=no ol_link_modules=no
@ -2030,7 +2054,6 @@ AC_CHECK_FUNCS( \
endgrent \ endgrent \
endpwent \ endpwent \
flock \ flock \
getaddrinfo \
getdtablesize \ getdtablesize \
getgrgid \ getgrgid \
gethostname \ gethostname \
@ -2123,10 +2146,12 @@ fi
if test "$ol_enable_cldap" != no ; then if test "$ol_enable_cldap" != no ; then
AC_DEFINE(LDAP_CONNECTIONLESS,1,[define to support CLDAP]) AC_DEFINE(LDAP_CONNECTIONLESS,1,[define to support CLDAP])
fi fi
if test "$ol_enable_ldapi" != no; then if test "$ol_enable_unix" != no; then
AC_DEFINE(USE_PF_LOCAL,1,[define to support PF_LOCAL transport]) AC_DEFINE(LDAP_PF_UNIX,1,[define to support PF_UNIX])
fi
if test "$ol_enable_ipv6" != no; then
AC_DEFINE(LDAP_PF_INET6,1,[define to support PF_INET6])
fi fi
if test "$ol_enable_cleartext" != no ; then if test "$ol_enable_cleartext" != no ; then
AC_DEFINE(SLAPD_CLEARTEXT,1,[define to support cleartext passwords]) AC_DEFINE(SLAPD_CLEARTEXT,1,[define to support cleartext passwords])
fi fi

View file

@ -536,6 +536,9 @@
/* Define if you have the <sys/types.h> header file. */ /* Define if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H #undef HAVE_SYS_TYPES_H
/* Define if you have the <sys/un.h> header file. */
#undef HAVE_SYS_UN_H
/* Define if you have the <sysexits.h> header file. */ /* Define if you have the <sysexits.h> header file. */
#undef HAVE_SYSEXITS_H #undef HAVE_SYSEXITS_H
@ -851,8 +854,11 @@
/* define to support CLDAP */ /* define to support CLDAP */
#undef LDAP_CONNECTIONLESS #undef LDAP_CONNECTIONLESS
/* define to support PF_LOCAL transport */ /* define to support PF_UNIX */
#undef USE_PF_LOCAL #undef LDAP_PF_UNIX
/* define to support PF_INET6 */
#undef LDAP_PF_INET6
/* define to support cleartext passwords */ /* define to support cleartext passwords */
#undef SLAPD_CLEARTEXT #undef SLAPD_CLEARTEXT

View file

@ -426,12 +426,12 @@ LIBLDAP_F (void) ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
LIBLDAP_F (int) ldap_is_read_ready( LDAP *ld, Sockbuf *sb ); LIBLDAP_F (int) ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
LIBLDAP_F (int) ldap_is_write_ready( LDAP *ld, Sockbuf *sb ); LIBLDAP_F (int) ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
#ifdef LDAP_PF_LOCAL
/* /*
* in os-local.c * in os-local.c
*/ */
#ifdef LDAP_PF_UNIX
LIBLDAP_F (int) ldap_connect_to_path( LDAP *ld, Sockbuf *sb, const char *path, int async ); LIBLDAP_F (int) ldap_connect_to_path( LDAP *ld, Sockbuf *sb, const char *path, int async );
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
/* /*
* in request.c * in request.c

View file

@ -303,8 +303,9 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv,
ber_sockbuf_add_io( sb, &ber_sockbuf_io_udp, ber_sockbuf_add_io( sb, &ber_sockbuf_io_udp,
LBER_SBIOD_LEVEL_PROVIDER, NULL ); LBER_SBIOD_LEVEL_PROVIDER, NULL );
break; break;
#ifdef LDAP_PF_LOCAL case LDAP_PROTO_IPC:
case LDAP_PROTO_LOCAL: #ifdef LDAP_PF_UNIX
/* only IPC mechanism supported is PF_UNIX */
rc = ldap_connect_to_path( ld, sb, srv->lud_host, rc = ldap_connect_to_path( ld, sb, srv->lud_host,
async ); async );
if ( rc == -1 ) if ( rc == -1 )
@ -312,7 +313,7 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv,
ber_sockbuf_add_io( sb, &ber_sockbuf_io_fd, ber_sockbuf_add_io( sb, &ber_sockbuf_io_fd,
LBER_SBIOD_LEVEL_PROVIDER, NULL ); LBER_SBIOD_LEVEL_PROVIDER, NULL );
break; break;
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
default: default:
return -1; return -1;
break; break;

View file

@ -13,7 +13,7 @@
#include "portable.h" #include "portable.h"
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
#include <stdio.h> #include <stdio.h>
@ -216,4 +216,4 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, const char *path, int async)
} }
#else #else
static int dummy; static int dummy;
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */

View file

@ -504,7 +504,7 @@ connection_destroy( Connection *c )
c->c_peer_domain = NULL; c->c_peer_domain = NULL;
} }
if(c->c_peer_name != NULL) { if(c->c_peer_name != NULL) {
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
/* /*
* If peer was a domain socket, unlink. Mind you, * If peer was a domain socket, unlink. Mind you,
* they may be un-named. Should we leave this to * they may be un-named. Should we leave this to
@ -516,7 +516,8 @@ connection_destroy( Connection *c )
(void)unlink(path); (void)unlink(path);
} }
} }
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
free(c->c_peer_name); free(c->c_peer_name);
c->c_peer_name = NULL; c->c_peer_name = NULL;
} }

View file

@ -27,9 +27,9 @@ int allow_severity = LOG_INFO;
int deny_severity = LOG_NOTICE; int deny_severity = LOG_NOTICE;
#endif /* TCP Wrappers */ #endif /* TCP Wrappers */
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
#include <sys/stat.h> #include <sys/stat.h>
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
/* globals */ /* globals */
time_t starttime; time_t starttime;
@ -38,10 +38,10 @@ ber_socket_t dtblsize;
typedef union slap_sockaddr { typedef union slap_sockaddr {
struct sockaddr sa_addr; struct sockaddr sa_addr;
struct sockaddr_in sa_in_addr; struct sockaddr_in sa_in_addr;
#ifdef LDAP_INET6 #ifdef LDAP_PF_INET6
struct sockaddr_in6 sa_in6_addr; struct sockaddr_in6 sa_in6_addr;
#endif #endif
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
struct sockaddr_un sa_un_addr; struct sockaddr_un sa_un_addr;
#endif #endif
} Sockaddr; } Sockaddr;
@ -244,7 +244,7 @@ static Listener * open_listener( const char* url )
hints.ai_family = AF_UNSPEC; hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM; hints.ai_socktype = SOCK_STREAM;
# ifdef LDAP_PF_LOCAL # ifdef LDAP_PF_UNIX
if (lud->lud_protocol == LDAP_PROTO_LOCAL) { if (lud->lud_protocol == LDAP_PROTO_LOCAL) {
if ( lud->lud_host == NULL || lud->lud_host[0] == '\0' ) { if ( lud->lud_host == NULL || lud->lud_host[0] == '\0' ) {
err = getaddrinfo(NULL, "/tmp/.ldap-sock", &hints, &res); err = getaddrinfo(NULL, "/tmp/.ldap-sock", &hints, &res);
@ -256,7 +256,7 @@ static Listener * open_listener( const char* url )
unlink( lud->lud_host ); unlink( lud->lud_host );
} }
} else } else
# endif /* LDAP_PF_LOCAL */ # endif /* LDAP_PF_UNIX */
{ {
snprintf(serv, sizeof serv, "%d", lud->lud_port); snprintf(serv, sizeof serv, "%d", lud->lud_port);
if( lud->lud_host == NULL || lud->lud_host[0] == '\0' if( lud->lud_host == NULL || lud->lud_host[0] == '\0'
@ -287,8 +287,9 @@ static Listener * open_listener( const char* url )
if ( sai->ai_family != AF_UNIX ) { if ( sai->ai_family != AF_UNIX ) {
#else #else
#ifdef LDAP_PF_LOCAL
if (lud->lud_protocol == LDAP_PROTO_LOCAL) { if ( ldap_pvt_url_scheme2proto(url) == LDAP_PROTO_IPC ) {
#ifdef LDAP_PF_UNIX
port = 0; port = 0;
(void) memset( (void *)&l.sl_sa.sa_un_addr, '\0', sizeof(l.sl_sa.sa_un_addr) ); (void) memset( (void *)&l.sl_sa.sa_un_addr, '\0', sizeof(l.sl_sa.sa_un_addr) );
@ -314,9 +315,13 @@ static Listener * open_listener( const char* url )
sizeof( l.sl_sa.sa_un_addr.sun_family ) + sizeof( l.sl_sa.sa_un_addr.sun_family ) +
strlen( l.sl_sa.sa_un_addr.sun_path ) + 1; strlen( l.sl_sa.sa_un_addr.sun_path ) + 1;
#endif #endif
} else #else
#endif /* LDAP_PF_LOCAL */ Debug( LDAP_DEBUG_ANY, "daemon: URL scheme not supported: %s",
{ url, 0, 0);
ldap_free_urldesc( lud );
return NULL;
#endif /* LDAP_PF_UNIX */
} else {
port = lud->lud_port; port = lud->lud_port;
@ -369,10 +374,10 @@ static Listener * open_listener( const char* url )
} }
#endif #endif
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
/* for IP sockets only */ /* for IP sockets only */
if ( l.sl_sa.sa_addr.sa_family == AF_INET ) { if ( l.sl_sa.sa_addr.sa_family == AF_INET ) {
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
#endif /* HAVE_GETADDRINFO */ #endif /* HAVE_GETADDRINFO */
#ifdef SO_REUSEADDR #ifdef SO_REUSEADDR
@ -429,7 +434,7 @@ static Listener * open_listener( const char* url )
} }
switch ( sai->ai_family ) { switch ( sai->ai_family ) {
# ifdef LDAP_PF_LOCAL # ifdef LDAP_PF_UNIX
case AF_UNIX: case AF_UNIX:
if ( chmod( (char *)sai->ai_addr, S_IRWXU ) < 0 ) { if ( chmod( (char *)sai->ai_addr, S_IRWXU ) < 0 ) {
err = sock_errno(); err = sock_errno();
@ -441,7 +446,7 @@ static Listener * open_listener( const char* url )
l.sl_name = ch_malloc( strlen((char *)sai->ai_addr) + sizeof("PATH=") ); l.sl_name = ch_malloc( strlen((char *)sai->ai_addr) + sizeof("PATH=") );
sprintf( l.sl_name, "PATH=%s", sai->ai_addr ); sprintf( l.sl_name, "PATH=%s", sai->ai_addr );
break; break;
# endif /* LDAP_PF_LOCAL */ # endif /* LDAP_PF_UNIX */
case AF_INET: { case AF_INET: {
char addr[INET_ADDRSTRLEN]; char addr[INET_ADDRSTRLEN];
@ -452,7 +457,7 @@ static Listener * open_listener( const char* url )
sprintf( l.sl_name, "IP=%s:%s", addr, serv ); sprintf( l.sl_name, "IP=%s:%s", addr, serv );
} break; } break;
# ifdef LDAP_INET6 # ifdef LDAP_PF_INET6
case AF_INET6: { case AF_INET6: {
char addr[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
inet_ntop( AF_INET6, inet_ntop( AF_INET6,
@ -461,7 +466,7 @@ static Listener * open_listener( const char* url )
l.sl_name = ch_malloc( strlen(addr) + strlen(serv) + sizeof("IP= ") ); l.sl_name = ch_malloc( strlen(addr) + strlen(serv) + sizeof("IP= ") );
sprintf( l.sl_name, "IP=%s %s", addr, serv ); sprintf( l.sl_name, "IP=%s %s", addr, serv );
} break; } break;
# endif /* LDAP_INET6 */ # endif /* LDAP_PF_INET6 */
default: default:
Debug( LDAP_DEBUG_ANY, "daemon: unsupported address family (%d)\n", Debug( LDAP_DEBUG_ANY, "daemon: unsupported address family (%d)\n",
@ -469,13 +474,13 @@ static Listener * open_listener( const char* url )
break; break;
} }
#else #else
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
/* close conditional */ /* close conditional */
} }
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
switch ( l.sl_sa.sa_addr.sa_family ) { switch ( l.sl_sa.sa_addr.sa_family ) {
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
case AF_UNIX: case AF_UNIX:
rc = bind( l.sl_sd, (struct sockaddr *)&l.sl_sa, rc = bind( l.sl_sd, (struct sockaddr *)&l.sl_sa,
sizeof(l.sl_sa.sa_un_addr) ); sizeof(l.sl_sa.sa_un_addr) );
@ -502,7 +507,7 @@ static Listener * open_listener( const char* url )
} }
switch ( l.sl_sa.sa_addr.sa_family ) { switch ( l.sl_sa.sa_addr.sa_family ) {
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
case AF_UNIX: case AF_UNIX:
if ( chmod( l.sl_sa.sa_un_addr.sun_path, S_IRWXU ) < 0 ) { if ( chmod( l.sl_sa.sa_un_addr.sun_path, S_IRWXU ) < 0 ) {
int err = sock_errno(); int err = sock_errno();
@ -517,7 +522,7 @@ static Listener * open_listener( const char* url )
+ sizeof("PATH=") ); + sizeof("PATH=") );
sprintf( l.sl_name, "PATH=%s", l.sl_sa.sa_un_addr.sun_path ); sprintf( l.sl_name, "PATH=%s", l.sl_sa.sa_un_addr.sun_path );
break; break;
# endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
case AF_INET: case AF_INET:
l.sl_name = ch_malloc( sizeof("IP=255.255.255.255:65336") ); l.sl_name = ch_malloc( sizeof("IP=255.255.255.255:65336") );
@ -827,13 +832,13 @@ slapd_daemon_task(
char *dnsname; char *dnsname;
char *peeraddr; char *peeraddr;
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
char peername[MAXPATHLEN + sizeof("PATH=")]; char peername[MAXPATHLEN + sizeof("PATH=")];
#elif defined(LDAP_INET6) #elif defined(LDAP_PF_INET6)
char peername[sizeof("IP=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 65535")]; char peername[sizeof("IP=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 65535")];
#else #else
char peername[sizeof("IP=255.255.255.255:65336")]; char peername[sizeof("IP=255.255.255.255:65336")];
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
peername[0] = '\0'; peername[0] = '\0';
@ -892,13 +897,13 @@ slapd_daemon_task(
} }
switch ( from.sa_addr.sa_family ) { switch ( from.sa_addr.sa_family ) {
# ifdef LDAP_PF_LOCAL # ifdef LDAP_PF_UNIX
case AF_UNIX: case AF_UNIX:
sprintf( peername, "PATH=%s", from.sa_un_addr.sun_path ); sprintf( peername, "PATH=%s", from.sa_un_addr.sun_path );
break; break;
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
# ifdef LDAP_INET6 # ifdef LDAP_PF_INET6
case AF_INET6: { case AF_INET6: {
char addr[INET6_ADDRSTRLEN]; char addr[INET6_ADDRSTRLEN];
sprintf( peername, "IP=%s %d", sprintf( peername, "IP=%s %d",
@ -907,7 +912,7 @@ slapd_daemon_task(
addr, sizeof addr) ? addr : "unknown", addr, sizeof addr) ? addr : "unknown",
(unsigned) ntohs( from.sa_in6_addr.sin6_port ) ); (unsigned) ntohs( from.sa_in6_addr.sin6_port ) );
} break; } break;
# endif /* LDAP_INET6 */ # endif /* LDAP_PF_INET6 */
case AF_INET: case AF_INET:
peeraddr = inet_ntoa( from.sa_in_addr.sin_addr ); peeraddr = inet_ntoa( from.sa_in_addr.sin_addr );
@ -921,19 +926,19 @@ slapd_daemon_task(
continue; continue;
} }
if ( ( from.sa_addr.sa_family == AF_INET ) if ( ( from.sa_addr.sa_family == AF_INET )
#ifdef LDAP_INET6 #ifdef LDAP_PF_INET6
|| ( from.sa_addr.sa_family == AF_INET6 ) || ( from.sa_addr.sa_family == AF_INET6 )
#endif #endif
) { ) {
#ifdef SLAPD_RLOOKUPS #ifdef SLAPD_RLOOKUPS
# ifdef LDAP_INET6 # ifdef LDAP_PF_INET6
if ( from.sa_addr.sa_family == AF_INET6 ) if ( from.sa_addr.sa_family == AF_INET6 )
hp = gethostbyaddr( hp = gethostbyaddr(
(char *)&(from.sa_in6_addr.sin6_addr), (char *)&(from.sa_in6_addr.sin6_addr),
sizeof(from.sa_in6_addr.sin6_addr), sizeof(from.sa_in6_addr.sin6_addr),
AF_INET6 ); AF_INET6 );
else else
# endif LDAP_INET6 # endif LDAP_PF_INET6
hp = gethostbyaddr( hp = gethostbyaddr(
(char *) &(from.sa_in_addr.sin_addr), (char *) &(from.sa_in_addr.sin_addr),
sizeof(from.sa_in_addr.sin_addr), sizeof(from.sa_in_addr.sin_addr),
@ -1143,11 +1148,11 @@ slapd_daemon_task(
for ( l = 0; slap_listeners[l] != NULL; l++ ) { for ( l = 0; slap_listeners[l] != NULL; l++ ) {
if ( slap_listeners[l]->sl_sd != AC_SOCKET_INVALID ) { if ( slap_listeners[l]->sl_sd != AC_SOCKET_INVALID ) {
#ifdef LDAP_PF_LOCAL #ifdef LDAP_PF_UNIX
if ( slap_listeners[l]->sl_sa.sa_addr.sa_family == AF_UNIX ) { if ( slap_listeners[l]->sl_sa.sa_addr.sa_family == AF_UNIX ) {
unlink( slap_listeners[l]->sl_sa.sa_un_addr.sun_path ); unlink( slap_listeners[l]->sl_sa.sa_un_addr.sun_path );
} }
#endif /* LDAP_PF_LOCAL */ #endif /* LDAP_PF_UNIX */
slapd_close( slap_listeners[l]->sl_sd ); slapd_close( slap_listeners[l]->sl_sd );
break; break;
} }