From 1f1993989a468c70774246b6eadb246543ac6dfe Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Sun, 9 Jul 2000 21:49:36 +0000 Subject: [PATCH] s/enable-unix/enable-local/ s/LDAP_PF_UNIX/LDAP_PF_LOCAL/ s/AF_UNIX/AF_LOCAL/ s/PF_UNIX/PF_LOCAL/ --- configure | 30 +++++++++--------- configure.in | 16 +++++----- include/ac/socket.h | 8 +++++ include/portable.h.in | 4 +-- libraries/libldap/open.c | 10 +++--- libraries/libldap/os-local.c | 8 ++--- servers/slapd/connection.c | 4 +-- servers/slapd/daemon.c | 60 ++++++++++++++++++------------------ 8 files changed, 74 insertions(+), 66 deletions(-) diff --git a/configure b/configure index 9ee0c9f66b..bfcffb940e 100755 --- a/configure +++ b/configure @@ -43,7 +43,7 @@ ac_help="$ac_help ac_help="$ac_help --enable-ipv6 enable IPv6 support (auto)" ac_help="$ac_help - --enable-unix enable UNIX domain socket support (auto)" + --enable-local enable AF_LOCAL socket support (auto)" ac_help="$ac_help --enable-x-compile enable cross compiling (no)" ac_help="$ac_help @@ -1337,10 +1337,10 @@ else ol_enable_ipv6="auto" fi # end --enable-ipv6 -# OpenLDAP --enable-unix - # Check whether --enable-unix or --disable-unix was given. -if test "${enable_unix+set}" = set; then - enableval="$enable_unix" +# OpenLDAP --enable-local + # Check whether --enable-local or --disable-local was given. +if test "${enable_local+set}" = set; then + enableval="$enable_local" ol_arg=invalid for ol_val in auto yes no ; do @@ -1349,14 +1349,14 @@ if test "${enable_unix+set}" = set; then fi done if test "$ol_arg" = "invalid" ; then - { echo "configure: error: bad value $enableval for --enable-unix" 1>&2; exit 1; } + { echo "configure: error: bad value $enableval for --enable-local" 1>&2; exit 1; } fi - ol_enable_unix="$ol_arg" + ol_enable_local="$ol_arg" else - ol_enable_unix="auto" + ol_enable_local="auto" fi -# end --enable-unix +# end --enable-local # OpenLDAP --enable-x_compile # Check whether --enable-x_compile or --disable-x_compile was given. if test "${enable_x_compile+set}" = set; then @@ -4192,7 +4192,7 @@ if test $ac_cv_func_getaddrinfo = no ; then ol_enable_ipv6=no fi -if test $ol_enable_unix != no ; then +if test $ol_enable_local != no ; then for ac_hdr in sys/un.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` @@ -4234,10 +4234,10 @@ fi done - if test $ol_enable_unix = auto ; then - ol_enable_unix=$ac_cv_header_sys_un_h + if test $ol_enable_local = auto ; then + ol_enable_local=$ac_cv_header_sys_un_h elif test $ac_cv_header_sys_un_h = no ; then - { echo "configure: error: UNIX domain support requires sys/un.h" 1>&2; exit 1; } + { echo "configure: error: AF_LOCAL domain support requires sys/un.h" 1>&2; exit 1; } fi fi @@ -15738,9 +15738,9 @@ if test "$ol_enable_cldap" != no ; then EOF fi -if test "$ol_enable_unix" != no; then +if test "$ol_enable_local" != no; then cat >> confdefs.h <<\EOF -#define LDAP_PF_UNIX 1 +#define LDAP_PF_LOCAL 1 EOF fi diff --git a/configure.in b/configure.in index b7ceb8c666..7023dbc4a4 100644 --- a/configure.in +++ b/configure.in @@ -108,7 +108,7 @@ OL_ARG_ENABLE(referrals,[ --enable-referrals enable V2 Referrals extension], ye 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(ipv6,[ --enable-ipv6 enable IPv6 support], auto)dnl -OL_ARG_ENABLE(unix,[ --enable-unix enable UNIX domain socket support], auto)dnl +OL_ARG_ENABLE(local,[ --enable-local enable AF_LOCAL socket support], auto)dnl OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling], no, [yes no])dnl @@ -597,7 +597,7 @@ AC_CHECK_LIB(s, afopen, [ dnl ---------------------------------------------------------------- dnl PF_INET6 support requires getaddrinfo -dnl PF_UNIX may use getaddrinfo in available +dnl PF_LOCAL may use getaddrinfo in available AC_CHECK_FUNCS( getaddrinfo ) if test $ac_cv_func_getaddrinfo = no ; then @@ -607,13 +607,13 @@ if test $ac_cv_func_getaddrinfo = no ; then ol_enable_ipv6=no fi -if test $ol_enable_unix != no ; then +if test $ol_enable_local != no ; then AC_CHECK_HEADERS( sys/un.h ) - if test $ol_enable_unix = auto ; then - ol_enable_unix=$ac_cv_header_sys_un_h + if test $ol_enable_local = auto ; then + ol_enable_local=$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]) + AC_MSG_ERROR([AF_LOCAL domain support requires sys/un.h]) fi fi @@ -2125,8 +2125,8 @@ fi if test "$ol_enable_cldap" != no ; then AC_DEFINE(LDAP_CONNECTIONLESS,1,[define to support CLDAP]) fi -if test "$ol_enable_unix" != no; then - AC_DEFINE(LDAP_PF_UNIX,1,[define to support PF_UNIX]) +if test "$ol_enable_local" != no; then + AC_DEFINE(LDAP_PF_LOCAL,1,[define to support PF_LOCAL]) fi if test "$ol_enable_ipv6" != no; then AC_DEFINE(LDAP_PF_INET6,1,[define to support PF_INET6]) diff --git a/include/ac/socket.h b/include/ac/socket.h index 81b4895e8c..027ed88765 100644 --- a/include/ac/socket.h +++ b/include/ac/socket.h @@ -167,5 +167,13 @@ LDAP_F (int) ldap_pvt_inet_aton LDAP_P(( const char *, struct in_addr * )); #define AC_HTONS( s ) htons( s ) #define AC_NTOHS( s ) ntohs( s ) +#ifdef LDAP_PF_LOCAL +# if !defined( AF_LOCAL ) && defined( AF_UNIX ) +# define AF_LOCAL AF_UNIX +# endif +# if !defined( PF_LOCAL ) && defined( PF_UNIX ) +# define PF_LOCAL PF_UNIX +# endif +#endif #endif /* _AC_SOCKET_H_ */ diff --git a/include/portable.h.in b/include/portable.h.in index b93bfe4b12..516629d4eb 100644 --- a/include/portable.h.in +++ b/include/portable.h.in @@ -849,8 +849,8 @@ /* define to support CLDAP */ #undef LDAP_CONNECTIONLESS -/* define to support PF_UNIX */ -#undef LDAP_PF_UNIX +/* define to support PF_LOCAL */ +#undef LDAP_PF_LOCAL /* define to support PF_INET6 */ #undef LDAP_PF_INET6 diff --git a/libraries/libldap/open.c b/libraries/libldap/open.c index f0a5a593df..2c9fafb669 100644 --- a/libraries/libldap/open.c +++ b/libraries/libldap/open.c @@ -306,16 +306,16 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv, LBER_SBIOD_LEVEL_PROVIDER, NULL ); break; case LDAP_PROTO_IPC: -#ifdef LDAP_PF_UNIX - /* only IPC mechanism supported is PF_UNIX */ - rc = ldap_connect_to_path( ld, sb, srv->lud_host, - async ); +#ifdef LDAP_PF_LOCAL + /* only IPC mechanism supported is PF_LOCAL (PF_UNIX) */ + rc = ldap_connect_to_path( ld, sb, + srv->lud_host, async ); if ( rc == -1 ) return rc; ber_sockbuf_add_io( sb, &ber_sockbuf_io_fd, LBER_SBIOD_LEVEL_PROVIDER, NULL ); break; -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ default: return -1; break; diff --git a/libraries/libldap/os-local.c b/libraries/libldap/os-local.c index 89d4278e18..6ccb1f4bd7 100644 --- a/libraries/libldap/os-local.c +++ b/libraries/libldap/os-local.c @@ -13,7 +13,7 @@ #include "portable.h" -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL #include @@ -65,7 +65,7 @@ ldap_pvt_ndelay_off(LDAP *ld, int fd) static ber_socket_t ldap_pvt_socket(LDAP *ld) { - ber_socket_t s = socket(AF_UNIX, SOCK_STREAM, 0); + ber_socket_t s = socket(PF_LOCAL, SOCK_STREAM, 0); oslocal_debug(ld, "ldap_new_socket: %d\n",s,0,0); return ( s ); } @@ -203,7 +203,7 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, const char *path, int async) oslocal_debug(ld, "ldap_connect_to_path: Trying %s\n", path, 0, 0); memset( &server, '\0', sizeof(server) ); - server.sun_family = AF_UNIX; + server.sun_family = AF_LOCAL; strcpy( server.sun_path, path ); rc = ldap_pvt_connect(ld, s, &server, async); @@ -217,4 +217,4 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, const char *path, int async) } #else static int dummy; -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index a86d9b0f37..adadffe8fc 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -504,7 +504,7 @@ connection_destroy( Connection *c ) c->c_peer_domain = NULL; } if(c->c_peer_name != NULL) { -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_lOCAL /* * If peer was a domain socket, unlink. Mind you, * they may be un-named. Should we leave this to @@ -516,7 +516,7 @@ connection_destroy( Connection *c ) (void)unlink(path); } } -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ free(c->c_peer_name); c->c_peer_name = NULL; diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 88dcd60d46..8c496ab0bc 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -27,9 +27,9 @@ int allow_severity = LOG_INFO; int deny_severity = LOG_NOTICE; #endif /* TCP Wrappers */ -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL #include -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ /* globals */ time_t starttime; @@ -41,7 +41,7 @@ typedef union slap_sockaddr { #ifdef LDAP_PF_INET6 struct sockaddr_in6 sa_in6_addr; #endif -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL struct sockaddr_un sa_un_addr; #endif } Sockaddr; @@ -244,7 +244,7 @@ static Listener * open_listener( const char* url ) hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; -# ifdef LDAP_PF_UNIX +# ifdef LDAP_PF_LOCAL if ( ldap_pvt_url_scheme2proto(lud->lud_scheme) == LDAP_PROTO_IPC ) { if ( lud->lud_host == NULL || lud->lud_host[0] == '\0' ) { err = getaddrinfo(NULL, LDAPI_SOCK, &hints, &res); @@ -256,7 +256,7 @@ static Listener * open_listener( const char* url ) unlink( lud->lud_host ); } } else -# endif /* LDAP_PF_UNIX */ +# endif /* LDAP_PF_LOCAL */ { snprintf(serv, sizeof serv, "%d", lud->lud_port); if( lud->lud_host == NULL || lud->lud_host[0] == '\0' @@ -286,15 +286,15 @@ static Listener * open_listener( const char* url ) continue; } - if ( sai->ai_family != AF_UNIX ) { + if ( sai->ai_family != AF_LOCAL ) { #else if ( ldap_pvt_url_scheme2proto(lud->lud_scheme) == LDAP_PROTO_IPC ) { -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL port = 0; (void) memset( (void *)&l.sl_sa.sa_un_addr, '\0', sizeof(l.sl_sa.sa_un_addr) ); - l.sl_sa.sa_un_addr.sun_family = AF_UNIX; + l.sl_sa.sa_un_addr.sun_family = AF_LOCAL; /* hack: overload the host to be the path */ if ( lud->lud_host == NULL || lud->lud_host[0] == '\0' ) { @@ -321,7 +321,7 @@ static Listener * open_listener( const char* url ) url, 0, 0); ldap_free_urldesc( lud ); return NULL; -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ } else { port = lud->lud_port; @@ -375,10 +375,10 @@ static Listener * open_listener( const char* url ) } #endif -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL /* for IP sockets only */ if ( l.sl_sa.sa_addr.sa_family == AF_INET ) { -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ #endif /* HAVE_GETADDRINFO */ #ifdef SO_REUSEADDR @@ -419,7 +419,7 @@ static Listener * open_listener( const char* url ) #endif #ifdef HAVE_GETADDRINFO - } /* sai->ai_family != AF_UNIX */ + } /* sai->ai_family != AF_LOCAL */ if (!bind(l.sl_sd, sai->ai_addr, sai->ai_addrlen)) break; err = sock_errno(); @@ -435,8 +435,8 @@ static Listener * open_listener( const char* url ) } switch ( sai->ai_family ) { -# ifdef LDAP_PF_UNIX - case AF_UNIX: +# ifdef LDAP_PF_LOCAL + case AF_LOCAL: if ( chmod( (char *)sai->ai_addr, S_IRWXU ) < 0 ) { int err = sock_errno(); Debug( LDAP_DEBUG_ANY, "daemon: fchmod(%ld) failed errno=%d (%s)", @@ -447,7 +447,7 @@ static Listener * open_listener( const char* url ) l.sl_name = ch_malloc( strlen((char *)sai->ai_addr) + sizeof("PATH=") ); sprintf( l.sl_name, "PATH=%s", sai->ai_addr ); break; -# endif /* LDAP_PF_UNIX */ +# endif /* LDAP_PF_LOCAL */ case AF_INET: { char addr[INET_ADDRSTRLEN]; @@ -475,14 +475,14 @@ static Listener * open_listener( const char* url ) break; } #else -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL /* close conditional */ } -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ switch ( l.sl_sa.sa_addr.sa_family ) { -#ifdef LDAP_PF_UNIX - case AF_UNIX: +#ifdef LDAP_PF_LOCAL + case AF_LOCAL: rc = bind( l.sl_sd, (struct sockaddr *)&l.sl_sa, sizeof(l.sl_sa.sa_un_addr) ); break; @@ -508,8 +508,8 @@ static Listener * open_listener( const char* url ) } switch ( l.sl_sa.sa_addr.sa_family ) { -#ifdef LDAP_PF_UNIX - case AF_UNIX: +#ifdef LDAP_PF_LOCAL + case AF_LOCAL: if ( chmod( l.sl_sa.sa_un_addr.sun_path, S_IRWXU ) < 0 ) { int err = sock_errno(); Debug( LDAP_DEBUG_ANY, @@ -523,7 +523,7 @@ static Listener * open_listener( const char* url ) + sizeof("PATH=") ); sprintf( l.sl_name, "PATH=%s", l.sl_sa.sa_un_addr.sun_path ); break; -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ case AF_INET: l.sl_name = ch_malloc( sizeof("IP=255.255.255.255:65336") ); @@ -831,13 +831,13 @@ slapd_daemon_task( char *dnsname; char *peeraddr; -#ifdef LDAP_PF_UNIX +#ifdef LDAP_PF_LOCAL char peername[MAXPATHLEN + sizeof("PATH=")]; #elif defined(LDAP_PF_INET6) char peername[sizeof("IP=ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff 65535")]; #else char peername[sizeof("IP=255.255.255.255:65336")]; -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ peername[0] = '\0'; @@ -896,11 +896,11 @@ slapd_daemon_task( } switch ( from.sa_addr.sa_family ) { -# ifdef LDAP_PF_UNIX - case AF_UNIX: +# ifdef LDAP_PF_LOCAL + case AF_LOCAL: sprintf( peername, "PATH=%s", from.sa_un_addr.sun_path ); break; -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ # ifdef LDAP_PF_INET6 case AF_INET6: { @@ -1147,11 +1147,11 @@ slapd_daemon_task( for ( l = 0; slap_listeners[l] != NULL; l++ ) { if ( slap_listeners[l]->sl_sd != AC_SOCKET_INVALID ) { -#ifdef LDAP_PF_UNIX - if ( slap_listeners[l]->sl_sa.sa_addr.sa_family == AF_UNIX ) { +#ifdef LDAP_PF_LOCAL + if ( slap_listeners[l]->sl_sa.sa_addr.sa_family == AF_LOCAL ) { unlink( slap_listeners[l]->sl_sa.sa_un_addr.sun_path ); } -#endif /* LDAP_PF_UNIX */ +#endif /* LDAP_PF_LOCAL */ slapd_close( slap_listeners[l]->sl_sd ); break; } -- 2.39.5