mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 07:39:35 -05:00
SLP extension derived from patch provided by Caldera Systems.
Copyright 2000, Caldera Systems, Inc All rights reserved. This software is not subject to any license of Caldera Systems, Inc This is free software; you can redistribute and use it under the same terms as OpenLDAP itself
This commit is contained in:
parent
cacb73c3db
commit
8a22a0e0d0
5 changed files with 986 additions and 738 deletions
|
|
@ -145,7 +145,7 @@ SLAPD_SQL_LDFLAGS = @SLAPD_SQL_LDFLAGS@
|
|||
SLAPD_SQL_INCLUDES = @SLAPD_SQL_INCLUDES@
|
||||
SLAPD_SQL_LIBS = @SLAPD_SQL_LIBS@
|
||||
|
||||
SLAPD_LIBS = @SLAPD_LIBS@ @SLAPD_PERL_LDFLAGS@ @SLAPD_SQL_LDFLAGS@ @SLAPD_SQL_LIBS@
|
||||
SLAPD_LIBS = @SLAPD_LIBS@ @SLAPD_PERL_LDFLAGS@ @SLAPD_SQL_LDFLAGS@ @SLAPD_SQL_LIBS@ @SLAPD_SLP_LIBS@
|
||||
SLURPD_LIBS = @SLURPD_LIBS@
|
||||
|
||||
# Our Defaults
|
||||
|
|
|
|||
26
configure.in
26
configure.in
|
|
@ -146,8 +146,10 @@ dnl ----------------------------------------------------------------
|
|||
dnl SLAPD OPTIONS
|
||||
AC_ARG_WITH(xxslapdoptions,[SLAPD (Standalone LDAP Daemon) Options:])
|
||||
OL_ARG_ENABLE(slapd,[ --enable-slapd enable building slapd], yes)dnl
|
||||
OL_ARG_ENABLE(aci,[ --enable-aci enable per-object ACIs], no)dnl
|
||||
OL_ARG_ENABLE(cleartext,[ --enable-cleartext enable cleartext passwords], yes)dnl
|
||||
OL_ARG_ENABLE(crypt,[ --enable-crypt enable crypt(3) passwords], auto)dnl
|
||||
OL_ARG_ENABLE(dynamic,[ --enable-dynamic enable linking built binaries with dynamic libs], no)dnl
|
||||
OL_ARG_ENABLE(kpasswd,[ --enable-kpasswd enable Kerberos password verification], no)dnl
|
||||
OL_ARG_ENABLE(lmpasswd,[ --enable-lmpasswd enable LAN Manager passwords], auto)dnl
|
||||
OL_ARG_ENABLE(spasswd,[ --enable-spasswd enable (Cyrus) SASL password verification], no)dnl
|
||||
|
|
@ -155,9 +157,8 @@ OL_ARG_ENABLE(modules,[ --enable-modules enable dynamic module support], no
|
|||
dnl OL_ARG_ENABLE(multimaster,[ --enable-multimaster enable multimaster replication], no)dnl
|
||||
OL_ARG_ENABLE(phonetic,[ --enable-phonetic enable phonetic/soundex], no)dnl
|
||||
OL_ARG_ENABLE(rlookups,[ --enable-rlookups enable reverse lookups], no)dnl
|
||||
OL_ARG_ENABLE(aci,[ --enable-aci enable per-object ACIs], no)dnl
|
||||
OL_ARG_ENABLE(slp, [ --enable-slp enable SLPv2 support], no)dnl
|
||||
OL_ARG_ENABLE(wrappers,[ --enable-wrappers enable tcp wrapper support], no)dnl
|
||||
OL_ARG_ENABLE(dynamic,[ --enable-dynamic enable linking built binaries with dynamic libs], no)dnl
|
||||
|
||||
dnl SLAPD Backend options
|
||||
OL_ARG_ENABLE(bdb,[ --enable-bdb enable Berkeley DB backend], no)dnl
|
||||
|
|
@ -464,6 +465,8 @@ TLS_LIBS=
|
|||
MODULES_LIBS=
|
||||
AUTH_LIBS=
|
||||
|
||||
SLAPD_SLP_LIBS=
|
||||
|
||||
dnl ================================================================
|
||||
dnl Checks for programs
|
||||
|
||||
|
|
@ -2061,6 +2064,23 @@ if test $ol_enable_proctitle != no ; then
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
dnl Check for SLPv2 Compliant API Library
|
||||
if test $ol_enable_slp != no ; then
|
||||
AC_CHECK_HEADERS( slp.h )
|
||||
|
||||
if test ac_cv_header_slp_h = yes ; then
|
||||
AC_CHECK_LIB(slp, SLPOpen, [have_slp=yes], [have_slp=no])
|
||||
if test $have_slp = yes ; then
|
||||
AC_DEFINE(HAVE_SLP, 1, [define if you have -lslp])
|
||||
SLAPD_SLP_LIBS=-lslp
|
||||
fi
|
||||
|
||||
elif test $ol_enable_slp = yes ; then
|
||||
AC_MSG_ERROR([SLP not found])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ----------------------------------------------------------------
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_TYPE_MODE_T
|
||||
|
|
@ -2463,6 +2483,8 @@ AC_SUBST(TLS_LIBS)
|
|||
AC_SUBST(MODULES_LIBS)
|
||||
AC_SUBST(AUTH_LIBS)
|
||||
|
||||
AC_SUBST(SLAPD_SLP_LIBS)
|
||||
|
||||
AC_SUBST(SLAPD_SQL_LDFLAGS)
|
||||
AC_SUBST(SLAPD_SQL_LIBS)
|
||||
AC_SUBST(SLAPD_SQL_INCLUDES)
|
||||
|
|
|
|||
|
|
@ -480,6 +480,9 @@
|
|||
/* Define if you have the <shadow.h> header file. */
|
||||
#undef HAVE_SHADOW_H
|
||||
|
||||
/* Define if you have the <slp.h> header file. */
|
||||
#undef HAVE_SLP_H
|
||||
|
||||
/* Define if you have the <ssl.h> header file. */
|
||||
#undef HAVE_SSL_H
|
||||
|
||||
|
|
@ -669,6 +672,9 @@
|
|||
/* define if you have TLS */
|
||||
#undef HAVE_TLS
|
||||
|
||||
/* define to support LAN Manager passwords */
|
||||
#undef SLAPD_LMHASH
|
||||
|
||||
/* set to the number of arguments ctime_r() expects */
|
||||
#undef CTIME_R_NARGS
|
||||
|
||||
|
|
@ -777,6 +783,9 @@
|
|||
/* define if setproctitle(3) is available */
|
||||
#undef HAVE_SETPROCTITLE
|
||||
|
||||
/* define if you have -lslp */
|
||||
#undef HAVE_SLP
|
||||
|
||||
/* Define to `int' if <sys/types.h> does not define. */
|
||||
#undef mode_t
|
||||
|
||||
|
|
@ -876,9 +885,6 @@
|
|||
/* define to support SASL passwords */
|
||||
#undef SLAPD_SPASSWD
|
||||
|
||||
/* define to support multimaster replication */
|
||||
#undef SLAPD_MULTIMASTER
|
||||
|
||||
/* define to support phonetic */
|
||||
#undef SLAPD_PHONETIC
|
||||
|
||||
|
|
|
|||
|
|
@ -99,6 +99,90 @@ static struct slap_daemon {
|
|||
fd_set sd_writers;
|
||||
} slap_daemon;
|
||||
|
||||
|
||||
|
||||
#ifdef HAVE_SLP
|
||||
/*
|
||||
* SLP related functions
|
||||
*/
|
||||
#include <slp.h>
|
||||
|
||||
#define MAX_HOSTNAME_LEN 256
|
||||
#define LDAP_SRVTYPE_PREFIX "service:ldap://"
|
||||
static char** slapd_srvurls = 0;
|
||||
static SLPHandle slapd_hslp = 0;
|
||||
|
||||
void slapd_slp_init( const char* urls ) {
|
||||
int i;
|
||||
struct hostent* he;
|
||||
char hn[MAX_HOSTNAME_LEN];
|
||||
|
||||
slapd_srvurls = str2charray( urls, " " );
|
||||
|
||||
for( i=0; slapd_srvurls[i]!=NULL; i++ ) {
|
||||
if( strcmp( slapd_srvurls[i], "ldap:///" ) == 0) {
|
||||
/* INADDR_ANY urls should be marked up with host.domainname */
|
||||
if ( gethostname( hn, MAX_HOSTNAME_LEN ) == 0) {
|
||||
he = gethostbyname( hn );
|
||||
if( he ) {
|
||||
slapd_srvurls[i] = (char *) realloc( slapd_srvurls[i],
|
||||
strlen( he->h_name ) +
|
||||
strlen( LDAP_SRVTYPE_PREFIX ) + 1);
|
||||
strcpy( slapd_srvurls[i], LDAP_SRVTYPE_PREFIX );
|
||||
strcat( slapd_srvurls[i], he->h_name );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* open the SLP handle */
|
||||
SLPOpen("en", 0, &slapd_hslp);
|
||||
}
|
||||
|
||||
void slapd_slp_deinit() {
|
||||
if ( slapd_srvurls ) {
|
||||
charray_free( slapd_srvurls );
|
||||
}
|
||||
|
||||
/* close the SLP handle */
|
||||
SLPClose( slapd_hslp );
|
||||
}
|
||||
|
||||
void slapd_slp_regreport(
|
||||
SLPHandle hslp,
|
||||
SLPError errcode,
|
||||
void* cookie )
|
||||
{
|
||||
/* empty report */
|
||||
}
|
||||
|
||||
void slapd_slp_reg() {
|
||||
int i;
|
||||
|
||||
for( i=0; slapd_srvurls[i] != NULL; i++ ) {
|
||||
SLPReg( slapd_hslp,
|
||||
slapd_srvurls[i],
|
||||
SLP_LIFETIME_MAXIMUM,
|
||||
"ldap",
|
||||
"",
|
||||
1,
|
||||
slapd_slp_regreport,
|
||||
NULL );
|
||||
}
|
||||
}
|
||||
|
||||
void slapd_slp_dereg() {
|
||||
int i;
|
||||
|
||||
for( i=0; slapd_srvurls[i] != NULL; i++ ) {
|
||||
SLPDereg( slapd_hslp,
|
||||
slapd_srvurls[i],
|
||||
slapd_slp_regreport,
|
||||
NULL );
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_SLP */
|
||||
|
||||
/*
|
||||
* Add a descriptor to daemon control
|
||||
*/
|
||||
|
|
@ -809,6 +893,12 @@ int slapd_daemon_init( const char *urls )
|
|||
Debug( LDAP_DEBUG_TRACE, "daemon_init: %d listeners opened\n",
|
||||
i, 0, 0 );
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SLP
|
||||
slapd_slp_init( urls );
|
||||
slapd_slp_reg();
|
||||
#endif
|
||||
|
||||
charray_free( u );
|
||||
ldap_pvt_thread_mutex_init( &slap_daemon.sd_mutex );
|
||||
return !i;
|
||||
|
|
@ -822,6 +912,12 @@ slapd_daemon_destroy(void)
|
|||
tcp_close( wake_sds[1] );
|
||||
tcp_close( wake_sds[0] );
|
||||
sockdestroy();
|
||||
|
||||
#ifdef HAVE_SLP
|
||||
slapd_slp_dereg();
|
||||
slapd_slp_deinit();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue