Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
openldap
OpenLDAP
Commits
55dba439
Commit
55dba439
authored
Jun 09, 2000
by
Kurt Zeilenga
Browse files
Update PF_INET6 and PF_UNIX detection, both default to auto
parent
ef898549
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
configure
View file @
55dba439
This diff is collapsed.
Click to expand it.
configure.in
View file @
55dba439
...
...
@@ -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(kbind,[ --enable-kbind enable V2 Kerberos IV bind], auto)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],
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])
])
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 Check for module support
ol_link_modules=no
...
...
@@ -2030,7 +2054,6 @@ AC_CHECK_FUNCS( \
endgrent \
endpwent \
flock \
getaddrinfo \
getdtablesize \
getgrgid \
gethostname \
...
...
@@ -2123,10 +2146,12 @@ fi
if test "$ol_enable_cldap" != no ; then
AC_DEFINE(LDAP_CONNECTIONLESS,1,[define to support CLDAP])
fi
if test "$ol_enable_ldapi" != no; then
AC_DEFINE(USE_PF_LOCAL,1,[define to support PF_LOCAL transport])
if test "$ol_enable_unix" != no; then
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
if test "$ol_enable_cleartext" != no ; then
AC_DEFINE(SLAPD_CLEARTEXT,1,[define to support cleartext passwords])
fi
...
...
include/portable.h.in
View file @
55dba439
...
...
@@ -536,6 +536,9 @@
/* Define if you have the <sys/types.h> header file. */
#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. */
#undef HAVE_SYSEXITS_H
...
...
@@ -851,8 +854,11 @@
/* define to support CLDAP */
#undef LDAP_CONNECTIONLESS
/* define to support PF_LOCAL transport */
#undef USE_PF_LOCAL
/* define to support PF_UNIX */
#undef LDAP_PF_UNIX
/* define to support PF_INET6 */
#undef LDAP_PF_INET6
/* define to support cleartext passwords */
#undef SLAPD_CLEARTEXT
...
...
libraries/libldap/ldap-int.h
View file @
55dba439
...
...
@@ -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_write_ready
(
LDAP
*
ld
,
Sockbuf
*
sb
);
#ifdef LDAP_PF_LOCAL
/*
* in os-local.c
*/
#ifdef LDAP_PF_UNIX
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
...
...
libraries/libldap/open.c
View file @
55dba439
...
...
@@ -303,8 +303,9 @@ open_ldap_connection( LDAP *ld, Sockbuf *sb, LDAPURLDesc *srv,
ber_sockbuf_add_io
(
sb
,
&
ber_sockbuf_io_udp
,
LBER_SBIOD_LEVEL_PROVIDER
,
NULL
);
break
;
#ifdef LDAP_PF_LOCAL
case
LDAP_PROTO_LOCAL
:
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
);
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
,
LBER_SBIOD_LEVEL_PROVIDER
,
NULL
);
break
;
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
default:
return
-
1
;
break
;
...
...
libraries/libldap/os-local.c
View file @
55dba439
...
...
@@ -13,7 +13,7 @@
#include
"portable.h"
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
#include
<stdio.h>
...
...
@@ -216,4 +216,4 @@ ldap_connect_to_path(LDAP *ld, Sockbuf *sb, const char *path, int async)
}
#else
static
int
dummy
;
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
servers/slapd/connection.c
View file @
55dba439
...
...
@@ -504,7 +504,7 @@ connection_destroy( Connection *c )
c
->
c_peer_domain
=
NULL
;
}
if
(
c
->
c_peer_name
!=
NULL
)
{
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
/*
* If peer was a domain socket, unlink. Mind you,
* they may be un-named. Should we leave this to
...
...
@@ -516,7 +516,8 @@ connection_destroy( Connection *c )
(
void
)
unlink
(
path
);
}
}
#endif
/* LDAP_PF_LOCAL */
#endif
/* LDAP_PF_UNIX */
free
(
c
->
c_peer_name
);
c
->
c_peer_name
=
NULL
;
}
...
...
servers/slapd/daemon.c
View file @
55dba439
...
...
@@ -27,9 +27,9 @@ int allow_severity = LOG_INFO;
int
deny_severity
=
LOG_NOTICE
;
#endif
/* TCP Wrappers */
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
#include
<sys/stat.h>
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
/* globals */
time_t
starttime
;
...
...
@@ -38,10 +38,10 @@ ber_socket_t dtblsize;
typedef
union
slap_sockaddr
{
struct
sockaddr
sa_addr
;
struct
sockaddr_in
sa_in_addr
;
#ifdef LDAP_INET6
#ifdef LDAP_
PF_
INET6
struct
sockaddr_in6
sa_in6_addr
;
#endif
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
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_
LOCAL
# ifdef LDAP_PF_
UNIX
if
(
lud
->
lud_protocol
==
LDAP_PROTO_LOCAL
)
{
if
(
lud
->
lud_host
==
NULL
||
lud
->
lud_host
[
0
]
==
'\0'
)
{
err
=
getaddrinfo
(
NULL
,
"/tmp/.ldap-sock"
,
&
hints
,
&
res
);
...
...
@@ -256,7 +256,7 @@ static Listener * open_listener( const char* url )
unlink
(
lud
->
lud_host
);
}
}
else
# endif
/* LDAP_PF_
LOCAL
*/
# endif
/* LDAP_PF_
UNIX
*/
{
snprintf
(
serv
,
sizeof
serv
,
"%d"
,
lud
->
lud_port
);
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
)
{
#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
;
(
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 ) +
strlen( l.sl_sa.sa_un_addr.sun_path ) + 1;
#endif
}
else
#endif
/* LDAP_PF_LOCAL */
{
#else
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
;
...
...
@@ -369,10 +374,10 @@ static Listener * open_listener( const char* url )
}
#endif
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
/* for IP sockets only */
if
(
l
.
sl_sa
.
sa_addr
.
sa_family
==
AF_INET
)
{
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
#endif
/* HAVE_GETADDRINFO */
#ifdef SO_REUSEADDR
...
...
@@ -429,7 +434,7 @@ static Listener * open_listener( const char* url )
}
switch
(
sai
->
ai_family
)
{
# ifdef LDAP_PF_
LOCAL
# ifdef LDAP_PF_
UNIX
case
AF_UNIX
:
if
(
chmod
(
(
char
*
)
sai
->
ai_addr
,
S_IRWXU
)
<
0
)
{
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="
)
);
sprintf
(
l
.
sl_name
,
"PATH=%s"
,
sai
->
ai_addr
);
break
;
# endif
/* LDAP_PF_
LOCAL
*/
# endif
/* LDAP_PF_
UNIX
*/
case
AF_INET
:
{
char
addr
[
INET_ADDRSTRLEN
];
...
...
@@ -452,7 +457,7 @@ static Listener * open_listener( const char* url )
sprintf
(
l
.
sl_name
,
"IP=%s:%s"
,
addr
,
serv
);
}
break
;
# ifdef LDAP_INET6
# ifdef LDAP_
PF_
INET6
case
AF_INET6
:
{
char
addr
[
INET6_ADDRSTRLEN
];
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= "
)
);
sprintf
(
l
.
sl_name
,
"IP=%s %s"
,
addr
,
serv
);
}
break
;
# endif
/* LDAP_INET6 */
# endif
/* LDAP_
PF_
INET6 */
default:
Debug
(
LDAP_DEBUG_ANY
,
"daemon: unsupported address family (%d)
\n
"
,
...
...
@@ -469,13 +474,13 @@ static Listener * open_listener( const char* url )
break
;
}
#else
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
/* close conditional */
}
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
switch
(
l
.
sl_sa
.
sa_addr
.
sa_family
)
{
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
case
AF_UNIX
:
rc
=
bind
(
l
.
sl_sd
,
(
struct
sockaddr
*
)
&
l
.
sl_sa
,
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
)
{
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
case
AF_UNIX
:
if
(
chmod
(
l
.
sl_sa
.
sa_un_addr
.
sun_path
,
S_IRWXU
)
<
0
)
{
int
err
=
sock_errno
();
...
...
@@ -517,7 +522,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_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
case
AF_INET
:
l
.
sl_name
=
ch_malloc
(
sizeof
(
"IP=255.255.255.255:65336"
)
);
...
...
@@ -827,13 +832,13 @@ slapd_daemon_task(
char
*
dnsname
;
char
*
peeraddr
;
#ifdef LDAP_PF_
LOCAL
#ifdef LDAP_PF_
UNIX
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"
)];
#else
char
peername
[
sizeof
(
"IP=255.255.255.255:65336"
)];
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
peername
[
0
]
=
'\0'
;
...
...
@@ -892,13 +897,13 @@ slapd_daemon_task(
}
switch
(
from
.
sa_addr
.
sa_family
)
{
# ifdef LDAP_PF_
LOCAL
# ifdef LDAP_PF_
UNIX
case
AF_UNIX
:
sprintf
(
peername
,
"PATH=%s"
,
from
.
sa_un_addr
.
sun_path
);
break
;
#endif
/* LDAP_PF_
LOCAL
*/
#endif
/* LDAP_PF_
UNIX
*/
# ifdef LDAP_INET6
# ifdef LDAP_
PF_
INET6
case
AF_INET6
:
{
char
addr
[
INET6_ADDRSTRLEN
];
sprintf
(
peername
,
"IP=%s %d"
,
...
...
@@ -907,7 +912,7 @@ slapd_daemon_task(
addr
,
sizeof
addr
)
?
addr
:
"unknown"
,
(
unsigned
)
ntohs
(
from
.
sa_in6_addr
.
sin6_port
)
);
}
break
;
# endif
/* LDAP_INET6 */
# endif
/* LDAP_
PF_
INET6 */
case
AF_INET
:
peeraddr
=
inet_ntoa
(
from
.
sa_in_addr
.
sin_addr
);
...
...
@@ -921,19 +926,19 @@ slapd_daemon_task(
continue
;
}
if
(
(
from
.
sa_addr
.
sa_family
==
AF_INET
)
#ifdef LDAP_INET6
#ifdef LDAP_
PF_
INET6
||
(
from
.
sa_addr
.
sa_family
==
AF_INET6
)
#endif
)
{
#ifdef SLAPD_RLOOKUPS
# ifdef LDAP_INET6
# ifdef LDAP_
PF_
INET6
if
(
from
.
sa_addr
.
sa_family
==
AF_INET6
)
hp
=
gethostbyaddr
(
(
char
*
)
&
(
from
.
sa_in6_addr
.
sin6_addr
),
sizeof
(
from
.
sa_in6_addr
.
sin6_addr
),
AF_INET6
);
else
# endif LDAP_INET6
# endif LDAP_
PF_
INET6
hp
=
gethostbyaddr
(
(
char
*
)
&
(
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
++
)
{
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
)
{
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
);
break
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment