Commit a75cb881 authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Import latest changes from devel

parent dda62b2b
......@@ -317,14 +317,17 @@ main()
int rc;
u_int32_t flags = DB_CREATE | DB_THREAD;
#if DB_VERSION_MAJOR > 2
DB_ENV *env = NULL;
rc = db_env_create( &env, 0 );
if( rc == 0 ) {
#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
rc = env->open( env, NULL, flags, 0 );
#else
rc = env->open( env, NULL, NULL, flags, 0 );
#endif
}
#else
......@@ -336,6 +339,13 @@ main()
if( rc == 0 ) {
db_appexit( &env );
}
#endif
#if DB_VERSION_MAJOR > 2
#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
env->remove( env, NULL, DB_FORCE);
#else
env->remove( env, NULL, NULL, DB_FORCE);
#endif
#endif
return rc;
......
......@@ -52,7 +52,7 @@ static void do_read(LDAP *ld, LDAPMessage *e);
static void
usage( char *name )
{
fprintf( stderr, "usage: %s [-l] [-x ldaphost] [-p ldapport] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
fprintf( stderr, "usage: %s [-l] [-x ldaphost] [-p ldapport] [-b searchbase] [-f filterfile] [-t templatefile] [-c rdncount]\r\n", name );
exit( EXIT_FAILURE );
}
......@@ -67,7 +67,7 @@ main( int argc, char **argv )
int interactive = 0;
deref = FINGER_DEREF;
while ( (i = getopt( argc, argv, "f:ilp:t:x:p:c:" )) != EOF ) {
while ( (i = getopt( argc, argv, "f:ilp:t:x:p:b:c:" )) != EOF ) {
switch( i ) {
case 'f': /* ldap filter file */
filterfile = strdup( optarg );
......@@ -93,6 +93,10 @@ main( int argc, char **argv )
ldapport = atoi( optarg );
break;
case 'b': /* specify search base */
base = strdup( optarg );
break;
case 'c': /* specify number of DN components to show */
rdncount = atoi( optarg );
break;
......
.TH SLAPD.CONF 5 "5 August 1999" "OpenLDAP LDVERSION"
.TH SLAPD.CONF 5 "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -66,18 +66,19 @@ Options described in this section apply to all backends, unless specifically
overridden in a backend definition. Arguments that should be replaced by
actual text are shown in brackets <>.
.TP
.B
access to <what> [ by <who> <access> <control> ]+
.B access to <what> [ by <who> <access> <control> ]+
Grant access (specified by <access>) to a set of entries and/or
attributes (specified by <what>) by one or more requestors (specified
by <who>).
See Developer's FAQ (http://www.openldap.org/faq/) for details.
.TP
.B
attributetype ( <oid> [NAME <name>] [DESC <description>] \
[OBSOLETE] [SUP <oid>] [EQUALITY <oid>] [ORDERING <oid>] \
[SUBSTR <oid>] [SYNTAX <oidlen>] [SINGLE\-VALUE] [COLLECTIVE] \
[NO\-USER\-MODIFICATION] [USAGE <attributeUsage>] )
.HP
.hy 0
.B attributetype (\ <oid> [NAME\ <name>] [OBSOLETE]\
[DESC\ <description>]\
[SUP\ <oid>] [EQUALITY\ <oid>] [ORDERING\ <oid>]\
[SUBSTR\ <oid>] [SYNTAX\ <oidlen>] [SINGLE\-VALUE] [COLLECTIVE]\
[NO\-USER\-MODIFICATION] [USAGE\ <attributeUsage>]\ )
.RS
Specify an attribute type using the LDAPv3 syntax defined in RFC 2252.
The slapd parser extends the RFC 2252 definition by allowing string
forms as well as numeric OIDs to be used for the attribute OID and
......@@ -102,19 +103,21 @@ SubstringAssertion NISnetgrouptriple Bootparameter
.PD
.RE
.RE
.RE
.TP
.B concurrency <integer>
Specify a desired level of concurrency. Provided to the underlying
thread system as a hint. The default is not to provdide any hint.
.TP
.B
defaultaccess { none | auth | compare | search | read | write }
.HP
.B defaultaccess { none | auth | compare | search | read | write }
.RS
Specify the default access level to grant requestors when
no access directives were provided for the database.
The default behavior is to grant 'read' access. It is
recommended that
.B access
directives be used instead.
.RE
.TP
.B idletimeout <integer>
Specify the number of seconds to wait before forcibly closing
......@@ -186,11 +189,11 @@ entry parsing
.PD
.RE
.RE
.TP
.B
objectclass ( <oid> [NAME <name>] [DESC <description] [OBSOLETE] \
[SUP <oids>] [{ ABSTRACT | STRUCTURAL | AUXILIARY }] [MUST <oids>] \
[MAY <oids>] )
.HP
.B objectclass ( <oid> [NAME <name>] [DESC <description] [OBSOLETE]\
[SUP <oids>] [{ ABSTRACT | STRUCTURAL | AUXILIARY }] [MUST <oids>]\
[MAY <oids>] )
.RS
Specify an objectclass using the LDAPv3 syntax defined in RFC 2252.
The slapd parser extends the RFC 2252 definition by allowing string
forms as well as numeric OIDs to be used for the object class OID.
......@@ -198,6 +201,7 @@ forms as well as numeric OIDs to be used for the object class OID.
.B
objectidentifier
description.) Object classes are "STRUCTURAL" by default.
.RE
.TP
.B objectidentifier <name> { <oid> | <name>[:<suffix>] }
Define a string name that equates to the given OID. The string can be used
......@@ -280,17 +284,16 @@ createTimestamp attributes for entries. By default, lastmod is on.
This option puts the database into "read-only" mode. Any attempts to
modify the database will return an "unwilling to perform" error. By
default, readonly is off.
.TP
.B
replica host=<hostname>[:port] "binddn=<DN>" bindmethod=simple |
.B
kerberos [credentials=<password>] [srvtab=<filename>]
.br
.HP
.B replica host=<hostname>[:port] "binddn=<DN>" bindmethod=simple |\
kerberos [credentials=<password>] [srvtab=<filename> ]
.RS
Specify a replication site for this database. Refer to "The SLAPD and
SLURPD Administrator's Guide" for detailed information on setting up
a replicated
.B slapd
directory service.
.RE
.TP
.B replogfile <filename>
Specify the name of the replication log file to log changes to.
......@@ -417,7 +420,7 @@ file.
Specifies an alternate passwd file to use. The default is
.B /etc/passwd.
.SH EXAMPLE
"The SLAPD and SLURPD Administrator's Guide" contains an annotated
"OpenLDAP Administrator's Guide" contains an annotated
example of a configuration file.
.SH FILES
ETCDIR/slapd.conf
......@@ -433,7 +436,7 @@ ETCDIR/slapd.conf
.BR slappassword (8),
.BR slurpd (8),
.LP
"The SLAPD and SLURPD Administrator's Guide"
"OpenLDAP Administrator's Guide"
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
......
.TH IN.XFINGERD 8C "22 September 1998" "OpenLDAP LDVERSION"
.TH IN.XFINGERD 8C "16 August 200" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -7,7 +7,7 @@ in.xfingerd \- Finger to LDAP/X.500 gateway daemon
.SH SYNOPSIS
.B LIBEXECDIR/in.xfingerd [\-f filterfile] [\-i]
.B [\-l] [\-t templatefile] [\-c rdncount] [\-x hostname]
.B [\-p port]
.B [\-b searchbase] [\-p port]
.SH DESCRIPTION
.B in.xfingerd
is the LDAP/X.500 finger daemon. It runs from
......@@ -66,6 +66,9 @@ Specify an alternate host on which the ldap server is running.
.TP
.BI \-p " port"
Specify an alternate port on which the ldap server is listening.
.TP
.BI \-b " searchbase"
Specify an alternate search base for queries.
.SH NOTES
The default values for most of the things you can specify with
options are configured at compile time in the
......
.TH SLAPADD 8C "17 August 1999" "OpenLDAP LDVERSION"
.TH SLAPADD 8C "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -96,6 +96,8 @@ database give the command:
.BR slapcat (8),
.BR ldapadd (1),
.BR slapd (8)
.LP
"OpenLDAP Administrator's Guide"
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
......
.TH SLAPCAT 8C "17 August 1999" "OpenLDAP LDVERSION"
.TH SLAPCAT 8C "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -85,6 +85,8 @@ give the command:
.BR slapadd (8),
.BR ldapadd (1),
.BR slapd (8)
.LP
"OpenLDAP Administrator's Guide"
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
......
.TH SLAPD 8C "19 September 1999" "OpenLDAP LDVERSION"
.TH SLAPD 8C "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -10,6 +10,7 @@ slapd \- Stand-alone LDAP Daemon
.B [\-h URLs]
.B [\-d debug\-level]
.B [\-n service\-name] [\-s syslog\-level] [\-l syslog\-local\-user]
.B [\-r directory]
.B [\-u user] [\-g group]
.B
.SH DESCRIPTION
......@@ -100,19 +101,28 @@ Specifies the slapd configuration file. The default is
.B slapd
will serve
.B ldap:///
(LDAP over TCP on all interfaces on default LDAP port). As such,
it will bind to INADDR_ANY, port 389.
(LDAP over TCP on all interfaces on default LDAP port). That is,
it will bind to using INADDR_ANY and port 389.
The
.B \-h
option may be used to specify LDAP (and LDAPS) URLs to serve.
For example, if slapd is given
.B \-h " ldap://127.0.0.1:9009/ ldaps:///",
It will bind 127.0.0.1:9009 for LDAP and INADDR_ANY:636 for LDAP over TLS.
.B \-h " ldap://127.0.0.1:9009/ ldaps:/// ldapi:///",
It will bind 127.0.0.1:9009 for LDAP, INADDR_ANY:636 for LDAP over TLS,
and LDAP over IPC (Unix domain sockets).
A space separated list of URLs is expected. The URLS should be of
LDAP (ldap://) or, if supported, LDAP over TLS (ldaps://) type without
a DN or other optional parameters. Hosts may be specified in either
Internet '.' format (preferred) or by name. Ports, if specfied,
must be numeric.
LDAP (ldap://) or LDAP over TLS (ldaps://) or LDAP over IPC (ldapi://)
scheme without a DN or other optional parameters. Support for the
latter two schemes depends on selected configuration options. Hosts
may be specified by name or IPv4 and IPv6 address formats.
Ports, if specfied, must be numeric. The default ldap:// port is 389
and the default ldaps:// port is 636.
.TP
.BI \-r " directory"
Specifies a run-time directory. slapd will
.BR chroot (2)
to this directory after opening listeners but before any reading
any configuration file or initializing any backend.
.TP
.BI \-u " user"
.B slapd
......@@ -156,7 +166,7 @@ on voluminous debugging which will be printed on standard error, type:
.BR slapd.conf (5),
.BR slurpd (8)
.LP
"The SLAPD and SLURPD Administrator's Guide"
"OpenLDAP Administrator's Guide"
.SH BUGS
See http://www.openldap.org/its/
.SH ACKNOWLEDGEMENTS
......
.TH SLAPINDEX 8C "17 July 1999" "OpenLDAP LDVERSION"
.TH SLAPINDEX 8C "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -76,6 +76,8 @@ To reindex your SLAPD database, give the command:
.BR slapadd (8),
.BR ldapadd (1),
.BR slapd (8)
.LP
"OpenLDAP Administrator's Guide"
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
......
.TH SLAPPASSWD 8C "15 June 2000" "OpenLDAP LDVERSION"
.TH SLAPPASSWD 8C "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -62,6 +62,8 @@ were clear text passwords.
.BR ldappasswd (1),
.BR ldapmodify (1),
.BR slapd (8)
.LP
"OpenLDAP Administrator's Guide"
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
......
.TH SLURPD 8C "22 September 1998" "OpenLDAP LDVERSION"
.TH SLURPD 8C "13 August 2000" "OpenLDAP LDVERSION"
.\" $OpenLDAP$
.\" Copyright 1998-2000 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
......@@ -109,7 +109,7 @@ processes a replication log and exits.
copies the replication log to a working directory before processing it.
This option allows you to specify the location of these temporary files.
The default is
.BR /usr/tmp .
.BR LOCALSTATEDIR/openldap-slurp .
.TP
.BI \-k " srvtab\-file"
Specify the location of the kerberos srvtab file which contains keys
......@@ -151,7 +151,7 @@ on voluminous debugging which will be printed on standard error, type:
.BR slapd.replog (5),
.BR slapd (8)
.LP
"The SLAPD and SLURPD Administrator's Guide"
"OpenLDAP Administrator's Guide"
.SH ACKNOWLEDGEMENTS
.B OpenLDAP
is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
......
......@@ -45,6 +45,8 @@ ldap_pvt_ctime LDAP_P((
const time_t *tp,
char *buf ));
LDAP_F( char *) ldap_pvt_get_fqdn LDAP_P(( char * ));
LDAP_F( int )
ldap_pvt_gethostbyname_a LDAP_P((
const char *name,
......
......@@ -498,12 +498,6 @@ ber_bvstr(
return NULL;
}
if ( *s == '\0' ) {
new->bv_val = NULL;
new->bv_len = 0;
return new;
}
new->bv_val = (char *) s;
new->bv_len = strlen( s );
......
......@@ -555,6 +555,13 @@ ldap_int_sasl_bind(
}
if ( rc != LDAP_SUCCESS && rc != LDAP_SASL_BIND_IN_PROGRESS ) {
if( scred ) {
/* and server provided us with data? */
Debug( LDAP_DEBUG_TRACE,
"ldap_int_sasl_bind: rc=%d sasl=%d len=%ld\n",
rc, saslrc, scred->bv_len );
ber_bvfree( scred );
}
return ld->ld_errno;
}
......@@ -609,8 +616,6 @@ ldap_int_sasl_bind(
return ld->ld_errno = sasl_err2ldap( saslrc );
}
/* likely should add a quiet option */
if( flags != LDAP_SASL_QUIET ) {
saslrc = sasl_getprop( ctx, SASL_USERNAME, (void **) &data );
if( saslrc == SASL_OK && data && *data ) {
......
......@@ -427,7 +427,7 @@ void ldap_int_initialize_global_options( struct ldapoptions *gopts, int *dbglvl
#if defined(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND) \
|| defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
char * ldap_int_hostname = "localhost";
char * ldap_int_hostname = NULL;
#endif
void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
......@@ -438,13 +438,7 @@ void ldap_int_initialize( struct ldapoptions *gopts, int *dbglvl )
#if defined(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND) \
|| defined(HAVE_TLS) || defined(HAVE_CYRUS_SASL)
{
char hostbuf[MAXHOSTNAMELEN+1];
if( gethostname( hostbuf, MAXHOSTNAMELEN ) == 0 ) {
hostbuf[MAXHOSTNAMELEN] = '\0';
ldap_int_hostname = hostbuf;
}
}
ldap_int_hostname = ldap_pvt_get_fqdn( ldap_int_hostname );
#endif
ldap_int_utils_init();
......
......@@ -473,6 +473,17 @@ ldap_host_connected_to( Sockbuf *sb )
{
return LDAP_STRDUP( ldap_int_hostname );
}
#ifdef INADDR_LOOPBACK
localhost.sin_addr.s_addr = htonl( INADDR_LOOPBACK );
if( memcmp ( &localhost.sin_addr,
&((struct sockaddr_in *)&sa)->sin_addr,
sizeof(localhost.sin_addr) ) == 0 )
{
return LDAP_STRDUP( ldap_int_hostname );
}
#endif
}
break;
......
......@@ -357,7 +357,7 @@ ldap_pvt_sasl_getmechs ( LDAP *ld, char **pmechlist )
Debug( LDAP_DEBUG_TRACE, "ldap_pvt_sasl_getmech\n", 0, 0, 0 );
rc = ldap_search_s( ld, NULL, LDAP_SCOPE_BASE,
rc = ldap_search_s( ld, "", LDAP_SCOPE_BASE,
NULL, attrs, 0, &res );
if ( rc != LDAP_SUCCESS ) {
......
......@@ -142,6 +142,7 @@ int ldap_pvt_gethostbyname_a(
# define NEED_COPY_HOSTENT
struct hostent *he;
int retval;
*buf = NULL;
ldap_pvt_thread_mutex_lock( &ldap_int_gethostby_mutex );
......@@ -162,6 +163,7 @@ int ldap_pvt_gethostbyname_a(
return retval;
#else
*buf = NULL;
*result = gethostbyname( name );
if (*result!=NULL) {
......@@ -221,6 +223,7 @@ int ldap_pvt_gethostbyaddr_a(
# define NEED_COPY_HOSTENT
struct hostent *he;
int retval;
*buf = NULL;
ldap_pvt_thread_mutex_lock( &ldap_int_gethostby_mutex );
......@@ -241,6 +244,7 @@ int ldap_pvt_gethostbyaddr_a(
return retval;
#else /* gethostbyaddr() */
*buf = NULL;
*result = gethostbyaddr( addr, len, type );
if (*result!=NULL) {
......@@ -377,4 +381,31 @@ static char *safe_realloc( char **buf, int len )
}
#endif
char * ldap_pvt_get_fqdn( char *name )
{
char *fqdn, *ha_buf;
char hostbuf[MAXHOSTNAMELEN+1];
struct hostent *hp, he_buf;
int rc, local_h_errno;
if( name == NULL ) {
if( gethostname( hostbuf, MAXHOSTNAMELEN ) == 0 ) {
hostbuf[MAXHOSTNAMELEN] = '\0';
name = hostbuf;
} else {
name = "localhost";
}
}
rc = ldap_pvt_gethostbyname_a( name,
&he_buf, &ha_buf, &hp, &local_h_errno );
if( rc < 0 || hp == NULL || hp->h_name == NULL ) {
fqdn = LDAP_STRDUP( name );
} else {
fqdn = LDAP_STRDUP( hp->h_name );
}
LDAP_FREE( ha_buf );
return fqdn;
}
......@@ -145,12 +145,17 @@ int ldbm_initialize( void )
return( 1 );
}
#if DB_VERSION_MAJOR >= 3
#if DB_VERSION_MAJOR > 2
ldbm_Env->set_errcall( ldbm_Env, ldbm_db_errcall );
ldbm_Env->set_errpfx( ldbm_Env, "==>" );
envFlags |= DB_INIT_MPOOL;
#if (DB_VERSION_MAJOR > 3) || (DB_VERSION_MINOR >= 1)
err = ldbm_Env->open( ldbm_Env, NULL, envFlags, 0 );
#else
err = ldbm_Env->open( ldbm_Env, NULL, NULL, envFlags, 0 );
#endif
if ( err != 0 )
{
char error[BUFSIZ];
......@@ -175,7 +180,7 @@ int ldbm_shutdown( void )
if( !ldbm_initialized ) return 1;
#if DB_VERSION_MAJOR >= 3
ldbm_Env->close( ldbm_Env, 0 );
ldbm_Env->close( ldbm_Env, 0 );
#else
db_appexit( ldbm_Env );
#endif
......@@ -253,8 +258,7 @@ ldbm_open( char *name, int rw, int mode, int dbcachesize )
memset( &dbinfo, '\0', sizeof( dbinfo ));
#if defined( DB_VERSION_MAJOR ) && defined( DB_VERSION_MINOR ) && \
DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 4
#if DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 4
/*
* BerkeleyDB 2.4 do not allow db_cachesize
* to be specified if an DB_ENV is.
......
......@@ -609,18 +609,18 @@ static int chk_kerberos(
}
{
char host[MAXHOSTNAMELEN+1];
char *host = ldap_pvt_get_fqdn( NULL );
if( gethostname( host, MAXHOSTNAMELEN ) != 0 ) {
if( host == NULL ) {
krb5_free_principal( context, client );
krb5_free_context( context );
return 1;
}
host[MAXHOSTNAMELEN] = '\0';
ret = krb5_sname_to_principal( context,
host, "ldap", KRB5_NT_SRV_HST, &server );
ber_memfree( host );
}
if (ret) {
......
......@@ -726,18 +726,18 @@ static int chk_kerberos(
}
{
char host[MAXHOSTNAMELEN+1];
char *host = ldap_pvt_get_fqdn( NULL );
if( gethostname( host, MAXHOSTNAMELEN ) != 0 ) {
if( host == NULL ) {
krb5_free_principal( context, client );
krb5_free_context( context );
return 1;
}
host[MAXHOSTNAMELEN] = '\0';
ret = krb5_sname_to_principal( context,
host, "ldap", KRB5_NT_SRV_HST, &server );
ber_memfree( host );
}
if (ret) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment