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

Moved ldap_ headers to include/ac or include/ldap

parent 114f2cc9
......@@ -11,6 +11,9 @@
# -------------------------------------------------------------------------
# you will probably not need to edit anything below this point
# -------------------------------------------------------------------------
CC = gcc
CC = cc
PLATFORMCFLAGS= -Dfreebsd
# uncomment this line if using for LDAP_CRYPT
#PLATFORMLIBS= -lcrypt
......@@ -15,3 +15,6 @@ CC = gcc
RANLIB = "ranlib"
PLATFORMCFLAGS= -Dlinux
# uncomment this if -DLDAP_CRYPT is defined
#PLATFORMLIBS= -lcrypt
......@@ -10,7 +10,7 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
......@@ -24,7 +24,7 @@
#include <sys/socket.h>
#include <sysexits.h>
#include <ldapconfig.h>
#include "portable.h"
#include "bridge.h"
#include "lber.h"
#include "ldap.h"
......
......@@ -10,11 +10,12 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
#include <stdio.h>
#include <string.h>
#include <ac/string.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/time.h>
......@@ -24,12 +25,12 @@
#include <netdb.h>
#include <syslog.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <ac/wait.h>
#ifdef aix
#include <sys/select.h>
#endif /* aix */
#include <signal.h>
#include "portable.h"
#include "bridge.h"
#include "ldapconfig.h"
#ifdef USE_SYSCONF
......
......@@ -10,6 +10,7 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
......@@ -27,7 +28,7 @@
#include <sys/select.h>
#endif /* aix */
#include <signal.h>
#include "portable.h"
#include "bridge.h"
#include "ldapconfig.h"
#include "lber.h"
#include "ldap.h"
......
......@@ -10,6 +10,8 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
......@@ -30,7 +32,7 @@
#ifdef aix
#include <sys/select.h>
#endif /* aix */
#include "portable.h"
#include "bridge.h"
#include "ldapconfig.h"
#ifdef USE_SYSCONF
......
......@@ -10,6 +10,7 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
......@@ -21,7 +22,7 @@
#include <sys/resource.h>
#include <sys/wait.h>
#include <sysexits.h>
#include "portable.h"
#include "bridge.h"
#include "lber.h"
#include "ldap.h"
......
......@@ -6,13 +6,14 @@
* All Rights Reserved
*/
#include "portable.h"
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <string.h>
#include <ctype.h>
#include "portable.h"
#include "bridge.h"
#include "ldapconfig.h"
#include "rcpt500.h"
......
......@@ -35,7 +35,8 @@
#include <termios.h>
#endif /* defined( NeXT ) || defined( ultrix ) etc. */
#endif /* !DOS */
#if defined( aix ) || defined( __NetBSD__ )
#if defined( aix ) || defined( __NetBSD__ ) \
|| defined( __FreeBSD__ ) || defined( linux )
#include <sys/ioctl.h>
#endif /* aix || __NetBSD__ */
#include <ctype.h>
......
......@@ -14,7 +14,7 @@
#include <stdio.h>
#include <signal.h>
#include "ldap_string.h"
#include <ac/string.h>
#ifdef DOS
#include <malloc.h>
#endif
......@@ -30,7 +30,7 @@
#if !defined(DOS) && !defined(VMS)
#include <sys/types.h>
#endif
#include "bridge.h"
#ifdef USE_TERMIOS
#include <termios.h>
#else /* USE_TERMIOS */
......@@ -38,8 +38,6 @@
#endif /* USE_TERMIOS */
#include "ud.h"
#include "bridge.h"
#if defined(VMS)
#define getch getchar
#endif
......
......@@ -3,7 +3,40 @@
#ifndef _LTHREAD_H
#define _LTHREAD_H
#if defined( THREAD_SUNOS4_LWP )
#if defined ( THREAD_NEXT_CTHREADS )
#define _THREAD
#include <mach/cthreads.h>
typedef cthread_fn_t VFP;
typedef int pthread_attr_t;
typedef cthread_t pthread_t;
/* default attr states */
#define pthread_mutexattr_default NULL
#define pthread_condattr_default NULL
/* thread state - joinable or not */
#define PTHREAD_CREATE_JOINABLE 0
#define PTHREAD_CREATE_DETACHED 1
/* thread scope - who is in scheduling pool */
#define PTHREAD_SCOPE_PROCESS 0
#define PTHREAD_SCOPE_SYSTEM 1
/* mutex attributes and mutex type */
typedef int pthread_mutexattr_t;
typedef struct mutex pthread_mutex_t;
/* mutex and condition variable scope - process or system */
#define PTHREAD_SHARE_PRIVATE 0
#define PTHREAD_SHARE_PROCESS 1
/* condition variable attributes and condition variable type */
typedef int pthread_condattr_t;
typedef struct condition pthread_cond_t;
#elif defined( THREAD_SUNOS4_LWP )
/***********************************
* *
* thread definitions for sunos4 *
......@@ -127,6 +160,18 @@ typedef cond_t pthread_cond_t;
#define pthread_attr_setdetachstate( a, b ) \
pthread_attr_setdetach_np( a, b )
#else /* end dce pthreads */
#if defined( POSIX_THREADS )
#define _THREAD
#include <pthread.h>
#define pthread_mutexattr_default NULL
#define pthread_condattr_default NULL
#endif /* posix threads */
#endif /* dce pthreads */
#endif /* mit pthreads */
#endif /* sunos5 */
......
......@@ -2,7 +2,157 @@
#include <stdio.h>
#include "lthread.h"
#if defined( THREAD_SUNOS4_LWP )
#if defined( THREAD_NEXT_CTHREADS )
/***********************************************************************
* *
* under NEXTSTEP or OPENSTEP use CThreads *
* lukeh@xedoc.com.au *
* *
***********************************************************************/
int
pthread_attr_init( pthread_attr_t *attr )
{
*attr = 0;
return( 0 );
}
int
pthread_attr_destroy( pthread_attr_t *attr )
{
return( 0 );
}
int
pthread_attr_getdetachstate( pthread_attr_t *attr, int *detachstate )
{
*detachstate = *attr;
return( 0 );
}
int
pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate )
{
*attr = detachstate;
return( 0 );
}
/* ARGSUSED */
int
pthread_create(
pthread_t *tid,
pthread_attr_t attr,
VFP func,
void *arg
)
{
*tid = cthread_fork(func, arg);
return ( *tid == NULL ? -1 : 0 );
}
void
pthread_yield()
{
cthread_yield();
}
void
pthread_exit( any_t a )
{
cthread_exit( a );
}
void
pthread_join( pthread_t tid, int *pStatus )
{
int status;
status = (int) cthread_join ( tid );
if (pStatus != NULL)
{
*pStatus = status;
}
}
/* ARGSUSED */
void
pthread_kill( pthread_t tid, int sig )
{
return;
}
/* ARGSUSED */
int
pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr )
{
mutex_init( mp );
mp->name = NULL;
return ( 0 );
}
int
pthread_mutex_destroy( pthread_mutex_t *mp )
{
mutex_clear( mp );
return ( 0 );
}
int
pthread_mutex_lock( pthread_mutex_t *mp )
{
mutex_lock( mp );
return ( 0 );
}
int
pthread_mutex_unlock( pthread_mutex_t *mp )
{
mutex_unlock( mp );
return ( 0 );
}
int
pthread_mutex_trylock( pthread_mutex_t *mp )
{
return mutex_try_lock( mp );
}
int
pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr )
{
condition_init( cv );
return( 0 );
}
int
pthread_cond_destroy( pthread_cond_t *cv )
{
condition_clear( cv );
return( 0 );
}
int
pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp )
{
condition_wait( cv, mp );
return( 0 );
}
int
pthread_cond_signal( pthread_cond_t *cv )
{
condition_signal( cv );
return( 0 );
}
int
pthread_cond_broadcast( pthread_cond_t *cv )
{
condition_broadcast( cv );
return( 0 );
}
#elif defined( THREAD_SUNOS4_LWP )
/***********************************************************************
* *
......@@ -333,6 +483,16 @@ pthread_kill( pthread_t tid, int sig )
kill( getpid(), sig );
}
#else
#if defined ( POSIX_THREADS )
void p_thread_yield( void )
{
sched_yield();
}
#endif /* posix threads */
#endif /* dce pthreads */
#endif /* mit pthreads */
#endif /* sunos5 lwp */
......
/* acl.c - routines to parse and check acl's */
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
......@@ -9,7 +9,7 @@
#include <netdb.h>
#include "regex.h"
#include "slap.h"
#include "portable.h"
#include "bridge.h"
extern Filter *str2filter();
extern char *re_comp();
......
/* attr.c - routines for dealing with attributes */
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
......@@ -9,7 +10,7 @@
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/stat.h>
#include "portable.h"
#include "bridge.h"
#include "slap.h"
extern char **charray_dup();
......
/* ldbmcache.c - maintain a cache of open ldbm files */
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
......@@ -8,7 +9,7 @@
#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include "portable.h"
#include "bridge.h"
#include "slap.h"
#include "ldapconfig.h"
#include "back-ldbm.h"
......
......@@ -107,12 +107,15 @@ charray_dup( char **a )
}
char **
str2charray( char *str, char *brkstr )
str2charray( char *str_in, char *brkstr )
{
char **res;
char *s;
int i;
/* protect the input string from strtok */
char *str = strdup( str_in );
i = 1;
for ( s = str; *s; s++ ) {
if ( strchr( brkstr, *s ) != NULL ) {
......@@ -128,5 +131,6 @@ str2charray( char *str, char *brkstr )
}
res[i] = NULL;
free( str );
return( res );
}
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
......@@ -5,7 +6,7 @@
#include <sys/socket.h>
#include <errno.h>
#include <signal.h>
#include "portable.h"
#include "bridge.h"
#include "slap.h"
extern Operation *op_add();
......@@ -203,7 +204,7 @@ connection_activity(
pthread_attr_init( &attr );
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
if ( pthread_create( &arg->co_op->o_tid, attr,
if ( pthread_create( &arg->co_op->o_tid, &attr,
(void *) connection_operation, (void *) arg ) != 0 ) {
Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
} else {
......
/* Revision history
*
* 5-Jun-96 hodges
* Added locking of new_conn_mutex when traversing the c[] array.
*/
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
......@@ -12,7 +20,7 @@
#include <sys/select.h>
#endif
#include "slap.h"
#include "portable.h"
#include "bridge.h"
#include "ldapconfig.h"
#ifdef NEED_FILIO
#include <sys/filio.h>
......@@ -48,7 +56,7 @@ static void set_shutdown();
static void do_nothing();
void
daemon(
slapd_daemon(
int port
)
{
......@@ -68,7 +76,12 @@ daemon(
#else /* USE_SYSCONF */
dtblsize = getdtablesize();
#endif /* USE_SYSCONF */
/*
* Add greg@greg.rim.or.jp
*/
if(dtblsize > FD_SETSIZE) {
dtblsize = FD_SETSIZE;
}
c = (Connection *) ch_calloc( 1, dtblsize * sizeof(Connection) );
for ( i = 0; i < dtblsize; i++ ) {
......@@ -127,9 +140,18 @@ daemon(
}
(void) SIGNAL( SIGPIPE, SIG_IGN );
#ifdef SIGSTKFLT
(void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
#else
(void) SIGNAL( SIGUSR1, (void *) do_nothing );
#endif
#ifdef SIGSTKFLT
(void) SIGNAL( SIGUNUSED, (void *) set_shutdown );
#else
(void) SIGNAL( SIGUSR2, (void *) set_shutdown );
#endif
(void) SIGNAL( SIGTERM, (void *) set_shutdown );
(void) SIGNAL( SIGINT, (void *) set_shutdown );
(void) SIGNAL( SIGHUP, (void *) set_shutdown );
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
......@@ -164,6 +186,8 @@ daemon(
Debug( LDAP_DEBUG_CONNS,
"listening for connections on %d, activity on:",
tcps, 0, 0 );
pthread_mutex_lock( &new_conn_mutex );
for ( i = 0; i < dtblsize; i++ ) {
if ( c[i].c_sb.sb_sd != -1 ) {
FD_SET( c[i].c_sb.sb_sd, &readfds );
......@@ -176,6 +200,7 @@ daemon(
}
}
Debug( LDAP_DEBUG_CONNS, "\n", 0, 0, 0 );
pthread_mutex_unlock( &new_conn_mutex );
zero.tv_sec = 0;
zero.tv_usec = 0;
......@@ -349,15 +374,28 @@ set_shutdown()
{
Debug( LDAP_DEBUG_ANY, "slapd got shutdown signal\n", 0, 0, 0 );
slapd_shutdown = 1;
#ifdef SIGSTKFLT
pthread_kill( listener_tid, SIGSTKFLT );
#else
pthread_kill( listener_tid, SIGUSR1 );
#endif
#ifdef SIGUNUSED
(void) SIGNAL( SIGUNUSED, (void *) set_shutdown );
#else
(void) SIGNAL( SIGUSR2, (void *) set_shutdown );
#endif
(void) SIGNAL( SIGTERM, (void *) set_shutdown );
(void) SIGNAL( SIGINT, (void *) set_shutdown );
(void) SIGNAL( SIGHUP, (void *) set_shutdown );
}
static void
do_nothing()
{
Debug( LDAP_DEBUG_TRACE, "slapd got SIGUSR1\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "slapd got do_nothing signal\n", 0, 0, 0 );
#ifdef SIGSTKFLT
(void) SIGNAL( SIGSTKFLT, (void *) do_nothing );
#else
(void) SIGNAL( SIGUSR1, (void *) do_nothing );
#endif
}
......@@ -10,6 +10,7 @@
* is provided ``as is'' without express or implied warranty.
*/
#include "portable.h"
#include <stdio.h>
#include <sys/types.h>
#ifdef SVR4
......@@ -19,7 +20,7 @@
#include <sys/file.h>
#include <sys/ioctl.h>
#include <signal.h>
#include "portable.h"
#include "bridge.h"
#ifdef USE_SYSCONF
#include <unistd.h>
......
/* dn.c - routines for dealing with distinguished names */
#include "portable.h"
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <sys/time.h>