]> git.sur5r.net Git - openldap/commitdiff
Mongo patch: changes from -devel from 981105 snap to present
authorKurt Zeilenga <kurt@openldap.org>
Sun, 15 Nov 1998 20:08:54 +0000 (20:08 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 15 Nov 1998 20:08:54 +0000 (20:08 +0000)
    Changed LDBM default to sync on writes
    Added mail500 BOUNCEFROM patch
    Added dbcachenowsync option
    Fixed slapd/ldbm id2children bug
    Fixed slapd/shell newline bug
    Fixed whois++ get_dn leak
    Fixed DEC OSF1 (alpha) support
    Fixed r/w lock initialization on non-final Pthreads
    Fixed slapd/slurpd file unlock bugs
    Fixed slurpd string translation bug
    Fixed slurpd/st mutex unlock bug
    Moved detach() to -llutil
    Added lutil_passwd() to -llutil
    Autoconf:
        Fixed thread detection
        Removed gcc -traditional tests
        Changed --enable-dns to require --enable-referrals
        Added -lresolv tests for ldapd and LDAP_DNS
        Added basic ISODE checks
        Added pwd.h &  getpwuid() tests
        Added sys/resource.h test
    Updated NT support (now builds ud)
    Removed lint

101 files changed:
CHANGES
README
acconfig.h
build/version
clients/fax500/faxtotpc.c
clients/fax500/main.c
clients/fax500/rp500.c
clients/gopher/go500.c
clients/mail500/main.c
clients/tools/ldapdelete.c
clients/tools/ldapdelete.dsp [new file with mode: 0644]
clients/tools/ldapmodify.dsp [new file with mode: 0644]
clients/tools/ldapmodrdn.c
clients/tools/ldapmodrdn.dsp [new file with mode: 0644]
clients/tools/ldapsearch.c
clients/tools/ldapsearch.dsp
clients/ud/auth.c
clients/ud/edit.c
clients/ud/find.c
clients/ud/main.c
clients/ud/mod.c
clients/ud/ud.dsp [new file with mode: 0644]
clients/ud/ud.dsw [new file with mode: 0644]
clients/ud/ud.h
clients/ud/util.c
configure
configure.in
contrib/whois++/describe.c
doc/man/man3/ldap.3
doc/man/man5/slapd.conf.5
include/avl.h
include/ldap.h
include/ldap_cdefs.h [new file with mode: 0644]
include/lthread.h
include/lutil.h
include/portable.h.in
include/portable.h.nt
libraries/liblber/dtest.c
libraries/liblber/liblber.dsp
libraries/libldap/cldap.c
libraries/libldap/disptmpl.c
libraries/libldap/dsparse.c
libraries/libldap/error.c
libraries/libldap/getfilter.c
libraries/libldap/kbind.c
libraries/libldap/ldap-int.h
libraries/libldap/libldap.dsp
libraries/libldap/sort.c
libraries/libldap/srchpref.c
libraries/libldap/ufn.c
libraries/libldap/url.c
libraries/libldif/libldif.dsp
libraries/libldif/line64.c
libraries/liblthread/rdwr.c [new file with mode: 0644]
libraries/liblthread/thread.c
libraries/liblutil/Makefile.in
libraries/liblutil/detach.c
libraries/liblutil/getopt.c [new file with mode: 0644]
libraries/liblutil/liblutil.dsp
libraries/liblutil/passwd.c [new file with mode: 0644]
libraries/liblutil/setproctitle.c
servers/slapd/attr.c
servers/slapd/back-ldbm/back-ldbm.h
servers/slapd/back-ldbm/config.c
servers/slapd/back-ldbm/delete.c
servers/slapd/back-ldbm/dn2id.c
servers/slapd/back-ldbm/id2children.c
servers/slapd/back-ldbm/id2entry.c
servers/slapd/back-ldbm/idl.c
servers/slapd/back-ldbm/init.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-shell/modify.c
servers/slapd/bind.c
servers/slapd/ch_malloc.c
servers/slapd/connection.c
servers/slapd/filter.c
servers/slapd/lock.c
servers/slapd/main.c
servers/slapd/proto-slap.h
servers/slapd/repl.c
servers/slapd/slap.h
servers/slapd/tools/centipede.c
servers/slapd/tools/chlog2replog.c
servers/slapd/tools/ldif.c
servers/slapd/tools/ldif2id2children.c
servers/slapd/tools/ldif2index.c
servers/slapd/tools/ldif2ldbm.c
servers/slurpd/ch_malloc.c
servers/slurpd/fm.c
servers/slurpd/globals.c
servers/slurpd/ldap_op.c
servers/slurpd/lock.c
servers/slurpd/main.c
servers/slurpd/re.c
servers/slurpd/replica.c
servers/slurpd/replog.c
servers/slurpd/ri.c
servers/slurpd/rq.c
servers/slurpd/slurp.h
servers/slurpd/st.c
tests/scripts/test001-ldif2ldbm

diff --git a/CHANGES b/CHANGES
index a612618a2c5e201859e52399acdeb4659abe015d..46bafb85f8b7939233d11ba1203b3c64ac17d90c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,32 @@
 OpenLDAP Change Log
 
+Changes included in OpenLDAP 1.1-Alpha (from -devel)
+       CVS Tag: OPENLDAP_REL_ENG_1_1
+       Changed LDBM default to sync on writes
+       Added mail500 BOUNCEFROM patch
+       Added dbcachenowsync option
+       Fixed slapd/ldbm id2children bug
+       Fixed slapd/shell newline bug
+       Fixed whois++ get_dn leak
+       Fixed DEC OSF1 (alpha) support
+       Fixed r/w lock initialization on non-final Pthreads
+       Fixed slapd/slurpd file unlock bugs
+       Fixed slurpd string translation bug
+       Fixed slurpd/st mutex unlock bug
+       Moved detach() to -llutil
+       Added lutil_passwd() to -llutil
+       Autoconf:
+               Fixed thread detection
+               Removed gcc -traditional tests
+               Changed --enable-dns to require --enable-referrals
+               Added -lresolv tests for ldapd and LDAP_DNS
+               Added basic ISODE checks
+               Added pwd.h &  getpwuid() tests
+               Added sys/resource.h test
+       Updated NT support (now builds ud)
+       Removed lint
+
+
 Changes included in OpenLDAP 1.1-Alpha (from -devel)
        CVS Tag: OPENLDAP_REL_ENG_1_1_ALPHA2
        Added cross compiling detect and warnings
diff --git a/README b/README
index f251681a9c96b67878b772bd376841f131da5494..1baca53c29663deb4fee6a8529f05dcb1503cd51 100644 (file)
--- a/README
+++ b/README
@@ -29,7 +29,7 @@ REQUIRED SOFTWARE
                ISODE compatible ldap distribution
 
        CLIENTS/CONTRIBware:
-               Depends on package.  See per package READMEs.
+               Depends on package.  See per package README.
                
 
 MAKING AND INSTALLING THE DISTRIBUTION
index ae871c6f03831a570e36c9df465ba5865e1b9a56..4aa89526b56e1769868e39766dc3bddb76384eca 100644 (file)
@@ -9,9 +9,12 @@
 /* define this if needed to get reentrant functions */
 #undef _REENTRANT
 
-/* define this if needed to get threadsafe functions */
+/* define this if needed to get thread safe functions */
 #undef _THREAD_SAFE
 
+/* define this if needed to get thread safe functions */
+#undef _THREADSAFE
+
 /* define this if toupper() requires tolower() check */
 #undef C_UPPER_LOWER
 
 /* define if you have crypt */
 #undef HAVE_CRYPT
 
-/* define if you have DCE */
-#undef HAVE_DCE
+/* define if you have DSAP */
+#undef HAVE_DSAP
 
 /* define if you have GDBM */
 #undef HAVE_GDBM
 
+/* define if you have ISODE */
+#undef HAVE_ISODE
+
 /* define if you have Kerberos */
 #undef HAVE_KERBEROS
 
@@ -51,6 +57,9 @@
 /* define if you have Mach CThreads */
 #undef HAVE_MACH_CTHREADS
 
+/* define if you have PP */
+#undef HAVE_PP
+
 /* define if you have a preemptive POSIX Threads implementation */
 #undef HAVE_PREEMPTIVE_PTHREADS
 
@@ -81,6 +90,9 @@
 /* define if you have Sun LWP (Solaris style) */
 #undef HAVE_THR
 
+/* define if you have XTPP */
+#undef HAVE_XTPP
+
 /* define this for connectionless LDAP support */
 #undef LDAP_CONNECTIONLESS
 
index 273e63228ce18e14dcd7ea08f8882cb7ebbbc92d..fee8c154199200d71902fcb723a4473691da63ab 100644 (file)
@@ -1 +1 @@
-1.1-alpha2
+1.1-alpha3
index d4631b43e6847c753b48c53be47063e61bc37304..727020f85f7adbdf434d20945aca24cd72f7e743 100644 (file)
  * Routines for parsing the facsimileTelephoneNumber field out of
  * an X.500 entry and converting it to a "tpc.int" domain name.
  *
- * char *faxtotpc(str)
- * char *str;
+ * char *faxtotpc( char *str, char *userinfo)
  *
  * faxtotpc() returns a pointer to a string allocated with malloc(3).
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
 #include <ctype.h>
-#include <sys/types.h>
-
-#ifdef ultrix
-extern char *strdup();
-#endif
 
+#include <sys/types.h>
+#include <ac/string.h>
 
 #define        TPCDOMAIN       "tpc.int"
 
index 7481d4980e860ec07b4756c89e0ff54d0f04ebef..d82859cb03bf4b567d56a9e239ec9c528df3ad42 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
+#include <stdlib.h>
 #include <ctype.h>
-#include <memory.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <syslog.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/wait.h>
+
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
 #include <sys/resource.h>
-#include <sys/wait.h>
-#include <sys/socket.h>
 #include <sysexits.h>
-#include <ldapconfig.h>
-#include "portable.h"
 
 #include "lber.h"
 #include "ldap.h"
+#include <ldapconfig.h>
 
 #define USER           0
 #define GROUP_ERRORS   1
@@ -308,7 +312,7 @@ connect_to_x500()
        ld->ld_sizelimit = FAX_MAXAMBIGUOUS;
        ld->ld_deref = LDAP_DEREF_ALWAYS;
 
-       if ( ldap_simple_bind_s( ld, FAX_BINDDN, NULL ) != LDAP_SUCCESS ) {
+       if ( ldap_simple_bind_s( ld, FAX_BINDDN, FAX_BIND_CRED ) != LDAP_SUCCESS ) {
                syslog( LOG_ALERT, "ldap_simple_bind_s failed" );
                return( -1 );
        }
@@ -921,14 +925,14 @@ send_message( to )
     char       **to;
 {
        int     pid;
-#ifndef USE_WAITPID
+#ifndef HAVE_WAITPID
        WAITSTATUSTYPE  status;
 #endif
 
 
        /* parent */
        if ( pid = fork() ) {
-#ifdef USE_WAITPID
+#ifdef HAVE_WAITPID
                waitpid( pid, (int *) NULL, 0 );
 #else
                wait4( pid, &status, WAIT_FLAGS, 0 );
@@ -953,7 +957,7 @@ send_group( group, ngroup )
        char    **argv;
        int     argc;
        char    *iargv[7];
-#ifndef USE_WAITPID
+#ifndef HAVE_WAITPID
        WAITSTATUSTYPE  status;
 #endif
 
@@ -976,7 +980,7 @@ send_group( group, ngroup )
 
                /* parent */
                if ( pid = fork() ) {
-#ifdef USE_WAITPID
+#ifdef HAVE_WAITPID
                        waitpid( pid, (int *) NULL, 0 );
 #else
                        wait4( pid, &status, WAIT_FLAGS, 0 );
index 25eece609dacd4d8217d6296ede3e47a5caa3965..0347369baed0ee5b2c9c781be2b633ea87e19bc4 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
-#include <sys/resource.h>
-#include <sys/wait.h>
 #include <signal.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/wait.h>
+
+#include <sys/resource.h>
+
+#include <lber.h>
+#include <ldap.h>
+
 #include <ldapconfig.h>
-#include "lber.h"
-#include "ldap.h"
 
 #define DEFAULT_PORT           79
 #define DEFAULT_SIZELIMIT      50
 
 int            debug;
-char           *ldaphost = LDAPHOST;
-char           *base = DEFAULT_BASE;
+char   *ldaphost = LDAPHOST;
+char   *base = RP_BASE;
 int            deref;
 int            sizelimit;
 LDAPFiltDesc   *filtd;
@@ -114,7 +116,7 @@ main (argc, argv)
        ld->ld_sizelimit = sizelimit ? sizelimit : DEFAULT_SIZELIMIT;
        ld->ld_deref = deref;
 
-       if ( ldap_simple_bind_s( ld, RP_BINDDN, NULL ) != LDAP_SUCCESS ) {
+       if ( ldap_simple_bind_s( ld, RP_BINDDN, RP_BIND_CRED ) != LDAP_SUCCESS ) {
                fprintf( stderr, "X.500 is temporarily unavailable.\n" );
                ldap_perror( ld, "ldap_simple_bind_s" );
                exit( -1 );
@@ -255,7 +257,7 @@ print_entry( ld, e )
                fprintf( stderr, "Entry \"%s\" has no fax number.\n", dn );
                exit( 1 );
        }
-       faxmail = faxtotpc( fax[0] );
+       faxmail = faxtotpc( fax[0], NULL );
        title = ldap_get_values( ld, e, "title" );
        phone = ldap_get_values( ld, e, "telephoneNumber" );
        mail = ldap_get_values( ld, e, "mail" );
index 5b4c7aa1cafec7e1e1aafe7c76a8199e7ec44359..4174d1eda89d5e42c3f0f60566b912587cf530cf 100644 (file)
@@ -377,7 +377,9 @@ int s;
 
        rewind(fp);
 
-       if ( *query != '~' && *query != '@' ) {
+       if ( *query == '~' || *query == '@' ) {
+               ld = NULL;
+       } else {
                if ( (ld = ldap_open( ldaphost, LDAP_PORT )) == NULL ) {
                        fprintf(fp,
                            "0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
@@ -423,7 +425,10 @@ int        s;
 
        fprintf( fp, ".\r\n" );
        rewind(fp);
-       ldap_unbind( ld );
+
+       if( ld == NULL ) {
+               ldap_unbind( ld );
+       }
 
        exit( 1 );
        /* NOT REACHED */
index 5fdea962011536a366ef54fb7b72c77565e2acdc..37205d35eae1d4fbad91d05ceccf4cc5f2b88af0 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
+#include <stdlib.h>
 #include <ctype.h>
-#include <memory.h>
-#include <sys/types.h>
-#include <sys/time.h>
-#include <syslog.h>
+
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/wait.h>
+
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
 #include <sys/resource.h>
-#include <sys/wait.h>
+
 #include <sysexits.h>
-#include "portable.h"
 
 #include "lber.h"
 #include "ldap.h"
 #include "ldapconfig.h"
 
+#ifndef MAIL500_BOUNCEFROM
+#define MAIL500_BOUNCEFROM "<>"
+#endif
+
 #define USER           0x01
 #define GROUP_ERRORS   0x02
 #define GROUP_REQUEST  0x04
@@ -734,7 +744,8 @@ do_group( e, dn, to, nto, togroups, ngroups, err, nerr )
                /* else from the moderator - fall through and deliver it */
        }
 
-       if ( has_attributes( e, "rfc822ErrorsTo", "errorsTo" ) ) {
+       if (strcmp(MAIL500_BOUNCEFROM, mailfrom) != 0 &&
+           has_attributes( e, "rfc822ErrorsTo", "errorsTo" ) ) {
                add_group( dn, togroups, ngroups );
 
                return( 0 );
@@ -1029,7 +1040,7 @@ send_message( to )
     char       **to;
 {
        int     pid;
-#ifndef USE_WAITPID
+#ifndef HAVE_WAITPID
        WAITSTATUSTYPE  status;
 #endif
 
@@ -1048,7 +1059,7 @@ send_message( to )
 
        /* parent */
        if ( pid = fork() ) {
-#ifdef USE_WAITPID
+#ifdef HAVE_WAITPID
                waitpid( pid, (int *) NULL, 0 );
 #else
                wait4( pid, &status, WAIT_FLAGS, 0 );
@@ -1073,7 +1084,7 @@ send_group( group, ngroup )
        char    **argv;
        int     argc;
        char    *iargv[7];
-#ifndef USE_WAITPID
+#ifndef HAVE_WAITPID
        WAITSTATUSTYPE  status;
 #endif
 
@@ -1108,7 +1119,7 @@ send_group( group, ngroup )
 
                /* parent */
                if ( pid = fork() ) {
-#ifdef USE_WAITPID
+#ifdef HAVE_WAITPID
                        waitpid( pid, (int *) NULL, 0 );
 #else
                        wait4( pid, &status, WAIT_FLAGS, 0 );
@@ -1136,16 +1147,20 @@ send_errors( err, nerr )
        int     fd[2];
        char    *argv[8];
        char    buf[1024];
-#ifndef USE_WAITPID
+#ifndef HAVE_WAITPID
        WAITSTATUSTYPE  status;
 #endif
 
+       if ( strcmp( MAIL500_BOUNCEFROM, mailfrom ) == 0 ) {
+           mailfrom = errorsfrom;
+       }
+
        argv[0] = MAIL500_SENDMAIL;
        argv[1] = "-oMrX.500";
        argv[2] = "-odi";
        argv[3] = "-oi";
        argv[4] = "-f";
-       argv[5] = errorsfrom;
+       argv[5] = MAIL500_BOUNCEFROM;
        argv[6] = mailfrom;
        argv[7] = NULL;
 
@@ -1255,7 +1270,7 @@ send_errors( err, nerr )
                }
                fclose( fp );
 
-#ifdef USE_WAITPID
+#ifdef HAVE_WAITPID
                waitpid( pid, (int *) NULL, 0 );
 #else
                wait4( pid, &status, WAIT_FLAGS, 0 );
index 9a0bf901a8486e9a7400184806a487748c504e34..7b7555298dd160bde7238d7a5092fa2f0838643c 100644 (file)
@@ -34,6 +34,7 @@ static int dodelete LDAP_P((
     LDAP       *ld,
     char       *dn));
 
+int
 main( argc, argv )
     int                argc;
     char       **argv;
diff --git a/clients/tools/ldapdelete.dsp b/clients/tools/ldapdelete.dsp
new file mode 100644 (file)
index 0000000..395ec02
--- /dev/null
@@ -0,0 +1,91 @@
+# Microsoft Developer Studio Project File - Name="ldapdelete" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ldapdelete - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapdelete.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapdelete.mak" CFG="ldapdelete - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ldapdelete - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ldapdelete - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ldapdelete - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release\ldapdelete"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "ldapdelete - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug\ldapdelete"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ldapdelete - Win32 Release"
+# Name "ldapdelete - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ldapdelete.c
+# End Source File
+# End Target
+# End Project
diff --git a/clients/tools/ldapmodify.dsp b/clients/tools/ldapmodify.dsp
new file mode 100644 (file)
index 0000000..a34cb9c
--- /dev/null
@@ -0,0 +1,91 @@
+# Microsoft Developer Studio Project File - Name="ldapmodify" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ldapmodify - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapmodify.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapmodify.mak" CFG="ldapmodify - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ldapmodify - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ldapmodify - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ldapmodify - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "ldapmodify - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug\ldapmodify"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ldapmodify - Win32 Release"
+# Name "ldapmodify - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ldapmodify.c
+# End Source File
+# End Target
+# End Project
index 76b6154f9fd84fb01edf201f26a05cbf9ef6a41c..2bc5d772c1a5e9de4b836ee5255eae715bff38a4 100644 (file)
@@ -36,6 +36,7 @@ static int domodrdn LDAP_P((
     char       *rdn,
     int                remove));       /* flag: remove old RDN */
 
+int
 main( argc, argv )
     int                argc;
     char       **argv;
diff --git a/clients/tools/ldapmodrdn.dsp b/clients/tools/ldapmodrdn.dsp
new file mode 100644 (file)
index 0000000..d5e6bfd
--- /dev/null
@@ -0,0 +1,91 @@
+# Microsoft Developer Studio Project File - Name="ldapmodrdn" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ldapmodrdn - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapmodrdn.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "ldapmodrdn.mak" CFG="ldapmodrdn - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ldapmodrdn - Win32 Release" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE "ldapmodrdn - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ldapmodrdn - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\libraries\Release"
+
+!ELSEIF  "$(CFG)" == "ldapmodrdn - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug\ldapmodrdn"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 oldap32.lib olber32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ldapmodrdn - Win32 Release"
+# Name "ldapmodrdn - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\ldapmodrdn.c
+# End Source File
+# End Target
+# End Project
index baa67d649b30ef1c3ac8af26e5deafc03389a67d..ef39b868e058fb4a0a56228d9a5fd5c0ebe9fd5f 100644 (file)
@@ -1,8 +1,9 @@
 #include "portable.h"
 
 #include <stdio.h>
-#include <ctype.h>
+#include <stdlib.h>
 
+#include <ac/ctype.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
@@ -87,6 +88,7 @@ static char   *sortattr = NULL;
 static int     skipsortattr = 0;
 static int     verbose, not, includeufn, allow_binary, vals2tmp, ldif;
 
+int
 main( argc, argv )
 int    argc;
 char   **argv;
index 986dd35c5e0d3f7ba94ba86a57866709a8cf989e..be396ce5e880e67aa1bc8ad8949b2bbb658fe005 100644 (file)
@@ -43,7 +43,7 @@ RSC=rc.exe
 # PROP Ignore_Export_Lib 0
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /Ze /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
 # ADD BASE RSC /l 0x409 /d "NDEBUG"
 # ADD RSC /l 0x409 /d "NDEBUG"
 BSC32=bscmake.exe
@@ -51,7 +51,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
-# ADD LINK32 libldap.lib liblber.lib liblutil.lib ws2_32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /machine:I386
 
 !ELSEIF  "$(CFG)" == "ldapsearch - Win32 Debug"
 
@@ -75,7 +75,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 libldap.lib liblber.lib libldif.lib liblutil.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
+# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
 
 !ENDIF 
 
index be4727695be956c6d6d0acfe5b77f90d0125e293..1b2474ef663d166b3a4a46d4fe441cbfa750cdd8 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
+#include <stdlib.h>
+
+#include <ac/ctype.h>
+#include <ac/krb.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#ifdef HAVE_PWD_H
 #include <pwd.h>
-#include <string.h>
-#include <ctype.h>
+#endif
+
 #include <lber.h>
 #include <ldap.h>
 #include <ldapconfig.h>
+
 #include "ud.h"
-#ifdef KERBEROS
-#include <sys/types.h>
-#include <krb.h>
-#endif
 
 extern LDAP *ld;               /* our LDAP descriptor */
 extern int verbose;            /* verbosity indicator */
@@ -31,12 +38,14 @@ extern char *mygetpass();   /* getpass() passwds are too short */
 extern int debug;              /* debug flag */
 #endif
 
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
 static char tktpath[20];       /* ticket file path */
 static int kinit();
 static int valid_tgt();
 #endif
 
+static void set_bound_dn();
+
 auth(who, implicit)
 char *who;
 int implicit;
@@ -46,9 +55,13 @@ int implicit;
        char **rdns;            /* for fiddling with the DN */
        int authmethod;
        int name_provided;      /* was a name passed in? */
+#ifdef HAVE_GETPWUID
        struct passwd *pw;      /* for getting user id */
+#else
+       char *user;
+#endif
        char uidname[20];
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
        char **krbnames;        /* for kerberos names */
        int kinited, ikrb;
        char buf[5];
@@ -65,7 +78,6 @@ int implicit;
        extern void printbase();        /* used to pretty-print a base */
        extern int bind_status;
        extern void Free();
-       static void set_bound_dn();
 
 #ifdef DEBUG
        if (debug & D_TRACE)
@@ -77,11 +89,26 @@ int implicit;
         *  The user needs to bind.  If <who> is not specified, we
         *  assume that authenticating as user id is what user wants.
         */
-       if (who == NULL && implicit && (pw = getpwuid((uid_t)geteuid()))
-           != (struct passwd *) NULL) {
-               sprintf(uidname, "uid=%s", pw->pw_name);
-               /* who = pw->pw_name; /* */
-               who = uidname;
+       if (who == NULL && implicit) {
+               uidname[0] = '\0';
+
+#ifdef HAVE_GETPWUID
+               if ((pw = getpwuid((uid_t)geteuid())) != (struct passwd *) NULL) {
+                       sprintf(uidname, "uid=%s", pw->pw_name);
+               }
+#else
+               user = getenv("USER");
+               if(user == NULL) user = getenv("USERNAME");
+               if(user == NULL) user = getenv("LOGNAME");
+
+               if(user != NULL) {
+                       sprintf(uidname, "uid=%s", user);
+               }
+#endif
+
+               if(uidname[0] != '\0') {
+                       who = uidname;
+               }
        }
 
        if ( who == NULL ) {
@@ -130,7 +157,7 @@ int implicit;
        rdns = ldap_explode_dn(Entry.DN, TRUE);
        printf("  Authenticating to the directory as \"%s\"...\n", *rdns );
 
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
        /*
         * First, if the user has a choice of auth methods, ask which
         * one they want to use.  if they want kerberos, ask which
@@ -155,7 +182,7 @@ int implicit;
 
                if ( hassimple && !kinited ) {
                        printf("  Which password would you like to use?\n");
-                       printf("    1 -> X.500 password\n");
+                       printf("    1 -> LDAP password\n");
 #ifdef UOFM
                        printf("    2 -> UMICH password (aka Uniqname or Kerberos password)\n");
 #else
@@ -221,7 +248,7 @@ int implicit;
        } else {
 #endif
                authmethod = LDAP_AUTH_SIMPLE;
-               sprintf(prompt, "  Enter your X.500 password: ");
+               sprintf(prompt, "  Enter your LDAP password: ");
                do {
                        passwd = mygetpass(prompt);
                } while (passwd != NULL && *passwd == '\0');
@@ -229,7 +256,7 @@ int implicit;
                        (void) ldap_value_free(rdns);
                        return(0);
                }
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
        }
        (void) ldap_value_free(krbnames);
 #endif
@@ -239,19 +266,19 @@ int implicit;
                if (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)
                        fprintf(stderr, "  Entry has no password\n");
                else if (ld->ld_errno == LDAP_INVALID_CREDENTIALS)
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
                        if ( authmethod == LDAP_AUTH_KRBV4 ) {
                                fprintf(stderr, "  The Kerberos credentials are invalid.\n");
                        } else {
 #endif
                                fprintf(stderr, "  The password you provided is incorrect.\n");
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
                        }
 #endif
                else
                        ldap_perror(ld, "ldap_bind_s" );
                (void) ldap_bind_s(ld, default_bind_object,
-                        (char *) UD_PASSWD, LDAP_AUTH_SIMPLE);
+                        (char *) UD_BIND_CRED, LDAP_AUTH_SIMPLE);
                if (default_bind_object == NULL)
                        set_bound_dn(NULL);
                else
@@ -274,20 +301,18 @@ int implicit;
        return(0);
 }
 
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
 
 #define FIVEMINS       ( 5 * 60 )
 #define TGT            "krbtgt"
 
-str2upper( s )
+static void str2upper( s )
     char       *s;
 {
        char    *p;
 
        for ( p = s; *p != '\0'; ++p ) {
-               if ( islower( *p )) {
-                       *p = toupper( *p );
-               }
+               *p = TOUPPER( *p );
        }
 }
 
@@ -307,12 +332,12 @@ static valid_tgt( names )
                        return( 0 );
                }
 
-#ifdef AFSKERBEROS
+#ifdef HAVE_AFS_KERBEROS
                /*
                 * realm must be uppercase for krb_ routines
                 */
                str2upper( realm );
-#endif /* AFSKERBEROS */
+#endif /* HAVE_AFS_KERBEROS */
 
                /*
                * check ticket file for a valid ticket granting ticket
@@ -351,18 +376,16 @@ krbgetpass( user, inst, realm, pw, key )
                return(-1);
        }
 
-#ifdef AFSKERBEROS
+#ifdef HAVE_AFS_KERBEROS
        strcpy( lcrealm, realm );
        for ( p = lcrealm; *p != '\0'; ++p ) {
-               if ( isupper( *p )) {
-                       *p = tolower( *p );
-               }
+               *p = TOLOWER( *p );
        }
 
        ka_StringToKey( passwd, lcrealm, key );
-#else /* AFSKERBEROS */
+#else /* HAVE_AFS_KERBEROS */
        string_to_key( passwd, key );
-#endif /* AFSKERBEROS */
+#endif /* HAVE_AFS_KERBEROS */
 
        return( 0 );
 }
@@ -382,12 +405,12 @@ static kinit( kname )
                return( -1 );
        }
 
-#ifdef AFSKERBEROS
+#ifdef HAVE_AFS_KERBEROS
        /*
         * realm must be uppercase for krb_ routines
         */
        str2upper( realm );
-#endif /* AFSKERBEROS */
+#endif /* HAVE_AFS_KERBEROS */
 
        rc = krb_get_in_tkt( name, inst, realm, TGT, realm,
            DEFAULT_TKT_LIFE, krbgetpass, NULL, NULL );
@@ -407,7 +430,7 @@ static kinit( kname )
        return( 0 );
 }
 
-destroy_tickets()
+void destroy_tickets(void)
 {
        if ( *tktpath != '\0' ) {
                unlink( tktpath );
@@ -415,13 +438,12 @@ destroy_tickets()
 }
 #endif
 
-static void set_bound_dn(s)
-char *s;
+static void set_bound_dn(char *s)
 {
        extern void Free();
        extern char *bound_dn;
 
        if (bound_dn != NULL)
                Free(bound_dn);
-       bound_dn = strdup(s);
+       bound_dn = (s == NULL) ? NULL : strdup(s);
 }
index eb8969c533dd5e4c65c67b8257c4f8b9ab6596f5..d780c5ab9e08d4f02e3d454405a8a72dd957cd2a 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/time.h>
+
+#include <ac/signal.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/wait.h>
+
+#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-#include <sys/wait.h>
-#include <signal.h>
+#endif
+#ifdef HAVE_PROCESS_H
+#include <process.h>
+#endif
+
 #include <lber.h>
 #include <ldap.h>
 #include <ldapconfig.h>
 #include "ud.h"
+extern void *Malloc();
 
 extern struct entry Entry; 
 extern int verbose;
@@ -29,6 +39,12 @@ extern LDAP *ld;
 
 extern LDAPMessage *find();
 
+static int load_editor();
+static int modifiable();
+static int print_attrs_and_values();
+static int ovalues();
+static int write_entry();
+
 static char *entry_temp_file;
 
 #ifdef DEBUG
@@ -42,8 +58,6 @@ char *who;
        char *dn, **rdns;                       /* distinguished name */
        char name[MED_BUF_SIZE];                /* entry to modify */
        extern int bind_status;
-       static int load_editor();
-       static int write_entry();
 
 #ifdef DEBUG
        if (debug & D_TRACE)
@@ -110,7 +124,6 @@ static load_editor()
        static char template[MED_BUF_SIZE];
        extern char * mktemp();
        extern int isgroup(), fatal();
-       static int print_attrs_and_values();
        int pid;
        int status;
        int rc;
@@ -164,25 +177,34 @@ static load_editor()
                        ++p;
                }
                printf("  Using %s as the editor...\n", p );
+#ifndef HAVE_SPAWNLP
                sleep(2);
+#endif
        }
+#ifdef HAVE_SPAWNLP
+       rc = _spawnlp( _P_WAIT, editor, editor, entry_temp_file, NULL );
+       if(rc != 0) {
+               fatal("spawnlp");
+       }
+#else
        if ((pid = fork()) == 0) {      
                /* child - edit the Directory entry */
-               (void) signal(SIGINT, SIG_IGN);
+               (void) SIGNAL(SIGINT, SIG_IGN);
                (void) execlp(editor, editor, entry_temp_file, NULL);
                /*NOTREACHED*/
                (void) fatal(editor);   
        }
        else if (pid > 0) {
                /* parent - wait until the child proc is done editing */
-               handler = signal(SIGINT, SIG_IGN);
+               handler = SIGNAL(SIGINT, SIG_IGN);
                (void) wait(&status);
-               (void) signal(SIGINT, handler);
+               (void) SIGNAL(SIGINT, handler);
        }
        else {
                fatal("fork");
                /*NOTREACHED*/
        }
+#endif
        return(0);
 }
 
@@ -191,7 +213,6 @@ FILE *fp;
 struct attribute attrs[];
 short flag;
 {
-       static int modifiable();
        register int i, j;
 
        for (i = 0; attrs[i].quipu_name != NULL; i++) {
@@ -238,7 +259,6 @@ static write_entry()
        LDAPMod *mods[MAX_ATTRS + 1];
        LDAPMod *modp = NULL;
 
-       static int ovalues();
        extern char * code_to_str();
        extern void free_mod_struct();
 
index 3551c1af6d7674dcc6153cce5a52b93072903d12..b057233420cc5646423a65f539165ea365b50f04 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifndef __STDC__
-#include <memory.h>
-#endif
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include <lber.h>
 #include <ldap.h>
+
 #include "ud.h"
 
 extern char *search_base;      /* search base */
@@ -222,9 +225,12 @@ int quiet;
                        ld->ld_deref = savederef;
                        return(NULL);
                } else if (matches == 1) {
-                       if (ldap_search_s(ld, ldap_get_dn(ld, ldap_first_entry(ld, res)), LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
+                       dn = ldap_get_dn(ld, ldap_first_entry(ld, res));
+                       rc = ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res);
+                       Free(dn);
+                       if (rc != LDAP_SUCCESS) {
                                if (ld->ld_errno == LDAP_UNAVAILABLE)
-                                       printf("  Could not contact the X.500 server to find \"%s\".\n", who);
+                                       printf("  Could not contact the LDAP server to find \"%s\".\n", who);
                                else
                                        ldap_perror(ld, "ldap_search_s");
                                return(NULL);
@@ -232,8 +238,7 @@ int quiet;
                        ld->ld_deref = savederef;
                        return(res);
                } else if (matches > 1 ) {
-                       return( disambiguate( ld, res, matches, read_attrs,
-                           who ) );
+                       return disambiguate( res, matches, read_attrs, who );
                }
                ld->ld_deref = savederef;
        }
@@ -287,7 +292,10 @@ int quiet;
                                fflush(stdout);
                                fetch_buffer(response, sizeof(response), stdin);
                                if ((response[0] == 'n') || (response[0] == 'N'))
+                               {
+                                       Free(dn);
                                        return(NULL);
+                               }
                        }
 #ifdef DEBUG
                        if (debug & D_FIND) {
@@ -306,7 +314,7 @@ int quiet;
                        if (ldap_search_s(ld, dn, LDAP_SCOPE_BASE, "objectClass=*", read_attrs, FALSE, &res) != LDAP_SUCCESS) {
                                ldap_perror(ld, "ldap_search_s");
                                ldap_msgfree(res);
-                               return(NULL);
+                               res = NULL;
                        }
                        Free(dn);
                        return(res);
index cb2030c2833505a62e163df2509bae5d9f2fa734..7e5f7e8e9280ee1cb2997c4870bb816b7e375f3c 100644 (file)
  *     Simon Fraser University, Academic Computing Services
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <sys/types.h>
-#if defined(NeXT)
 #include <stdlib.h>
-#include <sys/file.h>
-#else NeXT
-#include <unistd.h>
-#endif NeXT
-#include <pwd.h>
-#include <string.h>
-#ifndef DOS
-#if defined( NeXT ) || defined( ultrix ) || defined( osf1 ) || (defined(SunOS) && SunOS < 40)
-#include <sgtty.h>
-#else /* defined( NeXT ) || defined( ultrix ) etc. */
-#include <termios.h>
-#endif /* defined( NeXT ) || defined( ultrix ) etc. */
-#endif /* !DOS */
-#if defined( aix ) || defined( __NetBSD__ )
-#include <sys/ioctl.h>
-#endif /* aix || __NetBSD__ */
-#include <ctype.h>
-#include <signal.h>
 #include <setjmp.h>
-#include <memory.h>
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+
+#include <ac/signal.h>
+#include <ac/string.h>
+#include <ac/termios.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
+
 #include <lber.h>
 #include <ldap.h>
 #include <ldapconfig.h>
-#include "portable.h"
 #include "ud.h"
 
 #ifndef lint
@@ -68,8 +63,8 @@ static int dereference = TRUE;
 char *default_bind_object = UD_BINDDN;
 
 char *bound_dn;                        /* bound user's Distinguished Name */
-char *group_base;              /* place in X.500 tree where groups are */
-char *search_base;             /* place in X.500 tree where searches start */
+char *group_base;              /* place in LDAP tree where groups are */
+char *search_base;             /* place in LDAP tree where searches start */
 
 static jmp_buf env;            /* spot to jump to on an interrupt */
 
@@ -85,6 +80,9 @@ LDAPFiltDesc *lfdp;           /* LDAP filter descriptor */
 int debug;                     /* debug flag */
 #endif
 
+extern void initialize_client();
+extern void initialize_attribute_strings();
+
 main(argc, argv)
 int argc;
 char *argv[];
@@ -93,7 +91,6 @@ char *argv[];
        extern char *optarg;                    /* for parsing argv */
        register int c;                         /* for parsing argv */
        register char *cp;                      /* for parsing Version */
-       extern void initialize_attribute_strings();
 
        verbose = 1;
 
@@ -278,7 +275,7 @@ do_commands()
        printf(" Thank you!\n");
        
        ldap_unbind(ld);
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
        destroy_tickets();
 #endif
        exit(0);
@@ -374,7 +371,7 @@ char **base, *s;
        }
 
        /*
-        *  User wants to ascend one level in the X.500 tree.
+        *  User wants to ascend one level in the LDAP tree.
         *  Easy:  Just strip off the first element of the
         *  current search base, unless it's the root, in
         *  which case we just do nothing.
@@ -531,7 +528,7 @@ char **base, *s;
        }
 }
 
-initialize_client()
+void initialize_client()
 {
        FILE *fp;                               /* for config file */
        static char buffer[MED_BUF_SIZE];       /* for input */
@@ -540,7 +537,7 @@ initialize_client()
        char *term;                             /* for tty set-up */
        char *config;                           /* config file to use */
        static char bp[1024];                   /* for tty set-up */
-       extern SIG_FN attn();                   /* ^C signal handler */
+       extern RETSIGTYPE attn();                       /* ^C signal handler */
        extern char *getenv();
        extern void Free();
 
@@ -552,6 +549,7 @@ initialize_client()
         *  A per-user config file has precedence over any system-wide
         *  config file, if one exists.
         */
+#ifdef HAVE_GETPWUID_H
        if ((pw = getpwuid((uid_t) geteuid())) == (struct passwd *) NULL)
                config = config_file;
        else {
@@ -566,6 +564,7 @@ initialize_client()
                                config = config_file;
                }
        }
+#endif /* getpwduid() */
 #ifdef DEBUG
        if (debug & D_INITIALIZE)
                printf("Using config file %s\n", config);
@@ -627,13 +626,13 @@ initialize_client()
         *  because we want to be sure to use TCP, not UDP.
         */
        if ((ld = ldap_open(server, ldap_port)) == NULL) {
-               fprintf(stderr, "  The X.500 Directory is temporarily unavailable.  Please try again later.\n");
+               fprintf(stderr, "  The LDAP Directory is temporarily unavailable.  Please try again later.\n");
                exit(0);
                /* NOTREACHED */
        }
-       if (ldap_bind_s(ld, (char *) default_bind_object, (char *) UD_PASSWD,
+       if (ldap_bind_s(ld, (char *) default_bind_object, (char *) UD_BIND_CRED,
            LDAP_AUTH_SIMPLE) != LDAP_SUCCESS) {
-               fprintf(stderr, "  The X.500 Directory is temporarily unavailable.  Please try again later.\n");
+               fprintf(stderr, "  The LDAP Directory is temporarily unavailable.  Please try again later.\n");
                if (ld->ld_errno != LDAP_UNAVAILABLE)
                        ldap_perror(ld, "  ldap_bind_s");
                exit(0);
@@ -648,11 +647,7 @@ initialize_client()
        }
 
        /* enabled local caching of ldap results, 15 minute lifetime */
-#ifdef DOS
-       ldap_enable_cache( ld, 60 * 15, 100 * 1024 );   /* 100k max memory */
-#else /* DOS */
        ldap_enable_cache( ld, 60 * 15, 0 );            /* no memory limit */
-#endif /* DOS */
 
        /* initialize the search filters */
        if ((lfdp = ldap_init_getfilter(filter_file)) == NULL) {
@@ -665,21 +660,23 @@ initialize_client()
        lpp = DEFAULT_TTY_HEIGHT;
        col_size = DEFAULT_TTY_WIDTH;
 
-       (void) signal(SIGINT, attn);
+       (void) SIGNAL (SIGINT, attn);
 
-#if !defined(DOS) && !defined(NOTERMCAP)
+#ifndef NO_TERMCAP
        {
        struct winsize win;                     /* for tty set-up */
-       extern SIG_FN chwinsz();                /* WINSZ signal handler */
+       extern RETSIGTYPE chwinsz();            /* WINSZ signal handler */
 
        if (((term = getenv("TERM")) == NULL) || (tgetent(bp, term) <= 0))
                return;
        else {
+#ifdef TIOCGWINSZ
                if (ioctl(fileno(stdout), TIOCGWINSZ, &win) < 0) {
                        lpp = tgetnum("li");
                        col_size = tgetnum("co");
-               }
-               else {
+               } else
+#endif
+               {
                        if ((lpp = win.ws_row) == 0)
                                lpp = tgetnum("li");
                        if ((col_size = win.ws_col) == 0)
@@ -690,35 +687,36 @@ initialize_client()
                                col_size = DEFAULT_TTY_WIDTH;
                }
        }
-       (void) signal(SIGWINCH, chwinsz);
+       (void) SIGNAL (SIGWINCH, chwinsz);
 
        }
 #endif
 }
 
-SIG_FN attn()
+RETSIGTYPE attn()
 {
        fflush(stderr);
        fflush(stdout);
        printf("\n\n  INTERRUPTED!\n");
-#if defined(DOS) || defined(SYSV)
-       (void) signal(SIGINT, attn);
-#endif
+
+       (void) SIGNAL (SIGINT, attn);
+
        longjmp(env, 1);
 }
 
-#if !defined(DOS) && !defined(NOTERMCAP)
-SIG_FN chwinsz() 
+#ifndef NO_TERMCAP
+RETSIGTYPE chwinsz() 
 {
        struct winsize win;
 
-       (void) signal(SIGWINCH, SIG_IGN);
+       (void) SIGNAL (SIGWINCH, SIG_IGN);
        if (ioctl(fileno(stdout), TIOCGWINSZ, &win) != -1) {
                if (win.ws_row != 0)
                        lpp = win.ws_row;
                if (win.ws_col != 0)
                        col_size = win.ws_col;
        }
-       (void) signal(SIGWINCH, chwinsz);
+
+       (void) SIGNAL (SIGWINCH, chwinsz);
 }
 #endif
index ef7099e9489a9161605e933938297c956e46e4ea..637084f295488a87ccd13dc811dff86e3b06793a 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include <lber.h>
 #include <ldap.h>
-#ifndef __STDC__
-#include <memory.h>
-#endif
-#include <sys/types.h>
 #include "ud.h"
+extern void Free();
 
 extern struct entry Entry; 
 extern int verbose;
 extern LDAP *ld;
 
 extern LDAPMessage *find();
+extern void * Malloc();
+
+static char * get_URL();
+static int check_URL();
 
 #ifdef DEBUG
 extern int debug;
@@ -109,7 +115,7 @@ char *who;
        if (verbose && !printed_warning && (ld->ld_errno == LDAP_NO_SUCH_ATTRIBUTE)) {
                printed_warning = 1;
                printf("\n  WARNING!\n");
-               printf("  You are about to make a modification to an X.500 entry\n");
+               printf("  You are about to make a modification to an LDAP entry\n");
                printf("  that has its \"automatic updates\" field set to ON.\n");
                printf("  This means that the entry will be automatically updated\n");
                printf("  each month from official University sources like the\n");
@@ -381,9 +387,6 @@ char *id, *prompt;
        static char line[LINE_SIZE];    /* raw line from user */
        static char buffer[MAX_DESC_LINES * LINE_SIZE]; /* holds ALL of the 
                                                           lines we get */
-       extern void * Malloc();
-       static char * get_URL();
-
 #ifdef DEBUG
        if (debug & D_TRACE)
                printf("->get_value(%s, %s)\n", id, prompt);
@@ -481,7 +484,7 @@ mail_is_good:
                        if (lmp == (LDAPMessage *) NULL) {
                                printf("  Could not find \"%s\" in the Directory\n", line);
                                if (verbose) 
-                                       format("Owners of groups must be valid entries in the X.500 Directory.  The name you have typed above could not be found in the X.500 Directory.", 72, 2);
+                                       format("Owners of groups must be valid entries in the LDAP Directory.  The name you have typed above could not be found in the LDAP Directory.", 72, 2);
                                return(NULL);
                        }
                        elmp = ldap_first_entry(ld, lmp);
@@ -491,6 +494,7 @@ mail_is_good:
                        }
                        tmp = ldap_get_dn(ld, elmp);
                        strcpy(buffer, tmp);
+                       Free(tmp);
                        (void) ldap_msgfree(lmp);
                        break;
                }
@@ -620,9 +624,9 @@ char *who;
        if (verbose) {
                printf("\n  By default, updates that are received from the Personnel\n");
                printf("  Office and the Office of the Registrar are applied to all\n");
-               printf("  entries in the X.500 database each month.  Sometimes this\n");
+               printf("  entries in the LDAP database each month.  Sometimes this\n");
                printf("  feature is undesirable.  For example, if you maintain your\n");
-               printf("  entry in the X.500 database manually, you may not want to\n");
+               printf("  entry in the LDAP database manually, you may not want to\n");
                printf("  have these updates applied to your entry, possibly overwriting\n");
                printf("  correct information with out-dated information.\n\n");
        }
@@ -753,8 +757,6 @@ int group;
 static char * get_URL()
 {
        char *rvalue, label[MED_BUF_SIZE], url[MED_BUF_SIZE];
-       static int check_URL();
-       extern void * Malloc();
 
        if (verbose) {
                printf("  First, enter the URL.  (Example: http://www.us.itd.umich.edu/users/).\n");
diff --git a/clients/ud/ud.dsp b/clients/ud/ud.dsp
new file mode 100644 (file)
index 0000000..2274449
--- /dev/null
@@ -0,0 +1,137 @@
+# Microsoft Developer Studio Project File - Name="ud" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=ud - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE 
+!MESSAGE NMAKE /f "ud.mak".
+!MESSAGE 
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE 
+!MESSAGE NMAKE /f "ud.mak" CFG="ud - Win32 Debug"
+!MESSAGE 
+!MESSAGE Possible choices for configuration are:
+!MESSAGE 
+!MESSAGE "ud - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "ud - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE 
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF  "$(CFG)" == "ud - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I "..\..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF  "$(CFG)" == "ud - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /Gm /GX /Zi /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 oldap32.lib olber32.lib oldif32.lib olutil32.lib ws2_32.lib hs_regex.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\libraries\Debug"
+
+!ENDIF 
+
+# Begin Target
+
+# Name "ud - Win32 Release"
+# Name "ud - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\auth.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\edit.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\find.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\globals.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\group.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\help.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\main.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mod.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\print.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\string_to_key.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ud.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\util.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\Version.c
+# End Source File
+# End Target
+# End Project
diff --git a/clients/ud/ud.dsw b/clients/ud/ud.dsw
new file mode 100644 (file)
index 0000000..5350cb7
--- /dev/null
@@ -0,0 +1,74 @@
+Microsoft Developer Studio Workspace File, Format Version 5.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "liblber"=..\..\libraries\liblber\liblber.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "libldap"=..\..\libraries\libldap\libldap.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "liblutil"=..\..\libraries\liblutil\liblutil.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Project: "ud"=.\ud.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+    Begin Project Dependency
+    Project_Dep_Name liblber
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name libldap
+    End Project Dependency
+    Begin Project Dependency
+    Project_Dep_Name liblutil
+    End Project Dependency
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
index 40b6ecff7a0e7e90b22c68ae46a4aec7a262fe40..56ed57f6c6628af713a3cc98de874055a3fe981e 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
-#ifdef DOS
-#include "protoud.h"
-#define strncasecmp(a, b, n)   strnicmp(a, b, n)
-#define strcasecmp(a, b)       stricmp(a, b)
-#define MAX_VALUES     8
-#else
 #define MAX_VALUES     1000
-#endif /* end of DOS ifdef */
 
 /*****************************************************************************
  **
@@ -87,7 +80,7 @@
 /*
  *  Authentication method we will be using.
  */
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
 #define UD_AUTH_METHOD         LDAP_AUTH_KRBV4
 #else
 #define UD_AUTH_METHOD         LDAP_AUTH_SIMPLE
 #define ATTR_FLAG_IS_A_BOOL    0x4000
 #define ATTR_FLAG_IS_MULTILINE 0x8000
 
+LDAP_BEGIN_DECL
+
 /*
  *  These are the structures we use when parsing an answer we get from the LDAP
  *  server.
@@ -156,3 +151,5 @@ struct entry {
        char *name;
        struct attribute attrs[MAX_ATTRS];
 };
+
+LDAP_END_DECL
index 2edb5aa265903c9be92d107413b5e0ee183610fd..2aa08dd906753d315624fa3785929fd319a1cbc8 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <signal.h>
-#include <string.h>
-#ifdef DOS
-#include <malloc.h>
-#endif
-#include <memory.h>
-#if defined( NeXT )
 #include <stdlib.h>
-#endif
-#include <ctype.h>
-#include <errno.h>
+
+#include <ac/ctype.h>
+#include <ac/errno.h>
+#include <ac/signal.h>
+#include <ac/string.h>
+#include <ac/termios.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
 #include <lber.h>
 #include <ldap.h>
 #include <ldapconfig.h>
-#if !defined(DOS) && !defined( VMS)
-#include <sys/types.h>
-#endif
-#include "portable.h"
-#ifdef USE_TERMIOS
-#include <termios.h>
-#else /* USE_TERMIOS */
-#include <sgtty.h>
-#endif /* USE_TERMIOS */
-#include "ud.h"
 
-#if defined(VMS)
-#define getch getchar
-#endif
+#include "ud.h"
 
 #ifdef DEBUG
 extern int debug;
@@ -47,7 +36,7 @@ extern int debug;
 char * mygetpass(prompt)
 char *prompt;
 {
-#if defined(DOS) || defined(VMS)
+#if !defined(HAVE_TERMIOS) && !defined(HAVE_SGTTY_H)
        static char buf[256];
        int i, c;
 
@@ -72,7 +61,7 @@ char *prompt;
        register char *p;
        register int c;
        FILE *fi;
-       SIG_FN (*sig)();
+       RETSIGTYPE (*sig)();
 
 #ifdef DEBUG
        if (debug & D_TRACE)
@@ -80,7 +69,7 @@ char *prompt;
 #endif
        /*
         *  Stolen from the getpass() routine.  Can't use the plain
-        *  getpass() for two reasons.  One is that X.500 passwords
+        *  getpass() for two reasons.  One is that LDAP passwords
         *  can be really, really long - much longer than 8 chars.
         *  The second is that we like to make this client available
         *  out of inetd via a Merit asynch port, and we need to be
@@ -91,7 +80,7 @@ char *prompt;
                fi = stdin;
        else
                setbuf(fi, (char *)NULL);
-       sig = signal(SIGINT, SIG_IGN);
+       sig = SIGNAL (SIGINT, SIG_IGN);
        if (fi != stdin) {
                if (GETATTR(fileno(fi), &ttyb) < 0)
                        perror("GETATTR");
@@ -145,7 +134,7 @@ char *prompt;
                if (SETATTR(fileno(fi), &ttyb) < 0)
                        perror("SETATTR");
        }
-       (void) signal(SIGINT, sig);
+       (void) SIGNAL (SIGINT, sig);
        if (fi != stdin)
                (void) fclose(fi);
        else
@@ -226,11 +215,9 @@ FILE *where;
 fatal(s)
 char *s;
 {
-       void exit();
-
        if (errno != 0)
                perror(s);
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
        destroy_tickets();
 #endif
        exit(-1);
@@ -477,7 +464,7 @@ char *cp;
        return(tmp);
 }
 
-char * code_to_str(i)
+char * code_to_str(int i)
 {
        switch(i) {
        case LDAP_MOD_ADD : return("ADD");
@@ -594,13 +581,15 @@ unsigned int size;
 void Free(ptr)
 char *ptr;
 {
-       extern int free();
-
+#ifndef STDC_HEADERS
        if (free(ptr) < 0) {
                perror("free");
                exit(-1);
                /*NOTREACHED*/
        }
+#else
+       free(ptr);
+#endif
        return;
 }
 
index 376440b8e5f8b0cd299f29c1c6a76c2f126ea8e6..b4d7982064060bebc73dd247e16931f31a27c5f2 100755 (executable)
--- a/configure
+++ b/configure
@@ -1127,6 +1127,14 @@ else
 fi
 # end --enable-slurpd
 
+# validate options
+if test $ol_enable_referrals = no ; then
+       if test $ol_enable_dns = yes ; then
+               echo "configure: warning: dns disabled, ignoring --enable-dns argument" 1>&2
+       fi
+       ol_enable_dns=no
+fi
+
 if test $ol_enable_slapd = no ; then
                if test $ol_enable_ldbm = yes ; then
                echo "configure: warning: slapd disabled, ignoring --enable_ldbm argument" 1>&2
@@ -1237,13 +1245,14 @@ BUILD_SLURPD=no
 BUILD_LDBM=no
 BUILD_PASSWD=no
 BUILD_SHELL=no
+BUILD_THREAD=no
 
 KRB_LIBS=
 TERMCAP_LIBS=
 
 
 echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1247: checking whether ln -s works" >&5
+echo "configure:1256: checking whether ln -s works" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1274,7 +1283,7 @@ fi
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
 echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:1278: checking for a BSD compatible install" >&5
+echo "configure:1287: checking for a BSD compatible install" >&5
 if test -z "$INSTALL"; then
 if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1326,7 +1335,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 # Extract the first word of "ranlib", so it can be a program name with args.
 set dummy ranlib; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1330: checking for $ac_word" >&5
+echo "configure:1339: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1353,7 +1362,7 @@ else
 fi
 
 echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1357: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1366: checking whether ${MAKE-make} sets \${MAKE}" >&5
 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1383,7 +1392,7 @@ fi
 # Extract the first word of "sendmail", so it can be a program name with args.
 set dummy sendmail; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1387: checking for $ac_word" >&5
+echo "configure:1396: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_SENDMAIL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1415,7 +1424,7 @@ fi
 # Extract the first word of "vi", so it can be a program name with args.
 set dummy vi; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1419: checking for $ac_word" >&5
+echo "configure:1428: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_EDITOR'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1447,7 +1456,7 @@ fi
 # Extract the first word of "finger", so it can be a program name with args.
 set dummy finger; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1451: checking for $ac_word" >&5
+echo "configure:1460: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_FINGER'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1480,7 +1489,7 @@ fi
 # Extract the first word of "gcc", so it can be a program name with args.
 set dummy gcc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1484: checking for $ac_word" >&5
+echo "configure:1493: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1509,7 +1518,7 @@ if test -z "$CC"; then
   # Extract the first word of "cc", so it can be a program name with args.
 set dummy cc; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:1513: checking for $ac_word" >&5
+echo "configure:1522: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1557,7 +1566,7 @@ fi
 fi
 
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1561: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1570: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
@@ -1567,11 +1576,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS
 cross_compiling=$ac_cv_prog_cc_cross
 
 cat > conftest.$ac_ext <<EOF
-#line 1571 "configure"
+#line 1580 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
-if { (eval echo configure:1575: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   ac_cv_prog_cc_works=yes
   # If we can't run a trivial program, we are probably using a cross compiler.
   if (./conftest; exit) 2>/dev/null; then
@@ -1591,12 +1600,12 @@ if test $ac_cv_prog_cc_works = no; then
   { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
 fi
 echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:1595: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1604: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
 cross_compiling=$ac_cv_prog_cc_cross
 
 echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:1600: checking whether we are using GNU C" >&5
+echo "configure:1609: checking whether we are using GNU C" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1605,7 +1614,7 @@ else
   yes;
 #endif
 EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1609: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1618: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
   ac_cv_prog_gcc=yes
 else
   ac_cv_prog_gcc=no
@@ -1620,7 +1629,7 @@ if test $ac_cv_prog_gcc = yes; then
   ac_save_CFLAGS="$CFLAGS"
   CFLAGS=
   echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1624: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1633: checking whether ${CC-cc} accepts -g" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -1661,115 +1670,7 @@ elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
 fi
 
 echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1665: checking how to run the C preprocessor" >&5
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
-  CPP=
-fi
-if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp.
-  cat > conftest.$ac_ext <<EOF
-#line 1680 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1686: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 1697 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out`
-if test -z "$ac_err"; then
-  :
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP=/lib/cpp
-fi
-rm -f conftest*
-fi
-rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
-fi
-  CPP="$ac_cv_prog_CPP"
-else
-  ac_cv_prog_CPP="$CPP"
-fi
-echo "$ac_t""$CPP" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
-    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1727: checking whether ${CC-cc} needs -traditional" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-    ac_pattern="Autoconf.*'x'"
-  cat > conftest.$ac_ext <<EOF
-#line 1733 "configure"
-#include "confdefs.h"
-#include <sgtty.h>
-Autoconf TIOCGETP
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "$ac_pattern" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_prog_gcc_traditional=yes
-else
-  rm -rf conftest*
-  ac_cv_prog_gcc_traditional=no
-fi
-rm -f conftest*
-
-
-  if test $ac_cv_prog_gcc_traditional = no; then
-    cat > conftest.$ac_ext <<EOF
-#line 1751 "configure"
-#include "confdefs.h"
-#include <termio.h>
-Autoconf TCGETA
-EOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "$ac_pattern" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_prog_gcc_traditional=yes
-fi
-rm -f conftest*
-
-  fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
-  if test $ac_cv_prog_gcc_traditional = yes; then
-    CC="$CC -traditional"
-  fi
-fi
-
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1773: checking how to run the C preprocessor" >&5
+echo "configure:1674: checking how to run the C preprocessor" >&5
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
@@ -1784,13 +1685,13 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 1788 "configure"
+#line 1689 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1695: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1801,13 +1702,13 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 1805 "configure"
+#line 1706 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1811: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   :
@@ -1832,9 +1733,9 @@ echo "$ac_t""$CPP" 1>&6
 
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1836: checking for AIX" >&5
+echo "configure:1737: checking for AIX" >&5
 cat > conftest.$ac_ext <<EOF
-#line 1838 "configure"
+#line 1739 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -1856,7 +1757,7 @@ rm -f conftest*
 
 
 echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1860: checking for POSIXized ISC" >&5
+echo "configure:1761: checking for POSIXized ISC" >&5
 if test -d /etc/conf/kconfig.d &&
   grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
 then
@@ -1878,17 +1779,17 @@ fi
 
 ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1882: checking for minix/config.h" >&5
+echo "configure:1783: checking for minix/config.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1887 "configure"
+#line 1788 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1793: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -1929,12 +1830,12 @@ fi
 
 
 echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:1933: checking for socket" >&5
+echo "configure:1834: checking for socket" >&5
 if eval "test \"`echo '$''{'ac_cv_func_socket'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1938 "configure"
+#line 1839 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char socket(); below.  */
@@ -1957,7 +1858,7 @@ socket();
 
 ; return 0; }
 EOF
-if { (eval echo configure:1961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1862: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_socket=yes"
 else
@@ -1976,7 +1877,7 @@ else
   echo "$ac_t""no" 1>&6
        
        echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:1980: checking for main in -lsocket" >&5
+echo "configure:1881: checking for main in -lsocket" >&5
 ac_lib_var=`echo socket'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -1984,14 +1885,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1988 "configure"
+#line 1889 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:1995: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2019,7 +1920,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
-echo "configure:2023: checking for main in -lnet" >&5
+echo "configure:1924: checking for main in -lnet" >&5
 ac_lib_var=`echo net'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2027,14 +1928,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2031 "configure"
+#line 1932 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1939: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2062,7 +1963,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnsl_s""... $ac_c" 1>&6
-echo "configure:2066: checking for main in -lnsl_s" >&5
+echo "configure:1967: checking for main in -lnsl_s" >&5
 ac_lib_var=`echo nsl_s'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2070,14 +1971,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl_s  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2074 "configure"
+#line 1975 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2081: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1982: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2105,7 +2006,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:2109: checking for main in -lnsl" >&5
+echo "configure:2010: checking for main in -lnsl" >&5
 ac_lib_var=`echo nsl'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2113,14 +2014,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2117 "configure"
+#line 2018 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2148,7 +2049,7 @@ else
 fi
 
        echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6
-echo "configure:2152: checking for socket in -linet" >&5
+echo "configure:2053: checking for socket in -linet" >&5
 ac_lib_var=`echo inet'_'socket | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2156,7 +2057,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-linet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2160 "configure"
+#line 2061 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2167,7 +2068,7 @@ int main() {
 socket()
 ; return 0; }
 EOF
-if { (eval echo configure:2171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2072: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2195,7 +2096,7 @@ else
 fi
 
        echo $ac_n "checking for main in -lgen""... $ac_c" 1>&6
-echo "configure:2199: checking for main in -lgen" >&5
+echo "configure:2100: checking for main in -lgen" >&5
 ac_lib_var=`echo gen'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2203,14 +2104,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgen  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2207 "configure"
+#line 2108 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2115: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2241,8 +2142,56 @@ fi
 fi
 
 
+echo $ac_n "checking for res_search in -lresolv""... $ac_c" 1>&6
+echo "configure:2147: checking for res_search in -lresolv" >&5
+ac_lib_var=`echo resolv'_'res_search | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lresolv  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2155 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char res_search();
+
+int main() {
+res_search()
+; return 0; }
+EOF
+if { (eval echo configure:2166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
+    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_lib 1
+EOF
+
+  LIBS="-lresolv $LIBS"
+
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+
 echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
-echo "configure:2246: checking for sigset in -lV3" >&5
+echo "configure:2195: checking for sigset in -lV3" >&5
 ac_lib_var=`echo V3'_'sigset | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2250,7 +2199,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lV3  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2254 "configure"
+#line 2203 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2261,7 +2210,7 @@ int main() {
 sigset()
 ; return 0; }
 EOF
-if { (eval echo configure:2265: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2289,22 +2238,237 @@ else
 fi
 
 
+# ISODE tests
+ol_link_isode=no
+if test $ol_enable_ldapd != no ; then
+               echo $ac_n "checking for main in -lxtpp""... $ac_c" 1>&6
+echo "configure:2246: checking for main in -lxtpp" >&5
+ac_lib_var=`echo xtpp'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lxtpp -lxtdsap -lxtisode -losi $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2254 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:2261: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+               ol_link_isode=yes
+               cat >> confdefs.h <<\EOF
+#define HAVE_XTPP 1
+EOF
+
+               LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
+               
+else
+  echo "$ac_t""no" 1>&6
+:
+fi
+
+       echo $ac_n "checking for main in -ldsap""... $ac_c" 1>&6
+echo "configure:2290: checking for main in -ldsap" >&5
+ac_lib_var=`echo dsap'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-ldsap -lisode $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2298 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:2305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+               ol_link_isode=yes
+               cat >> confdefs.h <<\EOF
+#define HAVE_DSAP 1
+EOF
+
+               LDAPD_LIBS="$LDAPD_LIBS -ldsap"
+               
+else
+  echo "$ac_t""no" 1>&6
+:
+fi
+
+       echo $ac_n "checking for main in -lisode""... $ac_c" 1>&6
+echo "configure:2334: checking for main in -lisode" >&5
+ac_lib_var=`echo isode'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lisode  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2342 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:2349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+               ol_link_isode=yes
+               cat >> confdefs.h <<\EOF
+#define HAVE_ISODE 1
+EOF
+
+               LDAPD_LIBS="$LDAPD_LIBS -lisode"
+               
+else
+  echo "$ac_t""no" 1>&6
+:
+fi
+
+fi
+
+if test $ol_link_isode != no; then
+       echo $ac_n "checking for main in -lpp""... $ac_c" 1>&6
+echo "configure:2381: checking for main in -lpp" >&5
+ac_lib_var=`echo pp'_'main | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lpp  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2389 "configure"
+#include "confdefs.h"
+
+int main() {
+main()
+; return 0; }
+EOF
+if { (eval echo configure:2396: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
+
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
+               cat >> confdefs.h <<\EOF
+#define HAVE_PP 1
+EOF
+
+               LDAPD_LIBS="-lpp $LDAPD_LIBS"
+               
+else
+  echo "$ac_t""no" 1>&6
+:
+fi
+
+
+       # Extract the first word of "pepsy", so it can be a program name with args.
+set dummy pepsy; ac_word=$2
+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
+echo "configure:2427: checking for $ac_word" >&5
+if eval "test \"`echo '$''{'ac_cv_path_PEPSY'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  case "$PEPSY" in
+  /*)
+  ac_cv_path_PEPSY="$PEPSY" # Let the user override the test with a path.
+  ;;
+  *)
+  IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
+  for ac_dir in $PATH; do
+    test -z "$ac_dir" && ac_dir=.
+    if test -f $ac_dir/$ac_word; then
+      ac_cv_path_PEPSY="$ac_dir/$ac_word"
+      break
+    fi
+  done
+  IFS="$ac_save_ifs"
+  ;;
+esac
+fi
+PEPSY="$ac_cv_path_PEPSY"
+if test -n "$PEPSY"; then
+  echo "$ac_t""$PEPSY" 1>&6
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+fi
+
 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
        for ac_hdr in kerberosIV/krb.h kerberosIV/des.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2298: checking for $ac_hdr" >&5
+echo "configure:2462: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2303 "configure"
+#line 2467 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2472: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2333,7 +2497,7 @@ done
 
        if test $ac_cv_header_kerberosIV_krb_h = yes ; then
                echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:2337: checking for main in -lkrb4" >&5
+echo "configure:2501: checking for main in -lkrb4" >&5
 ac_lib_var=`echo krb4'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2341,14 +2505,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lkrb4 -lkrb5 -ldes425 $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2345 "configure"
+#line 2509 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2516: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2388,17 +2552,17 @@ if test $ol_with_kerberos = auto -o $ol_with_kerberos = k4 ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2392: checking for $ac_hdr" >&5
+echo "configure:2556: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2397 "configure"
+#line 2561 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2566: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2427,7 +2591,7 @@ done
 
        if test $ac_cv_header_krb_h = yes ; then
                echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
-echo "configure:2431: checking for main in -lkrb" >&5
+echo "configure:2595: checking for main in -lkrb" >&5
 ac_lib_var=`echo krb'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2435,14 +2599,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lkrb -ldes $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2439 "configure"
+#line 2603 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:2446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2610: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2485,17 +2649,17 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2489: checking for $ac_hdr" >&5
+echo "configure:2653: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2494 "configure"
+#line 2658 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2663: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2524,13 +2688,13 @@ done
 
        if test $ac_cv_header_pthread_h = yes ; then
                echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
-echo "configure:2528: checking POSIX thread version" >&5
+echo "configure:2692: checking POSIX thread version" >&5
 if eval "test \"`echo '$''{'ol_cv_pthread_version'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 2534 "configure"
+#line 2698 "configure"
 #include "confdefs.h"
 
 #              include <pthread.h>
@@ -2552,7 +2716,7 @@ rm -f conftest*
 
 
        cat > conftest.$ac_ext <<EOF
-#line 2556 "configure"
+#line 2720 "configure"
 #include "confdefs.h"
 
 #              include <pthread.h>
@@ -2605,7 +2769,7 @@ EOF
 
                
 echo $ac_n "checking for LinuxThreads""... $ac_c" 1>&6
-echo "configure:2609: checking for LinuxThreads" >&5
+echo "configure:2773: checking for LinuxThreads" >&5
 if eval "test \"`echo '$''{'ol_cv_linux_threads'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2631,12 +2795,12 @@ EOF
 
                
                                echo $ac_n "checking for pthread_create""... $ac_c" 1>&6
-echo "configure:2635: checking for pthread_create" >&5
+echo "configure:2799: checking for pthread_create" >&5
 if eval "test \"`echo '$''{'ac_cv_func_pthread_create'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2640 "configure"
+#line 2804 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char pthread_create(); below.  */
@@ -2659,7 +2823,7 @@ pthread_create();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_pthread_create=yes"
 else
@@ -2681,7 +2845,7 @@ fi
 
                if test $ol_link_threads = no ; then
                                                echo $ac_n "checking for pthread_create with -pthread""... $ac_c" 1>&6
-echo "configure:2685: checking for pthread_create with -pthread" >&5
+echo "configure:2849: checking for pthread_create with -pthread" >&5
 if eval "test \"`echo '$''{'ol_cv_pthread_flag'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2689,17 +2853,16 @@ else
                                                                save_LIBS="$LIBS"
                                LIBS="-pthread $LIBS"
                                cat > conftest.$ac_ext <<EOF
-#line 2693 "configure"
+#line 2857 "configure"
 #include "confdefs.h"
-#include <pthread.h>
+char pthread();
 int main() {
 
-                                       pthread_create((pthread_t*) 0,
-                                               (pthread_attr_t*) 0, 0, 0);
+                                       pthread_create();
                                        
 ; return 0; }
 EOF
-if { (eval echo configure:2703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2866: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ol_cv_pthread_flag=yes
 else
@@ -2721,29 +2884,70 @@ echo "$ac_t""$ol_cv_pthread_flag" 1>&6
                        fi
                fi
 
+               if test $ol_link_threads = no ; then
+                                               echo $ac_n "checking for pthread_create with -thread""... $ac_c" 1>&6
+echo "configure:2890: checking for pthread_create with -thread" >&5
+if eval "test \"`echo '$''{'ol_cv_thread_flag'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  
+                                                               save_LIBS="$LIBS"
+                               LIBS="-thread $LIBS"
+                               cat > conftest.$ac_ext <<EOF
+#line 2898 "configure"
+#include "confdefs.h"
+char pthread();
+int main() {
+
+                                       pthread_create();
+                                       
+; return 0; }
+EOF
+if { (eval echo configure:2907: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  ol_cv_thread_flag=yes
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  ol_cv_thread_flag=no
+fi
+rm -f conftest*
+                                                               LIBS="$save_LIBS"
+                       
+fi
+
+echo "$ac_t""$ol_cv_thread_flag" 1>&6
+
+                       if test $ol_cv_thread_flag = yes ; then
+                               LTHREAD_LIBS="$LTHREAD_LIBS -thread"
+                               ol_link_threads=posix
+                       fi
+               fi
+
                if test $ol_link_threads = no ; then
                                                save_LIBS="$LIBS"
-                       echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:2728: checking for pthread_create in -lpthread" >&5
-ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
+                       echo $ac_n "checking for pthread_join in -lpthread""... $ac_c" 1>&6
+echo "configure:2932: checking for pthread_join in -lpthread" >&5
+ac_lib_var=`echo pthread'_'pthread_join | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lpthread  $LIBS"
+LIBS="-lpthread -lexc $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2736 "configure"
+#line 2940 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char pthread_create();
+char pthread_join();
 
 int main() {
-pthread_create()
+pthread_join()
 ; return 0; }
 EOF
-if { (eval echo configure:2747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2951: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2760,7 +2964,11 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   
                                ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
+                               if test $ol_with_preemptive = auto ; then
+                                       ol_with_preemptive=yes
+                               fi
+                               
 else
   echo "$ac_t""no" 1>&6
 fi
@@ -2770,27 +2978,27 @@ fi
 
                if test $ol_link_threads = no ; then
                                                save_LIBS="$LIBS"
-                       echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
-echo "configure:2775: checking for pthread_create in -lc_r" >&5
-ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
+                       echo $ac_n "checking for pthread_join in -lpthreads""... $ac_c" 1>&6
+echo "configure:2983: checking for pthread_join in -lpthreads" >&5
+ac_lib_var=`echo pthreads'_'pthread_join | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lc_r  $LIBS"
+LIBS="-lpthreads -lmach -lexc -lc_r $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2783 "configure"
+#line 2991 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
     builtin and then its argument prototype would still apply.  */
-char pthread_create();
+char pthread_join();
 
 int main() {
-pthread_create()
+pthread_join()
 ; return 0; }
 EOF
-if { (eval echo configure:2794: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2807,7 +3015,11 @@ if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   
                                ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
+                               if test $ol_with_preemptive = auto ; then
+                                       ol_with_preemptive=yes
+                               fi
+                               
 else
   echo "$ac_t""no" 1>&6
 fi
@@ -2818,15 +3030,15 @@ fi
                if test $ol_link_threads = no ; then
                                                save_LIBS="$LIBS"
                        echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:2822: checking for pthread_create in -lpthread" >&5
+echo "configure:3034: checking for pthread_create in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
-LIBS="-lpthread -lmach -lexc -lc $LIBS"
+LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2830 "configure"
+#line 3042 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2837,7 +3049,7 @@ int main() {
 pthread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:2841: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2853,16 +3065,55 @@ fi
 if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   
-                               cat >> confdefs.h <<\EOF
-#define HAVE_DCE 1
+                               ol_link_threads=posix
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
+else
+  echo "$ac_t""no" 1>&6
+fi
+
+                       LIBS="$save_LIBS"
+               fi
+
+               if test $ol_link_threads = no ; then
+                                               save_LIBS="$LIBS"
+                       echo $ac_n "checking for pthread_create in -lc_r""... $ac_c" 1>&6
+echo "configure:3081: checking for pthread_create in -lc_r" >&5
+ac_lib_var=`echo c_r'_'pthread_create | sed 'y%./+-%__p_%'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  ac_save_LIBS="$LIBS"
+LIBS="-lc_r  $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3089 "configure"
+#include "confdefs.h"
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char pthread_create();
+
+int main() {
+pthread_create()
+; return 0; }
 EOF
+if { (eval echo configure:3100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_lib_$ac_lib_var=no"
+fi
+rm -f conftest*
+LIBS="$ac_save_LIBS"
 
+fi
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+  
                                ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"
-                               if test $ol_with_preemptive = auto ; then
-                                       ol_with_preemptive=yes
-                               fi
-                               
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"
 else
   echo "$ac_t""no" 1>&6
 fi
@@ -2883,12 +3134,12 @@ EOF
                                                                                                for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2887: checking for $ac_func" >&5
+echo "configure:3138: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2892 "configure"
+#line 3143 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2911,7 +3162,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3166: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2939,7 +3190,7 @@ done
                        if test $ac_cv_func_sched_yield = no -a \
                                $ac_cv_func_pthread_yield = no ; then
                                                                echo $ac_n "checking for sched_yield in -lrt""... $ac_c" 1>&6
-echo "configure:2943: checking for sched_yield in -lrt" >&5
+echo "configure:3194: checking for sched_yield in -lrt" >&5
 ac_lib_var=`echo rt'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2947,7 +3198,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lrt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2951 "configure"
+#line 3202 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2958,7 +3209,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:2962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2988,7 +3239,7 @@ fi
                        if test $ac_cv_func_sched_yield = no -a \
                                $ac_cv_func_pthread_yield = no ; then
                                                                echo $ac_n "checking for sched_yield in -lposix4""... $ac_c" 1>&6
-echo "configure:2992: checking for sched_yield in -lposix4" >&5
+echo "configure:3243: checking for sched_yield in -lposix4" >&5
 ac_lib_var=`echo posix4'_'sched_yield | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2996,7 +3247,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lposix4  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3000 "configure"
+#line 3251 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3007,7 +3258,7 @@ int main() {
 sched_yield()
 ; return 0; }
 EOF
-if { (eval echo configure:3011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3043,12 +3294,12 @@ fi
                                                for ac_func in pthread_kill
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3047: checking for $ac_func" >&5
+echo "configure:3298: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3052 "configure"
+#line 3303 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3071,7 +3322,66 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3075: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=yes"
+else
+  echo "configure: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  rm -rf conftest*
+  eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+  echo "$ac_t""yes" 1>&6
+    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
+  cat >> confdefs.h <<EOF
+#define $ac_tr_func 1
+EOF
+else
+  echo "$ac_t""no" 1>&6
+fi
+done
+
+                       for ac_func in \
+                               pthread_attr_create pthread_attr_init \
+                               pthread_attr_destroy pthread_attr_delete \
+                               pthread_attr_setdetachstate pthread_attr_setdetach_np \
+                       
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3357: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+  echo $ac_n "(cached) $ac_c" 1>&6
+else
+  cat > conftest.$ac_ext <<EOF
+#line 3362 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func(); below.  */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error.  */
+/* We use char because int might match the return type of a gcc2
+    builtin and then its argument prototype would still apply.  */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:3385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3102,12 +3412,12 @@ done
                        
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3106: checking for $ac_func" >&5
+echo "configure:3416: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3111 "configure"
+#line 3421 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3130,7 +3440,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3157,13 +3467,13 @@ done
 
                                                if test $ol_with_preemptive = auto ; then
                                echo $ac_n "checking for preemptive Pthread implementation""... $ac_c" 1>&6
-echo "configure:3161: checking for preemptive Pthread implementation" >&5
+echo "configure:3471: checking for preemptive Pthread implementation" >&5
                                if test "$cross_compiling" = yes; then
   
                                { echo "configure: error: crossing compiling: use --with-preemptive=yes|no|manual" 1>&2; exit 1; }
 else
   cat > conftest.$ac_ext <<EOF
-#line 3167 "configure"
+#line 3477 "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -3197,9 +3507,11 @@ int argc; char **argv;
 
 #ifdef HAVE_PTHREAD_SETCONCURRENCY
        (void) pthread_setconcurrency(2);
-#elif HAVE_THR_SETCONCURRENCY
+#else
+#ifdef HAVE_THR_SETCONCURRENCY
        /* Set Solaris LWP concurrency to 2 */
        thr_setconcurrency(2);
+#endif
 #endif
 
        pthread_create(&t, NULL, (void *) task, NULL);
@@ -3207,7 +3519,7 @@ int argc; char **argv;
 #if HAVE_SCHED_YIELD
        sched_yield();  /* make sure task runs first */
 #else
-#if defined(HAVE_PTHREAD_YIELD)
+#ifdef HAVE_PTHREAD_YIELD
        pthread_yield();        /* make sure task runs first */
 #endif
 #endif
@@ -3215,7 +3527,7 @@ int argc; char **argv;
 }
                                
 EOF
-if { (eval echo configure:3219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ol_pthread_preemptive=yes
 else
@@ -3256,17 +3568,17 @@ if test $ol_with_threads = auto -o $ol_with_threads = mach ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3260: checking for $ac_hdr" >&5
+echo "configure:3572: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3265 "configure"
+#line 3577 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3296,12 +3608,12 @@ done
                ol_with_threads=found
 
                                echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
-echo "configure:3300: checking for cthread_fork" >&5
+echo "configure:3612: checking for cthread_fork" >&5
 if eval "test \"`echo '$''{'ac_cv_func_cthread_fork'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3305 "configure"
+#line 3617 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char cthread_fork(); below.  */
@@ -3324,7 +3636,7 @@ cthread_fork();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_cthread_fork=yes"
 else
@@ -3346,7 +3658,7 @@ fi
 
                if test $ol_link_threads = no ; then
                                                                        echo $ac_n "checking for cthread_fork with -all_load""... $ac_c" 1>&6
-echo "configure:3350: checking for cthread_fork with -all_load" >&5
+echo "configure:3662: checking for cthread_fork with -all_load" >&5
 if eval "test \"`echo '$''{'ol_cv_cthread_all_load'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3354,7 +3666,7 @@ else
                                                                save_LIBS="$LIBS"
                                LIBS="-all_load $LIBS"
                                cat > conftest.$ac_ext <<EOF
-#line 3358 "configure"
+#line 3670 "configure"
 #include "confdefs.h"
 #include <mach/cthreads.h>
 int main() {
@@ -3363,7 +3675,7 @@ int main() {
                                        
 ; return 0; }
 EOF
-if { (eval echo configure:3367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ol_cv_cthread_all_load=yes
 else
@@ -3387,6 +3699,10 @@ echo "$ac_t""$ol_cv_cthread_all_load" 1>&6
 
                if test $ol_link_threads != no ; then
                        : check for cthread specific functionality here
+                       cat >> confdefs.h <<\EOF
+#define HAVE_MACH_CTHREADS 1
+EOF
+
                else
                        { echo "configure: error: could not link with Mach CThreads" 1>&2; exit 1; }
                fi
@@ -3402,17 +3718,17 @@ if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3406: checking for $ac_hdr" >&5
+echo "configure:3722: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3411 "configure"
+#line 3727 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3732: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3440,7 +3756,7 @@ done
 
        if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
                echo $ac_n "checking for thr_create in -lthread""... $ac_c" 1>&6
-echo "configure:3444: checking for thr_create in -lthread" >&5
+echo "configure:3760: checking for thr_create in -lthread" >&5
 ac_lib_var=`echo thread'_'thr_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3448,7 +3764,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3452 "configure"
+#line 3768 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3459,7 +3775,7 @@ int main() {
 thr_create()
 ; return 0; }
 EOF
-if { (eval echo configure:3463: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3779: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3498,17 +3814,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3502: checking for $ac_hdr" >&5
+echo "configure:3818: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3507 "configure"
+#line 3823 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3512: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3828: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3536,7 +3852,7 @@ done
 
        if test $ac_cv_header_lwp_lwp_h = yes ; then
                echo $ac_n "checking for lwp_create in -llwp""... $ac_c" 1>&6
-echo "configure:3540: checking for lwp_create in -llwp" >&5
+echo "configure:3856: checking for lwp_create in -llwp" >&5
 ac_lib_var=`echo lwp'_'lwp_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3544,7 +3860,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-llwp  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3548 "configure"
+#line 3864 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3555,7 +3871,7 @@ int main() {
 lwp_create()
 ; return 0; }
 EOF
-if { (eval echo configure:3559: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3875: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3607,17 +3923,17 @@ if test $ol_with_threads = manual ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3611: checking for $ac_hdr" >&5
+echo "configure:3927: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3616 "configure"
+#line 3932 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3937: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3646,12 +3962,12 @@ done
        for ac_func in sched_yield pthread_yield
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3650: checking for $ac_func" >&5
+echo "configure:3966: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3655 "configure"
+#line 3971 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -3674,7 +3990,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:3678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -3700,7 +4016,7 @@ done
 
        
 echo $ac_n "checking for LinuxThreads""... $ac_c" 1>&6
-echo "configure:3704: checking for LinuxThreads" >&5
+echo "configure:4020: checking for LinuxThreads" >&5
 if eval "test \"`echo '$''{'ol_cv_linux_threads'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3721,17 +4037,17 @@ echo "$ac_t""$ol_cv_linux_threads" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3725: checking for $ac_hdr" >&5
+echo "configure:4041: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3730 "configure"
+#line 4046 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3735: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4051: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3761,17 +4077,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3765: checking for $ac_hdr" >&5
+echo "configure:4081: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3770 "configure"
+#line 4086 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4091: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3801,17 +4117,17 @@ done
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3805: checking for $ac_hdr" >&5
+echo "configure:4121: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3810 "configure"
+#line 4126 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4131: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3839,13 +4155,17 @@ done
 
 fi
 
-if test $ol_with_threads = yes ; then
+if test $ol_with_threads != no ; then
                                                cat >> confdefs.h <<\EOF
 #define _REENTRANT 1
 EOF
 
        cat >> confdefs.h <<\EOF
 #define _THREAD_SAFE 1
+EOF
+
+       cat >> confdefs.h <<\EOF
+#define _THREADSAFE 1
 EOF
 
 fi
@@ -3875,13 +4195,13 @@ fi
 ol_link_ldbm=no 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db2 ; then
        echo $ac_n "checking for DB2 library""... $ac_c" 1>&6
-echo "configure:3879: checking for DB2 library" >&5
+echo "configure:4199: checking for DB2 library" >&5
 if eval "test \"`echo '$''{'ol_cv_lib_db2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for db_open in -ldb""... $ac_c" 1>&6
-echo "configure:3885: checking for db_open in -ldb" >&5
+echo "configure:4205: checking for db_open in -ldb" >&5
 ac_lib_var=`echo db'_'db_open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3889,7 +4209,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldb  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3893 "configure"
+#line 4213 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -3900,7 +4220,7 @@ int main() {
 db_open()
 ; return 0; }
 EOF
-if { (eval echo configure:3904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4224: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -3931,17 +4251,17 @@ for ac_hdr in db.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3935: checking for $ac_hdr" >&5
+echo "configure:4255: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3940 "configure"
+#line 4260 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4265: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3969,13 +4289,13 @@ done
 
 if test $ac_cv_header_db_h = yes ; then
        echo $ac_n "checking if db.h is DB2""... $ac_c" 1>&6
-echo "configure:3973: checking if db.h is DB2" >&5
+echo "configure:4293: checking if db.h is DB2" >&5
 if eval "test \"`echo '$''{'ol_cv_header_db2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 3979 "configure"
+#line 4299 "configure"
 #include "confdefs.h"
 
 #                      include <db.h>
@@ -4007,7 +4327,7 @@ fi
 
  
  echo $ac_n "checking for Berkeley DB2""... $ac_c" 1>&6
-echo "configure:4011: checking for Berkeley DB2" >&5
+echo "configure:4331: checking for Berkeley DB2" >&5
 if eval "test \"`echo '$''{'ol_cv_berkeley_db2'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4053,18 +4373,18 @@ fi
 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = db ; then
        echo $ac_n "checking for Berkeley DB library""... $ac_c" 1>&6
-echo "configure:4057: checking for Berkeley DB library" >&5
+echo "configure:4377: checking for Berkeley DB library" >&5
 if eval "test \"`echo '$''{'ol_cv_lib_db'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for dbopen""... $ac_c" 1>&6
-echo "configure:4063: checking for dbopen" >&5
+echo "configure:4383: checking for dbopen" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dbopen'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4068 "configure"
+#line 4388 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbopen(); below.  */
@@ -4087,7 +4407,7 @@ dbopen();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbopen=yes"
 else
@@ -4106,7 +4426,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
-echo "configure:4110: checking for dbopen in -ldb" >&5
+echo "configure:4430: checking for dbopen in -ldb" >&5
 ac_lib_var=`echo db'_'dbopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4114,7 +4434,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldb  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4118 "configure"
+#line 4438 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4125,7 +4445,7 @@ int main() {
 dbopen()
 ; return 0; }
 EOF
-if { (eval echo configure:4129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4449: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4160,17 +4480,17 @@ for ac_hdr in db_185.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4164: checking for $ac_hdr" >&5
+echo "configure:4484: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4169 "configure"
+#line 4489 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4206,7 +4526,7 @@ fi
 
  
  echo $ac_n "checking for Berkeley DB""... $ac_c" 1>&6
-echo "configure:4210: checking for Berkeley DB" >&5
+echo "configure:4530: checking for Berkeley DB" >&5
 if eval "test \"`echo '$''{'ol_cv_berkeley_db'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4259,17 +4579,17 @@ if test $ol_with_ldbm_api = manual ; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4263: checking for $ac_hdr" >&5
+echo "configure:4583: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4268 "configure"
+#line 4588 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4593: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4304,18 +4624,18 @@ fi
 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
        echo $ac_n "checking for GDBM library""... $ac_c" 1>&6
-echo "configure:4308: checking for GDBM library" >&5
+echo "configure:4628: checking for GDBM library" >&5
 if eval "test \"`echo '$''{'ol_cv_lib_gdbm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for gdbm_open""... $ac_c" 1>&6
-echo "configure:4314: checking for gdbm_open" >&5
+echo "configure:4634: checking for gdbm_open" >&5
 if eval "test \"`echo '$''{'ac_cv_func_gdbm_open'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4319 "configure"
+#line 4639 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char gdbm_open(); below.  */
@@ -4338,7 +4658,7 @@ gdbm_open();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_gdbm_open=yes"
 else
@@ -4357,7 +4677,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:4361: checking for gdbm_open in -lgdbm" >&5
+echo "configure:4681: checking for gdbm_open in -lgdbm" >&5
 ac_lib_var=`echo gdbm'_'gdbm_open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4365,7 +4685,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lgdbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4369 "configure"
+#line 4689 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4376,7 +4696,7 @@ int main() {
 gdbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:4380: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4411,17 +4731,17 @@ echo "$ac_t""$ol_cv_lib_gdbm" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4415: checking for $ac_hdr" >&5
+echo "configure:4735: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4420 "configure"
+#line 4740 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4745: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4448,7 +4768,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:4452: checking for db" >&5
+echo "configure:4772: checking for db" >&5
 if eval "test \"`echo '$''{'ol_cv_gdbm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4482,18 +4802,18 @@ fi
 
 if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = ndbm ; then
        echo $ac_n "checking for NDBM library""... $ac_c" 1>&6
-echo "configure:4486: checking for NDBM library" >&5
+echo "configure:4806: checking for NDBM library" >&5
 if eval "test \"`echo '$''{'ol_cv_lib_ndbm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
        ol_LIBS="$LIBS"
        echo $ac_n "checking for dbm_open""... $ac_c" 1>&6
-echo "configure:4492: checking for dbm_open" >&5
+echo "configure:4812: checking for dbm_open" >&5
 if eval "test \"`echo '$''{'ac_cv_func_dbm_open'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4497 "configure"
+#line 4817 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char dbm_open(); below.  */
@@ -4516,7 +4836,7 @@ dbm_open();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4840: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_dbm_open=yes"
 else
@@ -4535,7 +4855,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:4539: checking for dbm_open in -lndbm" >&5
+echo "configure:4859: checking for dbm_open in -lndbm" >&5
 ac_lib_var=`echo ndbm'_'dbm_open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4543,7 +4863,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lndbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4547 "configure"
+#line 4867 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4554,7 +4874,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:4558: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4878: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4574,7 +4894,7 @@ else
   echo "$ac_t""no" 1>&6
 
                        echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:4578: checking for dbm_open in -ldbm" >&5
+echo "configure:4898: checking for dbm_open in -ldbm" >&5
 ac_lib_var=`echo dbm'_'dbm_open | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4582,7 +4902,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldbm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4586 "configure"
+#line 4906 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4593,7 +4913,7 @@ int main() {
 dbm_open()
 ; return 0; }
 EOF
-if { (eval echo configure:4597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4917: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4630,17 +4950,17 @@ echo "$ac_t""$ol_cv_lib_ndbm" 1>&6
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4634: checking for $ac_hdr" >&5
+echo "configure:4954: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4639 "configure"
+#line 4959 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4964: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4667,7 +4987,7 @@ fi
 done
 
  echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:4671: checking for db" >&5
+echo "configure:4991: checking for db" >&5
 if eval "test \"`echo '$''{'ol_cv_ndbm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -4715,7 +5035,7 @@ fi
 
 if test $ol_enable_wrappers = yes ; then
        echo $ac_n "checking for hosts_access in -lwrap""... $ac_c" 1>&6
-echo "configure:4719: checking for hosts_access in -lwrap" >&5
+echo "configure:5039: checking for hosts_access in -lwrap" >&5
 ac_lib_var=`echo wrap'_'hosts_access | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4723,7 +5043,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lwrap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4727 "configure"
+#line 5047 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4734,7 +5054,7 @@ int main() {
 hosts_access()
 ; return 0; }
 EOF
-if { (eval echo configure:4738: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5058: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4780,17 +5100,17 @@ for ac_hdr in termcap.h ncurses.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4784: checking for $ac_hdr" >&5
+echo "configure:5104: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4789 "configure"
+#line 5109 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5114: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -4819,7 +5139,7 @@ done
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6
-echo "configure:4823: checking for tputs in -ltermcap" >&5
+echo "configure:5143: checking for tputs in -ltermcap" >&5
 ac_lib_var=`echo termcap'_'tputs | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4827,7 +5147,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ltermcap  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4831 "configure"
+#line 5151 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4838,7 +5158,7 @@ int main() {
 tputs()
 ; return 0; }
 EOF
-if { (eval echo configure:4842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5162: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4871,7 +5191,7 @@ fi
 
 if test $ol_link_termcap = no ; then
        echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:4875: checking for initscr in -lncurses" >&5
+echo "configure:5195: checking for initscr in -lncurses" >&5
 ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4879,7 +5199,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lncurses  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4883 "configure"
+#line 5203 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4890,7 +5210,7 @@ int main() {
 initscr()
 ; return 0; }
 EOF
-if { (eval echo configure:4894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5214: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -4932,12 +5252,12 @@ fi
 # FreeBSD (and others) have crypt(3) in -lcrypt
 if test $ol_enable_crypt != no ; then
        echo $ac_n "checking for crypt""... $ac_c" 1>&6
-echo "configure:4936: checking for crypt" >&5
+echo "configure:5256: checking for crypt" >&5
 if eval "test \"`echo '$''{'ac_cv_func_crypt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 4941 "configure"
+#line 5261 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char crypt(); below.  */
@@ -4960,7 +5280,7 @@ crypt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:4964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_crypt=yes"
 else
@@ -4979,7 +5299,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:4983: checking for crypt in -lcrypt" >&5
+echo "configure:5303: checking for crypt in -lcrypt" >&5
 ac_lib_var=`echo crypt'_'crypt | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -4987,7 +5307,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lcrypt  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 4991 "configure"
+#line 5311 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -4998,7 +5318,7 @@ int main() {
 crypt()
 ; return 0; }
 EOF
-if { (eval echo configure:5002: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5322: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5042,12 +5362,12 @@ fi
 # FreeBSD (and others) have setproctitle(3) in -lutil
 if test $ol_enable_proctitle != no ; then
        echo $ac_n "checking for setproctitle""... $ac_c" 1>&6
-echo "configure:5046: checking for setproctitle" >&5
+echo "configure:5366: checking for setproctitle" >&5
 if eval "test \"`echo '$''{'ac_cv_func_setproctitle'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5051 "configure"
+#line 5371 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char setproctitle(); below.  */
@@ -5070,7 +5390,7 @@ setproctitle();
 
 ; return 0; }
 EOF
-if { (eval echo configure:5074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5394: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_setproctitle=yes"
 else
@@ -5089,7 +5409,7 @@ else
   echo "$ac_t""no" 1>&6
 
                echo $ac_n "checking for setproctitle in -lutil""... $ac_c" 1>&6
-echo "configure:5093: checking for setproctitle in -lutil" >&5
+echo "configure:5413: checking for setproctitle in -lutil" >&5
 ac_lib_var=`echo util'_'setproctitle | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5097,7 +5417,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lutil  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5101 "configure"
+#line 5421 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5108,7 +5428,7 @@ int main() {
 setproctitle()
 ; return 0; }
 EOF
-if { (eval echo configure:5112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5432: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5143,12 +5463,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:5147: checking for ANSI C header files" >&5
+echo "configure:5467: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5152 "configure"
+#line 5472 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -5156,7 +5476,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5480: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5173,7 +5493,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 5177 "configure"
+#line 5497 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -5191,7 +5511,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 5195 "configure"
+#line 5515 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -5212,7 +5532,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 5216 "configure"
+#line 5536 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -5223,7 +5543,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5547: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -5256,12 +5576,12 @@ for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr that defines DIR""... $ac_c" 1>&6
-echo "configure:5260: checking for $ac_hdr that defines DIR" >&5
+echo "configure:5580: checking for $ac_hdr that defines DIR" >&5
 if eval "test \"`echo '$''{'ac_cv_header_dirent_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5265 "configure"
+#line 5585 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <$ac_hdr>
@@ -5269,7 +5589,7 @@ int main() {
 DIR *dirp = 0;
 ; return 0; }
 EOF
-if { (eval echo configure:5273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5593: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   eval "ac_cv_header_dirent_$ac_safe=yes"
 else
@@ -5294,7 +5614,7 @@ done
 # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix.
 if test $ac_header_dirent = dirent.h; then
 echo $ac_n "checking for opendir in -ldir""... $ac_c" 1>&6
-echo "configure:5298: checking for opendir in -ldir" >&5
+echo "configure:5618: checking for opendir in -ldir" >&5
 ac_lib_var=`echo dir'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5302,7 +5622,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldir  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5306 "configure"
+#line 5626 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5313,7 +5633,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:5317: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5637: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5335,7 +5655,7 @@ fi
 
 else
 echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:5339: checking for opendir in -lx" >&5
+echo "configure:5659: checking for opendir in -lx" >&5
 ac_lib_var=`echo x'_'opendir | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -5343,7 +5663,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lx  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 5347 "configure"
+#line 5667 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -5354,7 +5674,7 @@ int main() {
 opendir()
 ; return 0; }
 EOF
-if { (eval echo configure:5358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5678: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -5377,12 +5697,12 @@ fi
 fi
 
 echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:5381: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:5701: checking for sys/wait.h that is POSIX.1 compatible" >&5
 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5386 "configure"
+#line 5706 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/wait.h>
@@ -5398,7 +5718,7 @@ wait (&s);
 s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
 ; return 0; }
 EOF
-if { (eval echo configure:5402: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5722: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_sys_wait_h=yes
 else
@@ -5429,12 +5749,14 @@ for ac_hdr in \
        limits.h                \
        malloc.h                \
        regex.h                 \
+       pwd.h                   \
        sgtty.h                 \
        sys/file.h              \
        sys/filio.h             \
        sys/errno.h             \
        sys/ioctl.h             \
        sys/param.h             \
+       sys/resource.h  \
        sys/socket.h    \
        sys/syslog.h    \
        sys/time.h              \
@@ -5446,17 +5768,17 @@ for ac_hdr in \
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:5450: checking for $ac_hdr" >&5
+echo "configure:5772: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5455 "configure"
+#line 5777 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5782: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -5484,12 +5806,12 @@ done
 
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5488: checking for uid_t in sys/types.h" >&5
+echo "configure:5810: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5493 "configure"
+#line 5815 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -5518,7 +5840,7 @@ EOF
 fi
 
 echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:5522: checking type of array argument to getgroups" >&5
+echo "configure:5844: checking type of array argument to getgroups" >&5
 if eval "test \"`echo '$''{'ac_cv_type_getgroups'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5526,7 +5848,7 @@ else
   ac_cv_type_getgroups=cross
 else
   cat > conftest.$ac_ext <<EOF
-#line 5530 "configure"
+#line 5852 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Rendell for this test.  */
@@ -5551,7 +5873,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:5555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5877: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
     ac_cv_type_getgroups=gid_t
 else
@@ -5565,7 +5887,7 @@ fi
 
 if test $ac_cv_type_getgroups = cross; then
         cat > conftest.$ac_ext <<EOF
-#line 5569 "configure"
+#line 5891 "configure"
 #include "confdefs.h"
 #include <unistd.h>
 EOF
@@ -5589,12 +5911,12 @@ EOF
 
 
 echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:5593: checking for mode_t" >&5
+echo "configure:5915: checking for mode_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_mode_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5598 "configure"
+#line 5920 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5622,12 +5944,12 @@ EOF
 fi
 
 echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:5626: checking for off_t" >&5
+echo "configure:5948: checking for off_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5631 "configure"
+#line 5953 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5655,12 +5977,12 @@ EOF
 fi
 
 echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:5659: checking for pid_t" >&5
+echo "configure:5981: checking for pid_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5664 "configure"
+#line 5986 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5688,12 +6010,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:5692: checking return type of signal handlers" >&5
+echo "configure:6014: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5697 "configure"
+#line 6019 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -5710,7 +6032,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6036: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -5729,12 +6051,12 @@ EOF
 
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:5733: checking for size_t" >&5
+echo "configure:6055: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5738 "configure"
+#line 6060 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -5762,12 +6084,12 @@ EOF
 fi
 
 echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5766: checking for uid_t in sys/types.h" >&5
+echo "configure:6088: checking for uid_t in sys/types.h" >&5
 if eval "test \"`echo '$''{'ac_cv_type_uid_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5771 "configure"
+#line 6093 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 EOF
@@ -5796,12 +6118,12 @@ EOF
 fi
 
 echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:5800: checking for st_blksize in struct stat" >&5
+echo "configure:6122: checking for st_blksize in struct stat" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_st_blksize'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5805 "configure"
+#line 6127 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -5809,7 +6131,7 @@ int main() {
 struct stat s; s.st_blksize;
 ; return 0; }
 EOF
-if { (eval echo configure:5813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6135: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_st_blksize=yes
 else
@@ -5830,12 +6152,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:5834: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:6156: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5839 "configure"
+#line 6161 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -5844,7 +6166,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:5848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -5865,12 +6187,12 @@ EOF
 fi
 
 echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:5869: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:6191: checking whether struct tm is in sys/time.h or time.h" >&5
 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5874 "configure"
+#line 6196 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <time.h>
@@ -5878,7 +6200,7 @@ int main() {
 struct tm *tp; tp->tm_sec;
 ; return 0; }
 EOF
-if { (eval echo configure:5882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6204: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_struct_tm=time.h
 else
@@ -5901,7 +6223,7 @@ fi
 
 
 echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:5905: checking if toupper() requires islower()" >&5
+echo "configure:6227: checking if toupper() requires islower()" >&5
 if eval "test \"`echo '$''{'ol_cv_c_upper_lower'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -5910,7 +6232,7 @@ else
   ol_cv_c_upper_lower=safe
 else
   cat > conftest.$ac_ext <<EOF
-#line 5914 "configure"
+#line 6236 "configure"
 #include "confdefs.h"
 
 #include <ctype.h>
@@ -5922,7 +6244,7 @@ main()
                exit(1);
 }
 EOF
-if { (eval echo configure:5926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ol_cv_c_upper_lower=no
 else
@@ -5945,12 +6267,12 @@ EOF
 fi
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5949: checking for working const" >&5
+echo "configure:6271: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 5954 "configure"
+#line 6276 "configure"
 #include "confdefs.h"
 
 int main() {
@@ -5999,7 +6321,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:6003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6325: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -6022,7 +6344,7 @@ fi
 
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:6026: checking for 8-bit clean memcmp" >&5
+echo "configure:6348: checking for 8-bit clean memcmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6030,7 +6352,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 6034 "configure"
+#line 6356 "configure"
 #include "confdefs.h"
 
 main()
@@ -6040,7 +6362,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:6044: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6366: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_memcmp_clean=yes
 else
@@ -6058,12 +6380,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
 
 echo $ac_n "checking for strftime""... $ac_c" 1>&6
-echo "configure:6062: checking for strftime" >&5
+echo "configure:6384: checking for strftime" >&5
 if eval "test \"`echo '$''{'ac_cv_func_strftime'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6067 "configure"
+#line 6389 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char strftime(); below.  */
@@ -6086,7 +6408,7 @@ strftime();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6412: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_strftime=yes"
 else
@@ -6108,7 +6430,7 @@ else
   echo "$ac_t""no" 1>&6
 # strftime is in -lintl on SCO UNIX.
 echo $ac_n "checking for strftime in -lintl""... $ac_c" 1>&6
-echo "configure:6112: checking for strftime in -lintl" >&5
+echo "configure:6434: checking for strftime in -lintl" >&5
 ac_lib_var=`echo intl'_'strftime | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -6116,7 +6438,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lintl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 6120 "configure"
+#line 6442 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -6127,7 +6449,7 @@ int main() {
 strftime()
 ; return 0; }
 EOF
-if { (eval echo configure:6131: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -6154,12 +6476,12 @@ fi
 fi
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:6158: checking for vprintf" >&5
+echo "configure:6480: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6163 "configure"
+#line 6485 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -6182,7 +6504,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -6206,12 +6528,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:6210: checking for _doprnt" >&5
+echo "configure:6532: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6215 "configure"
+#line 6537 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -6234,7 +6556,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6560: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -6263,12 +6585,12 @@ if test $ac_cv_func_vprintf = yes ; then
                for ac_func in vsnprintf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6267: checking for $ac_func" >&5
+echo "configure:6589: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6272 "configure"
+#line 6594 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6291,7 +6613,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6295: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6617: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6318,7 +6640,7 @@ done
 fi
 
 echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6
-echo "configure:6322: checking for wait3 that fills in rusage" >&5
+echo "configure:6644: checking for wait3 that fills in rusage" >&5
 if eval "test \"`echo '$''{'ac_cv_func_wait3_rusage'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -6326,7 +6648,7 @@ else
   ac_cv_func_wait3_rusage=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 6330 "configure"
+#line 6652 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -6357,7 +6679,7 @@ main() {
   }
 }
 EOF
-if { (eval echo configure:6361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_wait3_rusage=yes
 else
@@ -6387,11 +6709,13 @@ for ac_func in \
        gethostname             \
        gettimeofday    \
        getdtablesize   \
+       getpwuid                \
        lockf                   \
        memcpy                  \
        memmove                 \
        mkstemp                 \
        mktime                  \
+       res_search              \
        select                  \
        setpwfile               \
        setsid                  \
@@ -6412,12 +6736,12 @@ for ac_func in \
 
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6416: checking for $ac_func" >&5
+echo "configure:6740: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6421 "configure"
+#line 6745 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6440,7 +6764,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6468,12 +6792,12 @@ done
 for ac_func in getopt strdup tempnam
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:6472: checking for $ac_func" >&5
+echo "configure:6796: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 6477 "configure"
+#line 6801 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -6496,7 +6820,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:6500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -6526,13 +6850,13 @@ done
 # Check Configuration
 
 echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:6530: checking declaration of sys_errlist" >&5
+echo "configure:6854: checking declaration of sys_errlist" >&5
 if eval "test \"`echo '$''{'ol_cv_dcl_sys_errlist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
        cat > conftest.$ac_ext <<EOF
-#line 6536 "configure"
+#line 6860 "configure"
 #include "confdefs.h"
 
 #include <stdio.h>
@@ -6542,7 +6866,7 @@ int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:6546: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6870: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ol_cv_dcl_sys_errlist=yes
 else
@@ -6563,20 +6887,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then
 EOF
 
        echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:6567: checking existence of sys_errlist" >&5
+echo "configure:6891: checking existence of sys_errlist" >&5
        if eval "test \"`echo '$''{'ol_cv_have_sys_errlist'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   
                cat > conftest.$ac_ext <<EOF
-#line 6573 "configure"
+#line 6897 "configure"
 #include "confdefs.h"
 #include <errno.h>
 int main() {
 char *c = (char *) *sys_errlist
 ; return 0; }
 EOF
-if { (eval echo configure:6580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6904: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
   rm -rf conftest*
   ol_cv_have_sys_errlist=yes
 else
@@ -6705,7 +7029,7 @@ if test $ol_enable_slurpd != no -a $ol_link_threads != no -a \
        BUILD_SLURPD=yes
 fi
 
-if test $ol_enable_ldapd != no ; then
+if test $ol_link_isode != no ; then
        BUILD_LDAPD=yes
 fi
 
@@ -6728,7 +7052,6 @@ fi
 
 
 
-
 
 
 trap '' 1 2 15
@@ -6907,6 +7230,7 @@ s%@EDITOR@%$EDITOR%g
 s%@FINGER@%$FINGER%g
 s%@CC@%$CC%g
 s%@CPP@%$CPP%g
+s%@PEPSY@%$PEPSY%g
 s%@LIBOBJS@%$LIBOBJS%g
 s%@BUILD_LDAPD@%$BUILD_LDAPD%g
 s%@BUILD_SLAPD@%$BUILD_SLAPD%g
index 314d59a9ab2e6c60d4182f042e58246015a10c83..1cb0084dba3bf2fd5da4443db970ad3ba5d0a519 100644 (file)
@@ -69,6 +69,14 @@ OL_ARG_ENABLE(shell,[    --enable-shell      enable shell backend], no)dnl
 dnl SLURPD OPTIONS
 OL_ARG_ENABLE(slurpd,[  --enable-slurpd        enable building slurpd], auto)dnl
 
+# validate options
+if test $ol_enable_referrals = no ; then
+       if test $ol_enable_dns = yes ; then
+               AC_MSG_WARN([dns disabled, ignoring --enable-dns argument])
+       fi
+       ol_enable_dns=no
+fi
+
 if test $ol_enable_slapd = no ; then
        dnl SLAPD was specificallly disabled
        if test $ol_enable_ldbm = yes ; then
@@ -183,6 +191,7 @@ BUILD_SLURPD=no
 BUILD_LDBM=no
 BUILD_PASSWD=no
 BUILD_SHELL=no
+BUILD_THREAD=no
 
 KRB_LIBS=
 TERMCAP_LIBS=
@@ -215,7 +224,8 @@ elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
        AC_ERROR([  if cross compiling,  add --enable-x-compile.])
 fi
 
-AC_PROG_GCC_TRADITIONAL
+dnl OpenLDAP requires STDC features
+dnl AC_PROG_GCC_TRADITIONAL
 AC_PROG_CPP
 
 
@@ -242,9 +252,42 @@ dnl
        AC_CHECK_LIB(gen, main)
 ])
 
+dnl Check for resolv
+AC_CHECK_LIB(resolv, res_search)
+
 dnl HP-UX requires -lV3
 AC_CHECK_LIB(V3, sigset)
 
+# ISODE tests
+ol_link_isode=no
+if test $ol_enable_ldapd != no ; then
+       dnl look for ISODE libraries
+       AC_CHECK_LIB(xtpp, main, [
+               ol_link_isode=yes
+               AC_DEFINE(HAVE_XTPP,1)
+               LDAPD_LIBS="$LDAPD_LIBS -lxtpp -lxtdsap -lxtisode -losi"
+               ],:,[-lxtdsap -lxtisode -losi])
+       AC_CHECK_LIB(dsap, main, [
+               ol_link_isode=yes
+               AC_DEFINE(HAVE_DSAP,1)
+               LDAPD_LIBS="$LDAPD_LIBS -ldsap"
+               ],:,[-lisode])
+       AC_CHECK_LIB(isode, main, [
+               ol_link_isode=yes
+               AC_DEFINE(HAVE_ISODE,1)
+               LDAPD_LIBS="$LDAPD_LIBS -lisode"
+               ],:)
+fi
+
+if test $ol_link_isode != no; then
+       AC_CHECK_LIB(pp, main, [
+               AC_DEFINE(HAVE_PP,1)
+               LDAPD_LIBS="-lpp $LDAPD_LIBS"
+               ],:)
+
+       AC_PATH_PROG(PEPSY, pepsy)
+fi
+
 if test $ol_with_kerberos = auto -o $ol_with_kerberos = k5 ; then
        AC_CHECK_HEADERS(kerberosIV/krb.h kerberosIV/des.h)
 
@@ -313,12 +356,11 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
                        dnl try -pthread
                        AC_CACHE_CHECK([for pthread_create with -pthread],
                                [ol_cv_pthread_flag], [
-                               dnl save the CPPFLAGS
+                               dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-pthread $LIBS"
-                               AC_TRY_LINK([#include <pthread.h>],[
-                                       pthread_create((pthread_t*) 0,
-                                               (pthread_attr_t*) 0, 0, 0);
+                               AC_TRY_LINK([char pthread();],[
+                                       pthread_create();
                                        ], ol_cv_pthread_flag=yes, ol_cv_pthread_flag=no)
                                dnl restore the LIBS
                                LIBS="$save_LIBS"
@@ -331,41 +373,73 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
                fi
 
                if test $ol_link_threads = no ; then
-                       dnl try -lpthread
-                       save_LIBS="$LIBS"
-                       AC_CHECK_LIB(pthread, pthread_create, [
+                       dnl try -thread
+                       AC_CACHE_CHECK([for pthread_create with -thread],
+                               [ol_cv_thread_flag], [
+                               dnl save the flags
+                               save_LIBS="$LIBS"
+                               LIBS="-thread $LIBS"
+                               AC_TRY_LINK([char pthread();],[
+                                       pthread_create();
+                                       ], ol_cv_thread_flag=yes, ol_cv_thread_flag=no)
+                               dnl restore the LIBS
+                               LIBS="$save_LIBS"
+                       ])
+
+                       if test $ol_cv_thread_flag = yes ; then
+                               LTHREAD_LIBS="$LTHREAD_LIBS -thread"
                                ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"])
-                       LIBS="$save_LIBS"
+                       fi
                fi
 
                if test $ol_link_threads = no ; then
-                       dnl try -lc_r
+                       dnl try DEC Threads -lpthread -lexc
                        save_LIBS="$LIBS"
-                       AC_CHECK_LIB(c_r, pthread_create, [
+                       AC_CHECK_LIB(pthread, pthread_join, [
                                ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"])
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lexc"
+                               if test $ol_with_preemptive = auto ; then
+                                       ol_with_preemptive=yes
+                               fi
+                               ],,[-lexc])
                        LIBS="$save_LIBS"
                fi
 
                if test $ol_link_threads = no ; then
-                       dnl try DEC Threads
+                       dnl try DEC Threads -lpthreads -lmach -lexc -lc_r
                        save_LIBS="$LIBS"
-                       AC_CHECK_LIB(pthread, pthread_create, [
-                               AC_DEFINE(HAVE_DCE)
+                       AC_CHECK_LIB(pthreads, pthread_join, [
                                ol_link_threads=posix
-                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthreads -lmach -lexc -lc_r"
                                if test $ol_with_preemptive = auto ; then
                                        ol_with_preemptive=yes
                                fi
-                               ],,[-lmach -lexc -lc])
+                               ],,[-lmach -lexc -lc_r])
+                       LIBS="$save_LIBS"
+               fi
+
+               if test $ol_link_threads = no ; then
+                       dnl try -lpthread
+                       save_LIBS="$LIBS"
+                       AC_CHECK_LIB(pthread, pthread_create, [
+                               ol_link_threads=posix
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"])
+                       LIBS="$save_LIBS"
+               fi
+
+               if test $ol_link_threads = no ; then
+                       dnl try -lc_r
+                       save_LIBS="$LIBS"
+                       AC_CHECK_LIB(c_r, pthread_create, [
+                               ol_link_threads=posix
+                               LTHREAD_LIBS="$LTHREAD_LIBS -lc_r"])
                        LIBS="$save_LIBS"
                fi
 
                if test $ol_link_threads != no ; then
                        AC_DEFINE(HAVE_PTHREADS)
 
-                       dnl save DEFS/LIBS
+                       dnl save flags
                        save_CPPFLAGS="$CPPFLAGS"
                        save_LIBS="$LIBS"
                        LIBS="$LTHREAD_LIBS $LIBS"
@@ -401,11 +475,11 @@ if test $ol_with_threads = auto -o $ol_with_threads = posix ; then
 
                        dnl Check functions for compatibility
                        AC_CHECK_FUNCS(pthread_kill)
-dnl                    AC_CHECK_FUNCS( \
-dnl                            pthread_attr_create pthread_attr_init \
-dnl                            pthread_attr_destroy pthread_attr_delete \
-dnl                            pthread_attr_setdetachstate pthread_attr_setdetach_np \
-dnl                    )
+                       AC_CHECK_FUNCS( \
+                               pthread_attr_create pthread_attr_init \
+                               pthread_attr_destroy pthread_attr_delete \
+                               pthread_attr_setdetachstate pthread_attr_setdetach_np \
+                       )
 
                        dnl Check for setconcurreny functions
                        AC_CHECK_FUNCS( \
@@ -448,9 +522,11 @@ int argc; char **argv;
 
 #ifdef HAVE_PTHREAD_SETCONCURRENCY
        (void) pthread_setconcurrency(2);
-#elif HAVE_THR_SETCONCURRENCY
+#else
+#ifdef HAVE_THR_SETCONCURRENCY
        /* Set Solaris LWP concurrency to 2 */
        thr_setconcurrency(2);
+#endif
 #endif
 
        pthread_create(&t, NULL, (void *) task, NULL);
@@ -458,7 +534,7 @@ int argc; char **argv;
 #if HAVE_SCHED_YIELD
        sched_yield();  /* make sure task runs first */
 #else
-#if defined(HAVE_PTHREAD_YIELD)
+#ifdef HAVE_PTHREAD_YIELD
        pthread_yield();        /* make sure task runs first */
 #endif
 #endif
@@ -485,7 +561,7 @@ dnl                         gmtime_r \
 dnl                            strtok_r \
 dnl                    )
 
-                       dnl restore DEFS/LIBS
+                       dnl restore flags
                        CPPFLAGS="$save_CPPFLAGS"
                        LIBS="$save_LIBS"
                else
@@ -512,7 +588,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = mach ; then
                        dnl this test needs work
                        AC_CACHE_CHECK([for cthread_fork with -all_load],
                                [ol_cv_cthread_all_load], [
-                               dnl save the CPPFLAGS
+                               dnl save the flags
                                save_LIBS="$LIBS"
                                LIBS="-all_load $LIBS"
                                AC_TRY_LINK([#include <mach/cthreads.h>],[
@@ -530,6 +606,7 @@ if test $ol_with_threads = auto -o $ol_with_threads = mach ; then
 
                if test $ol_link_threads != no ; then
                        : check for cthread specific functionality here
+                       AC_DEFINE(HAVE_MACH_CTHREADS,1)
                else
                        AC_MSG_ERROR([could not link with Mach CThreads])
                fi
@@ -591,7 +668,7 @@ if test $ol_with_threads = manual ; then
        AC_CHECK_HEADERS(thread.h synch.h)
 fi
 
-if test $ol_with_threads = yes ; then
+if test $ol_with_threads != no ; then
        dnl needed to get reentrant/threadsafe versions
        dnl
        dnl hopefully this will not cause problems with
@@ -599,6 +676,7 @@ if test $ol_with_threads = yes ; then
        dnl
        AC_DEFINE(_REENTRANT,1)
        AC_DEFINE(_THREAD_SAFE,1)
+       AC_DEFINE(_THREADSAFE,1)
 fi
 
 dnl ----------------------------------------------------------------
@@ -815,12 +893,14 @@ AC_CHECK_HEADERS( \
        limits.h                \
        malloc.h                \
        regex.h                 \
+       pwd.h                   \
        sgtty.h                 \
        sys/file.h              \
        sys/filio.h             \
        sys/errno.h             \
        sys/ioctl.h             \
        sys/param.h             \
+       sys/resource.h  \
        sys/socket.h    \
        sys/syslog.h    \
        sys/time.h              \
@@ -870,11 +950,13 @@ AC_CHECK_FUNCS(           \
        gethostname             \
        gettimeofday    \
        getdtablesize   \
+       getpwuid                \
        lockf                   \
        memcpy                  \
        memmove                 \
        mkstemp                 \
        mktime                  \
+       res_search              \
        select                  \
        setpwfile               \
        setsid                  \
@@ -970,7 +1052,7 @@ if test $ol_enable_slurpd != no -a $ol_link_threads != no -a \
        BUILD_SLURPD=yes
 fi
 
-if test $ol_enable_ldapd != no ; then
+if test $ol_link_isode != no ; then
        BUILD_LDAPD=yes
 fi
 
@@ -999,12 +1081,6 @@ dnl ----------------------------------------------------------------
 dnl final output
 dnl
 
-dnl AC_OUTPUT( \
-dnl contrib/Makefile:build/top.mk:contrib/Makefile.in:build/dir.mk \
-dnl contrib/saucer/Makefile:build/top.mk:contrib/saucer/Makefile.in:build/rules.mk \
-dnl contrib/whois++/Makefile:build/top.mk:contrib/whois++/Makefile.in:build/rules.mk \
-dnl [date > stamp-h])
-
 AC_OUTPUT( \
 Makefile:build/top.mk:Makefile.in:build/dir.mk \
 doc/Makefile:build/top.mk:doc/Makefile.in:build/dir.mk \
index eb019fed701e9e30fa3406cc38158933c0b5e80e..94813d9370ec0a8b2947318f1b903e520be491a3 100644 (file)
@@ -182,11 +182,13 @@ according to the IAFA services template." );
                ldap_value_free( values );
        } else {
 #endif
-               value = strdup( ldap_dn2ufn( ldap_get_dn( ld, result ) ) );
+               value = ldap_dn2ufn( ptr = ldap_get_dn( ld, result ) );
+               free( ptr );
                if ( (ptr = index( value, ',' )) != NULL )
                        *ptr = '\0';
                printFormatted( lineLength, FALSE, stdout, "%-19s %s",
                        "Contact:", value );
+               free( value );
 #if defined(UOFA)
        }
 #endif
index 8f2c20e9e0bdac534a38f2b38e847a9d63165d6a..919495db9e6d45c29551dee75f7ce753c08647ac 100644 (file)
@@ -1,4 +1,4 @@
-.TH LDAP 3  "13 November 1995" "U-M LDAP LDVERSION"
+.TH LDAP 3 "10 November 1998" "OpenLDAP LDVERSION"
 .SH NAME
 ldap - Lightweight Directory Access Protocol package
 .SH SYNOPSIS
@@ -12,7 +12,7 @@ ldap - Lightweight Directory Access Protocol package
 .LP
 The Lightweight Directory Access Protocol provides TCP/IP access to
 the X.500 Directory or to a stand-alone LDAP server.
-The University of Michigan LDAP package includes a stand-alone server in
+The OpenLDAP LDAP package includes a stand-alone server in
 .BR slapd (8),
 an LDAP to X.500 gateway in
 .BR ldapd (8),
@@ -499,3 +499,8 @@ terminate a connectionless LDAP session
 .SH AUTHORS
 Tim Howes, Mark Smith, Gordon Good, Lance Sloan, and Steve Rothwell from
 the University of Michigan, along with help from lots of others.
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index e0e6249d0240c2c1e4c7a257f5405728f1ecd4b7..223dc9bccc3ce8aca6b00caf7c0139552ec0dc65 100644 (file)
@@ -1,4 +1,4 @@
-.TH SLAPD.CONF 5  "13 November 1995" "U-M LDAP LDVERSION"
+.TH SLAPD.CONF 5 "22 September 1998" "OpenLDAP LDVERSION"
 .SH NAME
 slapd.conf \- configuration file for slapd, the stand-alone LDAP daemon
 .SH SYNOPSIS
@@ -266,6 +266,10 @@ by the LDBM backend database instance.  The default is 1000 entries.
 Specify the size in bytes of the in-memory cache associated 
 with each open index file. If not supported by the underlying database 
 method, this option is ignored without comment.  The default is 100000 bytes.
+.B dbcachenowsync
+Specify that database writes should not be immediately synchronized
+with in memory changes.  Enabling this option may improving performance
+at the expense of data security.
 .TP
 .B directory <directory>
 Specify the directory where the LDBM files containing the database and
@@ -338,3 +342,8 @@ ETCDIR/slapd.conf
 .BR slurpd (8),
 .LP
 "The SLAPD and SLURPD Administrator's Guide"
+.SH ACKNOWLEDGEMENTS
+.B     OpenLDAP
+is developed and maintained by The OpenLDAP Project (http://www.openldap.org/).
+.B     OpenLDAP
+is derived from University of Michigan LDAP 3.3 Release.  
index 745cc17d61ee4cfd1f55a40d6cb9c2630fba3253..c9dc9b2a25eb0c6a1ed069f774c3b7254bed006b 100644 (file)
 #ifndef _AVL
 #define _AVL
 
+#include <ldap_cdefs.h>
+
 /*
  * this structure represents a generic avl tree node.
  */
 
+LDAP_BEGIN_DECL
+
 typedef struct avlnode {
        caddr_t         avl_data;
-       char            avl_bf;
+       signed char             avl_bf;
        struct avlnode  *avl_left;
        struct avlnode  *avl_right;
 } Avlnode;
@@ -29,28 +33,57 @@ typedef struct avlnode {
 #define NULLAVL        ((Avlnode *) NULL)
 
 /* balance factor values */
-#define LH     -1
+#define LH     (-1)
 #define EH     0
 #define RH     1
 
 /* avl routines */
-#define avl_getone(x)  (x == 0 ? 0 : (x)->avl_data)
-#define avl_onenode(x) (x == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
-extern int             avl_insert();
-extern caddr_t         avl_delete();
-extern caddr_t         avl_find();
-extern caddr_t         avl_getfirst();
-extern caddr_t         avl_getnext();
-extern int             avl_dup_error();
-extern int             avl_apply();
+#define avl_getone(x)  ((x) == 0 ? 0 : (x)->avl_data)
+#define avl_onenode(x) ((x) == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
+
+/* looks like this function pointer is not used consistently */
+/* typedef int (*IFP)LDAP_P((caddr_t, caddr_t)); */
+typedef int    (*IFP)();
+
+LDAP_F int
+avl_free LDAP_P(( Avlnode *root, IFP dfree ));
+
+LDAP_F int
+avl_insert LDAP_P((Avlnode **, caddr_t, IFP, IFP));
+
+LDAP_F caddr_t
+avl_delete LDAP_P((Avlnode **, caddr_t, IFP));
+
+LDAP_F caddr_t
+avl_find LDAP_P((Avlnode *, caddr_t, IFP));
+
+LDAP_F caddr_t
+avl_find_lin LDAP_P((Avlnode *, caddr_t, IFP));
+
+LDAP_F caddr_t
+avl_getfirst LDAP_P((Avlnode *));
+
+#ifdef AVL_REENTRANT
+LDAP_F caddr_t
+avl_getnext LDAP_P((Avlnode *, caddr_t ));
+#else
+LDAP_F caddr_t
+avl_getnext LDAP_P((void));
+#endif
+
+LDAP_F int
+avl_dup_error LDAP_P((void));
+
+LDAP_F int
+avl_apply LDAP_P((Avlnode *, IFP, caddr_t, int, int));
 
 /* apply traversal types */
 #define AVL_PREORDER   1
 #define AVL_INORDER    2
 #define AVL_POSTORDER  3
 /* what apply returns if it ran out of nodes */
-#define AVL_NOMORE     -6
+#define AVL_NOMORE     (-6)
 
-typedef int    (*IFP)();
+LDAP_END_DECL
 
 #endif /* _AVL */
index 1eab5bda62322dce07c67affdfe65f8db84eaa2c..c139f8eeda9b1e18fe1f2346e90590cd80bd3d4c 100644 (file)
 #ifndef _LDAP_H
 #define _LDAP_H
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+#include <ldap_cdefs.h>
 
-#ifdef WINSOCK
-#include "msdos.h"
-#include <winsock.h>
-#endif
-
-#if !defined( NEEDPROTOS ) && defined(__STDC__)
-#define NEEDPROTOS     1
-#endif
+LDAP_BEGIN_DECL
 
 #define LDAP_PORT      389
 #define LDAP_VERSION1  1
 #define LDAP_VERSION2  2
+#define LDAP_VERSION3  3
 #define LDAP_VERSION   LDAP_VERSION2
 
-#define COMPAT20
-#define COMPAT30
-#if defined(COMPAT20) || defined(COMPAT30)
-#define COMPAT
+#define LDAP_COMPAT20
+#define LDAP_COMPAT30
+#if defined(LDAP_COMPAT20) || defined(LDAP_COMPAT30)
+#define LDAP_COMPAT
 #endif
 
 #define LDAP_MAX_ATTR_LEN      100
@@ -46,7 +37,8 @@ extern int    ldap_debug;
 #ifdef LDAP_SYSLOG
 extern int     ldap_syslog;
 extern int     ldap_syslog_level;
-#endif
+#endif /* LDAP_SYSLOG */
+
 #define LDAP_DEBUG_TRACE       0x001
 #define LDAP_DEBUG_PACKETS     0x002
 #define LDAP_DEBUG_ARGS                0x004
@@ -61,19 +53,20 @@ extern int  ldap_syslog_level;
 #define LDAP_DEBUG_PARSE       0x800
 #define LDAP_DEBUG_ANY         0xffff
 
+/* this doesn't below as part of ldap.h */
 #ifdef LDAP_SYSLOG
 #define Debug( level, fmt, arg1, arg2, arg3 )  \
        { \
-               if ( ldap_debug & level ) \
-                       fprintf( stderr, fmt, arg1, arg2, arg3 ); \
+               if ( ldap_debug & (level) ) \
+                       fprintf( stderr, (fmt), (arg1), (arg2), (arg3) ); \
                if ( ldap_syslog & level ) \
-                       syslog( ldap_syslog_level, fmt, arg1, arg2, arg3 ); \
+                       syslog( ldap_syslog_level, (fmt), (arg1), (arg2), (arg3) ); \
        }
 #else /* LDAP_SYSLOG */
 #ifndef WINSOCK
 #define Debug( level, fmt, arg1, arg2, arg3 ) \
-               if ( ldap_debug & level ) \
-                       fprintf( stderr, fmt, arg1, arg2, arg3 );
+               if ( ldap_debug & (level) ) \
+                       fprintf( stderr, (fmt), (arg1), (arg2), (arg3) );
 #else /* !WINSOCK */
 extern void Debug( int level, char* fmt, ... );
 #endif /* !WINSOCK */
@@ -295,7 +288,7 @@ typedef struct ldapmsg {
        BerElement      *lm_ber;        /* the ber encoded message contents */
        struct ldapmsg  *lm_chain;      /* for search - next msg in the resp */
        struct ldapmsg  *lm_next;       /* next response */
-       unsigned long   lm_time;        /* used to maintain cache */
+       unsigned int    lm_time;        /* used to maintain cache */
 } LDAPMessage;
 #define NULLMSG        ((LDAPMessage *) NULL)
 
@@ -318,7 +311,7 @@ typedef struct ldap_server {
 typedef struct ldap_conn {
        Sockbuf                 *lconn_sb;
        int                     lconn_refcnt;
-       unsigned long           lconn_lastused; /* time */
+       time_t          lconn_lastused; /* time */
        int                     lconn_status;
 #define LDAP_CONNST_NEEDSOCKET         1
 #define LDAP_CONNST_CONNECTING         2
@@ -453,12 +446,8 @@ typedef struct ldap {
        int             ld_cldaptimeout;/* time between retries */
        int             ld_refhoplimit; /* limit on referral nesting */
        unsigned long   ld_options;     /* boolean options */
-#ifdef LDAP_DNS
 #define LDAP_OPT_DNS           0x00000001      /* use DN & DNS */
-#endif /* LDAP_DNS */
-#ifdef LDAP_REFERRALS
 #define LDAP_OPT_REFERRALS     0x00000002      /* chase referrals */
-#endif /* LDAP_REFERRALS */
 #define LDAP_OPT_RESTART       0x00000004      /* restart if EINTR occurs */
 
        /* do not mess with the rest though */
@@ -490,7 +479,7 @@ typedef struct friendly {
 /*
  * handy macro to check whether LDAP struct is set up for CLDAP or not
  */
-#define LDAP_IS_CLDAP( ld )    ( ld->ld_sb.sb_naddr > 0 )
+#define LDAP_IS_CLDAP( ld )    ( (ld)->ld_sb.sb_naddr > 0 )
 
 
 /*
@@ -512,81 +501,265 @@ typedef struct ldap_url_desc {
 #define LDAP_URL_ERR_BADSCOPE  3       /* URL scope string is invalid */
 #define LDAP_URL_ERR_MEM       4       /* can't allocate memory space */
 
+/* this typedef is never used, only exists to rid of declaration
+ in function param list warning */
+typedef struct timeval LDAPtv;
 
-#ifndef NEEDPROTOS
-extern LDAP *ldap_open();
-extern LDAP *ldap_init();
-#ifdef STR_TRANSLATION
-extern void ldap_set_string_translators();
-#ifdef LDAP_CHARSET_8859
-extern int ldap_t61_to_8859();
-extern int ldap_8859_to_t61();
-#endif /* LDAP_CHARSET_8859 */
-#endif /* STR_TRANSLATION */
-extern LDAPMessage *ldap_first_entry();
-extern LDAPMessage *ldap_next_entry();
-extern char *ldap_get_dn();
-extern char *ldap_dn2ufn();
-extern char **ldap_explode_dn();
-extern char *ldap_first_attribute();
-extern char *ldap_next_attribute();
-extern char **ldap_get_values();
-extern struct berval **ldap_get_values_len();
-extern void ldap_value_free();
-extern void ldap_value_free_len();
-extern int ldap_count_values();
-extern int ldap_count_values_len();
-extern char *ldap_err2string();
-extern void ldap_getfilter_free();
-extern LDAPFiltDesc *ldap_init_getfilter();
-extern LDAPFiltDesc *ldap_init_getfilter_buf();
-extern LDAPFiltInfo *ldap_getfirstfilter();
-extern LDAPFiltInfo *ldap_getnextfilter();
-extern void ldap_setfilteraffixes();
-extern void ldap_build_filter();
-extern void ldap_flush_cache();
-extern void ldap_set_cache_options();
-extern void ldap_uncache_entry();
-extern void ldap_uncache_request();
-extern char *ldap_friendly_name();
-extern void ldap_free_friendlymap();
-extern LDAP *cldap_open();
-extern void cldap_setretryinfo();
-extern void cldap_close();
-extern LDAPFiltDesc *ldap_ufn_setfilter();
-extern int ldap_ufn_timeout();
-extern int ldap_sort_entries();
-extern int ldap_sort_values();
-extern int ldap_sort_strcasecmp();
-void ldap_free_urldesc();
-void ldap_set_rebind_proc();
-void ldap_enable_translation();
-
-
-#if defined(ultrix) || defined(VMS) || defined( nextstep )
-extern char *strdup();
-#endif
+/*
+ * in abandon.c:
+ */
+LDAP_F int ldap_abandon LDAP_P(( LDAP *ld, int msgid ));
 
-#else /* NEEDPROTOS */
-#if !defined(MACOS) && !defined(DOS) && !defined(_WIN32) && !defined(WINSOCK)
-#include <sys/time.h>
-#endif
-#if defined(WINSOCK)
-#include "proto-ld.h"
-#else
-#include "proto-ldap.h"
-#endif
+/*
+ * in add.c:
+ */
+LDAP_F int ldap_add LDAP_P(( LDAP *ld, char *dn, LDAPMod **attrs ));
+LDAP_F int ldap_add_s LDAP_P(( LDAP *ld, char *dn, LDAPMod **attrs ));
 
-#ifdef VMS
-extern char *strdup( const char *s );
-#endif
-#if defined(ultrix) || defined( nextstep )
-extern char *strdup();
-#endif
+/*
+ * in bind.c:
+ */
+LDAP_F int ldap_bind LDAP_P(( LDAP *ld, char *who, char *passwd, int authmethod ));
+LDAP_F int ldap_bind_s LDAP_P(( LDAP *ld, char *who, char *cred, int method ));
+LDAP_F void ldap_set_rebind_proc LDAP_P(( LDAP *ld,
+       int (*rebindproc) LDAP_P(( LDAP *ld, char **dnp, char **passwdp, int *authmethodp, int freeit ))
+));
 
-#endif /* NEEDPROTOS */
+/*
+ * in sbind.c:
+ */
+LDAP_F int ldap_simple_bind LDAP_P(( LDAP *ld, char *who, char *passwd ));
+LDAP_F int ldap_simple_bind_s LDAP_P(( LDAP *ld, char *who, char *passwd ));
+
+/*
+ * in kbind.c:
+ */
+LDAP_F int ldap_kerberos_bind_s LDAP_P(( LDAP *ld, char *who ));
+LDAP_F int ldap_kerberos_bind1 LDAP_P(( LDAP *ld, char *who ));
+LDAP_F int ldap_kerberos_bind1_s LDAP_P(( LDAP *ld, char *who ));
+LDAP_F int ldap_kerberos_bind2 LDAP_P(( LDAP *ld, char *who ));
+LDAP_F int ldap_kerberos_bind2_s LDAP_P(( LDAP *ld, char *who ));
+
+/*
+ * in cache.c
+ */
+LDAP_F int ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, long maxmem ));
+LDAP_F void ldap_disable_cache LDAP_P(( LDAP *ld ));
+LDAP_F void ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts ));
+LDAP_F void ldap_destroy_cache LDAP_P(( LDAP *ld ));
+LDAP_F void ldap_flush_cache LDAP_P(( LDAP *ld ));
+LDAP_F void ldap_uncache_entry LDAP_P(( LDAP *ld, char *dn ));
+LDAP_F void ldap_uncache_request LDAP_P(( LDAP *ld, int msgid ));
+
+/*
+ * in compare.c:
+ */
+LDAP_F int ldap_compare LDAP_P(( LDAP *ld, char *dn, char *attr, char *value ));
+LDAP_F int ldap_compare_s LDAP_P(( LDAP *ld, char *dn, char *attr, char *value ));
+
+/*
+ * in delete.c:
+ */
+LDAP_F int ldap_delete LDAP_P(( LDAP *ld, char *dn ));
+LDAP_F int ldap_delete_s LDAP_P(( LDAP *ld, char *dn ));
+
+/*
+ * in error.c:
+ */
+LDAP_F int ldap_result2error LDAP_P(( LDAP *ld, LDAPMessage *r, int freeit ));
+LDAP_F char *ldap_err2string LDAP_P(( int err ));
+LDAP_F void ldap_perror LDAP_P(( LDAP *ld, char *s ));
+
+/*
+ * in modify.c:
+ */
+LDAP_F int ldap_modify LDAP_P(( LDAP *ld, char *dn, LDAPMod **mods ));
+LDAP_F int ldap_modify_s LDAP_P(( LDAP *ld, char *dn, LDAPMod **mods ));
+
+/*
+ * in modrdn.c:
+ */
+LDAP_F int ldap_modrdn LDAP_P(( LDAP *ld, char *dn, char *newrdn ));
+LDAP_F int ldap_modrdn_s LDAP_P(( LDAP *ld, char *dn, char *newrdn ));
+LDAP_F int ldap_modrdn2 LDAP_P(( LDAP *ld, char *dn, char *newrdn,
+       int deleteoldrdn ));
+LDAP_F int ldap_modrdn2_s LDAP_P(( LDAP *ld, char *dn, char *newrdn,
+       int deleteoldrdn));
+
+/*
+ * in open.c:
+ */
+LDAP_F LDAP *ldap_open LDAP_P(( char *host, int port ));
+LDAP_F LDAP *ldap_init LDAP_P(( char *defhost, int defport ));
+
+/*
+ * in getentry.c:
+ */
+LDAP_F LDAPMessage *ldap_first_entry LDAP_P(( LDAP *ld, LDAPMessage *chain ));
+LDAP_F LDAPMessage *ldap_next_entry LDAP_P(( LDAP *ld, LDAPMessage *entry ));
+LDAP_F int ldap_count_entries LDAP_P(( LDAP *ld, LDAPMessage *chain ));
+
+/*
+ * in addentry.c
+ */
+LDAP_F LDAPMessage *ldap_delete_result_entry LDAP_P(( LDAPMessage **list,
+       LDAPMessage *e ));
+LDAP_F void ldap_add_result_entry LDAP_P(( LDAPMessage **list, LDAPMessage *e ));
+
+/*
+ * in getdn.c
+ */
+LDAP_F char *ldap_get_dn LDAP_P(( LDAP *ld, LDAPMessage *entry ));
+LDAP_F char *ldap_dn2ufn LDAP_P(( char *dn ));
+LDAP_F char **ldap_explode_dn LDAP_P(( char *dn, int notypes ));
+LDAP_F char **ldap_explode_dns LDAP_P(( char *dn ));
+LDAP_F int ldap_is_dns_dn LDAP_P(( char *dn ));
+
+/*
+ * in getattr.c
+ */
+LDAP_F char *ldap_first_attribute LDAP_P(( LDAP *ld, LDAPMessage *entry,
+       BerElement **ber ));
+LDAP_F char *ldap_next_attribute LDAP_P(( LDAP *ld, LDAPMessage *entry,
+       BerElement *ber ));
+
+/*
+ * in getvalues.c
+ */
+LDAP_F char **ldap_get_values LDAP_P(( LDAP *ld, LDAPMessage *entry, char *target ));
+LDAP_F struct berval **ldap_get_values_len LDAP_P(( LDAP *ld, LDAPMessage *entry,
+       char *target ));
+LDAP_F int ldap_count_values LDAP_P(( char **vals ));
+LDAP_F int ldap_count_values_len LDAP_P(( struct berval **vals ));
+LDAP_F void ldap_value_free LDAP_P(( char **vals ));
+LDAP_F void ldap_value_free_len LDAP_P(( struct berval **vals ));
+
+/*
+ * in result.c:
+ */
+LDAP_F int ldap_result LDAP_P(( LDAP *ld, int msgid, int all,
+       struct timeval *timeout, LDAPMessage **result ));
+LDAP_F int ldap_msgfree LDAP_P(( LDAPMessage *lm ));
+LDAP_F int ldap_msgdelete LDAP_P(( LDAP *ld, int msgid ));
+
+/*
+ * in search.c:
+ */
+LDAP_F int ldap_search LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
+       char **attrs, int attrsonly ));
+LDAP_F int ldap_search_s LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
+       char **attrs, int attrsonly, LDAPMessage **res ));
+LDAP_F int ldap_search_st LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
+    char **attrs, int attrsonly, struct timeval *timeout, LDAPMessage **res ));
+
+/*
+ * in ufn.c
+ */
+LDAP_F int ldap_ufn_search_c LDAP_P(( LDAP *ld, char *ufn, char **attrs,
+       int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ),
+       void *cancelparm ));
+LDAP_F int ldap_ufn_search_ct LDAP_P(( LDAP *ld, char *ufn, char **attrs,
+       int attrsonly, LDAPMessage **res, int (*cancelproc)( void *cl ),
+       void *cancelparm, char *tag1, char *tag2, char *tag3 ));
+LDAP_F int ldap_ufn_search_s LDAP_P(( LDAP *ld, char *ufn, char **attrs,
+       int attrsonly, LDAPMessage **res ));
+LDAP_F LDAPFiltDesc *ldap_ufn_setfilter LDAP_P(( LDAP *ld, char *fname ));
+LDAP_F void ldap_ufn_setprefix LDAP_P(( LDAP *ld, char *prefix ));
+LDAP_F int ldap_ufn_timeout LDAP_P(( void *tvparam ));
+
+
+/*
+ * in unbind.c
+ */
+LDAP_F int ldap_unbind LDAP_P(( LDAP *ld ));
+LDAP_F int ldap_unbind_s LDAP_P(( LDAP *ld ));
+
+
+/*
+ * in getfilter.c
+ */
+LDAP_F LDAPFiltDesc *ldap_init_getfilter LDAP_P(( char *fname ));
+LDAP_F LDAPFiltDesc *ldap_init_getfilter_buf LDAP_P(( char *buf, long buflen ));
+LDAP_F LDAPFiltInfo *ldap_getfirstfilter LDAP_P(( LDAPFiltDesc *lfdp, char *tagpat,
+       char *value ));
+LDAP_F LDAPFiltInfo *ldap_getnextfilter LDAP_P(( LDAPFiltDesc *lfdp ));
+LDAP_F void ldap_setfilteraffixes LDAP_P(( LDAPFiltDesc *lfdp, char *prefix, char *suffix ));
+LDAP_F void ldap_build_filter LDAP_P(( char *buf, unsigned long buflen,
+       char *pattern, char *prefix, char *suffix, char *attr,
+       char *value, char **valwords ));
+
+/*
+ * in free.c
+ */
+LDAP_F void ldap_getfilter_free LDAP_P(( LDAPFiltDesc *lfdp ));
+LDAP_F void ldap_mods_free LDAP_P(( LDAPMod **mods, int freemods ));
+
+/*
+ * in friendly.c
+ */
+LDAP_F char *ldap_friendly_name LDAP_P(( char *filename, char *uname,
+       FriendlyMap **map ));
+LDAP_F void ldap_free_friendlymap LDAP_P(( FriendlyMap **map ));
+
+
+/*
+ * in cldap.c
+ */
+LDAP_F LDAP *cldap_open LDAP_P(( char *host, int port ));
+LDAP_F void cldap_close LDAP_P(( LDAP *ld ));
+LDAP_F int cldap_search_s LDAP_P(( LDAP *ld, char *base, int scope, char *filter,
+       char **attrs, int attrsonly, LDAPMessage **res, char *logdn ));
+LDAP_F void cldap_setretryinfo LDAP_P(( LDAP *ld, int tries, int timeout ));
+
+
+/*
+ * in sort.c
+ */
+LDAP_F int ldap_sort_entries LDAP_P(( LDAP *ld,
+       LDAPMessage **chain, char *attr,
+       int (*cmp) LDAP_P((const char *, const char *)) ));
+LDAP_F int ldap_sort_values LDAP_P(( LDAP *ld,
+       char **vals, int (*cmp) LDAP_P((const void *, const void *)) ));
+LDAP_F int ldap_sort_strcasecmp LDAP_P(( char **a, char **b ));
+
+
+/*
+ * in url.c
+ */
+LDAP_F int ldap_is_ldap_url LDAP_P(( char *url ));
+LDAP_F int ldap_url_parse LDAP_P(( char *url, LDAPURLDesc **ludpp ));
+LDAP_F void ldap_free_urldesc LDAP_P(( LDAPURLDesc *ludp ));
+LDAP_F int ldap_url_search LDAP_P(( LDAP *ld, char *url, int attrsonly ));
+LDAP_F int ldap_url_search_s LDAP_P(( LDAP *ld, char *url, int attrsonly,
+       LDAPMessage **res ));
+LDAP_F int ldap_url_search_st LDAP_P(( LDAP *ld, char *url, int attrsonly,
+       struct timeval *timeout, LDAPMessage **res ));
+
+
+/*
+ * in charset.c
+ */
+LDAP_F void ldap_set_string_translators LDAP_P(( LDAP *ld,
+       BERTranslateProc encode_proc, BERTranslateProc decode_proc ));
+LDAP_F int ldap_translate_from_t61 LDAP_P(( LDAP *ld, char **bufp,
+       unsigned long *lenp, int free_input ));
+LDAP_F int ldap_translate_to_t61 LDAP_P(( LDAP *ld, char **bufp,
+       unsigned long *lenp, int free_input ));
+LDAP_F void ldap_enable_translation LDAP_P(( LDAP *ld, LDAPMessage *entry,
+       int enable ));
+
+LDAP_F int ldap_t61_to_8859 LDAP_P(( char **bufp, unsigned long *buflenp,
+       int free_input ));
+LDAP_F int ldap_8859_to_t61 LDAP_P(( char **bufp, unsigned long *buflenp,
+       int free_input ));
+
+
+/*
+ * in msdos/winsock/wsa.c
+ */
+LDAP_F void ldap_memfree LDAP_P(( void *p ));
+
+LDAP_END_DECL
 
-#ifdef __cplusplus
-}
-#endif
 #endif /* _LDAP_H */
diff --git a/include/ldap_cdefs.h b/include/ldap_cdefs.h
new file mode 100644 (file)
index 0000000..9657928
--- /dev/null
@@ -0,0 +1,43 @@
+/* LDAP C Defines */
+
+#ifndef _LDAP_CDEFS_H
+#define _LDAP_CDEFS_H
+
+#if defined(__cplusplus)
+#      define LDAP_BEGIN_DECL  extern "C" {
+#      define LDAP_END_DECL    }
+#else
+#      define LDAP_BEGIN_DECL  /* empty */
+#      define LDAP_END_DECL    /* empty */
+#endif
+
+#if !defined(__NO_PROTOTYPES) && ( \
+       defined(__STDC__) || defined(__cplusplus) || \
+       defined(__NEED_PROTOTYPES) )
+
+       /* ANSI C or C++ */
+#      define LDAP_P(protos)   protos
+#      define LDAP_CONCAT1(x,y)        x ## y
+#      define LDAP_CONCAT(x,y) LDAP_CONCAT1(x,y)
+#      define LDAP_STRING(x)   #x /* stringify without expanding x */
+#      define LDAP_XSTRING(x)  LDAP_STRING(x) /* expand x, then stringify */
+
+#else /* no prototypes */
+
+       /* traditional C */
+#      define LDAP_P(protos)   ()
+#      define LDAP_CONCAT(x,y) x/**/y
+#      define LDAP_STRING(x)   "x"
+
+#endif /* no prototypes */
+
+
+#ifndef LDAP_F
+#      ifdef _WIN32
+#              define LDAP_F   __declspec( dllexport )
+#      else /* ! _WIN32 */
+#              define LDAP_F   extern
+#      endif /* _WIN32 */
+#endif /* LDAP_FDECL */
+
+#endif /* _LDAP_CDEFS_H */
index d1b34d8ecfdd6ebf6d15d12cc8a7a80fe8d884f4..52af54ccbf1a9d0eedaad999a52b78ee907ceeda 100644 (file)
@@ -3,23 +3,68 @@
 #ifndef _LTHREAD_H
 #define _LTHREAD_H
 
-#if defined( THREAD_SUNOS4_LWP )
-/***********************************
- *                                 *
- * thread definitions for sunos4   *
- *                                 *
- ***********************************/
+#include "portable.h"
 
-#define _THREAD
+#if defined( HAVE_PTHREADS )
+/**********************************
+ *                                *
+ * definitions for POSIX Threads  *
+ *                                *
+ **********************************/
 
-#include <lwp/lwp.h>
-#include <lwp/stackdep.h>
+#include <pthread.h>
+#ifdef HAVE_SCHED_H
+#include <sched.h>
+#endif
 
-typedef void   *(*VFP)();
+LDAP_BEGIN_DECL
 
-/* thread attributes and thread type */
+#if !defined( HAVE_PTHREAD_ATTR_INIT ) && \
+       defined( HAVE_PTHREAD_ATTR_CREATE )
+#define pthread_attr_init( a )         pthread_attr_create( a )
+#endif
+
+#if !defined( HAVE_PTHREAD_ATTR_DESTROY ) && \
+       defined( HAVE_PTHREAD_ATTR_DELETE )
+#define pthread_attr_destroy( a )      pthread_attr_delete( a )
+#endif
+
+#if !defined( HAVE_PTHREAD_ATTR_SETDETACHSTATE ) && \
+       defined( HAVE_PTHREAD_ATTR_SETDETACH_NP )
+#define pthread_attr_setdetachstate( a, b ) \
+                                       pthread_attr_setdetach_np( a, b )
+#endif
+
+#ifndef HAVE_PTHREAD_KILL
+/* missing pthread_kill(), define prototype */
+LDAP_F void pthread_kill LDAP_P(( pthread_t tid, int sig ));
+#endif
+
+#ifndef HAVE_PTHREADS_D4
+#define pthread_mutexattr_default      NULL
+#define pthread_condattr_default       NULL
+
+#ifdef HAVE_SCHED_YIELD
+#define pthread_yield sched_yield
+#endif
+#endif
+
+LDAP_END_DECL
+
+#elif defined ( HAVE_MACH_CTHREADS )
+/**********************************
+ *                                *
+ * definitions for Mach CThreads  *
+ *                                *
+ **********************************/
+
+#include <mach/cthreads.h>
+
+LDAP_BEGIN_DECL
+
+typedef cthread_fn_t   VFP;
 typedef int            pthread_attr_t;
-typedef thread_t       pthread_t;
+typedef cthread_t      pthread_t;
 
 /* default attr states */
 #define pthread_mutexattr_default      NULL
@@ -34,7 +79,7 @@ typedef thread_t      pthread_t;
 
 /* mutex attributes and mutex type */
 typedef int    pthread_mutexattr_t;
-typedef mon_t  pthread_mutex_t;
+typedef struct mutex pthread_mutex_t;
 
 /* mutex and condition variable scope - process or system */
 #define PTHREAD_SHARE_PRIVATE  0
@@ -42,33 +87,23 @@ typedef mon_t       pthread_mutex_t;
 
 /* condition variable attributes and condition variable type */
 typedef int    pthread_condattr_t;
-typedef struct lwpcv {
-       int             lcv_created;
-       cv_t            lcv_cv;
-} pthread_cond_t;
+typedef struct condition pthread_cond_t;
 
-#else /* end sunos4 */
+LDAP_END_DECL
 
-#if defined( THREAD_SUNOS5_LWP )
-/***********************************
- *                                 *
- * thread definitions for sunos5   *
- *                                 *
- ***********************************/
-
-#define _THREAD
+#elif defined( HAVE_THR )
+/**************************************
+ *                                    *
+ * thread definitions for Solaris LWP *
+ *                                    *
+ **************************************/
 
 #include <thread.h>
 #include <synch.h>
 
-typedef void   *(*VFP)();
-
-/* sunos5 threads are preemptive */
-#define PTHREAD_PREEMPTIVE     1
+LDAP_BEGIN_DECL
 
-/* thread attributes and thread type */
-typedef int            pthread_attr_t;
-typedef thread_t       pthread_t;
+typedef void   *(*VFP)();
 
 /* default attr states */
 #define pthread_mutexattr_default      NULL
@@ -80,59 +115,74 @@ typedef thread_t   pthread_t;
 /* thread scope - who is in scheduling pool */
 #define PTHREAD_SCOPE_PROCESS   0
 #define PTHREAD_SCOPE_SYSTEM    THR_BOUND
+/* mutex and condition variable scope - process or system */
+#define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
+#define PTHREAD_SHARE_PROCESS   USYNC_PROCESS
+
+
+#if !defined(__SunOS_5_6)
+/* thread attributes and thread type */
+typedef int            pthread_attr_t;
+typedef thread_t       pthread_t;
 
 /* mutex attributes and mutex type */
 typedef int    pthread_mutexattr_t;
 typedef mutex_t        pthread_mutex_t;
 
-/* mutex and condition variable scope - process or system */
-#define PTHREAD_SHARE_PRIVATE   USYNC_THREAD
-#define PTHREAD_SHARE_PROCESS   USYNC_PROCESS
-
 /* condition variable attributes and condition variable type */
 typedef int     pthread_condattr_t;
 typedef cond_t pthread_cond_t;
+#endif /* ! sunos56 */
 
-#else /* end sunos5 */
+LDAP_END_DECL
 
-#if defined( THREAD_MIT_PTHREADS )
-/***********************************
- *                                 *
- * definitions for mit pthreads    *
- *                                 *
- ***********************************/
+#elif defined( HAVE_LWP )
+/*************************************
+ *                                   *
+ * thread definitions for SunOS LWP  *
+ *                                   *
+ *************************************/
 
-#define _THREAD
+#include <lwp/lwp.h>
+#include <lwp/stackdep.h>
 
-#include <pthread.h>
+LDAP_BEGIN_DECL
 
-#else /* end mit pthreads */
+typedef void   *(*VFP)();
 
-#if defined( THREAD_DCE_PTHREADS )
-/***********************************
- *                                 *
- * definitions for mit pthreads    *
- *                                 *
- ***********************************/
+/* thread attributes and thread type */
+typedef int            pthread_attr_t;
+typedef thread_t       pthread_t;
 
-#define _THREAD
+/* default attr states */
+#define pthread_mutexattr_default      NULL
+#define pthread_condattr_default       NULL
 
-#include <pthread.h>
+/* 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
 
-/* dce threads are preemptive */
-#define PTHREAD_PREEMPTIVE     1
+/* mutex attributes and mutex type */
+typedef int    pthread_mutexattr_t;
+typedef mon_t  pthread_mutex_t;
 
-#define pthread_attr_init( a )         pthread_attr_create( a )
-#define pthread_attr_destroy( a )      pthread_attr_delete( a )
-#define pthread_attr_setdetachstate( a, b ) \
-                                       pthread_attr_setdetach_np( a, b )
+/* 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 lwpcv {
+       int             lcv_created;
+       cv_t            lcv_cv;
+} pthread_cond_t;
 
-#endif /* dce pthreads */
-#endif /* mit pthreads */
-#endif /* sunos5 */
-#endif /* sunos4 */
+LDAP_END_DECL
 
-#ifndef _THREAD
+#else
 
 /***********************************
  *                                 *
@@ -141,6 +191,17 @@ typedef cond_t     pthread_cond_t;
  *                                 *
  ***********************************/
 
+LDAP_BEGIN_DECL
+
+#ifndef NO_THREADS
+#define NO_THREADS 1
+#endif
+
+#ifndef PREEMPTIVE_THREADS
+/* treat no threads as preemptive */
+#define PREEMPTIVE_THREADS 1
+#endif
+
 typedef void   *(*VFP)();
 
 /* thread attributes and thread type */
@@ -170,5 +231,7 @@ typedef int pthread_mutex_t;
 typedef int     pthread_condattr_t;
 typedef int    pthread_cond_t;
 
+LDAP_END_DECL
+
 #endif /* no threads support */
 #endif /* _LTHREAD_H */
index 6f14d55980ab6d2287f97c3ac328b45ea1217a6a..82023d631a1f205a2818c2974a551a06aaf6d9dd 100644 (file)
@@ -13,6 +13,7 @@ LDAP_BEGIN_DECL
 LDAP_F int b64_ntop LDAP_P((u_char const *, size_t, char *, size_t));
 LDAP_F int b64_pton LDAP_P((char const *, u_char *, size_t));
 LDAP_F void lutil_detach LDAP_P((int debug, int do_close));
+LDAP_F int lutil_passwd LDAP_P((const char *cred, const char *passwd));
 
 LDAP_END_DECL
 
index 8f954665e6829d929a9152dee95748c943bb5c5e..767fdeb7f51e6f22b61591b3296751ee9a991587 100644 (file)
@@ -109,9 +109,12 @@ is provided ``as is'' without express or implied warranty.
 /* define this if needed to get reentrant functions */
 #undef _REENTRANT
 
-/* define this if needed to get threadsafe functions */
+/* define this if needed to get thread safe functions */
 #undef _THREAD_SAFE
 
+/* define this if needed to get thread safe functions */
+#undef _THREADSAFE
+
 /* define this if toupper() requires tolower() check */
 #undef C_UPPER_LOWER
 
@@ -127,12 +130,15 @@ is provided ``as is'' without express or implied warranty.
 /* define if you have crypt */
 #undef HAVE_CRYPT
 
-/* define if you have DCE */
-#undef HAVE_DCE
+/* define if you have DSAP */
+#undef HAVE_DSAP
 
 /* define if you have GDBM */
 #undef HAVE_GDBM
 
+/* define if you have ISODE */
+#undef HAVE_ISODE
+
 /* define if you have Kerberos */
 #undef HAVE_KERBEROS
 
@@ -148,6 +154,12 @@ is provided ``as is'' without express or implied warranty.
 /* define if you have NDBM */
 #undef HAVE_NDBM
 
+/* define if you have Mach CThreads */
+#undef HAVE_MACH_CTHREADS
+
+/* define if you have PP */
+#undef HAVE_PP
+
 /* define if you have a preemptive POSIX Threads implementation */
 #undef HAVE_PREEMPTIVE_PTHREADS
 
@@ -178,6 +190,9 @@ is provided ``as is'' without express or implied warranty.
 /* define if you have Sun LWP (Solaris style) */
 #undef HAVE_THR
 
+/* define if you have XTPP */
+#undef HAVE_XTPP
+
 /* define this for connectionless LDAP support */
 #undef LDAP_CONNECTIONLESS
 
@@ -256,6 +271,9 @@ is provided ``as is'' without express or implied warranty.
 /* Define if you have the getopt function.  */
 #undef HAVE_GETOPT
 
+/* Define if you have the getpwuid function.  */
+#undef HAVE_GETPWUID
+
 /* Define if you have the gettimeofday function.  */
 #undef HAVE_GETTIMEOFDAY
 
@@ -274,6 +292,24 @@ is provided ``as is'' without express or implied warranty.
 /* Define if you have the mktime function.  */
 #undef HAVE_MKTIME
 
+/* Define if you have the pthread_attr_create function.  */
+#undef HAVE_PTHREAD_ATTR_CREATE
+
+/* Define if you have the pthread_attr_delete function.  */
+#undef HAVE_PTHREAD_ATTR_DELETE
+
+/* Define if you have the pthread_attr_destroy function.  */
+#undef HAVE_PTHREAD_ATTR_DESTROY
+
+/* Define if you have the pthread_attr_init function.  */
+#undef HAVE_PTHREAD_ATTR_INIT
+
+/* Define if you have the pthread_attr_setdetach_np function.  */
+#undef HAVE_PTHREAD_ATTR_SETDETACH_NP
+
+/* Define if you have the pthread_attr_setdetachstate function.  */
+#undef HAVE_PTHREAD_ATTR_SETDETACHSTATE
+
 /* Define if you have the pthread_kill function.  */
 #undef HAVE_PTHREAD_KILL
 
@@ -283,6 +319,9 @@ is provided ``as is'' without express or implied warranty.
 /* Define if you have the pthread_yield function.  */
 #undef HAVE_PTHREAD_YIELD
 
+/* Define if you have the res_search function.  */
+#undef HAVE_RES_SEARCH
+
 /* Define if you have the sched_yield function.  */
 #undef HAVE_SCHED_YIELD
 
@@ -409,6 +448,9 @@ is provided ``as is'' without express or implied warranty.
 /* Define if you have the <pthread.h> header file.  */
 #undef HAVE_PTHREAD_H
 
+/* Define if you have the <pwd.h> header file.  */
+#undef HAVE_PWD_H
+
 /* Define if you have the <regex.h> header file.  */
 #undef HAVE_REGEX_H
 
@@ -448,6 +490,9 @@ is provided ``as is'' without express or implied warranty.
 /* Define if you have the <sys/param.h> header file.  */
 #undef HAVE_SYS_PARAM_H
 
+/* Define if you have the <sys/resource.h> header file.  */
+#undef HAVE_SYS_RESOURCE_H
+
 /* Define if you have the <sys/socket.h> header file.  */
 #undef HAVE_SYS_SOCKET_H
 
@@ -493,6 +538,9 @@ is provided ``as is'' without express or implied warranty.
 /* Define if you have the nsl_s library (-lnsl_s).  */
 #undef HAVE_LIBNSL_S
 
+/* Define if you have the resolv library (-lresolv).  */
+#undef HAVE_LIBRESOLV
+
 /* Define if you have the socket library (-lsocket).  */
 #undef HAVE_LIBSOCKET
 /* portable.h.bot begin */
index 9d78330308638444bd572e3b4480b62e19c2cfc3..ba45d908cd367b3a1742eaa8c6a55429b46c708a 100644 (file)
@@ -1,5 +1,5 @@
 /* include/portable.h.nt -- manually updated of MS NT (MS VC5) */
-/* synced with portable.h.in 1.8 */
+/* synced with portable.h.in 1.11 */
 /*
 Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
 All rights reserved.
@@ -32,6 +32,9 @@ is provided ``as is'' without express or implied warranty.
 #ifndef _LDAP_PORTABLE_H
 #define _LDAP_PORTABLE_H
 
+/* MSVC5 doesn't define _STDC_, but requires prototypes */
+#define __NEED_PROTOTYPES 1
+
 /* we installed Henry Spencer's REGEX */
 #define HAVE_REGEX_H 1
 
@@ -86,18 +89,9 @@ typedef char * caddr_t;
 /* Define if you have <sys/wait.h> that is POSIX.1 compatible.  */
 /* #undef HAVE_SYS_WAIT_H */
 
-/* Define if you have the tempnam function.  */
-/* #undef HAVE_TEMPNAM */
-
-/* Define if you have the thr_setconcurrency function.  */
-/* #undef HAVE_THR_SETCONCURRENCY */
-
 /* Define if you have the vprintf function.  */
 #define HAVE_VPRINTF 1
 
-/* Define if you have the vsnprintf function.  */
-/* #undef HAVE_VSNPRINTF */
-
 /* Define if you have the wait3 system call.  */
 /* #undef HAVE_WAIT3 */
 
@@ -135,15 +129,15 @@ typedef char * caddr_t;
 /* Define if your <sys/time.h> declares struct tm.  */
 /* #undef TM_IN_SYS_TIME */
 
+/* Define to `int' if <sys/types.h> doesn't define.  */
+#define uid_t long
+
 /* define this if needed to get reentrant functions */
 #undef _REENTRANT
 
 /* define this if needed to get threadsafe functions */
 #undef _THREAD_SAFE
 
-/* Define to `int' if <sys/types.h> doesn't define.  */
-#define uid_t long
-
 /* define this if toupper() requires tolower() */
 #define C_UPPER_LOWER
 
@@ -162,9 +156,15 @@ typedef char * caddr_t;
 /* define if you have DCE */
 /* #undef HAVE_DCE */
 
+/* define if you have DSAP */
+/* #undef HAVE_DSAP */
+
 /* define if you have GDBM */
 /* #undef HAVE_GDBM */
 
+/* define if you have ISODE */
+/* #undef HAVE_ISODE */
+
 /* define if you have Kerberos */
 /* #undef HAVE_KERBEROS */
 
@@ -183,12 +183,18 @@ typedef char * caddr_t;
 /* define if you have Mach CThreads */
 /* #undef HAVE_MACH_CTHREADS */
 
+/* define if you have PP */
+/* #undef HAVE_PP */
+
 /* define if you have a preemptive POSIX Threads implementation */
 /* #undef HAVE_PREEMPTIVE_PTHREADS */
 
 /* define if you have POSIX Threads */
 /* #undef HAVE_PTHREADS */
 
+/* define if your POSIX Threads implementatin is circa Final Draft */
+/* #undef HAVE_PTHREADS_FINAL */
+
 /* define if your POSIX Threads implementatin is circa Draft 4 */
 /* #undef HAVE_PTHREADS_D4 */
 
@@ -210,6 +216,9 @@ typedef char * caddr_t;
 /* define if you have Solaris LWP Threads */
 /* #undef HAVE_THR */
 
+/* define if you have XTPP */
+/* #undef HAVE_XTPP */
+
 /* define this for connectionless LDAP support */
 /* #undef LDAP_CONNECTIONLESS */
 
@@ -315,6 +324,9 @@ typedef char * caddr_t;
 /* Define if you have the pthread_yield function.  */
 /* #undef HAVE_PTHREAD_YIELD */
 
+/* Define if you have the res_search function.  */
+/* #undef HAVE_RES_SEARCH */
+
 /* Define if you have the sched_yield function.  */
 /* #undef HAVE_SCHED_YIELD */
 
@@ -366,6 +378,15 @@ typedef char * caddr_t;
 /* Define if you have the sysconf function.  */
 /* #undef HAVE_SYSCONF */
 
+/* Define if you have the tempnam function.  */
+/* #undef HAVE_TEMPNAM */
+
+/* Define if you have the thr_setconcurrency function.  */
+/* #undef HAVE_THR_SETCONCURRENCY */
+
+/* Define if you have the vsnprintf function.  */
+/* #undef HAVE_VSNPRINTF */
+
 /* Define if you have the waitpid function.  */
 #define HAVE_WAITPID 1
 
@@ -516,6 +537,9 @@ typedef char * caddr_t;
 /* Define if you have the nsl_s library (-lnsl_s).  */
 /* #undef HAVE_LIBNSL_S */
 
+/* Define if you have the resolv library (-lresolv).  */
+/* #undef HAVE_LIBRESOLV */
+
 /* Define if you have the socket library (-lsocket).  */
 /* #undef HAVE_LIBSOCKET */
 
index cd63b9f89a1b95bcd340f03ecfd8554e8bf3d94a..57763213214d91f5e7d7532358ee7a2572e29bd6 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#ifdef MACOS
 #include <stdlib.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
+#ifdef HAVE_CONSOLE_H
 #include <console.h>
-#else /* MACOS */
-#include <sys/types.h>
-#include <sys/socket.h>
 #endif /* MACOS */
-#include "lber.h"
 
-static usage( char *name )
+#include "lber-int.h"
+
+static void usage( char *name )
 {
        fprintf( stderr, "usage: %s fmt\n", name );
 }
 
+int
 main( int argc, char **argv )
 {
-       long            i, i2, num;
+       long            i;
        unsigned long   len;
        int             tag;
-       char            *str, *s1, *s2;
        BerElement      ber;
        Sockbuf         sb;
        extern char     *optarg;
 
-#ifdef MACOS
+#ifdef HAVE_CONSOLE_H
        ccommand( &argv );
        cshow( stdout );
 #endif /* MACOS */
 
-       bzero( &sb, sizeof(sb) );
+       memset( &sb, 0, sizeof(sb) );
        sb.sb_sd = 0;
        sb.sb_ber.ber_buf = NULL;
+
        if ( (tag = ber_get_next( &sb, &len, &ber )) == -1 ) {
                perror( "ber_get_next" );
                exit( 1 );
index e0457f90f6e3adff569dd029562fe17135890f7e..8d1d0bcac1663890b20246399b2ad51d9d813257 100644 (file)
@@ -35,8 +35,8 @@ CPP=cl.exe
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "Release\liblber"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
 # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
@@ -45,7 +45,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Release\olber32.lib"
 
 !ELSEIF  "$(CFG)" == "liblber - Win32 Debug"
 
@@ -66,7 +66,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Debug\olber32.lib"
 
 !ENDIF 
 
@@ -92,6 +92,10 @@ SOURCE=.\io.c
 # End Source File
 # Begin Source File
 
+SOURCE=".\lber-int.h"
+# End Source File
+# Begin Source File
+
 SOURCE=..\..\include\lber.h
 # End Source File
 # End Target
index e34b53f78c641e7e14246952a48102a98c6dae8a..8e05bf26530dca2c123ab6792e7296ec0752a6ce 100644 (file)
@@ -111,7 +111,10 @@ cldap_open( char *host, int port )
                }
            }
 
-           if ( (address = inet_addr( host )) == (unsigned long) -1L ) {
+           address = inet_addr( host );
+           /* This was just a test for -1 until OSF1 let inet_addr return
+              unsigned int, which is narrower than 'unsigned long address' */
+           if ( address == 0xffffffff || address == (unsigned long) -1 ) {
                if ( (hp = gethostbyname( host )) == NULL ) {
                    errno = EHOSTUNREACH;
                    continue;
index be418309e982a74b6d594fa808fd69e5ac825a4d..1e7d47479b0f025a1ffee48111582840f7e7fd73 100644 (file)
  * 7 March 1994 by Mark C Smith
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <ctype.h>
-#include <string.h>
 #include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
+#endif
 
 #include "lber.h"
 #include "ldap.h"
 #include "disptmpl.h"
 
-#ifndef NEEDPROTOS
-static void free_disptmpl();
-static int read_next_tmpl();
-int next_line_tokens();
-void free_strarray();
-#else /* !NEEDPROTOS */
-static void free_disptmpl( struct ldap_disptmpl *tmpl );
-static int read_next_tmpl( char **bufp, long *blenp,
-       struct ldap_disptmpl **tmplp, int dtversion );
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-#endif /* !NEEDPROTOS */
+static void free_disptmpl LDAP_P(( struct ldap_disptmpl *tmpl ));
+static int read_next_tmpl LDAP_P(( char **bufp, long *blenp,
+       struct ldap_disptmpl **tmplp, int dtversion ));
 
 static char            *tmploptions[] = {
     "addable", "modrdn",
@@ -152,7 +138,7 @@ int
 ldap_init_templates_buf( char *buf, long buflen,
        struct ldap_disptmpl **tmpllistp )
 {
-    int                                rc, version;
+    int                                rc=-1, version;
     char                       **toks;
     struct ldap_disptmpl       *prevtmpl, *tmpl;
 
@@ -457,9 +443,9 @@ read_next_tmpl( char **bufp, long *blenp, struct ldap_disptmpl **tmplp,
     int                                i, j, tokcnt, samerow, adsource;
     char                       **toks, *itemopts;
     struct ldap_disptmpl       *tmpl;
-    struct ldap_oclist         *ocp, *prevocp;
-    struct ldap_adddeflist     *adp, *prevadp;
-    struct ldap_tmplitem       *rowp, *ip, *previp;
+    struct ldap_oclist         *ocp, *prevocp = NULL;
+    struct ldap_adddeflist     *adp, *prevadp = NULL;
+    struct ldap_tmplitem       *rowp = NULL, *ip, *previp = NULL;
 
     *tmplp = NULL;
 
index 1771d7283e73f6a17d186f8f1012807d679e1c92..8c83232a8c5a61aa8763fddb579caaeeb8ca54b0 100644 (file)
  * 7 March 1994 by Mark C Smith
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
-#include <stdlib.h>
-#endif /* DOS */
-#endif /* MACOS */
+#endif
 
 #include "lber.h"
 #include "ldap.h"
 
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static int next_line();
-static char *next_token();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-static int next_line( char **bufp, long *blenp, char **linep );
-static char *next_token( char ** sp );
-#endif /* !NEEDPROTOS */
+#include "ldap-int.h"
 
+static int next_line LDAP_P(( char **bufp, long *blenp, char **linep ));
+static char *next_token LDAP_P(( char ** sp ));
 
 
 int
index 9f9cd136787003e0759468f32ab39fb410d1629c..4a9a9a4ebd330ffe65eff83641e513a684429ae5 100644 (file)
@@ -80,10 +80,10 @@ ldap_err2string( int err )
        return( "Unknown error" );
 }
 
-#ifdef LDAP_LIBUI
 void
 ldap_perror( LDAP *ld, char *s )
 {
+#ifdef LDAP_LIBUI
        int     i;
 
        Debug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );
@@ -110,17 +110,8 @@ ldap_perror( LDAP *ld, char *s )
 
        fprintf( stderr, "%s: Not an LDAP errno %d\n", s, ld->ld_errno );
        fflush( stderr );
-}
-
-#else
-
-void
-ldap_perror( LDAP *ld, char *s )
-{
-}
-
 #endif /* !LDAP_LIBUI */
-
+}
 
 int
 ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
index e9ebc6aa294457ceed11058ff4df09140a697704..a0dcba3bf5f3cf04f6eae20df2fd100636333a22 100644 (file)
@@ -5,52 +5,30 @@
  *  getfilter.c -- optional add-on to libldap
  */
 
+#include "portable.h"
+
 #ifndef lint 
 static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
 #endif
 
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#if defined(NeXT)
-#include <regex.h>
-#endif
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/errno.h>
+#include <ac/regex.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
-#include <stdlib.h>
-#include <sys/errno.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
+#endif
 
 #include "lber.h"
 #include "ldap.h"
-#include "regex.h"
-
-#ifdef NEEDPROTOS
-static int break_into_words( char *str, char *delims, char ***wordsp );
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-#else /* NEEDPROTOS */
-static int break_into_words();
-int next_line_tokens();
-void free_strarray();
-#endif /* NEEDPROTOS */
-
-#if !defined( MACOS ) && !defined( DOS )
-extern int     errno;
-extern char    *re_comp();
-#endif
+
+static int break_into_words LDAP_P(( char *str, char *delims, char ***wordsp ));
 
 #define FILT_MAX_LINE_LEN      1024
 
@@ -107,8 +85,10 @@ ldap_init_getfilter_buf( char *buf, long buflen )
     LDAPFiltDesc       *lfdp;
     LDAPFiltList       *flp, *nextflp;
     LDAPFiltInfo       *fip, *nextfip;
-    char               *tag, **tok;
-    int                        tokcnt, i;
+    char                       *tag, **tok;
+    int                                tokcnt, i;
+       int                             rc;
+       regex_t                 re;
 
     if (( lfdp = (LDAPFiltDesc *)calloc( 1, sizeof( LDAPFiltDesc))) == NULL ) {
        return( NULL );
@@ -138,18 +118,19 @@ ldap_init_getfilter_buf( char *buf, long buflen )
            }
            nextflp->lfl_tag = strdup( tag );
            nextflp->lfl_pattern = tok[ 0 ];
-           if ( re_comp( nextflp->lfl_pattern ) != NULL ) {
-#ifndef NO_USERINTERFACE
+           if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
+#ifdef LDAP_LIBUI
+               char error[512];
+               regerror(rc, &re, error, sizeof(error));
                ldap_getfilter_free( lfdp );
-               fprintf( stderr, "bad regular expresssion %s\n",
-                       nextflp->lfl_pattern );
-#if !defined( MACOS ) && !defined( DOS )
+               fprintf( stderr, "bad regular expresssion %s, %s\n",
+                       nextflp->lfl_pattern, error );
                errno = EINVAL;
-#endif
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
                free_strarray( tok );
                return( NULL );
            }
+               regfree(&re);
                
            nextflp->lfl_delims = tok[ 1 ];
            nextflp->lfl_ilist = NULL;
@@ -194,9 +175,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
                    } else {
                        free_strarray( tok );
                        ldap_getfilter_free( lfdp );
-#if !defined( MACOS ) && !defined( DOS )
                        errno = EINVAL;
-#endif
                        return( NULL );
                    }
                    free( tok[ 2 ] );
@@ -213,9 +192,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
        default:
            free_strarray( tok );
            ldap_getfilter_free( lfdp );
-#if !defined( MACOS ) && !defined( DOS )
            errno = EINVAL;
-#endif
            return( NULL );
        }
     }
@@ -247,6 +224,8 @@ LDAPFiltInfo *
 ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
 {
     LDAPFiltList       *flp;
+       int                             rc;
+       regex_t                 re;
 
     if ( lfdp->lfd_curvalcopy != NULL ) {
        free( lfdp->lfd_curvalcopy );
@@ -256,13 +235,30 @@ ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
     lfdp->lfd_curval = value;
     lfdp->lfd_curfip = NULL;
 
-    for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
-       if ( re_comp( tagpat ) == NULL && re_exec( flp->lfl_tag ) == 1
-               && re_comp( flp->lfl_pattern ) == NULL
-               && re_exec( lfdp->lfd_curval ) == 1 ) {
-           lfdp->lfd_curfip = flp->lfl_ilist;
-           break;
-       }
+       for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
+               /* compile tagpat, continue if we fail */
+               if (regcomp(&re, tagpat, 0) != 0)
+                       continue;
+
+               /* match tagpatern and tag, continue if we fail */
+               rc = regexec(&re, flp->lfl_tag, 0, NULL, 0);
+               regfree(&re);
+               if (rc != 0)
+                       continue;
+
+               /* compile flp->ifl_pattern, continue if we fail */
+               if (regcomp(&re, flp->lfl_pattern, 0) != 0)
+                       continue;
+
+               /* match ifl_pattern and lfd_curval, continue if we fail */
+               rc = regexec(&re, lfdp->lfd_curval, 0, NULL, 0);
+               regfree(&re);
+               if (rc != 0)
+                       continue;
+
+               /* we successfully compiled both patterns and matched both values */
+               lfdp->lfd_curfip = flp->lfl_ilist;
+               break;
     }
 
     if ( lfdp->lfd_curfip == NULL ) {
@@ -388,14 +384,16 @@ ldap_build_filter( char *filtbuf, unsigned long buflen, char *pattern,
                *f++ = *p;
            }
                
-           if ( f - filtbuf > buflen ) {
+           if ( (unsigned long) (f - filtbuf) > buflen ) {
                /* sanity check */
                --f;
                break;
            }
        }
 
-       if ( suffix != NULL && ( f - filtbuf ) < buflen ) {
+       if ( suffix != NULL && (
+               (unsigned long) ( f - filtbuf ) < buflen ) )
+       {
            strcpy( f, suffix );
        } else {
            *f = '\0';
index ce4a8a7f6d54bef4eba2f1bae0a96f164d7f7aaa..8bf63e912d77192780e8b72421cd6688daa91bb8 100644 (file)
@@ -5,30 +5,21 @@
  *  kbind.c
  */
 
+#include "portable.h"
+
 #ifndef lint 
 static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
 #endif
 
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
 
 #include <stdio.h>
-#include <string.h>
-
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include "msdos.h"
-#endif /* DOS */
-#include <krb.h>
-#include <stdlib.h>
-#if !defined(DOS) && !defined( _WIN32 )
-#include <sys/types.h>
-#endif /* !DOS && !_WIN32 */
-#include <sys/time.h>
-#include <sys/socket.h>
-#endif /* MACOS */
+
+#include <ac/krb.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
 
 #include "lber.h"
 #include "ldap.h"
@@ -52,7 +43,6 @@ ldap_kerberos_bind1( LDAP *ld, char *dn )
        BerElement      *ber;
        char            *cred;
        int             rc, credlen;
-       char            *get_kerberosv4_credentials();
 #ifdef STR_TRANSLATION
        int             str_translation_on;
 #endif /* STR_TRANSLATION */
@@ -75,13 +65,13 @@ ldap_kerberos_bind1( LDAP *ld, char *dn )
        if ( dn == NULL )
                dn = "";
 
-       if ( (cred = get_kerberosv4_credentials( ld, dn, "ldapserver",
+       if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "ldapserver",
            &credlen )) == NULL ) {
                return( -1 );   /* ld_errno should already be set */
        }
 
        /* create a message to send */
-       if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+       if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
                free( cred );
                return( -1 );
        }
@@ -112,14 +102,14 @@ ldap_kerberos_bind1( LDAP *ld, char *dn )
 
        free( cred );
 
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
        if ( ld->ld_cache != NULL ) {
                ldap_flush_cache( ld );
        }
-#endif /* !NO_CACHE */
+#endif /* !LDAP_NOCACHE */
 
        /* send the message */
-       return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+       return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
 }
 
 int
@@ -159,7 +149,6 @@ ldap_kerberos_bind2( LDAP *ld, char *dn )
        BerElement      *ber;
        char            *cred;
        int             rc, credlen;
-       char            *get_kerberosv4_credentials();
 #ifdef STR_TRANSLATION
        int             str_translation_on;
 #endif /* STR_TRANSLATION */
@@ -169,13 +158,13 @@ ldap_kerberos_bind2( LDAP *ld, char *dn )
        if ( dn == NULL )
                dn = "";
 
-       if ( (cred = get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
+       if ( (cred = ldap_get_kerberosv4_credentials( ld, dn, "x500dsa", &credlen ))
            == NULL ) {
                return( -1 );   /* ld_errno should already be set */
        }
 
        /* create a message to send */
-       if ( (ber = alloc_ber_with_options( ld )) == NULLBER ) {
+       if ( (ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
                free( cred );
                return( -1 );
        }
@@ -207,7 +196,7 @@ ldap_kerberos_bind2( LDAP *ld, char *dn )
        }
 
        /* send the message */
-       return ( send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
+       return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
 }
 
 /* synchronous bind to DSA using kerberos */
@@ -249,25 +238,25 @@ ldap_kerberos_bind_s( LDAP *ld, char *dn )
 
 #ifndef AUTHMAN
 /*
- * get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
+ * ldap_get_kerberosv4_credentials - obtain kerberos v4 credentials for ldap.
  * The dn of the entry to which to bind is supplied.  It's assumed the
  * user already has a tgt.
  */
 
 char *
-get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
+ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
 {
        KTEXT_ST        ktxt;
        int             err;
        char            realm[REALM_SZ], *cred, *krbinstance;
 
-       Debug( LDAP_DEBUG_TRACE, "get_kerberosv4_credentials\n", 0, 0, 0 );
+       Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
 
        if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
                fprintf( stderr, "krb_get_tf_realm failed (%s)\n",
                    krb_err_txt[err] );
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
                ld->ld_errno = LDAP_INVALID_CREDENTIALS;
                return( NULL );
        }
@@ -280,9 +269,9 @@ get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
 
        if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
            != KSUCCESS ) {
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
                fprintf( stderr, "krb_mk_req failed (%s)\n", krb_err_txt[err] );
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
                ld->ld_errno = LDAP_INVALID_CREDENTIALS;
                return( NULL );
        }
@@ -299,4 +288,4 @@ get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
 }
 
 #endif /* !AUTHMAN */
-#endif /* KERBEROS */
+#endif /* HAVE_KERBEROS */
index 10adbe91ff7fdd143e69252e46e479f2790dee39..2de43b7358f57871780fd8f19afdd8df450c65c2 100644 (file)
@@ -5,6 +5,8 @@
  *  ldap-int.h - defines & prototypes internal to the LDAP library
  */
 
+#ifndef _LDAP_INT_H 
+#define _LDAP_INT_H 
 
 #define LDAP_URL_PREFIX         "ldap://"
 #define LDAP_URL_PREFIX_LEN     7
 #endif /* LDAP_DNS */
 #endif /* LDAP_REFERRALS */
 
-
+LDAP_BEGIN_DECL
 /*
  * in cache.c
  */
-#ifdef NEEDPROTOS
-void add_request_to_cache( LDAP *ld, unsigned long msgtype,
-        BerElement *request );
-void add_result_to_cache( LDAP *ld, LDAPMessage *result );
-int check_cache( LDAP *ld, unsigned long msgtype, BerElement *request );
-#else /* NEEDPROTOS */
-void add_request_to_cache();
-void add_result_to_cache();
-int check_cache();
-#endif /* NEEDPROTOS */
-
-
-#ifdef KERBEROS
+void ldap_add_request_to_cache LDAP_P(( LDAP *ld, unsigned long msgtype,
+        BerElement *request ));
+void ldap_add_result_to_cache LDAP_P(( LDAP *ld, LDAPMessage *result ));
+int ldap_check_cache LDAP_P(( LDAP *ld, unsigned long msgtype, BerElement *request ));
+
+/*
+ * in dparse.c
+ */
+int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
+void free_strarray LDAP_P(( char **sap ));
+
+#ifdef HAVE_KERBEROS
 /*
  * in kerberos.c
  */
-#ifdef NEEDPROTOS
-char *get_kerberosv4_credentials( LDAP *ld, char *who, char *service,
-        int *len );
-#else /* NEEDPROTOS */
-char *get_kerberosv4_credentials();
-#endif /* NEEDPROTOS */
+char *ldap_get_kerberosv4_credentials LDAP_P(( LDAP *ld, char *who, char *service,
+        int *len ));
 
-#endif /* KERBEROS */
+#endif /* HAVE_KERBEROS */
 
 
 /*
  * in open.c
  */
-#ifdef NEEDPROTOS
 int open_ldap_connection( LDAP *ld, Sockbuf *sb, char *host, int defport,
        char **krbinstancep, int async );
-#else /* NEEDPROTOS */
-int open_ldap_connection();
-#endif /* NEEDPROTOS */
 
 
 /*
  * in os-ip.c
  */
-#ifdef NEEDPROTOS
-int connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
+int ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address, int port,
        int async );
-void close_connection( Sockbuf *sb );
-#else /* NEEDPROTOS */
-int connect_to_host();
-void close_connection();
-#endif /* NEEDPROTOS */
-
-#ifdef KERBEROS
-#ifdef NEEDPROTOS
-char *host_connected_to( Sockbuf *sb );
-#else /* NEEDPROTOS */
-char *host_connected_to();
-#endif /* NEEDPROTOS */
-#endif /* KERBEROS */
+void ldap_close_connection( Sockbuf *sb );
+
+#ifdef HAVE_KERBEROS
+char *ldap_host_connected_to( Sockbuf *sb );
+#endif /* HAVE_KERBEROS */
 
 #ifdef LDAP_REFERRALS
-#ifdef NEEDPROTOS
 int do_ldap_select( LDAP *ld, struct timeval *timeout );
-void *new_select_info( void );
-void free_select_info( void *sip );
-void mark_select_write( LDAP *ld, Sockbuf *sb );
-void mark_select_read( LDAP *ld, Sockbuf *sb );
-void mark_select_clear( LDAP *ld, Sockbuf *sb );
-int is_read_ready( LDAP *ld, Sockbuf *sb );
-int is_write_ready( LDAP *ld, Sockbuf *sb );
-#else /* NEEDPROTOS */
-int do_ldap_select();
-void *new_select_info();
-void free_select_info();
-void mark_select_write();
-void mark_select_read();
-void mark_select_clear();
-int is_read_ready();
-int is_write_ready();
-#endif /* NEEDPROTOS */
+void *ldap_new_select_info( void );
+void ldap_free_select_info( void *sip );
+void ldap_mark_select_write( LDAP *ld, Sockbuf *sb );
+void ldap_mark_select_read( LDAP *ld, Sockbuf *sb );
+void ldap_mark_select_clear( LDAP *ld, Sockbuf *sb );
+int ldap_is_read_ready( LDAP *ld, Sockbuf *sb );
+int ldap_is_write_ready( LDAP *ld, Sockbuf *sb );
 #endif /* LDAP_REFERRALS */
 
 
 /*
  * in request.c
  */
-#ifdef NEEDPROTOS
-int send_initial_request( LDAP *ld, unsigned long msgtype,
+int ldap_send_initial_request( LDAP *ld, unsigned long msgtype,
        char *dn, BerElement *ber );
-BerElement *alloc_ber_with_options( LDAP *ld );
-void set_ber_options( LDAP *ld, BerElement *ber );
-#else /* NEEDPROTOS */
-int send_initial_request();
-BerElement *alloc_ber_with_options();
-void set_ber_options();
-#endif /* NEEDPROTOS */
+BerElement *ldap_alloc_ber_with_options( LDAP *ld );
+void ldap_set_ber_options( LDAP *ld, BerElement *ber );
 
 #if defined( LDAP_REFERRALS ) || defined( LDAP_DNS )
-#ifdef NEEDPROTOS
-int send_server_request( LDAP *ld, BerElement *ber, int msgid,
+int ldap_send_server_request( LDAP *ld, BerElement *ber, int msgid,
        LDAPRequest *parentreq, LDAPServer *srvlist, LDAPConn *lc,
        int bind );
-LDAPConn *new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
+LDAPConn *ldap_new_connection( LDAP *ld, LDAPServer **srvlistp, int use_ldsb,
        int connect, int bind );
-LDAPRequest *find_request_by_msgid( LDAP *ld, int msgid );
-void free_request( LDAP *ld, LDAPRequest *lr );
-void free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
-void dump_connection( LDAP *ld, LDAPConn *lconns, int all );
-void dump_requests_and_responses( LDAP *ld );
-#else /* NEEDPROTOS */
-int send_server_request();
-LDAPConn *new_connection();
-LDAPRequest *find_request_by_msgid();
-void free_request();
-void free_connection();
-void dump_connection();
-void dump_requests_and_responses();
-#endif /* NEEDPROTOS */
+LDAPRequest *ldap_find_request_by_msgid( LDAP *ld, int msgid );
+void ldap_free_request( LDAP *ld, LDAPRequest *lr );
+void ldap_free_connection( LDAP *ld, LDAPConn *lc, int force, int unbind );
+void ldap_dump_connection( LDAP *ld, LDAPConn *lconns, int all );
+void ldap_dump_requests_and_responses( LDAP *ld );
 #endif /* LDAP_REFERRALS || LDAP_DNS */
 
 #ifdef LDAP_REFERRALS
-#ifdef NEEDPROTOS
-int chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
-int append_referral( LDAP *ld, char **referralsp, char *s );
-#else /* NEEDPROTOS */
-int chase_referrals();
-int append_referral();
-#endif /* NEEDPROTOS */
+int ldap_chase_referrals( LDAP *ld, LDAPRequest *lr, char **errstrp, int *hadrefp );
+int ldap_append_referral( LDAP *ld, char **referralsp, char *s );
 #endif /* LDAP_REFERRALS */
 
 
 /*
  * in search.c
  */
-#ifdef NEEDPROTOS
 BerElement *ldap_build_search_req( LDAP *ld, char *base, int scope,
        char *filter, char **attrs, int attrsonly );
-#else /* NEEDPROTOS */
-BerElement *ldap_build_search_req();
-#endif /* NEEDPROTOS */
 
 
 /*
  * in unbind.c
  */
-#ifdef NEEDPROTOS
 int ldap_ld_free( LDAP *ld, int close );
-int send_unbind( LDAP *ld, Sockbuf *sb );
-#else /* NEEDPROTOS */
-int ldap_ld_free();
-int send_unbind();
-#endif /* NEEDPROTOS */
-
+int ldap_send_unbind( LDAP *ld, Sockbuf *sb );
 
 #ifdef LDAP_DNS
 /*
  * in getdxbyname.c
  */
-#ifdef NEEDPROTOS
-char **getdxbyname( char *domain );
-#else /* NEEDPROTOS */
-char **getdxbyname();
-#endif /* NEEDPROTOS */
+char **ldap_getdxbyname( char *domain );
 #endif /* LDAP_DNS */
+
+#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
+/*
+ * in charset.c
+ *
+ * added-in this stuff so that libldap.a would build, i.e. refs to 
+ * these routines from open.c would resolve. 
+ * hodges@stanford.edu 5-Feb-96
+ */
+#if LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET
+extern 
+int ldap_t61_to_8859( char **bufp, unsigned long *buflenp, int free_input );
+extern 
+int ldap_8859_to_t61( char **bufp, unsigned long *buflenp, int free_input );
+#endif /* LDAP_CHARSET_8859 == LDAP_DEFAULT_CHARSET */
+#endif /* STR_TRANSLATION && LDAP_DEFAULT_CHARSET */
+
+#endif /* _LDAP_INT_H */
index 2d90c6392b0cdd3b5b28d6009ebceb9afded1a7b..169f872173b7ca9d9a027426ba4e5aca2c2d1bf4 100644 (file)
@@ -35,8 +35,8 @@ CPP=cl.exe
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "Release\libldap"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
 # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
@@ -45,7 +45,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Release\oldap32.lib"
 
 !ELSEIF  "$(CFG)" == "libldap - Win32 Debug"
 
@@ -66,7 +66,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Debug\oldap32.lib"
 
 !ENDIF 
 
index 7085c8efb652a01f38ea9cffa1fa7285b82e5f59..319cb9ccdfe2c4c07a1949be8b3a6d3d13bc9293 100644 (file)
@@ -79,7 +79,7 @@ ldap_sort_entries(
     LDAP       *ld,
     LDAPMessage        **chain,
     char       *attr,          /* NULL => sort by DN */
-    int                (*cmp) LDAP_P((char *, char *))
+    int                (*cmp) LDAP_P((const char *, const char *))
 )
 {
        int                     i, count;
index 88c094ce76a6b65de98b66cc8a0df299fcc9a987..9ada96636900f8e958ba5b3f1a86f69d03d15a56 100644 (file)
  * 17 May 1994 by Gordon Good
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <ctype.h>
-#include <string.h>
 #include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_SYS_FILE_H
 #include <sys/file.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
-#endif /* DOS */
-#endif /* MACOS */
+#endif
 
 #include "lber.h"
 #include "ldap.h"
 #include "srchpref.h"
 
-#ifndef NEEDPROTOS
-int next_line_tokens();
-void free_strarray();
-static void free_searchobj();
-static int read_next_searchobj();
-#else /* !NEEDPROTOS */
-int next_line_tokens( char **bufp, long *blenp, char ***toksp );
-void free_strarray( char **sap );
-static void free_searchobj( struct ldap_searchobj *so );
-static int read_next_searchobj( char **bufp, long *blenp,
-       struct ldap_searchobj **sop, int soversion );
-#endif /* !NEEDPROTOS */
+static void free_searchobj LDAP_P(( struct ldap_searchobj *so ));
+static int read_next_searchobj LDAP_P(( char **bufp, long *blenp,
+       struct ldap_searchobj **sop, int soversion ));
 
 
 static char            *sobjoptions[] = {
@@ -110,7 +96,7 @@ int
 ldap_init_searchprefs_buf( char *buf, long buflen,
        struct ldap_searchobj **solistp )
 {
-    int                                rc, version;
+    int                                rc = -1, version;
     char                       **toks;
     struct ldap_searchobj      *prevso, *so;
 
index 9596adf131dcee892fb90b5dea07a43cfd14919f..e9c533aca538f67444b8ae8552a1ac25fa52edfd 100644 (file)
@@ -5,51 +5,35 @@
  *  ufn.c
  */
 
+#include "portable.h"
+
 #ifndef lint 
 static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
 #endif
 
 #include <stdio.h>
-#include <string.h>
+#include <ac/string.h>
 #include <ctype.h>
-
-#ifdef MACOS
 #include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/time.h>
 
 #include "lber.h"
 #include "ldap.h"
 
-#ifdef NEEDPROTOS
-typedef int (*cancelptype)( void *cancelparm );
-#else /* NEEDPROTOS */
-typedef int (*cancelptype)();
-#endif /* NEEDPROTOS */
+#include "ldapconfig.h"
+
+typedef int (*cancelptype) LDAP_P(( void *cancelparm ));
 
-#ifdef NEEDPROTOS
-static int ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, 
+static int ldap_ufn_search_ctx LDAP_P(( LDAP *ld, char **ufncomp, int ncomp, 
        char *prefix, char **attrs, int attrsonly, LDAPMessage **res, 
        cancelptype cancelproc, void *cancelparm, char *tag1, char *tag2,
-       char *tag3 );
-static LDAPMessage *ldap_msg_merge( LDAP *ld, LDAPMessage *a, LDAPMessage *b );
-static LDAPMessage *ldap_ufn_expand( LDAP *ld, cancelptype cancelproc,
+       char *tag3 ));
+static LDAPMessage *ldap_msg_merge LDAP_P(( LDAP *ld, LDAPMessage *a, LDAPMessage *b ));
+static LDAPMessage *ldap_ufn_expand LDAP_P(( LDAP *ld, cancelptype cancelproc,
        void *cancelparm, char **dns, char *filter, int scope,
-       char **attrs, int aonly, int *err );
-LDAPFiltDesc *ldap_ufn_setfilter( LDAP *ld, char *fname );
-#else /* NEEDPROTOS */
-static LDAPMessage *ldap_msg_merge();
-static LDAPMessage *ldap_ufn_expand();
-LDAPFiltDesc *ldap_ufn_setfilter();
-#endif /* NEEDPROTOS */
+       char **attrs, int aonly, int *err ));
 
 /*
  * ldap_ufn_search_ctx - do user friendly searching; provide cancel feature;
@@ -83,9 +67,9 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
        char **attrs, int attrsonly, LDAPMessage **res, cancelptype cancelproc,
        void *cancelparm, char *tag1, char *tag2, char *tag3 )
 {
-       char            *dn, *ftag;
-       char            **dns;
-       int             max, i, err, scope, phase, tries;
+       char            *dn, *ftag = NULL;
+       char            **dns = NULL;
+       int             max, i, err, scope = 0, phase, tries;
        LDAPFiltInfo    *fi;
        LDAPMessage     *tmpcand;
        LDAPMessage     *candidates;
@@ -240,7 +224,7 @@ ldap_ufn_search_ct( LDAP *ld, char *ufn, char **attrs, int attrsonly,
 {
        char    **ufncomp, **prefixcomp;
        char    *pbuf;
-       int     ncomp, pcomp, i, err;
+       int     ncomp, pcomp, i, err = 0;
 
        /* initialize the getfilter stuff if it's not already */
        if ( ld->ld_filtd == NULL && ldap_ufn_setfilter( ld, FILTERFILE )
index 08b47efd6be668222fdd938388f11b4294d18fc2..e96685a02bea46436d1a6368fae4c180b485f60c 100644 (file)
  *  We also tolerate URLs that look like: <ldapurl> and <URL:ldapurl>
  */
 
+#include "portable.h"
+
 #ifndef lint 
 static char copyright[] = "@(#) Copyright (c) 1996 Regents of the University of Michigan.\nAll rights reserved.\n";
 #endif
 
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#endif /* MACOS */
-
-#if defined( DOS ) || defined( _WIN32 )
 #include <stdlib.h>
-#include <malloc.h>
-#include "msdos.h"
-#endif /* DOS || _WIN32 */
 
-#if !defined(MACOS) && !defined(DOS) && !defined( _WIN32 )
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* !MACOS && !DOS && !_WIN32 */
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
 
 #include "lber.h"
 #include "ldap.h"
 #include "ldap-int.h"
 
 
-#ifdef NEEDPROTOS
-static int skip_url_prefix( char **urlp, int *enclosedp );
-static void hex_unescape( char *s );
+static int skip_url_prefix LDAP_P(( char **urlp, int *enclosedp ));
+static void hex_unescape LDAP_P(( char *s ));
 static int unhex( char c );
-#else /* NEEDPROTOS */
-static int skip_url_prefix();
-static void hex_unescape();
-static int unhex();
-#endif /* NEEDPROTOS */
 
 
 int
@@ -305,10 +288,10 @@ ldap_url_search( LDAP *ld, char *url, int attrsonly )
                ber_free( ber, 1 );
        } else {
 #ifdef LDAP_REFERRALS
-               err = send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
+               err = ldap_send_server_request( ld, ber, ld->ld_msgid, NULL, srv,
                    NULL, 1 );
 #else /* LDAP_REFERRALS */
-               err = send_initial_request( ld, LDAP_REQ_SEARCH,
+               err = ldap_send_initial_request( ld, LDAP_REQ_SEARCH,
                    ludp->lud_dn, ber );
 #endif /* LDAP_REFERRALS */
        }
index e9fb0c2b9785a35643defa7a5c18479ad84492af..0e52fbad6db9f6d55b2e23f99ef8b86f36599ef4 100644 (file)
@@ -35,8 +35,8 @@ CPP=cl.exe
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "Release\libldif"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
 # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
@@ -56,8 +56,8 @@ LIB32=link.exe -lib
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
+# PROP Output_Dir "..\Debug"
+# PROP Intermediate_Dir "Debug\libldif"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
 # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
@@ -66,7 +66,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo /out:"..\Debug\libldif.lib"
+# ADD LIB32 /nologo /out:"..\Debug\oldif32.lib"
 
 !ENDIF 
 
index 7fae27961c3d2581f6bdbc66577f311063808f7d..65c6f071318b99991b1fa4aa31e3472d1210fa42 100644 (file)
@@ -3,6 +3,7 @@
 #include "portable.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ctype.h>
 
 #include <ac/string.h>
diff --git a/libraries/liblthread/rdwr.c b/libraries/liblthread/rdwr.c
new file mode 100644 (file)
index 0000000..f105344
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+** This basic implementation of Reader/Writer locks does not
+** protect writers from starvation.  That is, if a writer is
+** currently waiting on a reader, any new reader will get
+** the lock before the writer.
+*/
+
+/********************************************************
+ * An example source module to accompany...
+ *
+ * "Using POSIX Threads: Programming with Pthreads"
+ *              by Brad nichols, Dick Buttlar, Jackie Farrell
+ *              O'Reilly & Associates, Inc.
+ *
+ ********************************************************
+ * rdwr.c --
+ * 
+ * Library of functions implementing reader/writer locks
+ */
+
+#include <portable.h>
+
+#include <stdlib.h>
+#include <lthread.h>
+#include <lthread_rdwr.h>
+
+int pthread_rdwr_init_np(pthread_rdwr_t *rdwrp, pthread_rdwrattr_t *attrp)
+{
+       rdwrp->readers_reading = 0;
+       rdwrp->writer_writing = 0;
+       pthread_mutex_init(&(rdwrp->mutex), pthread_mutexattr_default);
+       pthread_cond_init(&(rdwrp->lock_free), pthread_condattr_default);
+       return 0;
+}
+
+int pthread_rdwr_rlock_np(pthread_rdwr_t *rdwrp){
+       pthread_mutex_lock(&(rdwrp->mutex));
+       while(rdwrp->writer_writing) {
+               pthread_cond_wait(&(rdwrp->lock_free), &(rdwrp->mutex));
+       }
+       rdwrp->readers_reading++;
+       pthread_mutex_unlock(&(rdwrp->mutex));
+       return 0;
+}
+
+int pthread_rdwr_runlock_np(pthread_rdwr_t *rdwrp)
+{
+       pthread_mutex_lock(&(rdwrp->mutex));
+       if (rdwrp->readers_reading == 0) {
+               pthread_mutex_unlock(&(rdwrp->mutex));
+               return -1;
+       }
+       else {
+               rdwrp->readers_reading--;
+               if (rdwrp->readers_reading == 0) {
+                       pthread_cond_signal(&(rdwrp->lock_free));
+               }
+               pthread_mutex_unlock(&(rdwrp->mutex));
+               return 0;
+       }
+}
+
+int pthread_rdwr_wlock_np(pthread_rdwr_t *rdwrp)
+{
+       pthread_mutex_lock(&(rdwrp->mutex));
+       while(rdwrp->writer_writing || rdwrp->readers_reading) {
+               pthread_cond_wait(&(rdwrp->lock_free), &(rdwrp->mutex));
+       }
+       rdwrp->writer_writing++;
+       pthread_mutex_unlock(&(rdwrp->mutex));
+       return 0;
+}
+
+int pthread_rdwr_wunlock_np(pthread_rdwr_t *rdwrp)
+{
+       pthread_mutex_lock(&(rdwrp->mutex));
+       if (rdwrp->writer_writing == 0) {
+               pthread_mutex_unlock(&(rdwrp->mutex));
+               return -1;
+       }
+       else {
+               rdwrp->writer_writing = 0;
+               pthread_cond_broadcast(&(rdwrp->lock_free));
+               pthread_mutex_unlock(&(rdwrp->mutex));
+               return 0;
+       }
+}
+
+#ifdef LDAP_DEBUG
+
+/* just for testing, 
+ * return 0 if false, suitable for assert(pthread_rdwr_Xchk(rdwr))
+ * 
+ * Currently they don't check if the calling thread is the one 
+ * that has the lock, just that there is a reader or writer.
+ *
+ * Basically sufficent for testing that places that should have
+ * a lock are caught.
+ */
+
+int pthread_rdwr_rchk_np(pthread_rdwr_t *rdwrp)
+{
+       return(rdwrp->readers_reading!=0);
+}
+
+int pthread_rdwr_wchk_np(pthread_rdwr_t *rdwrp)
+{
+       return(rdwrp->writer_writing!=0);
+}
+int pthread_rdwr_rwchk_np(pthread_rdwr_t *rdwrp)
+{
+       return(pthread_rdwr_rchk_np(rdwrp) || pthread_rdwr_wchk_np(rdwrp));
+}
+
+#endif /* LDAP_DEBUG */
index 89a85c70b44872819dda6da7b229cd9923323b94..68baf5f30f4a9f60be2de8fb177f47b2eef09115 100644 (file)
@@ -1,17 +1,35 @@
 /* thread.c - glue routines to provide a consistent thread interface */
-#include <stdio.h>
-#include "lthread.h"
 
-#if defined( THREAD_SUNOS4_LWP )
+#include "portable.h"
 
+#include <lthread.h>
+
+#if defined( HAVE_PTHREADS )
+
+#ifndef HAVE_PTHREAD_KILL
 /***********************************************************************
  *                                                                     *
- * under sunos 4 - use the built in non-preemptive lwp threads package *
+ * pthreads package with DCE - no mapping to do (except to create a    *
+ * pthread_kill() routine)                                             *
  *                                                                     *
  ***********************************************************************/
 
-extern stkalign_t      *get_stack();
-static void            lwp_create_stack();
+/* ARGSUSED */
+void
+pthread_kill( pthread_t tid, int sig )
+{
+       kill( getpid(), sig );
+}
+#endif /* HAVE_PTHREAD_KILL */
+
+#elif defined( HAVE_MACH_CTHREADS )
+
+/***********************************************************************
+ *                                                                     *
+ * under NEXTSTEP or OPENSTEP use CThreads                             *
+ * lukeh@xedoc.com.au                                                  *
+ *                                                                     *
+ ***********************************************************************/
 
 int
 pthread_attr_init( pthread_attr_t *attr )
@@ -44,45 +62,36 @@ pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate )
 int
 pthread_create(
     pthread_t          *tid,
-    pthread_attr_t     attr,
+    pthread_attr_t     *attr,
     VFP                        func,
     void               *arg
 )
 {
-       stkalign_t      *stack;
-       int             stackno;
-
-       if ( (stack = get_stack( &stackno )) == NULL ) {
-               return( -1 );
-       }
-       return( lwp_create( tid, lwp_create_stack, MINPRIO, 0, stack, 3, func,
-           arg, stackno ) );
-}
-
-static void
-lwp_create_stack( VFP func, void *arg, int stackno )
-{
-       (*func)( arg );
-
-       free_stack( stackno );
+       *tid = cthread_fork(func, arg);
+        return ( *tid == NULL ? -1 : 0 );
 }
 
 void
 pthread_yield()
 {
-       lwp_yield( SELF );
+       cthread_yield();
 }
 
 void
-pthread_exit()
+pthread_exit( any_t a )
 {
-       lwp_destroy( SELF );
+       cthread_exit( a );
 }
 
 void
-pthread_join( pthread_t tid, int *status )
+pthread_join( pthread_t tid, int *pStatus )
 {
-       lwp_join( tid );
+       int status;
+       status = (int) cthread_join ( tid );
+       if (pStatus != NULL)
+               {
+               *pStatus = status;
+               }
 }
 
 /* ARGSUSED */
@@ -96,88 +105,82 @@ pthread_kill( pthread_t tid, int sig )
 int
 pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr )
 {
-       return( mon_create( mp ) );
+       mutex_init( mp );
+       mp->name = NULL;
+       return ( 0 );
 }
 
 int
 pthread_mutex_destroy( pthread_mutex_t *mp )
 {
-       return( mon_destroy( *mp ) );
+       mutex_clear( mp );
+       return ( 0 );
 }
 
 int
 pthread_mutex_lock( pthread_mutex_t *mp )
 {
-       return( mon_enter( *mp ) );
+       mutex_lock( mp );
+       return ( 0 );
 }
 
 int
 pthread_mutex_unlock( pthread_mutex_t *mp )
 {
-       return( mon_exit( *mp ) );
+       mutex_unlock( mp );
+       return ( 0 );
 }
 
 int
 pthread_mutex_trylock( pthread_mutex_t *mp )
 {
-       return( mon_cond_enter( *mp ) );
+       return mutex_try_lock( mp );
 }
 
 int
 pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr )
 {
-       /*
-        * lwp cv_create requires the monitor id be passed in
-        * when the cv is created, pthreads passes it when the
-        * condition is waited for.  so, we fake the creation
-        * here and actually do it when the cv is waited for
-        * later.
-        */
-
-       cv->lcv_created = 0;
-
+       condition_init( cv );
        return( 0 );
 }
 
 int
 pthread_cond_destroy( pthread_cond_t *cv )
 {
-       return( cv->lcv_created ? cv_destroy( cv->lcv_cv ) : 0 );
+       condition_clear( cv );
+       return( 0 );
 }
 
 int
 pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp )
 {
-       if ( ! cv->lcv_created ) {
-               cv_create( &cv->lcv_cv, *mp );
-               cv->lcv_created = 1;
-       }
-
-       return( cv_wait( cv->lcv_cv ) );
+       condition_wait( cv, mp );
+       return( 0 );
 }
 
 int
 pthread_cond_signal( pthread_cond_t *cv )
 {
-       return( cv->lcv_created ? cv_notify( cv->lcv_cv ) : 0 );
+       condition_signal( cv );
+       return( 0 );
 }
 
 int
 pthread_cond_broadcast( pthread_cond_t *cv )
 {
-       return( cv->lcv_created ? cv_broadcast( cv->lcv_cv ) : 0 );
+       condition_broadcast( cv );
+       return( 0 );
 }
 
-#else /* end sunos4 */
+#elif defined( HAVE_THR )
 
-#  if defined( THREAD_SUNOS5_LWP )
-
-/***********************************************************************
- *                                                                     *
- * under sunos 5 - use the built in preemptive solaris threads package *
- *                                                                     *
- ***********************************************************************/
+/*******************
+ *                 *
+ * Solaris Threads *
+ *                 *
+ *******************/
 
+#if !defined(__SunOS_5_6)
 int
 pthread_attr_init( pthread_attr_t *attr )
 {
@@ -210,13 +213,14 @@ pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate )
 int
 pthread_create(
     pthread_t          *tid,
-    pthread_attr_t     attr,
+    pthread_attr_t     *attr,
     VFP                        func,
     void               *arg
 )
 {
-       return( thr_create( NULL, 0, func, arg, attr, tid ) );
+       return( thr_create( NULL, 0, func, arg, *attr, tid ) );
 }
+#endif /* ! sunos56 */
 
 void
 pthread_yield()
@@ -224,6 +228,7 @@ pthread_yield()
        thr_yield();
 }
 
+#if !defined(__SunOS_5_6)
 void
 pthread_exit()
 {
@@ -302,43 +307,176 @@ pthread_cond_broadcast( pthread_cond_t *cv )
 {
        return( cond_broadcast( cv ) );
 }
+#endif /* ! sunos56 */
 
+#elif defined( HAVE_LWP )
 
-#else /* end sunos5 threads */
+/*************
+ *           *
+ * SunOS LWP *
+ *           *
+ *************/
 
-#if defined( THREAD_MIT_PTHREADS )
+extern stkalign_t      *get_stack();
+static void            lwp_create_stack();
 
-/***********************************************************************
- *                                                                     *
- * pthreads package by Chris Provenzano of MIT - provides all the      *
- * pthreads calls already, so no mapping to do                         *
- *                                                                     *
- ***********************************************************************/
+int
+pthread_attr_init( pthread_attr_t *attr )
+{
+       *attr = 0;
+       return( 0 );
+}
 
-#else /* end mit pthreads */
+int
+pthread_attr_destroy( pthread_attr_t *attr )
+{
+       return( 0 );
+}
 
-#if defined( THREAD_DCE_PTHREADS )
+int
+pthread_attr_getdetachstate( pthread_attr_t *attr, int *detachstate )
+{
+       *detachstate = *attr;
+       return( 0 );
+}
 
-/***********************************************************************
- *                                                                     *
- * pthreads package with DCE - no mapping to do (except to create a    *
- * pthread_kill() routine)                                             *
- *                                                                     *
- ***********************************************************************/
+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
+)
+{
+       stkalign_t      *stack;
+       int             stackno;
+
+       if ( (stack = get_stack( &stackno )) == NULL ) {
+               return( -1 );
+       }
+       return( lwp_create( tid, lwp_create_stack, MINPRIO, 0, stack, 3, func,
+           arg, stackno ) );
+}
+
+static void
+lwp_create_stack( VFP func, void *arg, int stackno )
+{
+       (*func)( arg );
+
+       free_stack( stackno );
+}
+
+void
+pthread_yield()
+{
+       lwp_yield( SELF );
+}
+
+void
+pthread_exit()
+{
+       lwp_destroy( SELF );
+}
+
+void
+pthread_join( pthread_t tid, int *status )
+{
+       lwp_join( tid );
+}
 
 /* ARGSUSED */
 void
 pthread_kill( pthread_t tid, int sig )
 {
-       kill( getpid(), sig );
+       return;
+}
+
+/* ARGSUSED */
+int
+pthread_mutex_init( pthread_mutex_t *mp, pthread_mutexattr_t *attr )
+{
+       return( mon_create( mp ) );
+}
+
+int
+pthread_mutex_destroy( pthread_mutex_t *mp )
+{
+       return( mon_destroy( *mp ) );
+}
+
+int
+pthread_mutex_lock( pthread_mutex_t *mp )
+{
+       return( mon_enter( *mp ) );
+}
+
+int
+pthread_mutex_unlock( pthread_mutex_t *mp )
+{
+       return( mon_exit( *mp ) );
+}
+
+int
+pthread_mutex_trylock( pthread_mutex_t *mp )
+{
+       return( mon_cond_enter( *mp ) );
+}
+
+int
+pthread_cond_init( pthread_cond_t *cv, pthread_condattr_t *attr )
+{
+       /*
+        * lwp cv_create requires the monitor id be passed in
+        * when the cv is created, pthreads passes it when the
+        * condition is waited for.  so, we fake the creation
+        * here and actually do it when the cv is waited for
+        * later.
+        */
+
+       cv->lcv_created = 0;
+
+       return( 0 );
+}
+
+int
+pthread_cond_destroy( pthread_cond_t *cv )
+{
+       return( cv->lcv_created ? cv_destroy( cv->lcv_cv ) : 0 );
+}
+
+int
+pthread_cond_wait( pthread_cond_t *cv, pthread_mutex_t *mp )
+{
+       if ( ! cv->lcv_created ) {
+               cv_create( &cv->lcv_cv, *mp );
+               cv->lcv_created = 1;
+       }
+
+       return( cv_wait( cv->lcv_cv ) );
+}
+
+int
+pthread_cond_signal( pthread_cond_t *cv )
+{
+       return( cv->lcv_created ? cv_notify( cv->lcv_cv ) : 0 );
+}
+
+int
+pthread_cond_broadcast( pthread_cond_t *cv )
+{
+       return( cv->lcv_created ? cv_broadcast( cv->lcv_cv ) : 0 );
 }
 
-#endif /* dce pthreads */
-#endif /* mit pthreads */
-#endif /* sunos5 lwp */
-#endif /* sunos4 lwp */
 
-#ifndef _THREAD
+#else
 
 /***********************************************************************
  *                                                                     *
@@ -379,7 +517,7 @@ pthread_attr_setdetachstate( pthread_attr_t *attr, int detachstate )
 int
 pthread_create(
     pthread_t          *tid,
-    pthread_attr_t     attr,
+    pthread_attr_t     *attr,
     VFP                        func,
     void               *arg
 )
index 80b5420e56a8aab8b14e02c84d126d37069ce32c..a1cf5ab72e8fd55748afe927d221ddef7442812a 100644 (file)
@@ -3,8 +3,8 @@
 ##
 
 LIBRARY        = liblutil.a
-SRCS   = base64.c md5.c sha1.c detach.c
-OBJS   = base64.o md5.o sha1.o detach.o @LIBOBJS@
+SRCS   = base64.c detach.c md5.c passwd.c sha1.c
+OBJS   = base64.o detach.o md5.o passwd.c sha1.o @LIBOBJS@
 
 LDAP_INCDIR= ../../include       
 LDAP_LIBDIR= ../../libraries
index 72ec99741f2dccdcc0d0c25147af0889be47a4fc..1ca3f84be9cce7b57c83923ae18a3bcb0e4872cd 100644 (file)
@@ -23,8 +23,7 @@
 #include <sys/file.h>
 #include <sys/ioctl.h>
 
-#include "portable.h"
-
+#include "lutil.h"
 
 /* I'd really like to make do_close an fd_set, but that isn't portable. */
 void
diff --git a/libraries/liblutil/getopt.c b/libraries/liblutil/getopt.c
new file mode 100644 (file)
index 0000000..c69bd17
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+       getopt.c
+
+       modified public-domain AT&T getopt(3)
+       modified by Kurt Zeilenga for inclusion into OpenLDAP
+*/
+
+#include "portable.h"
+
+#ifndef HAVE_GETOPT
+
+#include <stdio.h>
+
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
+
+#ifndef STDERR_FILENO
+#define STDERR_FILENO 2
+#endif
+
+int opterr = 1;
+int optind = 1;
+int optopt;
+char * optarg;
+
+static void ERR (char * const argv[], const char * s, char c)
+{
+       char errbuf[2];
+
+#ifdef DF_TRACE_DEBUG
+printf("DF_TRACE_DEBUG:        static void ERR () in getopt.c\n");
+#endif
+       if (opterr)
+       {
+               errbuf[0] = c;
+               errbuf[1] = '\n';
+               (void) write(STDERR_FILENO,argv[0],strlen(argv[0]));
+               (void) write(STDERR_FILENO,s,strlen(s));
+               (void) write(STDERR_FILENO,errbuf,sizeof errbuf);
+       }
+}
+
+int getopt (int argc, char * const argv [], const char * opts)
+{
+       static int sp = 1, error = (int) '?';
+       static char sw = '-', eos = '\0', arg = ':';
+       register char c, * cp;
+
+#ifdef DF_TRACE_DEBUG
+printf("DF_TRACE_DEBUG:        int getopt () in getopt.c\n");
+#endif
+       if (sp == 1)
+               if (optind >= argc || argv[optind][0] != sw
+               || argv[optind][1] == eos)
+                       return EOF;
+               else if (strcmp(argv[optind],"--") == 0)
+               {
+                       optind++;
+                       return EOF;
+               }
+       c = argv[optind][sp];
+       optopt = (int) c;
+       if (c == arg || (cp = strchr(opts,c)) == NULL)
+       {
+               ERR(argv,": illegal option--",c);
+               if (argv[optind][++sp] == eos)
+               {
+                       optind++;
+                       sp = 1;
+               }
+               return error;
+       }
+       else if (*++cp == arg)
+       {
+               if (argv[optind][sp + 1] != eos)
+                       optarg = &argv[optind++][sp + 1];
+               else if (++optind >= argc)
+               {
+                       ERR(argv,": option requires an argument--",c);
+                       sp = 1;
+                       return error;
+               }
+               else
+                       optarg = argv[optind++];
+               sp = 1;
+       }
+       else
+       {
+               if (argv[optind][++sp] == eos)
+               {
+                       sp = 1;
+                       optind++;
+               }
+               optarg = NULL;
+       }
+       return (int) c;
+}
+#endif /* HAVE_GETOPT */
index 59de922e50c721d977b131c50b97e3d4e725d798..7188ca00dc01556a8e31d5820b828379c8be1b1a 100644 (file)
@@ -35,8 +35,8 @@ CPP=cl.exe
 # PROP BASE Target_Dir ""
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
+# PROP Output_Dir "..\Release"
+# PROP Intermediate_Dir "Release\liblutil"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
 # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
@@ -57,7 +57,7 @@ LIB32=link.exe -lib
 # PROP Use_MFC 0
 # PROP Use_Debug_Libraries 1
 # PROP Output_Dir "..\Debug"
-# PROP Intermediate_Dir "Debug"
+# PROP Intermediate_Dir "Debug\liblutil"
 # PROP Target_Dir ""
 # ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
 # ADD CPP /nologo /W3 /GX /Z7 /Od /I "..\..\include" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
@@ -66,7 +66,7 @@ BSC32=bscmake.exe
 # ADD BSC32 /nologo
 LIB32=link.exe -lib
 # ADD BASE LIB32 /nologo
-# ADD LIB32 /nologo
+# ADD LIB32 /nologo /out:"..\Debug\olutil32.lib"
 
 !ENDIF 
 
@@ -80,6 +80,10 @@ SOURCE=.\base64.c
 # End Source File
 # Begin Source File
 
+SOURCE="..\..\include\getopt-compat.h"
+# End Source File
+# Begin Source File
+
 SOURCE=.\getopt.c
 # End Source File
 # Begin Source File
diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c
new file mode 100644 (file)
index 0000000..89b45b9
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * lutil_password(credentials, password)
+ *
+ * Returns true if user supplied credentials matches
+ * the stored password. 
+ *
+ * Due to the use of the crypt(3) function 
+ * this routine is NOT thread-safe.
+ */
+
+#include "portable.h"
+
+#include <ac/string.h>
+#include <ac/unistd.h>
+
+#include "lutil_md5.h"
+#include "lutil_sha1.h"
+#include "lutil.h"
+
+/*
+ */
+
+int
+lutil_passwd(
+       const char *cred,
+       const char *passwd)
+{
+
+       if (cred == NULL || passwd == NULL) {
+               return 0;
+       }
+
+       if (strncasecmp(passwd, "{CRYPT}", sizeof("{CRYPT}") - 1) == 0 ) {
+               const char *p = passwd + (sizeof("{CRYPT}") - 1);
+
+               return( strcmp(p, crypt(cred, p)) != 0 );
+
+       } else if (strncasecmp(passwd, "{MD5}", sizeof("{MD5}") - 1) == 0 ) {
+               ldap_MD5_CTX MD5context;
+               unsigned char MD5digest[20];
+               char base64digest[29];  /* ceiling(sizeof(input)/3) * 4 + 1 */
+
+               const char *p = passwd + (sizeof("{MD5}") - 1);
+
+               ldap_MD5Init(&MD5context);
+               ldap_MD5Update(&MD5context,
+                       cred, strlen(cred));
+               ldap_MD5Final(MD5digest, &MD5context);
+
+               if ( b64_ntop(MD5digest, sizeof(MD5digest),
+                       base64digest, sizeof(base64digest)) < 0)
+               {
+                       return ( 1 );
+               }
+
+               return (strcmp(p, base64digest) != 0);
+
+       } else if (strncasecmp(passwd, "{SHA}",sizeof("{SHA}") - 1) == 0 ) {
+               ldap_SHA1_CTX SHA1context;
+               unsigned char SHA1digest[20];
+               char base64digest[29];  /* ceiling(sizeof(input)/3) * 4 + 1 */
+               const char *p = passwd + (sizeof("{SHA}") - 1);
+
+               ldap_SHA1Init(&SHA1context);
+               ldap_SHA1Update(&SHA1context,
+                       (unsigned char *) cred, strlen(cred));
+               ldap_SHA1Final(SHA1digest, &SHA1context);
+
+               if (b64_ntop(SHA1digest, sizeof(SHA1digest),
+                       base64digest, sizeof(base64digest)) < 0)
+               {
+                       return ( 0 );
+               }
+
+               return( strcmp(p, base64digest) != 0 );
+       }
+
+       return( strcmp(passwd, cred) != 0 );
+}
index b2a590b6121f9d9b83ae75c188ec9ac7bc619912..d0da848040168f3841b4819f50e409226092f281 100644 (file)
@@ -3,6 +3,7 @@
 #ifndef HAVE_SETPROCTITLE
 
 #include <stdlib.h>
+#include <ac/string.h>
 
 #if defined( HAVE_STDARG_H ) && __STDC__
 #include <stdarg.h>
index 7686d94767df285a23ad73347ff036fc5f7e0853..e4fa388fa99b6a0f32b66d89f7de0b70e2e2ffb9 100644 (file)
@@ -1,19 +1,27 @@
 /* attr.c - routines for dealing with attributes */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <ctype.h>
+
+#ifdef HAVE_FCNTL_H
 #include <fcntl.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#endif
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+
 #include <sys/stat.h>
-#include "portable.h"
+
 #include "slap.h"
 
 extern char    **charray_dup();
-extern char    *ch_malloc();
 extern int     errno;
 
 void
@@ -298,7 +306,7 @@ attr_syntax_config(
        a->asi_names = charray_dup( argv );
        argv[lasti] = save;
 
-       switch ( avl_insert( &attr_syntaxes, a, attr_syntax_cmp,
+       switch ( avl_insert( &attr_syntaxes, (caddr_t) a, attr_syntax_cmp,
            attr_syntax_dup ) ) {
        case -1:        /* duplicate - different syntaxes */
                Debug( LDAP_DEBUG_ARGS, "%s: line %d: duplicate attribute\n",
index 28243301907197768cd7e076f56c776301ff8e73..960d2e1d4e0e4cc24958502150792a635f528a87 100644 (file)
@@ -5,8 +5,16 @@
 
 #include "ldbm.h"
 
+LDAP_BEGIN_DECL
+
 #define DEFAULT_CACHE_SIZE     1000
-#define DEFAULT_DBCACHE_SIZE   100000
+
+#ifdef HAVE_BERKELEY_DB2
+#      define DEFAULT_DBCACHE_SIZE (100 * DEFAULT_DB_PAGE_SIZE)
+#else
+#      define DEFAULT_DBCACHE_SIZE 100000
+#endif
+
 #define DEFAULT_DB_DIRECTORY   "/usr/tmp"
 #define DEFAULT_MODE           0600
 
@@ -102,13 +110,14 @@ struct ldbminfo {
        struct cache            li_cache;
        Avlnode                 *li_attrs;
        int                     li_dbcachesize;
+       int                     li_dbcachewsync;
        struct dbcache          li_dbcache[MAXDBCACHE];
        pthread_mutex_t         li_dbcache_mutex;
        pthread_cond_t          li_dbcache_cv;
 };
 
-#ifdef NEEDPROTOS
 #include "proto-back-ldbm.h"
-#endif
+
+LDAP_END_DECL
 
 #endif /* _back_ldbm_h_ */
index d6aca2c413fcd20213bd8f75e8d04b630ee5868f..a47d7a14a1386e3deeef99fb3c99251223adbbd5 100644 (file)
@@ -1,9 +1,12 @@
 /* config.c - ldbm backend configuration file routine */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
 #include "slap.h"
 #include "back-ldbm.h"
 
@@ -77,6 +80,10 @@ ldbm_back_config(
                }
                li->li_dbcachesize = atoi( argv[1] );
 
+       /* no write sync */
+       } else if ( strcasecmp( argv[0], "dbcachenowsync" ) == 0 ) {
+               li->li_dbcachewsync = 0;
+
        /* anything else */
        } else {
                fprintf( stderr,
index c773929ffb43a64eb73ba3e3b7c28124a5655b08..412566d809ff64ecb1cf0d965fd5c83ad8abaa00 100644 (file)
@@ -1,13 +1,16 @@
 /* delete.c - ldbm backend delete routine */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 #include "back-ldbm.h"
+#include "proto-back-ldbm.h"
 
-extern Entry           *dn2entry();
 extern Attribute       *attr_find();
 
 int
@@ -20,9 +23,15 @@ ldbm_back_delete(
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
        char            *matched = NULL;
-       Entry           *e;
+        char            *pdn = NULL;
+       Entry           *e, *p;
+
+       Debug(LDAP_DEBUG_ARGS, "==> ldbm_back_delete: %s\n", dn, 0, 0);
 
-       if ( (e = dn2entry( be, dn, &matched )) == NULL ) {
+       /* get entry with writer lock */
+       if ( (e = dn2entry_w( be, dn, &matched )) == NULL ) {
+               Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: no such object %s\n",
+                       dn, 0, 0);
                send_ldap_result( conn, op, LDAP_NO_SUCH_OBJECT, matched, "" );
                if ( matched != NULL ) {
                        free( matched );
@@ -30,38 +39,73 @@ ldbm_back_delete(
                return( -1 );
        }
 
+       Debug (LDAP_DEBUG_TRACE,
+               "rdwr_Xchk: readers_reading: %d writer_writing: %d\n",
+               e->e_rdwr.readers_reading, e->e_rdwr.writer_writing, 0);
+
+       /* check for deleted */
+
        if ( has_children( be, e ) ) {
+               Debug(LDAP_DEBUG_ARGS, "<=- ldbm_back_delete: non leaf %s\n",
+                       dn, 0, 0);
                send_ldap_result( conn, op, LDAP_NOT_ALLOWED_ON_NONLEAF, "",
                    "" );
-               cache_return_entry( &li->li_cache, e );
-               return( -1 );
+               goto error_return;
        }
 
        if ( ! access_allowed( be, conn, op, e, "entry", NULL, op->o_dn,
            ACL_WRITE ) ) {
+               Debug(LDAP_DEBUG_ARGS,
+                       "<=- ldbm_back_delete: insufficient access %s\n",
+                       dn, 0, 0);
                send_ldap_result( conn, op, LDAP_INSUFFICIENT_ACCESS, "", "" );
-               cache_return_entry( &li->li_cache, e );
-               return( -1 );
+               goto error_return;
        }
 
+       Debug (LDAP_DEBUG_TRACE,
+               "rdwr_Xchk: readers_reading: %d writer_writing: %d\n",
+               e->e_rdwr.readers_reading, e->e_rdwr.writer_writing, 0);
+
        /* XXX delete from parent's id2children entry XXX */
+       pdn = dn_parent( be, dn );
+       matched = NULL;
+       p = dn2entry_r( be, pdn, &matched );
+       if ( id2children_remove( be, p, e ) != 0 ) {
+               send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "","" );
+                goto error_return;
+       }
 
        /* delete from dn2id mapping */
        if ( dn2id_delete( be, e->e_dn ) != 0 ) {
+               Debug(LDAP_DEBUG_ARGS,
+                       "<=- ldbm_back_delete: operations error %s\n",
+                       dn, 0, 0);
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
-               cache_return_entry( &li->li_cache, e );
-               return( -1 );
+               goto error_return;
        }
 
        /* delete from disk and cache */
        if ( id2entry_delete( be, e ) != 0 ) {
+               Debug(LDAP_DEBUG_ARGS,
+                       "<=- ldbm_back_delete: operations error %s\n",
+                       dn, 0, 0);
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, "", "" );
-               cache_return_entry( &li->li_cache, e );
-               return( -1 );
+               goto error_return;
        }
-       cache_return_entry( &li->li_cache, e );
+
+       /* free entry and writer lock */
+       cache_return_entry_w( &li->li_cache, e );
 
        send_ldap_result( conn, op, LDAP_SUCCESS, "", "" );
 
        return( 0 );
+
+error_return:;
+       /* free entry and writer lock */
+       cache_return_entry_w( &li->li_cache, e );
+
+       if( p )
+               cache_return_entry_r( &li->li_cache, p );
+
+       return( -1 );
 }
index c4116086b00d5aab3d143a14f045956a3737c51d..4a7da28731e28b7986fd23473304c9658ea792be 100644 (file)
@@ -1,15 +1,17 @@
 /* dn2id.c - routines to deal with the dn2id index */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 #include "back-ldbm.h"
+#include "proto-back-ldbm.h"
 
 extern struct dbcache  *ldbm_cache_open();
-extern Entry           *cache_find_entry_dn();
-extern Entry           *id2entry();
 extern char            *dn_parent();
 extern Datum           ldbm_cache_fetch();
 
@@ -20,9 +22,15 @@ dn2id_add(
     ID         id
 )
 {
-       int             rc;
+       int             rc, flags;
        struct dbcache  *db;
        Datum           key, data;
+       struct ldbminfo *li = (struct ldbminfo *) be->be_private;
+
+#ifdef HAVE_BERKELEY_DB2
+       memset( &key, 0, sizeof( key ) );
+       memset( &data, 0, sizeof( data ) );
+#endif
 
        Debug( LDAP_DEBUG_TRACE, "=> dn2id_add( \"%s\", %ld )\n", dn, id, 0 );
 
@@ -41,7 +49,10 @@ dn2id_add(
        data.dptr = (char *) &id;
        data.dsize = sizeof(ID);
 
-       rc = ldbm_cache_store( db, key, data, LDBM_INSERT );
+       flags = LDBM_INSERT;
+       if ( li->li_dbcachewsync ) flags |= LDBM_SYNC;
+
+       rc = ldbm_cache_store( db, key, data, flags );
 
        free( dn );
        ldbm_cache_close( be, db );
@@ -58,31 +69,31 @@ dn2id(
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
        struct dbcache  *db;
-       Entry           *e;
        ID              id;
        Datum           key, data;
 
-       Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 );
+#ifdef HAVE_BERKELEY_DB2
+       memset( &key, 0, sizeof( key ) );
+       memset( &data, 0, sizeof( data ) );
+#endif
 
        dn = strdup( dn );
+       Debug( LDAP_DEBUG_TRACE, "=> dn2id( \"%s\" )\n", dn, 0, 0 );
        dn_normalize_case( dn );
 
        /* first check the cache */
-       if ( (e = cache_find_entry_dn( &li->li_cache, dn )) != NULL ) {
-               id = e->e_id;
+       if ( (id = cache_find_entry_dn2id( be, &li->li_cache, dn )) != NOID ) {
                free( dn );
-               Debug( LDAP_DEBUG_TRACE, "<= dn2id %d (in cache)\n", e->e_id,
-                   0, 0 );
-               cache_return_entry( &li->li_cache, e );
-
+               Debug( LDAP_DEBUG_TRACE, "<= dn2id %d (in cache)\n", id,
+                       0, 0 );
                return( id );
        }
 
        if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
-           == NULL ) {
+               == NULL ) {
                free( dn );
                Debug( LDAP_DEBUG_ANY, "<= dn2id could not open dn2id%s\n",
-                   LDBM_SUFFIX, 0, 0 );
+                       LDBM_SUFFIX, 0, 0 );
                return( NOID );
        }
 
@@ -118,6 +129,10 @@ dn2id_delete(
        Datum           key;
        int             rc;
 
+#ifdef HAVE_BERKELEY_DB2
+       memset( &key, 0, sizeof( key ) );
+#endif
+
        Debug( LDAP_DEBUG_TRACE, "=> dn2id_delete( \"%s\" )\n", dn, 0, 0 );
 
        if ( (db = ldbm_cache_open( be, "dn2id", LDBM_SUFFIX, LDBM_WRCREAT ))
@@ -145,11 +160,12 @@ dn2id_delete(
  * entry.
  */
 
-Entry *
+static Entry *
 dn2entry(
     Backend    *be,
     char       *dn,
-    char       **matched
+    char       **matched,
+    int         rw
 )
 {
        struct ldbminfo *li = (struct ldbminfo *) be->be_private;
@@ -157,8 +173,12 @@ dn2entry(
        Entry           *e;
        char            *pdn;
 
-       if ( (id = dn2id( be, dn )) != NOID && (e = id2entry( be, id ))
-           != NULL ) {
+       Debug(LDAP_DEBUG_TRACE, "dn2entry_%s: dn: %s\n",
+               rw ? "w" : "r", dn, 0);
+
+       if ( (id = dn2id( be, dn )) != NOID &&
+               (e = id2entry( be, id, rw )) != NULL )
+       {
                return( e );
        }
        *matched = NULL;
@@ -170,9 +190,11 @@ dn2entry(
 
        /* entry does not exist - see how much of the dn does exist */
        if ( (pdn = dn_parent( be, dn )) != NULL ) {
-               if ( (e = dn2entry( be, pdn, matched )) != NULL ) {
+               /* get entry with reader lock */
+               if ( (e = dn2entry_r( be, pdn, matched )) != NULL ) {
                        *matched = pdn;
-                       cache_return_entry( &li->li_cache, e );
+                       /* free entry with reader lock */
+                       cache_return_entry_r( &li->li_cache, e );
                } else {
                        free( pdn );
                }
@@ -180,3 +202,39 @@ dn2entry(
 
        return( NULL );
 }
+
+#if 0
+               if (e->e_state == ENTRY_STATE_DELETED)
+                       continue;
+
+               if (strcmp(dn, e->e_dn) != 0)
+                       continue;
+
+               /* return locked entry entry */
+               return(e);
+       }
+}
+#endif
+
+Entry *
+dn2entry_r(
+       Backend *be,
+       char    *dn,
+       char    **matched
+)
+{
+       return( dn2entry( be, dn, matched, 0 ) );
+}
+
+Entry *
+dn2entry_w(
+       Backend *be,
+       char    *dn,
+       char    **matched
+)
+{
+       return( dn2entry( be, dn, matched, 1 ) );
+}
+
+
+
index b8272b87a15cf2f287c9372bf739412ea9914c85..7c555bfecbdfb1fb76690fb63e8c5645fb1a1821 100644 (file)
@@ -3,6 +3,7 @@
 #include "portable.h"
 
 #include <stdio.h>
+#include <ac/string.h>
 
 #include <ac/socket.h>
 
@@ -60,6 +61,49 @@ id2children_add(
        return( 0 );
 }
 
+
+int
+id2children_remove(
+    Backend    *be,
+    Entry      *p,
+    Entry      *e
+)
+{
+       struct dbcache  *db;
+       Datum           key;
+       int             len, rc;
+       IDList          *idl;
+       char            buf[20];
+
+       Debug( LDAP_DEBUG_TRACE, "=> id2children_remove( %d, %d )\n", p ? p->e_id
+           : 0, e->e_id, 0 );
+
+       if ( (db = ldbm_cache_open( be, "id2children", LDBM_SUFFIX,
+           LDBM_WRCREAT )) == NULL ) {
+               Debug( LDAP_DEBUG_ANY,
+                   "<= id2children_add -1 could not open \"id2children%s\"\n",
+                   LDBM_SUFFIX, 0, 0 );
+               return( -1 );
+       }
+
+       memset( &key, 0, sizeof(key) );
+       sprintf( buf, "%c%d", EQ_PREFIX, p ? p->e_id : 0 );
+       key.dptr = buf;
+       key.dsize = strlen( buf ) + 1;
+
+       if ( idl_delete_key( be, db, key, e->e_id ) != 0 ) {
+               Debug( LDAP_DEBUG_TRACE, "<= id2children_add -1 (idl_insert)\n",
+                   0, 0, 0 );
+               ldbm_cache_close( be, db );
+               return( -1 );
+       }
+
+       ldbm_cache_close( be, db );
+
+       Debug( LDAP_DEBUG_TRACE, "<= id2children_add 0\n", 0, 0, 0 );
+       return( 0 );
+}
+
 int
 has_children(
     Backend    *be,
index c458ca503ffe8f1dc1d49826a3e80cc7b0498181..edc8f4c7b209ee64c3aff293d0eb8f376e9c47ce 100644 (file)
@@ -48,7 +48,7 @@ id2entry_add( Backend *be, Entry *e )
 
        /* store it */
        flags = LDBM_REPLACE;
-       if ( li->li_flush_wrt ) flags |= LDBM_SYNC;
+       if ( li->li_dbcachewsync ) flags |= LDBM_SYNC;
        rc = ldbm_cache_store( db, key, data, flags );
 
        pthread_mutex_unlock( &entry2str_mutex );
index 2f96f8f3c500986cf76fcca13c644eee19346103..d1e38aa197627da0f01defe370f0e66ade2b7740 100644 (file)
@@ -195,7 +195,7 @@ idl_store(
 #endif
 
        flags = LDBM_REPLACE;
-       if( li->li_flush_wrt ) flags |= LDBM_SYNC;
+       if( li->li_dbcachewsync ) flags |= LDBM_SYNC;
        rc = ldbm_cache_store( db, key, data, flags );
 
        /* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */
@@ -618,6 +618,93 @@ idl_insert( IDList **idl, ID id, int maxids )
        return( i == 0 ? 1 : 0 );       /* inserted - first id changed or not */
 }
 
+int
+idl_delete_key (
+       Backend         *be,
+       struct dbcache  *db,
+       Datum           key,
+       ID              id
+)
+{
+       Datum  k2;
+       IDList *idl, *tmp;
+       int i, j, nids;
+       char    *kstr;
+
+       if ( (idl = idl_fetch_one( be, db, key ) ) == NULL )
+       {
+               /* It wasn't found.  Hmm... */
+               return -1;
+       }
+
+       if ( ! INDIRECT_BLOCK( idl ) )
+       {
+               for ( i=0; i < idl->b_nids; i++ )
+               {
+                       if ( idl->b_ids[i] == id )
+                       {
+                               memcpy ( &idl->b_ids[i], &idl->b_ids[i+1], sizeof(ID)*(idl->b_nids-(i+1)));
+                               idl->b_ids[idl->b_nids-1] = NOID;
+                               idl->b_nids--;
+                               if ( idl->b_nids )
+                                       idl_store( be, db, key, idl );
+                               else
+                                       ldbm_cache_delete( db, key );
+                               return 0;
+                       }
+                       /*  We didn't find the ID.  Hmmm... */
+               }
+               return -1;
+       }
+       
+       /* We have to go through an indirect block and find the ID
+          in the list of IDL's
+          */
+       for ( nids = 0; idl->b_ids[nids] != NOID; nids++ )
+               ;       /* NULL */
+       kstr = (char *) ch_malloc( key.dsize + 20 );
+       for ( j = 0; idl->b_ids[j] != NOID; j++ ) 
+       {
+               memset( &k2, 0, sizeof(k2) );
+               sprintf( kstr, "%c%s%d", CONT_PREFIX, key.dptr, idl->b_ids[j] );
+               k2.dptr = kstr;
+               k2.dsize = strlen( kstr ) + 1;
+
+               if ( (tmp = idl_fetch_one( be, db, k2 )) == NULL ) {
+                       Debug( LDAP_DEBUG_ANY,
+                           "idl_fetch of (%s) returns NULL\n", k2.dptr, 0, 0 );
+                       continue;
+               }
+               /*
+                  Now try to find the ID in tmp
+               */
+               for ( i=0; i < tmp->b_nids; i++ )
+               {
+                       if ( tmp->b_ids[i] == id )
+                       {
+                               memcpy ( &tmp->b_ids[i], &tmp->b_ids[i+1], sizeof(ID)*(tmp->b_nids-(i+1)));
+                               tmp->b_ids[tmp->b_nids-1] = NOID;
+                               tmp->b_nids--;
+                               if ( tmp->b_nids )
+                                       idl_store ( be, db, k2, tmp );
+                               else
+                               {
+                                       ldbm_cache_delete( db, k2 );
+                                       memcpy ( &idl->b_ids[j], &idl->b_ids[j+1], sizeof(ID)*(nids-(j+1)));
+                                       idl->b_ids[nids-1] = NOID;
+                                       nids--;
+                                       if ( ! nids )
+                                               ldbm_cache_delete( db, key );
+                                       else
+                                               idl_store( be, db, key, idl );
+                               }
+                               return 0;
+                       }
+               }
+       }
+       return -1;
+}
+
 static IDList *
 idl_dup( IDList *idl )
 {
index b9c5c2f3fa1feac501b93271679a854ce25819ec..9193f7213c7859e06d1d26f460d29dc4eb261fdd 100644 (file)
@@ -1,9 +1,12 @@
 /* init.c - initialize ldbm backend */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 #include "back-ldbm.h"
 
@@ -15,6 +18,10 @@ ldbm_back_init(
        char            *argv[ 4 ];
        int             i;
 
+#ifdef SLAPD_CRYPT
+       extern pthread_mutex_t crypt_mutex;
+#endif /* SLAPD_CRYPT */
+
        /* allocate backend-specific stuff */
        li = (struct ldbminfo *) ch_calloc( 1, sizeof(struct ldbminfo) );
 
@@ -27,6 +34,9 @@ ldbm_back_init(
        /* default database cache size */
        li->li_dbcachesize = DEFAULT_DBCACHE_SIZE;
 
+       /* default cache mode is sync on write */
+       li->li_dbcachewsync = 1;
+
        /* default file creation mode */
        li->li_mode = DEFAULT_MODE;
 
@@ -59,6 +69,9 @@ ldbm_back_init(
        pthread_mutex_init( &li->li_cache.c_mutex, pthread_mutexattr_default );
        pthread_mutex_init( &li->li_nextid_mutex, pthread_mutexattr_default );
        pthread_mutex_init( &li->li_dbcache_mutex, pthread_mutexattr_default );
+#ifdef SLAPD_CRYPT
+       pthread_mutex_init( &crypt_mutex, pthread_mutexattr_default );
+#endif /* SLAPD_CRYPT */
        pthread_cond_init( &li->li_dbcache_cv, pthread_condattr_default );
        for ( i = 0; i < MAXDBCACHE; i++ ) {
                pthread_mutex_init( &li->li_dbcache[i].dbc_mutex,
index 9839a542c19bb6e10994284659871ba3e2154749..6b73e802b72c16a04d304f9f02db77ab4ceeba3b 100644 (file)
@@ -17,7 +17,6 @@ extern pthread_mutex_t        currenttime_mutex;
 extern IDList          *idl_alloc();
 extern Attribute       *attr_find();
 extern IDList          *filter_candidates();
-extern char            *ch_realloc();
 extern char            *dn_parent();
 
 static IDList  *base_candidates();
index d05b79639df7f024d2c95461e996608f6aefa6fe..c3863bfd364c6c6bee1c7bdd19fbaabab5ca02c6 100644 (file)
@@ -1,9 +1,12 @@
 /* modify.c - shell backend modify function */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 #include "shell.h"
 
@@ -41,15 +44,15 @@ shell_back_modify(
        for ( ; mods != NULL; mods = mods->mod_next ) {
                switch ( mods->mod_op & ~LDAP_MOD_BVALUES ) {
                case LDAP_MOD_ADD:
-                       fprintf( wfp, "add: %s", mods->mod_type );
+                       fprintf( wfp, "add: %s\n", mods->mod_type );
                        break;
 
                case LDAP_MOD_DELETE:
-                       fprintf( wfp, "delete: %s", mods->mod_type );
+                       fprintf( wfp, "delete: %s\n", mods->mod_type );
                        break;
 
                case LDAP_MOD_REPLACE:
-                       fprintf( wfp, "replace: %s", mods->mod_type );
+                       fprintf( wfp, "replace: %s\n", mods->mod_type );
                        break;
                }
 
index 562ce5b54ab6c08665074201735a7ab76cc798a2..8d3979992c57bca3e662fffebbc0c3de67f42878 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 
 extern Backend *select_backend();
+extern char    *suffixAlias();
 
 extern char    *default_referral;
 
@@ -29,7 +33,8 @@ do_bind(
 )
 {
        BerElement      *ber = op->o_ber;
-       int             version, method, len, rc;
+       int             version, method, len;
+       unsigned long   rc;
        char            *dn;
        struct berval   cred;
        Backend         *be;
@@ -50,7 +55,7 @@ do_bind(
         *      }
         */
 
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
        /*
         * in version 3.0 there is an extra SEQUENCE tag after the
         * BindRequest SEQUENCE tag.
@@ -79,13 +84,13 @@ do_bind(
                    "decoding error" );
                return;
        }
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
        if ( conn->c_version == 30 ) {
                switch ( method ) {
                case LDAP_AUTH_SIMPLE_30:
                        method = LDAP_AUTH_SIMPLE;
                        break;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
                case LDAP_AUTH_KRBV41_30:
                        method = LDAP_AUTH_KRBV41;
                        break;
@@ -143,14 +148,21 @@ do_bind(
                        free( cred.bv_val );
                }
                if ( cred.bv_len == 0 ) {
-                       send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL );
+                       send_ldap_result( conn, op, LDAP_SUCCESS,
+                               NULL, NULL );
+               } else if ( default_referral && *default_referral ) {
+                       send_ldap_result( conn, op, LDAP_PARTIAL_RESULTS,
+                               NULL, default_referral );
                } else {
-                       send_ldap_result( conn, op, LDAP_PARTIAL_RESULTS, NULL,
-                           default_referral );
+                       send_ldap_result( conn, op, LDAP_INVALID_CREDENTIALS,
+                               NULL, default_referral );
                }
                return;
        }
 
+        /* alias suffix */
+        dn = suffixAlias ( dn, op, be );
+
        if ( be->be_bind != NULL ) {
                if ( (*be->be_bind)( be, conn, op, dn, method, &cred ) == 0 ) {
                        pthread_mutex_lock( &conn->c_dnmutex );
index 43ec4c9adb08ebd63a0eaec3e9967f9bc3252379..519720e238862417b221b7fcb5b288f995e2ae0e 100644 (file)
@@ -1,18 +1,22 @@
 /* ch_malloc.c - malloc routines that test returns from malloc and friends */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "slap.h"
 
-char *
+void *
 ch_malloc(
     unsigned long      size
 )
 {
-       char    *new;
+       void    *new;
 
-       if ( (new = (char *) malloc( size )) == NULL ) {
+       if ( (new = (void *) malloc( size )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "malloc of %d bytes failed\n", size, 0, 0 );
                exit( 1 );
        }
@@ -20,19 +24,19 @@ ch_malloc(
        return( new );
 }
 
-char *
+void *
 ch_realloc(
-    char               *block,
+    void               *block,
     unsigned long      size
 )
 {
-       char    *new;
+       void    *new;
 
        if ( block == NULL ) {
                return( ch_malloc( size ) );
        }
 
-       if ( (new = (char *) realloc( block, size )) == NULL ) {
+       if ( (new = (void *) realloc( block, size )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "realloc of %d bytes failed\n", size, 0, 0 );
                exit( 1 );
        }
@@ -40,15 +44,15 @@ ch_realloc(
        return( new );
 }
 
-char *
+void *
 ch_calloc(
     unsigned long      nelem,
     unsigned long      size
 )
 {
-       char    *new;
+       void    *new;
 
-       if ( (new = (char *) calloc( nelem, size )) == NULL ) {
+       if ( (new = (void *) calloc( nelem, size )) == NULL ) {
                Debug( LDAP_DEBUG_ANY, "calloc of %d elems of %d bytes failed\n",
                  nelem, size, 0 );
                exit( 1 );
index 5c3ebdf708f7307d78562dee2c30ceaf4f4e567d..abc10cdfced93e96c7e52a4da075c3b227683f16 100644 (file)
@@ -1,11 +1,13 @@
-#include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <errno.h>
-#include <signal.h>
 #include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/errno.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include "slap.h"
 
 extern Operation       *op_add();
@@ -16,10 +18,6 @@ extern long          ops_initiated;
 extern long            ops_completed;
 extern pthread_mutex_t ops_mutex;
 extern pthread_t       listener_tid;
-#ifndef SYSERRLIST_IN_STDIO
-extern int             sys_nerr;
-extern char            *sys_errlist[];
-#endif
 
 struct co_arg {
        Connection      *co_conn;
@@ -50,7 +48,7 @@ connection_operation( struct co_arg *arg )
                do_bind( arg->co_conn, arg->co_op );
                break;
 
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
        case LDAP_REQ_UNBIND_30:
 #endif
        case LDAP_REQ_UNBIND:
@@ -61,7 +59,7 @@ connection_operation( struct co_arg *arg )
                do_add( arg->co_conn, arg->co_op );
                break;
 
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
        case LDAP_REQ_DELETE_30:
 #endif
        case LDAP_REQ_DELETE:
@@ -84,7 +82,7 @@ connection_operation( struct co_arg *arg )
                do_search( arg->co_conn, arg->co_op );
                break;
 
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
        case LDAP_REQ_ABANDON_30:
 #endif
        case LDAP_REQ_ABANDON:
@@ -175,7 +173,7 @@ connection_activity(
                return;
        }
 
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
        if ( conn->c_version == 30 ) {
                (void) ber_skip_tag( ber, &len );
        }
@@ -203,13 +201,30 @@ connection_activity(
 
        pthread_attr_init( &attr );
        pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
+#if !defined(HAVE_PTHREADS_D4)
+       /* POSIX_THREADS or compatible
+        * This is a draft 10 or standard pthreads implementation
+        */
+       if ( pthread_create( &arg->co_op->o_tid, &attr,
+           connection_operation, (void *) arg ) != 0 ) {
+               Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
+       } else {
+               pthread_mutex_lock( &active_threads_mutex );
+               active_threads++;
+               pthread_mutex_unlock( &active_threads_mutex );
+       }
+#else  /* pthread draft4  */
+       /*
+        * This is a draft 4 or earlier pthreads implementation
+        */
        if ( pthread_create( &arg->co_op->o_tid, attr,
-           (void *) connection_operation, (void *) arg ) != 0 ) {
+           connection_operation, (void *) arg ) != 0 ) {
                Debug( LDAP_DEBUG_ANY, "pthread_create failed\n", 0, 0, 0 );
        } else {
                pthread_mutex_lock( &active_threads_mutex );
                active_threads++;
                pthread_mutex_unlock( &active_threads_mutex );
        }
+#endif /* pthread draft4 */
        pthread_attr_destroy( &attr );
 }
index f408e6838301e923a0d42e58da13947deda45a71..4f76fa55b9742bb3f8d5c31aa915edbed5439637 100644 (file)
@@ -13,8 +13,6 @@ static int    get_filter_list();
 static int     get_substring_filter();
 
 extern int     get_ava();
-extern char    *ch_malloc();
-extern char    *ch_realloc();
 
 int
 get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr )
index 47f09cf546c572df28a79b9518a27e915fce65d5..ad80443eb93755f78c803c416678309aeccc60b1 100644 (file)
@@ -43,6 +43,8 @@ lock_fopen( char *fname, char *type, FILE **lfp )
 #else
                lockf( fileno( *lfp ), F_ULOCK, 0 );
 #endif
+               fclose( *lfp );
+               *lfp = NULL;
                return( NULL );
        }
 
index ec3b4a9b93e3ac01df30993e086edbc2aaea653d..f38fea58e4c95d6963a46e7cbc39352d2b6785a1 100644 (file)
@@ -187,7 +187,7 @@ main( argc, argv )
                pthread_attr_init( &attr );
                pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
 
-#if !defined(HAVE_PTHREADS_D4) && !defined(HAVE_DCE)
+#if !defined(HAVE_PTHREADS_D4)
                /* POSIX_THREADS or compatible
                 * This is a draft 10 or standard pthreads implementation
                 */
index a1ff6e5e755cb202ec1fb25028591eb53c45af47..ef402878e030bb0f57207de6702ce7fd9847691b 100644 (file)
 #ifndef _PROTO_SLAP
 #define _PROTO_SLAP
 
+#include <ldap_cdefs.h>
+
 /*
  * acl.c
  */
 
-int access_allowed( Backend *be, Connection *conn, Operation *op, Entry *e,
-       char *attr, struct berval *val, char *dn, int  access );
-struct acl * acl_get_applicable( Backend *be, Operation *op, Entry *e,
-       char *attr );
-int acl_access_allowed( struct acl *a, Backend *be, Connection *conn, Entry *e,
-       struct berval *val, Operation *op, int  access );
-int acl_check_mods( Backend *be, Connection *conn, Operation *op, Entry *e,
-       LDAPMod *mods );
+int access_allowed LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
+       char *attr, struct berval *val, char *dn, int  access ));
+
+struct acl * acl_get_applicable LDAP_P(( Backend *be, Operation *op, Entry *e,
+       char *attr, char *edn, int nmatches, regmatch_t *matches ));
+int acl_access_allowed LDAP_P(( struct acl *a, Backend *be, Connection *conn, Entry *e,
+       struct berval *val, Operation *op, int  access, char *edn,
+       regmatch_t *matches ));
+
+int acl_check_mods LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
+       LDAPMod *mods ));
 
 /*
  * aclparse.c
  */
 
-void parse_acl( Backend *be, char *fname, int lineno, int argc, char **argv );
-char * access2str( int access );
-int str2access( char *str );
+void parse_acl LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv ));
+char * access2str LDAP_P(( int access ));
+int str2access LDAP_P(( char *str ));
 
 /*
  * attr.c
  */
 
-void attr_free( Attribute *a );
-char * attr_normalize( char *s );
-int attr_merge_fast( Entry *e, char *type, struct berval **vals, int  nvals,
-       int  naddvals, int  *maxvals, Attribute ***a );
-int attr_merge( Entry *e, char *type, struct berval **vals );
-Attribute * attr_find( Attribute *a, char *type );
-int attr_delete( Attribute **attrs, char *type );
-int attr_syntax( char *type );
-void attr_syntax_config( char *fname, int lineno, int argc, char **argv );
+void attr_free LDAP_P(( Attribute *a ));
+char * attr_normalize LDAP_P(( char *s ));
+int attr_merge_fast LDAP_P(( Entry *e, char *type, struct berval **vals, int  nvals,
+       int  naddvals, int  *maxvals, Attribute ***a ));
+int attr_merge LDAP_P(( Entry *e, char *type, struct berval **vals ));
+Attribute * attr_find LDAP_P(( Attribute *a, char *type ));
+int attr_delete LDAP_P(( Attribute **attrs, char *type ));
+int attr_syntax LDAP_P(( char *type ));
+void attr_syntax_config LDAP_P(( char *fname, int lineno, int argc, char **argv ));
 
 /*
  * ava.c
  */
 
-int get_ava( BerElement *ber, Ava *ava );
-void ava_free( Ava *ava, int freeit );
+int get_ava LDAP_P(( BerElement *ber, Ava *ava ));
+void ava_free LDAP_P(( Ava *ava, int freeit ));
 
 /*
  * backend.c
  */
 
-Backend * new_backend( char *type );
-Backend * select_backend( char * dn );
-int be_issuffix( Backend *be, char *suffix );
-int be_isroot( Backend *be, char *dn );
-int be_isroot_pw( Backend *be, char *dn, struct berval *cred );
-void be_close();
+Backend * new_backend LDAP_P(( char *type ));
+Backend * select_backend LDAP_P(( char * dn ));
+int be_issuffix LDAP_P(( Backend *be, char *suffix ));
+int be_isroot LDAP_P(( Backend *be, char *dn ));
+int be_isroot_pw LDAP_P(( Backend *be, char *dn, struct berval *cred ));
+void be_close LDAP_P(());
 
 /*
  * ch_malloc.c
  */
 
-char * ch_malloc( unsigned long size );
-char * ch_realloc( char *block, unsigned long size );
-char * ch_calloc( unsigned long nelem, unsigned long size );
+void * ch_malloc LDAP_P(( unsigned long size ));
+void * ch_realloc LDAP_P(( void *block, unsigned long size ));
+void * ch_calloc LDAP_P(( unsigned long nelem, unsigned long size ));
 
 /*
  * charray.c
  */
 
-void charray_add( char ***a, char *s );
-void charray_merge( char ***a, char **s );
-void charray_free( char **array );
-int charray_inlist( char **a, char *s );
-char ** charray_dup( char **a );
-char ** str2charray( char *str, char *brkstr );
+void charray_add LDAP_P(( char ***a, char *s ));
+void charray_merge LDAP_P(( char ***a, char **s ));
+void charray_free LDAP_P(( char **array ));
+int charray_inlist LDAP_P(( char **a, char *s ));
+char ** charray_dup LDAP_P(( char **a ));
+char ** str2charray LDAP_P(( char *str, char *brkstr ));
 
 /*
  * config.c
  */
 
-void read_config( char *fname, Backend **bep, FILE *pfp );
+void read_config LDAP_P(( char *fname, Backend **bep, FILE *pfp ));
 
 /*
  * connection.c
  */
 
-void connection_activity( Connection *conn );
+void connection_activity LDAP_P(( Connection *conn ));
 
 /*
  * dn.c
  */
 
-char * dn_normalize( char *dn );
-char * dn_normalize_case( char *dn );
-char * dn_parent( Backend *be, char *dn );
-int dn_issuffix( char *dn, char *suffix );
-int dn_type( char *dn );
-char * dn_upcase( char *dn );
+char * dn_normalize LDAP_P(( char *dn ));
+char * dn_normalize_case LDAP_P(( char *dn ));
+char * dn_parent LDAP_P(( Backend *be, char *dn ));
+int dn_issuffix LDAP_P(( char *dn, char *suffix ));
+int dn_type LDAP_P(( char *dn ));
+char * dn_upcase LDAP_P(( char *dn ));
 
 /*
  * entry.c
  */
 
-Entry * str2entry( char        *s );
-char * entry2str( Entry *e, int *len, int printid );
-void entry_free( Entry *e );
+Entry * str2entry LDAP_P(( char        *s ));
+char * entry2str LDAP_P(( Entry *e, int *len, int printid ));
+void entry_free LDAP_P(( Entry *e ));
+
+int entry_rdwr_lock LDAP_P(( Entry *e, int rw ));
+int entry_rdwr_rlock LDAP_P(( Entry *e ));
+int entry_rdwr_wlock LDAP_P(( Entry *e ));
+int entry_rdwr_unlock LDAP_P(( Entry *e, int rw ));
+int entry_rdwr_runlock LDAP_P(( Entry *e ));
+int entry_rdwr_wunlock LDAP_P(( Entry *e ));
+int entry_rdwr_init LDAP_P(( Entry *e ));
 
 /*
  * filter.c
  */
 
-int get_filter( Connection *conn, BerElement *ber, Filter **filt, char **fstr );
-void filter_free( Filter *f );
-void filter_print( Filter *f );
+int get_filter LDAP_P(( Connection *conn, BerElement *ber, Filter **filt, char **fstr ));
+void filter_free LDAP_P(( Filter *f ));
+void filter_print LDAP_P(( Filter *f ));
 
 /*
  * filterentry.c
  */
 
-int test_filter( Backend *be, Connection *conn, Operation *op, Entry *e,
-       Filter  *f );
+int test_filter LDAP_P(( Backend *be, Connection *conn, Operation *op, Entry *e,
+       Filter  *f ));
 
 /*
  * lock.c
  */
 
-FILE * lock_fopen( char *fname, char *type, FILE **lfp );
-int lock_fclose( FILE *fp, FILE *lfp );
+FILE * lock_fopen LDAP_P(( char *fname, char *type, FILE **lfp ));
+int lock_fclose LDAP_P(( FILE *fp, FILE *lfp ));
 
 /*
  * monitor.c
  */
 
-void monitor_info( Connection *conn, Operation *op );
+void monitor_info LDAP_P(( Connection *conn, Operation *op ));
 
 /*
  * operation.c
  */
 
-void op_free( Operation *op );
-Operation * op_add( Operation **olist, BerElement *ber, unsigned long msgid,
-       unsigned long tag, char *dn, int id, int connid );
-void op_delete( Operation **olist, Operation *op );
+void op_free LDAP_P(( Operation *op ));
+Operation * op_add LDAP_P(( Operation **olist, BerElement *ber, unsigned long msgid,
+       unsigned long tag, char *dn, int id, int connid ));
+void op_delete LDAP_P(( Operation **olist, Operation *op ));
 
 /*
  * phonetic.c
  */
 
-char * first_word( char *s );
-char * next_word( char *s );
-char * word_dup( char *w );
-char * phonetic( char *s );
+char * first_word LDAP_P(( char *s ));
+char * next_word LDAP_P(( char *s ));
+char * word_dup LDAP_P(( char *w ));
+char * phonetic LDAP_P(( char *s ));
 
 /*
  * repl.c
  */
 
-void replog( Backend *be, int optype, char *dn, void *change, int flag );
+void replog LDAP_P(( Backend *be, int optype, char *dn, void *change, int flag ));
 
 /*
  * result.c
  */
 
-void send_ldap_result( Connection *conn, Operation *op, int err, char *matched,
-       char *text );
-void send_ldap_search_result( Connection *conn, Operation *op, int err,
-       char *matched, char *text, int nentries );
-void close_connection( Connection *conn, int opconnid, int opid );
+void send_ldap_result LDAP_P(( Connection *conn, Operation *op, int err, char *matched,
+       char *text ));
+void send_ldap_search_result LDAP_P(( Connection *conn, Operation *op, int err,
+       char *matched, char *text, int nentries ));
+void close_connection LDAP_P(( Connection *conn, int opconnid, int opid ));
 
 /*
  * schema.c
  */
 
-int oc_schema_check( Entry *e );
+int oc_schema_check LDAP_P(( Entry *e ));
 
 /*
  * schemaparse.c
  */
 
-void parse_oc( Backend *be, char *fname, int lineno, int argc, char **argv );
+void parse_oc LDAP_P(( Backend *be, char *fname, int lineno, int argc, char **argv ));
 
 /*
  * str2filter.c
  */
 
-Filter * str2filter( char *str );
+Filter * str2filter LDAP_P(( char *str ));
 
 /*
  * value.c
  */
 
-int value_add_fast( struct berval ***vals, struct berval **addvals, int nvals,
-       int naddvals, int *maxvals );
-int value_add( struct berval ***vals, struct berval **addvals );
-void value_normalize( char *s, int syntax );
-int value_cmp( struct berval *v1, struct berval *v2, int syntax,
-       int normalize );
-int value_ncmp( struct berval *v1, struct berval *v2, int syntax, int len,
-       int normalize );
-int value_find( struct berval **vals, struct berval *v, int syntax,
-       int normalize );
+int value_add_fast LDAP_P(( struct berval ***vals, struct berval **addvals, int nvals,
+       int naddvals, int *maxvals ));
+int value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
+void value_normalize LDAP_P(( char *s, int syntax ));
+int value_cmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax,
+       int normalize ));
+int value_ncmp LDAP_P(( struct berval *v1, struct berval *v2, int syntax, int len,
+       int normalize ));
+int value_find LDAP_P(( struct berval **vals, struct berval *v, int syntax,
+       int normalize ));
+
+/*
+ * suffixAlias.c
+ */
+char *suffixAlias LDAP_P(( char *dn, Operation *op, Backend *be ));
 
 #endif /* _proto_slap */
index 028b1919620527b5bbaa26a9d4188e855028c9a5..d47d754f576608e77fe2e0be532518cc138f3971 100644 (file)
@@ -1,11 +1,15 @@
 /* repl.c - log modifications for replication purposes */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include <sys/file.h>
-#include <sys/socket.h>
-#include <slap.h>
+
+#include "slap.h"
 
 extern pthread_mutex_t replog_mutex;
 extern pthread_mutex_t entry2str_mutex;
@@ -14,7 +18,6 @@ extern char           *replogfile;
 
 extern FILE    *lock_fopen();
 extern int     lock_fclose();
-extern char    *ch_malloc();
 extern char    *entry2str();
 
 void
@@ -77,7 +80,7 @@ replog(
                                len = strlen( mods->mod_type );
                                len = LDIF_SIZE_NEEDED( len,
                                    mods->mod_bvalues[i]->bv_len ) + 1;
-                               buf = ch_malloc( len );
+                               buf = (char *) ch_malloc( len );
 
                                bufp = buf;
                                put_type_and_value( &bufp, mods->mod_type,
index 79233f88e5e4be7c4b08f851baff1177b30dc9ac..49aaf52db53d0e5166871aa322afee25dd11d1cb 100644 (file)
@@ -3,8 +3,6 @@
 #ifndef _SLDAPD_H_
 #define _SLDAPD_H_
 
-#include "portable.h"
-
 #include <stdlib.h>
 
 #include <sys/types.h>
index 8e964ed05e90f3619ba48e891d90f4e1472048cd..9f1e81f9773c3aa5ba78e9aad24b974d7d02512a 100644 (file)
@@ -3,6 +3,7 @@
 #include "portable.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 
 #include <ac/ctype.h>
 #include <ac/string.h>
index f9f3b3c5d78b2cd8c2814d57e8182ec4c8408601..f76884643b7ab8b8566fb92a06c55ce3c3a7461a 100644 (file)
  * slapd/slurpd locking conventions.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
 #include <stdlib.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
 
 #include <quipu/commonarg.h>
 #include <quipu/attrvalue.h>
@@ -31,7 +34,7 @@ static void de_t61();
 
 extern FILE *lock_fopen( char *, char *, FILE ** );
 extern int lock_fclose( FILE *, FILE * );
-extern char *ch_realloc( char *, unsigned long ); 
+extern void *ch_realloc( void *, unsigned long ); 
 
 short  ldap_dn_syntax;
 PS     rps;
index dc9f25d584e9d80d46c4ee47bff1c4541c53d554..0668eddbcd0e80ebced57c4e1f2028bde9aa5b9d 100644 (file)
@@ -1,8 +1,11 @@
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+#include <stdlib.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "lber.h"
 #include "ldap.h"
 #include "ldif.h"
@@ -24,7 +27,7 @@ main( argc, argv )
 {
        char    buf[BUFSIZ];
        char    *type, *out;
-       int     binary = 0;
+       int     len, binary = 0;
 
        if (argc < 2 || argc > 3 ) {
                usage( argv[0] );
@@ -79,7 +82,9 @@ main( argc, argv )
        }
 
        /* not binary:  one value per line... */
-       while ( gets( buf ) != NULL ) {
+       while ( fgets( buf, sizeof(buf), stdin ) != NULL ) {
+               if( buf[len=strlen(buf)] == '\n') buf[len] = '\0';
+
                if (( out = ldif_type_and_value( type, buf, strlen( buf ) ))
                    == NULL ) {
                        perror( "ldif_type_and_value" );
index 2fb2aaf6039066f35d242610872be9686747f398..ee128855a86baa9274c5e06b65dcb70eaca693ee 100644 (file)
@@ -1,19 +1,22 @@
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "../slap.h"
 #include "../back-ldbm/back-ldbm.h"
 
-#define DEFAULT_CONFIGFILE     "/usr/local/etc/slapd.conf"
+#include "ldapconfig.h"
+#include "ldif.h"
+
 #define MAXARGS                100
 
 extern struct dbcache  *ldbm_cache_open();
 extern void            attr_index_config();
-extern char            *str_getline();
 extern char            *dn_parent();
 extern char            *dn_normalize_case();
-extern int             strcasecmp();
 extern int             nbackends;
 extern Backend         *backends;
 extern int             ldap_debug;
@@ -39,8 +42,6 @@ pthread_mutex_t       replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
 
-static int     make_index();
-
 static char    *tailorfile;
 static char    *inputfile;
  
@@ -63,13 +64,13 @@ main( int argc, char **argv )
        int             dbnum;
        ID              id;
        struct dbcache  *db, *db2;
-       Backend         *be;
+       Backend         *be = NULL;
        struct berval   bv;
        struct berval   *vals[2];
        Avlnode         *avltypes = NULL;
        extern char     *optarg;
 
-       tailorfile = DEFAULT_CONFIGFILE;
+       tailorfile = SLAPD_DEFAULT_CONFIGFILE;
        dbnum = -1;
        while ( (i = getopt( argc, argv, "d:f:i:n:" )) != EOF ) {
                switch ( i ) {
@@ -121,7 +122,7 @@ main( int argc, char **argv )
                        fprintf( stderr, "No ldbm database found in config file\n" );
                        exit( 1 );
                }
-       } else if ( dbnum < 1 || dbnum > nbackends ) {
+       } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
                fprintf( stderr, "Database number selected via -n is out of range\n" );
                fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
                exit( 1 );
index af377f6751abf68c059c6596d91bb0223160d91a..9995dea664fa3b5f88fd40e3a9e553cf0014f00d 100644 (file)
@@ -1,14 +1,18 @@
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include "../slap.h"
 
-#define DEFAULT_CONFIGFILE      "/usr/local/etc/slapd.conf"
+#include "ldapconfig.h"
+#include "ldif.h"
+
 #define MAXARGS                100
 
 extern void    attr_index_config();
-extern char    *str_getline();
 extern char    *attr_normalize();
 extern int     nbackends;
 extern Backend *backends;
@@ -53,13 +57,13 @@ main( int argc, char **argv )
        int             lmax, lcur, indexmask, syntaxmask;
        int             dbnum;
        unsigned long   id;
-       Backend         *be;
+       Backend         *be = NULL;
        struct berval   bv;
        struct berval   *vals[2];
        extern char     *optarg;
 
        inputfile = NULL;
-       tailorfile = DEFAULT_CONFIGFILE;
+       tailorfile = SLAPD_DEFAULT_CONFIGFILE;
        dbnum = -1;
        while ( (i = getopt( argc, argv, "d:f:i:n:" )) != EOF ) {
                switch ( i ) {
@@ -108,7 +112,7 @@ main( int argc, char **argv )
                        fprintf( stderr, "No ldbm database found in config file\n" );
                        exit( 1 );
                }
-       } else if ( dbnum < 1 || dbnum > nbackends ) {
+       } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
                fprintf( stderr, "Database number selected via -n is out of range\n" );
                fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
                exit( 1 );
index b2caa7b3cc0d87f86bd6cfd8b42ce1df40c3654f..01ae4fbd2165730d7311ea5872efe224231a8e99 100644 (file)
@@ -1,23 +1,24 @@
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
 #include <sys/param.h>
+
 #include "../slap.h"
 #include "../back-ldbm/back-ldbm.h"
+#include "ldapconfig.h"
+#include "ldif.h"
 
-#define DEFAULT_CONFIGFILE     "%ETCDIR%/slapd.conf"
-#define DEFAULT_ETCDIR         "%ETCDIR%"
 #define INDEXCMD               "ldif2index"
 #define ID2ENTRYCMD            "ldif2id2entry"
 #define ID2CHILDRENCMD         "ldif2id2children"
 #define MAXARGS                100
 
-extern void            attr_index_config();
-extern char            *str_getline();
-extern int             strcasecmp();
 extern int             nbackends;
-extern Backend         *backends;
+extern Backend *backends;
 extern int             ldap_debug;
 
 int            ldap_debug;
@@ -40,8 +41,8 @@ pthread_mutex_t       replog_mutex;
 pthread_mutex_t        ops_mutex;
 pthread_mutex_t        regex_mutex;
 
-static void    fork_child();
-static void    wait4kids();
+static void fork_child( char *prog, char *args[] );
+static void    wait4kids( int nkidval );
 
 static char    *indexcmd;
 static char    *tailorfile;
@@ -52,14 +53,14 @@ static int      nkids;
 static void
 usage( char *name )
 {
-       fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-j #jobs] [-n databasenumber] [-e etcdir]\n", name );
+       fprintf( stderr, "usage: %s -i inputfile [-d debuglevel] [-f configfile] [-j #jobs] [-n databasenumber] [-s sbindir]\n", name );
        exit( 1 );
 }
 
 main( int argc, char **argv )
 {
        int             i, stop, status;
-       char            *linep, *buf, *etcdir;
+       char            *linep, *buf, *sbindir;
        char            *args[10];
        char            buf2[20], buf3[20];
        char            line[BUFSIZ];
@@ -74,17 +75,18 @@ main( int argc, char **argv )
        Avlnode         *avltypes = NULL;
        extern char     *optarg;
 
-       etcdir = DEFAULT_ETCDIR;
-       tailorfile = DEFAULT_CONFIGFILE;
+       sbindir = DEFAULT_SBINDIR;
+       tailorfile = SLAPD_DEFAULT_CONFIGFILE;
        dbnum = -1;
-       while ( (i = getopt( argc, argv, "d:e:f:i:j:n:" )) != EOF ) {
+       while ( (i = getopt( argc, argv, "d:e:s:f:i:j:n:" )) != EOF ) {
                switch ( i ) {
                case 'd':       /* turn on debugging */
                        ldap_debug = atoi( optarg );
                        break;
 
-               case 'e':       /* alternate etcdir (index cmd location) */
-                       etcdir = strdup( optarg );
+               case 's':       /* alternate sbindir (index cmd location) */
+               case 'e':       /* accept -e for backwards compatibility */
+                       sbindir = strdup( optarg );
                        break;
 
                case 'f':       /* specify a tailor file */
@@ -135,7 +137,7 @@ main( int argc, char **argv )
                        fprintf( stderr, "No ldbm database found in config file\n" );
                        exit( 1 );
                }
-       } else if ( dbnum < 0 || dbnum > nbackends ) {
+       } else if ( dbnum < 0 || dbnum > (nbackends-1) ) {
                fprintf( stderr, "Database number selected via -n is out of range\n" );
                fprintf( stderr, "Must be in the range 1 to %d (number of databases in the config file)\n", nbackends );
                exit( 1 );
@@ -150,14 +152,14 @@ main( int argc, char **argv )
         */
 
        i = 0;
-       sprintf( cmd, "%s/%s", etcdir, ID2ENTRYCMD );
+       sprintf( cmd, "%s/%s", sbindir, ID2ENTRYCMD );
        args[i++] = cmd;
        args[i++] = "-i";
        args[i++] = inputfile;
        args[i++] = "-f";
        args[i++] = tailorfile;
        args[i++] = "-n";
-       sprintf( buf2, "%d", dbnum );
+       sprintf( buf2, "%d", dbnum+1 );
        args[i++] = buf2;
        if ( ldap_debug ) {
                sprintf( buf3, "%d", ldap_debug );
@@ -172,14 +174,14 @@ main( int argc, char **argv )
         */
 
        i = 0;
-       sprintf( cmd, "%s/%s", etcdir, ID2CHILDRENCMD );
+       sprintf( cmd, "%s/%s", sbindir, ID2CHILDRENCMD );
        args[i++] = cmd;
        args[i++] = "-i";
        args[i++] = inputfile;
        args[i++] = "-f";
        args[i++] = tailorfile;
        args[i++] = "-n";
-       sprintf( buf2, "%d", dbnum );
+       sprintf( buf2, "%d", dbnum+1 );
        args[i++] = buf2;
        if ( ldap_debug ) {
                sprintf( buf3, "%d", ldap_debug );
@@ -194,14 +196,14 @@ main( int argc, char **argv )
         */
 
        i = 0;
-       sprintf( cmd, "%s/%s", etcdir, INDEXCMD );
+       sprintf( cmd, "%s/%s", sbindir, INDEXCMD );
        args[i++] = cmd;
        args[i++] = "-i";
        args[i++] = inputfile;
        args[i++] = "-f";
        args[i++] = tailorfile;
        args[i++] = "-n";
-       sprintf( buf2, "%d", dbnum );
+       sprintf( buf2, "%d", dbnum+1 );
        args[i++] = buf2;
        if ( ldap_debug ) {
                sprintf( buf3, "%d", ldap_debug );
index d23bfbeb0107f9f332a124e82c99e17115507f7b..cf3b79c0b93b10ad4859f8a9f087a8c3818524c2 100644 (file)
  * Just like malloc, except we check the returned value and exit
  * if anything goes wrong.
  */
-char *
+void *
 ch_malloc(
     unsigned long      size
 )
 {
-       char    *new;
+       void    *new;
 
-       if ( (new = (char *) malloc( size )) == NULL ) {
+       if ( (new = (void *) malloc( size )) == NULL ) {
                fprintf( stderr, "malloc of %lu bytes failed\n", size );
                exit( 1 );
        }
@@ -50,19 +50,19 @@ ch_malloc(
  * Just like realloc, except we check the returned value and exit
  * if anything goes wrong.
  */
-char *
+void *
 ch_realloc(
-    char               *block,
+    void               *block,
     unsigned long      size
 )
 {
-       char    *new;
+       void    *new;
 
        if ( block == NULL ) {
                return( ch_malloc( size ) );
        }
 
-       if ( (new = (char *) realloc( block, size )) == NULL ) {
+       if ( (new = (void *) realloc( block, size )) == NULL ) {
                fprintf( stderr, "realloc of %lu bytes failed\n", size );
                exit( 1 );
        }
@@ -77,15 +77,15 @@ ch_realloc(
  * Just like calloc, except we check the returned value and exit
  * if anything goes wrong.
  */
-char *
+void *
 ch_calloc(
     unsigned long      nelem,
     unsigned long      size
 )
 {
-       char    *new;
+       void    *new;
 
-       if ( (new = (char *) calloc( nelem, size )) == NULL ) {
+       if ( (new = (void *) calloc( nelem, size )) == NULL ) {
                fprintf( stderr, "calloc of %lu elems of %lu bytes failed\n",
                    nelem, size );
                exit( 1 );
@@ -100,7 +100,7 @@ ch_calloc(
  */
 void
 ch_free(
-    char *p
+    void *p
 )
 {
     if ( p != NULL ) {
index 2d36838bb549dc4ed3086f44bcf955af03d370a6..602f8cd8a6547b4a89d82903fc27d0fbb2872d87 100644 (file)
  * fm.c - file management routines.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <signal.h>
+
+#include <ac/string.h>
+#include <ac/signal.h>
 
 #include "slurp.h"
 #include "globals.h"
 
-extern void do_admin();
-
-static void set_shutdown();
-void do_nothing();
 
 /*
  * Externs
  */
-#ifdef NEEDPROTOS
-extern int file_nonempty( char * );
-extern int acquire_lock(char *, FILE **, FILE ** );
-extern int relinquish_lock(char *, FILE *, FILE * );
-#else /* NEEDPROTOS */
-extern int file_nonempty();
-extern int acquire_lock();
-extern int relinquish_lock();
-#endif /* NEEDPROTOS */
+extern RETSIGTYPE do_admin LDAP_P((int));
+extern int file_nonempty LDAP_P(( char * ));
+extern int acquire_lock LDAP_P((char *, FILE **, FILE ** ));
+extern int relinquish_lock LDAP_P((char *, FILE *, FILE * ));
 
 /*
  * Forward references
  */
-#ifdef NEEDPROTOS
-static char *get_record( FILE * );
-static void populate_queue( char *f );
-static void set_shutdown();
-void do_nothing();
-#else /* NEEDPROTOS */
-static char *get_record();
-static void populate_queue();
-static void set_shutdown();
-void do_nothing();
-#endif /* NEEDPROTOS */
-
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
-#endif /* SYSERRLIST_IN_STDIO */
-
+static char *get_record LDAP_P(( FILE * ));
+static void populate_queue LDAP_P(( char *f ));
+static RETSIGTYPE set_shutdown LDAP_P((int));
+RETSIGTYPE do_nothing LDAP_P((int));
 
 
 /*
@@ -77,15 +59,20 @@ fm(
 
     /* Set up our signal handlers:
      * SIG{TERM,INT,HUP} causes a shutdown
-     * SIGUSR1 - does nothing, used to wake up sleeping threads.
-     * SIGUSR2 - causes slurpd to read its administrative interface file.
+     * SIG(STKFLT|USR1) - does nothing, used to wake up sleeping threads.
+     * SIG(UNUSED|USR2) - causes slurpd to read its administrative interface file.
      *           (not yet implemented).
      */
-    (void) SIGNAL( SIGUSR1, (void *) do_nothing );
-    (void) SIGNAL( SIGUSR2, (void *) do_admin );
-    (void) SIGNAL( SIGTERM, (void *) set_shutdown );
-    (void) SIGNAL( SIGINT, (void *) set_shutdown );
-    (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+#ifdef HAVE_LINUX_THREADS
+    (void) SIGNAL( SIGSTKFLT, do_nothing );
+    (void) SIGNAL( SIGUNUSED, do_admin );
+#else
+    (void) SIGNAL( SIGUSR1, do_nothing );
+    (void) SIGNAL( SIGUSR2, do_admin );
+#endif
+    (void) SIGNAL( SIGTERM, set_shutdown );
+    (void) SIGNAL( SIGINT, set_shutdown );
+    (void) SIGNAL( SIGHUP, set_shutdown );
 
     if ( sglob->one_shot_mode ) {
        if ( file_nonempty( sglob->slapd_replogfile )) {
@@ -154,22 +141,26 @@ fm(
 /*
  * Set a global flag which signals that we're shutting down.
  */
-static void
-set_shutdown()
+static RETSIGTYPE
+set_shutdown(int x)
 {
     int        i;
 
     sglob->slurpd_shutdown = 1;                                /* set flag */
+#ifdef HAVE_LINUX_THREADS
+    pthread_kill( sglob->fm_tid, SIGSTKFLT );  /* wake up file mgr */
+#else
     pthread_kill( sglob->fm_tid, SIGUSR1 );            /* wake up file mgr */
+#endif
     sglob->rq->rq_lock( sglob->rq );                   /* lock queue */
     pthread_cond_broadcast( &(sglob->rq->rq_more) );   /* wake repl threads */
     for ( i = 0; i < sglob->num_replicas; i++ ) {
        (sglob->replicas[ i ])->ri_wake( sglob->replicas[ i ]);
     }
     sglob->rq->rq_unlock( sglob->rq );                 /* unlock queue */
-    (void) SIGNAL( SIGTERM, (void *) set_shutdown );   /* reinstall handlers */
-    (void) SIGNAL( SIGINT, (void *) set_shutdown );
-    (void) SIGNAL( SIGHUP, (void *) set_shutdown );
+    (void) SIGNAL( SIGTERM, set_shutdown );    /* reinstall handlers */
+    (void) SIGNAL( SIGINT, set_shutdown );
+    (void) SIGNAL( SIGHUP, set_shutdown );
 }
 
 
@@ -178,10 +169,14 @@ set_shutdown()
 /*
  * A do-nothing signal handler.
  */
-void
-do_nothing()
+RETSIGTYPE
+do_nothing(int i)
 {
-    (void) SIGNAL( SIGUSR1, (void *) do_nothing );
+#ifdef HAVE_LINUX_THREADS
+    (void) SIGNAL( SIGSTKFLT, do_nothing );
+#else
+    (void) SIGNAL( SIGUSR1, do_nothing );
+#endif
 }
 
 
@@ -215,8 +210,7 @@ populate_queue(
        Debug( LDAP_DEBUG_ANY,
                "error: can't seek to offset %ld in file \"%s\"\n",
                sglob->srpos, f, 0 );
-       return;
-    }
+    } else {
     while (( p = get_record( fp )) != NULL ) {
        if ( sglob->rq->rq_add( sglob->rq, p ) < 0 ) {
            char *t;
@@ -232,6 +226,7 @@ populate_queue(
        pthread_yield();
     }
     sglob->srpos = ftell( fp );
+    }
     (void) relinquish_lock( f, fp, lfp );
 }
     
index f8630323cbc0ea690d0654271ead0207ae45d836..ba13dd20004554f775899b9911e1d81771cf5157 100644 (file)
  * globals.c - initialization code for global data
  */
 
+#include "portable.h"
+
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "slurp.h"
 #include "globals.h"
@@ -60,13 +63,13 @@ Globals *init_globals()
        fprintf( stderr, "Cannot initialize queue\n" );
        exit( 1 );
     }
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
     g->default_srvtab = SRVTAB;
-#endif /* KERBEROS */
-#if defined( THREAD_SUNOS4_LWP )
+#endif /* HAVE_KERBEROS */
+#if defined( HAVE_LWP )
     g->tsl_list = NULL;
     mon_create( &g->tsl_mon ); 
-#endif /* THREAD_SUNOS4_LWP */
+#endif /* HAVE_LWP */
 
     return g;
 }
index 3df1ec4ad3b91e3ff0fcf467ac87e4701b0a2227..6107bcbdac9426cafcb599e43cb36f16cde59869 100644 (file)
@@ -47,9 +47,6 @@ static int do_bind LDAP_P(( Ri *, int * ));
 static int do_unbind LDAP_P(( Ri * ));
 
 
-/* External references */
-extern char *ch_malloc LDAP_P(( unsigned long ));
-
 static char *kattrs[] = {"kerberosName", NULL };
 static struct timeval kst = {30L, 0L};
 
@@ -616,6 +613,15 @@ do_bind(
        return( BIND_ERR_OPEN );
     }
 
+    /*
+     * Disable string translation if enabled by default.
+     * The replication log is written in the internal format,
+     * so this would do another translation, breaking havoc.
+     */
+#if defined( STR_TRANSLATION ) && defined( LDAP_DEFAULT_CHARSET )
+        ri->ri_ldp->ld_lberoptions &= ~LBER_TRANSLATE_STRINGS;
+#endif /* STR_TRANSLATION && LDAP_DEFAULT_CHARSET */
+
     /*
      * Set ldap library options to (1) not follow referrals, and 
      * (2) restart the select() system call.
index 17bc995efaa650bebcfd43f62f4820a9726c579a..3e41854eb0dadaae5b5a4965d99b7ea2df0fe582 100644 (file)
@@ -68,6 +68,8 @@ lock_fopen(
 #else
                lockf( fileno( *lfp ), F_ULOCK, 0 );
 #endif
+               fclose( *lfp );
+               *lfp = NULL;
                return( NULL );
        }
 
index 632372f2e2ea94c4d415919c10a0dec2879c0f5d..385633b4acae6448ef19fdced04051f1e2108ec6 100644 (file)
@@ -124,7 +124,7 @@ main(
      */
     pthread_attr_init( &attr );
 
-#if !defined(HAVE_PTHREADS_D4) && !defined(HAVE_DCE)
+#if !defined(HAVE_PTHREADS_D4)
     /* POSIX_THREADS or compatible
      * This is a draft 10 or standard pthreads implementation
      */
index e2250c72a25ef019d793e727979181b1b3e7dfe9..f568f07df4b8d0cb26255bde40f87131df42998a 100644 (file)
@@ -33,7 +33,6 @@
 
 /* externs */
 extern char *str_getline LDAP_P(( char **next ));
-extern void ch_free LDAP_P(( char *p ));
 
 /* Forward references */
 static Rh      *get_repl_hosts LDAP_P(( char *, int *, char ** ));
index 7ed7b20d5eaea5c5405d10da07a1433d810ef4b1..98521033b23e4df4e98c9dad3c24327aea994a68 100644 (file)
@@ -60,7 +60,7 @@ start_replica_thread(
     pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
 #endif
 
-#if !defined(HAVE_PTHREAD_D4) && !defined(HAVE_DCE)
+#if !defined(HAVE_PTHREADS_D4)
     /* POSIX_THREADS or compatible
      * This is a draft 10 or standard pthreads implementation
      */
index c3a855cffecbc626a00d2c67b443c74213c40e73..b6b6004960a75e682efb791412c27df689f7cdd7 100644 (file)
  * replog.c - routines which read and write replication log files.
  */
 
+#include "portable.h"
 
-#include <errno.h>
 #include <stdio.h>
-#include <syslog.h>
-#include <sys/time.h>
-#include <sys/types.h>
+
+#include <ac/errno.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
 
-#include "portable.h"
 #include "slurp.h"
 #include "globals.h"
 
 /*
  * Externs
  */
-#ifdef NEEDPROTOS
-extern FILE *lock_fopen( char *, char *, FILE ** );
-extern char *ch_malloc( unsigned long );
-#else /* NEEDPROTOS */
-extern FILE *lock_fopen();
-extern char *ch_malloc();
-#endif /* NEEDPROTOS */
+extern FILE *lock_fopen LDAP_P(( char *, char *, FILE ** ));
 
 /*
  * Forward declarations
  */
-#ifdef NEEDPROTOS
-int file_nonempty( char * );
-#else /* NEEDPROTOS */
-int file_nonempty();
-#endif /* NEEDPROTOS */
-
+int file_nonempty LDAP_P(( char * ));
 
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
-#endif
 
 /*
  * Forward declarations
@@ -62,8 +49,6 @@ extern char *sys_errlist[];
 static int duplicate_replog( char *, char * );
 
 
-
-
 /*
  * Copy the replication log.  Returns 0 on success, 1 if a temporary
  * error occurs, and -1 if a fatal error occurs.
@@ -131,7 +116,7 @@ copy_replog(
        Debug( LDAP_DEBUG_ANY,
                "Error: copy_replog: Can't lock replog \"%s\" for write: %s\n",
                src, sys_errlist[ errno ], 0 );
-       lock_fclose( rfp );
+       lock_fclose( rfp, lfp );
        return( 1 );
     }
 
@@ -147,12 +132,12 @@ copy_replog(
        truncate( src, (off_t) 0 );
     }
 
-    if ( lock_fclose( rfp, lfp ) == EOF ) {
+    if ( lock_fclose( dfp, dlfp ) == EOF ) {
        Debug( LDAP_DEBUG_ANY,
                "Error: copy_replog: Error closing \"%s\"\n",
                src, 0, 0 );
     }
-    if ( lock_fclose( dfp, dlfp ) == EOF ) {
+    if ( lock_fclose( rfp, lfp ) == EOF ) {
        Debug( LDAP_DEBUG_ANY,
                "Error: copy_replog: Error closing \"%s\"\n",
                src, 0, 0 );
index 654b5a126503e48e5148664a724af2e5df79aaf7..e3af2d05f483ffb2bfb5250a388f3ca75f2b0f9f 100644 (file)
@@ -20,6 +20,7 @@
 #include "portable.h"
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <ac/signal.h>
 
 #include "slurp.h"
@@ -122,6 +123,7 @@ Ri_process(
        while ( !sglob->slurpd_shutdown &&
                ((new_re = re->re_getnext( re )) == NULL )) {
            if ( sglob->one_shot_mode ) {
+               rq->rq_unlock( rq );
                return 0;
            }
            /* No work - wait on condition variable */
index 54adb4da1af77e4fd26db6da62d375ea781e94c6..783b15ba2d7536a2a58635cb72d44667b96210c0 100644 (file)
  *
  */
 
+#include "portable.h"
+
 #include <stdio.h>
+#include <stdlib.h>
 
 #include "slurp.h"
 #include "globals.h"
 
 
 /* externs */
-#ifdef NEEDPROTOS
-extern void Re_dump( Re *re );
-#else /* NEEDPROTOS */
-extern void Re_dump();
-#endif /* NEEDPROTOS */
-
-
-extern char *sys_errlist[];
-
+extern void Re_dump LDAP_P(( Re *re ));
 
 /*
  * Lock the replication queue.
@@ -60,9 +55,6 @@ Rq_lock(
 }
 
 
-
-
-
 /*
  * Unlock the replication queue.
  */
@@ -89,8 +81,6 @@ Rq_gethead(
 }
 
 
-
-
 /*
  * Return the next item in the queue.  Callers should lock the queue before
  * calling this routine.
@@ -108,8 +98,6 @@ Rq_getnext(
 }
 
 
-
-
 /*
  * Delete the item at the head of the list.  The queue should be locked
  * by the caller before calling this routine.
@@ -144,8 +132,6 @@ Rq_delhead(
 }
 
 
-
-
 /* 
  * Add an entry to the tail of the replication queue.  Locking is handled
  * internally.  When items are added to the queue, this routine wakes
@@ -209,8 +195,6 @@ Rq_add(
 }
 
 
-
-
 /*
  * Garbage-collect the replication queue.  Locking is handled internally.
  */
@@ -234,7 +218,6 @@ Rq_gc(
 }
 
 
-
 /*
  * For debugging: dump the contents of the replication queue to a file.
  * Locking is handled internally.
@@ -268,7 +251,6 @@ Rq_dump(
 }
 
 
-
 /*
  * Write the contents of a replication queue to a file.  Returns zero if
  * successful, -1 if not.  Handles queue locking internally.  Callers should
@@ -317,8 +299,6 @@ Rq_write(
 }
 
 
-
-
 /*
  * Check to see if the private slurpd replication log needs trimming.
  * The current criteria are:
@@ -391,8 +371,6 @@ Rq_getcount(
 }
 
 
-
-
 /* 
  * Allocate and initialize an Rq object.
  */
index 622cd38374d2480b7af0b269a9e8c3eac2d12ad3..6041f6fe290e2d58ad8f86b2790d6f9d07754caf 100644 (file)
 
 #define LDAP_SYSLOG
 
-#include <syslog.h>
-#include <errno.h>
-#include <sys/types.h>
+#include <ac/syslog.h>
+#include <ac/errno.h>
+
 #include <sys/param.h>
+
 #include "lber.h"
 #include "ldap.h"
 #include "lthread.h"
-#include "portable.h"
 #include "ldapconfig.h"
 #include "ldif.h"
 
 #define        RETRY_SLEEP_TIME                60
 
 
+LDAP_BEGIN_DECL
 
 /*
  * ****************************************************************************
@@ -317,7 +318,7 @@ typedef struct st {
     int                (*st_unlock)();         /* read status info from disk */
 } St;
 
-#if defined( THREAD_SUNOS4_LWP )
+#if defined( HAVE_LWP )
 typedef struct tl {
     thread_t   tl_tid;         /* thread being managed */
     time_t     tl_wake;        /* time thread should be resumed */
@@ -328,22 +329,24 @@ typedef struct tsl {
     tl_t       *tsl_list;
     mon_t      tsl_mon;
 } tsl_t;
-#endif /* THREAD_SUNOS4_LWP */
+#endif /* HAVE_LWP */
+
+/* Public functions */
 
+/* In ch_malloc.c */
+void * ch_malloc       LDAP_P(( unsigned long size ));
+void * ch_realloc      LDAP_P(( void *block, unsigned long size ));
+void * ch_calloc       LDAP_P(( unsigned long nelem, unsigned long size ));
+void   ch_free         LDAP_P(( void *p ));
     
 
 /* 
  * Public functions used to instantiate and initialize queue objects.
  */
-#ifdef NEEDPROTOS
-extern int Ri_init( Ri **ri );
-extern int Rq_init( Rq **rq );
-extern int Re_init( Re **re );
-#else /* NEEDPROTOS */
-extern int Ri_init();
-extern int Rq_init();
-extern int Re_init();
-#endif /* NEEDPROTOS */
+extern int Ri_init LDAP_P(( Ri **ri ));
+extern int Rq_init LDAP_P(( Rq **rq ));
+extern int Re_init LDAP_P(( Re **re ));
 
-#endif /* _SLURPD_H_ */
+LDAP_END_DECL
 
+#endif /* _SLURPD_H_ */
index 610b29585342e2b4205d82ed080288b4448f2934..3d50e80ce4c19fe6187bafdfc04ca95d29b1736a 100644 (file)
  * writing status information to disk.
  */
 
-
+#include "portable.h"
 
 #include <stdio.h>
-#include <string.h>
-#include <unistd.h>
+#include <stdlib.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
 
 #include "slurp.h"
 #include "globals.h"
 
-#ifndef SYSERRLIST_IN_STDIO
-extern char *sys_errlist[];
-#endif /* SYSERRLIST_IN_STDIO */
-
 /*
  * Add information about replica host specified by Ri to list
  * of hosts.
@@ -56,8 +53,7 @@ St_add(
        pthread_mutex_unlock( &(st->st_mutex ));
        return NULL;
     }
-    st->st_data[ ind ]  = ( Stel * ) ch_malloc( st->st_data,
-           sizeof( Stel ));
+    st->st_data[ ind ]  = ( Stel * ) ch_malloc( sizeof( Stel ) );
     if ( st->st_data[ ind ] == NULL ) {
        pthread_mutex_unlock( &(st->st_mutex ));
        return NULL;
@@ -186,6 +182,7 @@ St_read(
        return 0;
     }
     if (( rc = acquire_lock( sglob->slurpd_status_file, &fp, &lfp)) < 0 ) {
+       pthread_mutex_unlock( &(st->st_mutex ));
        return 0;
     }
     while ( fgets( buf, sizeof( buf ), fp ) != NULL ) {
index d22e04c8e0791fadab91bed24cbf02baffa1c22a..16bed93019ccf2068f5d550a794fca5d14b2c35a 100755 (executable)
@@ -5,10 +5,10 @@
 
 echo "Cleaning up in $DBDIR..."
 
-rm -f $DBDIR/*
+rm -f $DBDIR/[!C]*
 
 echo "Running ldif2ldbm to build slapd database..."
-$LDIF2LDBM -f $CONF -i $LDIF -e ../servers/slapd/tools
+$LDIF2LDBM -j 1 -d 1 -f $CONF -i $LDIF -e ../servers/slapd/tools
 RC=$?
 if [ $RC != 0 ]; then
        echo "ldif2ldbm failed!"
@@ -16,7 +16,7 @@ if [ $RC != 0 ]; then
 fi
 
 echo "Starting slapd on TCP/IP port $PORT..."
-$SLAPD -f $CONF -p $PORT -d 1 > /dev/null 2>&1 &
+$SLAPD -f $CONF -p $PORT -d 1 > $MASTERLOG 2>&1 &
 PID=$!
 
 echo "Using ldapsearch to retrieve all the entries..."