Fixes from Allan Lynne

This commit is contained in:
Kurt Zeilenga 1998-08-18 17:51:53 +00:00
parent e4af28135d
commit dfeabf5213
6 changed files with 46 additions and 10 deletions

View file

@ -41,7 +41,11 @@ dn2id_add(
data.dptr = (char *) &id;
data.dsize = sizeof(ID);
#ifdef LDBM_PESSIMISTIC
rc = ldbm_cache_store( db, key, data, LDBM_INSERT | LDBM_SYNC );
#else
rc = ldbm_cache_store( db, key, data, LDBM_INSERT );
#endif
free( dn );
ldbm_cache_close( be, db );
@ -62,10 +66,10 @@ dn2id(
ID id;
Datum key, data;
Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 );
dn = strdup( dn );
dn_normalize_case( dn );
Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 );
/* first check the cache */
if ( (e = cache_find_entry_dn( &li->li_cache, dn )) != NULL ) {

View file

@ -2,7 +2,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include "slap.h"
#include "ldapconfig.h"
#include "back-ldbm.h"
@ -172,7 +171,11 @@ idl_store(
data.dptr = (char *) idl;
data.dsize = (2 + idl->b_nmax) * sizeof(ID);
#ifdef LDBM_PESSIMISTIC
rc = ldbm_cache_store( db, key, data, LDBM_REPLACE | LDBM_SYNC );
#else
rc = ldbm_cache_store( db, key, data, LDBM_REPLACE );
#endif
/* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */
return( rc );

View file

@ -206,7 +206,7 @@ dn_parent(
}
}
return( NULL );
return( strdup("") );
}
/*

View file

@ -20,7 +20,7 @@ extern char Versionstr[];
* read-only global variables or variables only written by the listener
* thread (after they are initialized) - no need to protect them with a mutex.
*/
int ldap_debug;
int ldap_debug = 0;
#ifdef LDAP_DEBUG
int ldap_syslog = LDAP_DEBUG_STATS;
#else
@ -64,7 +64,7 @@ static
usage( name )
char *name;
{
fprintf( stderr, "usage: %s [-d debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
fprintf( stderr, "usage: %s [-d ?|debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
}
main( argc, argv )
@ -106,19 +106,19 @@ main( argc, argv )
LDAP_DEBUG_CONFIG );
printf( "\tLDAP_DEBUG_ACL\t\t%d\n",
LDAP_DEBUG_ACL );
printf( "\tLDAP_DEBUG_STATS\t\t%d\n",
printf( "\tLDAP_DEBUG_STATS\t%d\n",
LDAP_DEBUG_STATS );
printf( "\tLDAP_DEBUG_STATS2\t\t%d\n",
printf( "\tLDAP_DEBUG_STATS2\t%d\n",
LDAP_DEBUG_STATS2 );
printf( "\tLDAP_DEBUG_SHELL\t\t%d\n",
printf( "\tLDAP_DEBUG_SHELL\t%d\n",
LDAP_DEBUG_SHELL );
printf( "\tLDAP_DEBUG_PARSE\t\t%d\n",
printf( "\tLDAP_DEBUG_PARSE\t%d\n",
LDAP_DEBUG_PARSE );
printf( "\tLDAP_DEBUG_ANY\t\t%d\n",
LDAP_DEBUG_ANY );
exit( 0 );
} else {
ldap_debug = atoi( optarg );
ldap_debug |= atoi( optarg );
lber_debug = (ldap_debug & LDAP_DEBUG_BER);
}
break;

View file

@ -76,6 +76,11 @@ oc_check_required( Entry *e, char *ocname )
return( 0 );
}
/* check for empty oc_required */
if(oc->oc_required == NULL) {
return( 0 );
}
/* for each required attribute */
for ( i = 0; oc->oc_required[i] != NULL; i++ ) {
/* see if it's in the entry */

View file

@ -121,6 +121,10 @@ main(
* Start the main file manager thread (in fm.c).
*/
pthread_attr_init( &attr );
#ifndef THREAD_MIT_PTHREADS
/* POSIX_THREADS or compatible
* This is a draft 10 or standard pthreads implementation
*/
if ( pthread_create( &(sglob->fm_tid), &attr, (void *) fm, (void *) NULL )
!= 0 ) {
Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
@ -128,17 +132,37 @@ main(
exit( 1 );
}
#else /* !THREAD_MIT_PTHREADS */
/*
* This is a draft 4 or earlier pthreads implementation
*/
if ( pthread_create( &(sglob->fm_tid), attr, (void *) fm, (void *) NULL )
!= 0 ) {
Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
0, 0, 0 );
exit( 1 );
}
#endif /* !THREAD_MIT_PTHREADS */
pthread_attr_destroy( &attr );
/*
* Wait for the fm thread to finish.
*/
#ifdef POSIX_THREADS
pthread_join( sglob->fm_tid, (void *) NULL );
#else
pthread_join( sglob->fm_tid, (void *) &status );
#endif
/*
* Wait for the replica threads to finish.
*/
for ( i = 0; sglob->replicas[ i ] != NULL; i++ ) {
#ifdef POSIX_THREADS
pthread_join( sglob->replicas[ i ]->ri_tid, (void *) NULL );
#else
pthread_join( sglob->replicas[ i ]->ri_tid, (void *) &status );
#endif
}
Debug( LDAP_DEBUG_ANY, "slurpd: terminating normally\n", 0, 0, 0 );
sglob->slurpd_shutdown = 1;