-Making and Installing the U-M LDAP Distribution
+Making and Installing the OpenLDAP Distribution
** It is recommended that you read or at least skim through ALL of the
** instructions in this file before attempting to build the software.
If you want to build binaries for more than one platform from a single
source tree, skip ahead to the "Building LDAP For More Than One Platform"
-section near the end of this file. If you are planning to run slapd,
-you should read the "SLAPD and SLURPD Administrator's Guide", found in
-the doc/guides/ directory within the distribution.
+section near the end of this file.
If you simply want to build LDAP for a single machine platform, follow
these steps:
1. untar the distribution and cd to the top:
- % zcat ldap-3.3.tar.Z | tar xf -
- % cd ldap-3.3
+ % tar xfz openldap-VERSION.tgz
+ % cd ldap
If you are reading this file, you probably have already done this!
+ 2. Type:
+ % ./configure --help
- 2. edit the files Make-common and include/ldapconfig.h.edit to configure
- the software for your site (the files are well-commented):
+ to list available configuration options. A description of
+ these options is provided in the 'CONFIGURE OPTIONS' section
+ below.
- % vi Make-common
- % vi include/ldapconfig.h.edit
+ The configure script uses environmental variables for
+ determining compiler/linker options. See the HINTS
+ section for commonly used settings.
- Note that you should NOT need to edit the Makefile located at the
- top of the distribution.
+ These environment variables are used:
+ CC C Compiler (cc, ecgs)
+ CFLAGS C Flags (-ansi)
+ CPPFLAGS CPP Flags (-I/path/include -Ddef)
+ LDFLAGS LDFLAGS (-L/path/lib -llib)
- If you just want to see if things will build, you can leave the
- configuration alone and change it later.
+ See the 'USING ENVIRONMENT VARIABLES' section for information
+ on how to use the variables.
- If you have the ISODE package built and want to build the
- LDAP-to-X.500 server (ldapd), be sure to uncomment the appropriate
- lines near the end of the Make-common file. By default only the
- stand-alone server, LDAP libraries and client software are built.
+ 3. edit the file include/ldapconfig.h.edit to configure
+ the software for your site (the files are well-commented):
- 3. make the software:
+ % vi include/ldapconfig.h.edit
- % make
+ 4. Configure the build system
- If all goes well, then make will figure out what platform you are on,
- pick a compiler to use, construct Makefiles, and build everything.
- If you see a message like "unknown platform..." LDAP has probably not
- been set up to build on your machine. See the file build/PORTS for
- hints on what to do in that case.
-
- Note that if your make does not use the Bourne (sh) shell by
- default when executing internal scripts (reportedly the case on SGI
- machines at least), you will need to run the make explicitly from
- within a Bourne shell. If you a syntax error such as "Missing ]"
- when you do the make under your usual shell, try this:
-
- % sh
- $ make
-
- If you don't like the some of the platform-specific options chosen
- by the automatic build process (such as the compiler to use, etc),
- you can intervene and edit them before anything is actually compiled
- by explicitly doing a "make platform" step, editing the .make-platform
- file (actually a link to the file to be edited), and then doing a
- regular make:
-
- % make platform
- % vi .make-platform
- % make
+ % [env settings] ./configure [options]
- If you want to choose the build platform yourself from among those that
- the distribution supports, cd to the appropriate directory underneath
- build/platforms and make from there. For example, if you are on a
- machine running SunOS 4.1.4 and you want to force the use of the cc
- compiler, you would do this:
+ If all goes well, the configure script with auto-detect the
+ appropriate settings. Use configure enable/with options and/or
+ environment variables to obtain desired results.
- % cd build/platforms/sunos4-cc
- % make
+ 5. Build dependencies
- If you want to run some simple tests after the build is complete, you
- can do this:
+ % make depend
- % make test
+ 6. Build the system
+
+ % make
- 4. install the binaries and man pages. You may need to be superuser to
+ If all goes well, the system will build as configured. If not,
+ return to step 4 after reviewing the enable/with options settings.
+
+ 7. install the binaries and man pages. You may need to be superuser to
do this (depending on where you are installing things):
% su
Building LDAP For More Than One Platform
It is now possible to build LDAP for more than one platform from the same
-source tree. This is accomplished by some rules in the Makefiles that
-create a shadow (linked) directory tree where the binaries are placed.
+source tree. This is accomplished by using make(1) VPATH support. If
+your make(1) program is old and doesn't have VPATH support, install GNU
+Make.
Follow these steps for each different platform:
- 1. move to the directory that matches the platform and compiler you
- want to build for and type make. The directories are all located
- underneath the build/platforms directory. If your platform is not
- there, you may need to do a port - see the build/PORTS file for
- more information. For a Sun running SunOS 4.1.4, you might do
- this:
+ 1. Create a directory for the platform object files.
- % cd build/platforms/sunos4-cc
- % make links
+ % mkdir obj-platform
- This will create a linked source area.
+ 2. Change your working directory to the platform object directory.
+ % cd obj-platform
- 2. move to the new directory and make as for a single platform. Follow steps
- 1-4 above to accomplish this. For example:
+ 3. Configure the build system
- % cd obj-sunos4-cc
- % make
+ % [env settings] ../configure --src-dir=.. [options]
+
+ ( replace ".." with the appropriate path )
+
+ 4. Continue as above (starting at step 6).
+
+ Note: make depend in VPATH environment is not yet supported.
+
+
+CONFIGURE OPTIONS
+
+Regrettably, this section has not been written (yet). See
+"./configure --help" for current list of options.
+
+
+USING ENVIRONMENT VARIABLES
+
+The configure script will also use your environmental
+variables for determining compiler/linker options. This can
+be used to manual specify features and compilation options.
+
+Supported Environmental Variables
+ CC C Compiler (cc, ecgs)
+ CFLAGS C Flags (-ansi)
+ CPPFLAGS CPP Flags (-I/path/include -Ddef)
+ LDFLAGS LDFLAGS (-L/path/lib -llib)
+ PATH command path /usr/local/bin:/usr/bin:/bin
+
+* Including alternative compilers
+ Use the CC environment variable to tell configure to
+ use a specific compiler. For example, to use ecgs
+ instead of the compiler configure choose, use:
+
+ [env] CC=ecgs ./configure
+
+ You can also use CC use specific flags with the
+ specified compiler. For example, to require strict
+ ANSI C using the GNU C Compiler, use:
+
+ [env] CC="gcc -ansi -predantic" ./configure
+
+ (you can use CFLAGS to specify compiler flags)
+
+* Preprocessor Flags
+ You may specify additional preprocessor flags by setting
+ CPPFLAGS. For example, if you would like to use headers
+ installed in /usr/local/include, use:
+
+ [env] CPPFLAGS="-I/usr/local/include" ./configure
+
+ You can also use CPPFLAGS to specify preprocessor macros.
+
+ [env] CPPFLAGS="-D__SPECIAL_FLAG__" ./configure
+
+* Linker Flags
+ You may specify additional linker flags by setting LDFLAGS.
+ For example, if you would like to use libraries installed
+ in /usr/local/lib, use:
+
+ [env] LDFLAGS="-L/usr/local/lib" ./configure
+
+ You can also use CPPFLAGS to specify linker flags:
+
+ [env] LDFLAGS="-Bstatic" ./configure
+
+* Path
+ You may alter your path to affect configure ability to
+ find (or not find) commands. For example, to have configure
+ additionally look in /usr/css/bin for commands, use:
+
+ [env] PATH="/usr/css/bin:$PATH" ./configure
+
+
+HINTS
- That's all there is to it. You can also create the linked source area(s)
- by just typing "make links" at the top of the distribution, in which case
- the Makefile will try to automatically determine the platform and
- compiler.
+* use software under installed in /usr/local/{include,lib}
+ [env] \
+ CPPFLAGS="-I/usr/local/include" \
+ LDFLAGS="-L/usr/local/lib" \
+ ./configure
-End of LDAP INSTALL file.
+End of OpenLDAP INSTALL file.
-UM-LDAP 3.3 README file
+OpenLDAP 1.1 Alpha README
- This is the UM-LDAP version 3.3 distribution. For a description of
- what this distribution contains, see the ANNOUNCEMENT file in this
- directory. For a description of changes from previous releases,
- see the CHANGES file in this directory. For a more detailed
- description of how to make and install the distribution, see the
- INSTALL file in this directory. For more information on making and
- installing slapd, see the "SLAPD and SLURPD Administrator's Guide"
- in the doc/guides/ directory.
+ This is the OpenLDAP version 1.1 Alpha.
+
+ For a description of what this distribution contains, see the
+ ANNOUNCEMENT file in this directory. For a description of
+ changes from previous releases, see the CHANGES file in this
+ directory. For a more detailed description of how to make an
+ install the distribution, see the INSTALL file in this directory.
+
+ For more information:
+ http://www.OpenLDAP.org/
+
+REQUIRED SOFTWARE
+ Build OpenLDAP requires the following software components:
+
+ Base system (libraries and tools):
+ Standard C compiler, headers, and libraries
+ POSIX REGEX headers and libraries
+
+ SLAPD:
+ LDBM compatible datastore
+ (Berkeley DB, Sleepycat DB2, or GDBM)
+ SLURPD:
+ LTHREAD compatible thread package
+ (POSIX pthreads, MIT pthreads, Mach Cthreads or Sun LWP)
+
+ LDAPD:
+ ISODE compatible ldap distribution
+
+ CLIENTS/CONTRIBware:
+ Depends on package. See per package READMEs.
+
MAKING AND INSTALLING THE DISTRIBUTION
- You should be able to make and install the distribution with a pretty
- standard default configuration by typing the following commands
+ You should be able to make and install the distribution with a
+ default configuration by typing the following commands:
+
+ % ./configure --help
+ This will list the available options.
+ The configure script will also use your environmental
+ variables for determining compiler/linker options.
+ These environment variables are used:
+ CC C compiler (cc, ecgs)
+ CFLAGS C Flags (-ansi)
+ CPPFLAGS CPP Flags (-I -D)
+ LDFLAGS LDFLAGS (-L -l)
+
+ % [env settings] ./configure [options]
+ this will configure the build system
+
+ % make depend
+ this will create dependency information
+
+ % make
+ this will build the system
- % make
% su
# make install
in this directory. This should produce something that basically
- works.
+ works. You can "cd tests; make" to verify the build.
You will probably want to do a little configuration to suit your
- site, though. There are two files you might want to edit:
+ site, though. There are one file you might want to edit:
- Make-common This file contains definitions for
- where things will be installed, where
- to find various things, etc. If you
- want to build an ldap server, you'll
- definitely need to edit this file
-
- include/ldapconfig.h.edit This file contains #defines used
- by many parts of the distribution.
- You'll at least want to change
- DEFAULT_BASE.
+ include/ldapconfig.h.edit
+ This file contains #defines used by many parts of the
+ distribution. You'll at least want to change DEFAULT_BASE.
See the INSTALL file in this directory for more information.
There are man pages for most programs in the distribution and
routines in the various libraries. See ldap(3) for details.
- There is a postscript version of an administrator's guide for
- slapd in doc/guides/slapd.ps.
-
- There is an LDAP homepage available that contains the latest
+ There is an OpenLDAP homepage available that contains the latest
LDAP news, releases announcements, pointers to other LDAP resources,
etc. You can access it at this URL:
- http://www.umich.edu/~rsug/ldap/
+ http://www.OpenLDAP.org/
-FEEDBACK / PROBLEM REPORTS
+FEEDBACK / PROBLEM REPORTS / DISCUSSIONS
We would appreciate any feedback you can provide. If you have
problems, report them to this address:
- ldap-support@umich.edu
+ OpenLDAP-bugs@OpenLDAP.org
+
Leave the following blank line there!! Autoheader needs it. */
\f
+
+/* define this if needed to get reentrant functions */
+#undef _REENTRANT
+
+/* define this if needed to get threadsafe functions */
+#undef _THREAD_SAFE
+
/* define this if toupper() requires tolower() check */
#undef C_UPPER_LOWER
/* define if your POSIX Threads implementation is circa Draft 4 */
#undef HAVE_PTHREADS_D4
+/* define if you have sched_yield() */
+#ifdef __notdef__
+/* see second sched_yield define */
+#undef HAVE_SCHED_YIELD
+#endif
+
+/* define if you have setproctitle() */
+#undef HAVE_SETPROCTITLE
+
/* define if you have -lwrap */
#undef HAVE_TCPD
/* define this to remove -lldap cache support */
#undef LDAP_NOCACHE
+/* define this for LDAP process title support */
+#undef LDAP_PROCTITLE
+
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
--- /dev/null
+##
+## Makefile for gopher clients
+##
+PROGRAMS= go500gw go500
+
+SRCS= go500.c go500gw.c
+XSRCS= gwversion.o goversion.o
+GOOBJS = go500.o
+GWOBJS = go500gw.o
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+XLIBS = -llutil @LUTIL_LIBS@
+
+go500 : goversion.o
+ $(CC) $(LDFLAGS) -o $@ $(GOOBJS) goversion.o $(LIBS)
+
+go500gw : gwversion.o
+ $(CC) $(LDFLAGS) -o $@ $(GWOBJS) gwversion.o $(LIBS)
+
+goversion.c: ${GOOBJS} $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Version.c > $@)
+
+gwversion.c: ${GWOBJS} $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Versiongw.c > $@)
+
+install: $(PROGRAMS) go500gw.help FORCE
+ -$(MKDIR) -p $(libexecdir) $(sysconfdir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 go500 $(libexecdir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 go500gw $(libexecdir)
+ -$(MV) $(sysconfdir)/go500gw.help $(sysconfdir)/go500gw.help-
+ $(INSTALL) $(INSTALLFLAGS) -m 644 go500gw.help $(sysconfdir)
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
+
+#include <ac/setproctitle.h>
+
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
-#include <syslog.h>
+#endif
+
#include <sys/resource.h>
-#include <sys/wait.h>
-#ifdef aix
-#include <sys/select.h>
-#endif /* aix */
-#include <signal.h>
-#include "portable.h"
+
#include "ldapconfig.h"
#include "lber.h"
#include "ldap.h"
-#include "disptmpl.h"
+#include "lutil.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
+#include "disptmpl.h"
int debug;
int dosyslog;
int myport;
static set_socket();
-static SIG_FN wait4child();
+static RETSIGTYPE wait4child();
static do_queries();
static do_error();
static do_search();
struct hostent *hp;
struct sockaddr_in from;
int fromlen;
- SIG_FN wait4child();
+ RETSIGTYPE wait4child();
extern char *optarg;
- extern char **Argv;
- extern int Argc;
+#if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE )
/* for setproctitle */
- Argv = argv;
- Argc = argc;
+ Argv = argv;
+ Argc = argc;
+#endif
while ( (i = getopt( argc, argv, "b:d:f:lp:c:t:x:I" )) != EOF ) {
switch( i ) {
}
#endif
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ dtblsize = FD_SETSIZE;
+#endif
+
+#ifdef FD_SETSIZE
+ if (dtblsize > FD_SETSIZE) {
+ dtblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE*/
+
/* detach if stderr is redirected or no debugging */
if ( inetd == 0 )
- (void) detach( debug );
+ lutil_detach( debug && !isatty( 1 ), 1 );
if ( (myname = strrchr( argv[0], '/' )) == NULL )
myname = strdup( argv[0] );
s = set_socket( port );
/* arrange to reap children */
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
} else {
myport = GO500_PORT;
inet_ntoa( from.sin_addr ) );
}
+#ifdef LDAP_PROCTITLE
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
hp->h_name );
+#endif
}
do_queries( 0 );
return( s );
}
-static SIG_FN
+static RETSIGTYPE
wait4child()
{
+#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
+#endif
if ( debug ) printf( "parent: catching child status\n" );
-#ifdef USE_WAITPID
+
+#ifdef HAVE_WAITPID
while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
-#else /* USE_WAITPID */
- while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
-#endif /* USE_WAITPID */
- ; /* NULL */
+ ; /* NULL */
+#else
+ while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
+ ; /* NULL */
+#endif
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
}
static
}
ld->ld_deref = GO500_DEREF;
- if ( (rc = ldap_simple_bind_s( ld, GO500_BINDDN, NULL ))
+ if ( (rc = ldap_simple_bind_s( ld, GO500_BINDDN, GO500_BIND_CRED ))
!= LDAP_SUCCESS ) {
fprintf(fp,
"0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/ctype.h>
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
+
+#include <ac/setproctitle.h>
+
+#include <sys/resource.h>
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+
#include "lber.h"
#include "ldap.h"
+#include "lutil.h"
+
#include "disptmpl.h"
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/param.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>
-#ifdef aix
-#include <sys/select.h>
-#endif /* aix */
-#include "portable.h"
-#include "ldapconfig.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
+#include "ldapconfig.h"
int debug;
int dosyslog;
int rdncount = GO500GW_RDNCOUNT;
static set_socket();
-static SIG_FN wait4child();
+static RETSIGTYPE wait4child();
static do_queries();
static do_menu();
static do_list();
struct hostent *hp;
struct sockaddr_in from;
int fromlen;
- SIG_FN wait4child();
+ RETSIGTYPE wait4child();
extern char *optarg;
- extern char **Argv;
- extern int Argc;
+#if defined( LDAP_PROCTITLE ) && !defined( HAVE_SETPROCTITLE )
/* for setproctitle */
- Argv = argv;
- Argc = argc;
+ Argv = argv;
+ Argc = argc;
+#endif
while ( (i = getopt( argc, argv, "P:ad:f:h:lp:t:x:Ic:" )) != EOF ) {
switch( i ) {
}
}
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ dtblsize = FD_SETSIZE;
+#endif
+
+#ifdef FD_SETSIZE
+ if ( dtblsize > FD_SETSIZE ) {
+ dtblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE*/
+
+
#ifdef GO500GW_HOSTNAME
strcpy( myhost, GO500GW_HOSTNAME );
/* detach if stderr is redirected or no debugging */
if ( inetd == 0 )
- (void) detach( debug );
+ lutil_detach( debug && !isatty( 1 ), 1 );
if ( (myname = strrchr( argv[0], '/' )) == NULL )
myname = strdup( argv[0] );
s = set_socket( port );
/* arrange to reap children */
- (void) signal( SIGCHLD, (void *) wait4child );
+ (void) SIGNAL( SIGCHLD, wait4child );
}
if ( inetd ) {
inet_ntoa( from.sin_addr ) );
}
+#ifdef LDAP_PROCTITLE
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
hp->h_name );
+#endif
}
do_queries( 0 );
return( s );
}
-static SIG_FN
+static RETSIGTYPE
wait4child()
{
- WAITSTATUSTYPE status;
+#ifndef HAVE_WAITPID
+ WAITSTATUSTYPE status;
+#endif
- if ( debug ) printf( "parent: catching child status\n" );
-#ifdef USE_WAITPID
- while (waitpid ((pid_t) -1, 0, WAIT_FLAGS) > 0)
-#else /* USE_WAITPID */
- while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
-#endif /* USE_WAITPID */
- ; /* NULL */
+ if ( debug ) printf( "parent: catching child status\n" );
- (void) signal( SIGCHLD, (void *) wait4child );
+#ifdef HAVE_WAITPID
+ while (waitpid ((pid_t) -1, NULL, WAIT_FLAGS) > 0)
+ ; /* NULL */
+#else
+ while (wait3( &status, WAIT_FLAGS, 0 ) > 0 )
+ ; /* NULL */
+#endif
+
+ (void) SIGNAL( SIGCHLD, wait4child );
}
static do_queries( s )
timeout.tv_sec = GO500GW_TIMEOUT;
timeout.tv_usec = 0;
+
ld->ld_sizelimit = 1;
+
if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_ONELEVEL,
"(objectClass=*)", attrs, 0, &timeout, &res ))
== LDAP_SUCCESS || rc == LDAP_SIZELIMIT_EXCEEDED ) {
timeout.tv_sec = GO500GW_TIMEOUT;
timeout.tv_usec = 0;
ld->ld_deref = LDAP_DEREF_FINDING;
+
if ( (rc = ldap_search_st( ld, dn, LDAP_SCOPE_ONELEVEL,
"(!(objectClass=dSA))", attrs, 0, &timeout, &res )) != LDAP_SUCCESS
&& rc != LDAP_SIZELIMIT_EXCEEDED ) {
rc, myhost, myport );
return;
}
+
ld->ld_deref = LDAP_DEREF_ALWAYS;
if ( ldap_count_entries( ld, res ) < 1 ) {
timeout.tv_sec = GO500GW_TIMEOUT;
timeout.tv_usec = 0;
ldap_ufn_timeout( (void *) &timeout );
+
ld->ld_deref = LDAP_DEREF_FINDING;
if ( (rc = ldap_ufn_search_s( ld, filter, attrs, 0, &res ))
e = ldap_first_entry( ld, res );
oc = ldap_get_values( ld, e, "objectClass" );
- if ( isnonleaf( ld, oc, dn ) ) {
- dn = ldap_get_dn( ld, e );
+ dn = ldap_get_dn( ld, e );
+ if ( isnonleaf( ld, oc, dn ) ) {
rc = do_menu( ld, fp, dn );
free( dn );
return( rc );
}
+ free( dn );
ldap_value_free( oc );
}
if ( ldap_entry2text_search( ld, dn, NULL, NULL, tmpllist, NULL, NULL,
entry2textwrite,(void *) fp, "\r\n", rdncount, 0 )
!= LDAP_SUCCESS ) {
+
fprintf(fp,
"0An error occurred (explanation)\t@%d\t%s\t%d\r\n",
ld->ld_errno, myhost, myport );
* All Rights Reserved
*/
+#include "portable.h"
+
#include <stdio.h>
#include <stdlib.h>
-#include <syslog.h>
-#include <string.h>
-#include <ctype.h>
-#include "portable.h"
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+
#include "ldapconfig.h"
#include "rcpt500.h"
-#ifdef ultrix
-extern char *strdup();
-#endif
-
int dosyslog = 0;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int do_cldap = 0;
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
+
int derefaliases = 1;
int sizelimit = RCPT500_SIZELIMIT;
int rdncount = RCPT500_RDNCOUNT;
dosyslog = 1;
break;
case 'U':
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
do_cldap = 1;
-#else /* CLDAP */
- fprintf( stderr, "Compile with -DCLDAP for -U support\n" );
-#endif /* CLDAP */
+#else /* LDAP_CONNECTIONLESS */
+ fprintf( stderr,
+ "Compile with -DLDAP_CONNECTIONLESS for -U support\n" );
+#endif /* LDAP_CONNECTIONLESS */
break;
case 'b':
searchbase = optarg;
p = text;
for ( s = argbuf; *p != '\0'; ++p ) {
- *s++ = tolower( *p );
+ *s++ = TOLOWER( *p );
}
*s = '\0';
--- /dev/null
+##
+## Makefile for LDAP tools
+##
+SRCS = ldapsearch.c ldapmodify.c ldapdelete.c ldapmodrdn.c
+OBJS = ldapsearch.o ldapmodify.o ldapdelete.o ldapmodrdn.o
+XLIBS = -llber -lldap
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+XSRCS = ldsversion.c ldmversion.c lddversion.c ldrversion.c
+
+PROGRAMS = ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd
+
+ldapsearch: ldsversion.o
+ $(CC) $(LDFLAGS) -o $@ ldapsearch.o ldsversion.o $(LIBS)
+
+ldapmodify: ldmversion.o
+ $(CC) $(LDFLAGS) -o $@ ldapmodify.o ldmversion.o $(LIBS)
+
+ldapdelete: lddversion.o
+ $(CC) $(LDFLAGS) -o $@ ldapdelete.o lddversion.o $(LIBS)
+
+ldapmodrdn: ldrversion.o
+ $(CC) $(LDFLAGS) -o $@ ldapmodrdn.o ldrversion.o $(LIBS)
+
+ldapadd: ldapmodify
+ $(RM) $@
+ $(LN) ldapmodify ldapadd
+
+ldsversion.c: ldapsearch.o $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Versionlds.c > $@)
+
+ldmversion.c: ldapmodify.o $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Versionldm.c > $@)
+
+lddversion.c: ldapdelete.o $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Versionldd.c > $@)
+
+ldrversion.c: ldapmodrdn.o $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Versionldr.c > $@)
+
+install-local: ldapsearch ldapmodify ldapdelete ldapmodrdn ldapadd FORCE
+ -$(MKDIR) -p $(bindir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 ldapsearch $(bindir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 ldapmodify $(bindir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 ldapdelete $(bindir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 ldapmodrdn $(bindir)
+ $(RM) $(BINDIR)/ldapadd
+ $(LN) $(BINDIR)/ldapmodify $(bindir)/ldapadd
/* ldapmodify.c - generic program to modify or add entries using LDAP */
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
-#include <sys/types.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/socket.h>
+#include <ac/unistd.h>
+
#include <sys/stat.h>
+
+#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
+#endif
+#ifdef HAVE_FCNTL_H
#include <fcntl.h>
-#ifndef VMS
-#include <unistd.h>
-#endif /* VMS */
+#endif
+
#include <lber.h>
#include <ldap.h>
#include <ldif.h>
static char *prog;
static char *binddn = LDAPMODIFY_BINDDN;
-static char *passwd = NULL;
+static char *passwd = LDAPMODIFY_BIND_CRED;
static char *ldaphost = LDAPHOST;
static int ldapport = LDAP_PORT;
static int new, replace, not, verbose, contoper, force, valsfromfiles;
#define T_DELETEOLDRDNSTR "deleteoldrdn"
-#ifdef NEEDPROTOS
-static int process_ldapmod_rec( char *rbuf );
-static int process_ldif_rec( char *rbuf );
-static void addmodifyop( LDAPMod ***pmodsp, int modop, char *attr,
- char *value, int vlen );
-static int domodify( char *dn, LDAPMod **pmods, int newentry );
-static int dodelete( char *dn );
-static int domodrdn( char *dn, char *newrdn, int deleteoldrdn );
-static void freepmods( LDAPMod **pmods );
-static int fromfile( char *path, struct berval *bv );
-static char *read_one_record( FILE *fp );
-#else /* NEEDPROTOS */
-static int process_ldapmod_rec();
-static int process_ldif_rec();
-static void addmodifyop();
-static int domodify();
-static int dodelete();
-static int domodrdn();
-static void freepmods();
-static int fromfile();
-static char *read_one_record();
-#endif /* NEEDPROTOS */
-
-
-main( argc, argv )
- int argc;
- char **argv;
+static int process_ldapmod_rec LDAP_P(( char *rbuf ));
+static int process_ldif_rec LDAP_P(( char *rbuf ));
+static void addmodifyop LDAP_P(( LDAPMod ***pmodsp, int modop, char *attr,
+ char *value, int vlen ));
+static int domodify LDAP_P(( char *dn, LDAPMod **pmods, int newentry ));
+static int dodelete LDAP_P(( char *dn ));
+static int domodrdn LDAP_P(( char *dn, char *newrdn, int deleteoldrdn ));
+static void freepmods LDAP_P(( LDAPMod **pmods ));
+static int fromfile LDAP_P(( char *path, struct berval *bv ));
+static char *read_one_record LDAP_P(( FILE *fp ));
+
+
+int
+main( int argc, char **argv )
{
char *infile, *rbuf, *start, *p, *q;
FILE *fp;
for ( j = 0; pmods[ i ]->mod_bvalues[ j ] != NULL; ++j ) {
bvp = pmods[ i ]->mod_bvalues[ j ];
notascii = 0;
- for ( k = 0; k < bvp->bv_len; ++k ) {
+ for ( k = 0; (unsigned long) k < bvp->bv_len; ++k ) {
if ( !isascii( bvp->bv_val[ k ] )) {
notascii = 1;
break;
eof = feof( fp );
fclose( fp );
- if ( rlen != bv->bv_len ) {
+ if ( (unsigned long) rlen != bv->bv_len ) {
perror( path );
free( bv->bv_val );
return( -1 );
/* ldapmodrdn.c - generic program to modify an entry's RDN using LDAP */
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include <lber.h>
#include <ldap.h>
#include "ldapconfig.h"
static char *binddn = LDAPMODRDN_BINDDN;
+static char *passwd = LDAPMODRDN_BIND_CRED;
static char *base = LDAPMODRDN_BASE;
-static char *passwd = NULL;
static char *ldaphost = LDAPHOST;
static int ldapport = LDAP_PORT;
static int not, verbose, contoper;
#define safe_realloc( ptr, size ) ( ptr == NULL ? malloc( size ) : \
realloc( ptr, size ))
+static int domodrdn LDAP_P((
+ LDAP *ld,
+ char *dn,
+ char *rdn,
+ int remove)); /* flag: remove old RDN */
main( argc, argv )
int argc;
char **argv;
{
char *usage = "usage: %s [-nvkc] [-d debug-level] [-h ldaphost] [-p ldapport] [-D binddn] [-w passwd] [ -f file | < entryfile | dn newrdn ]\n";
- char *myname,*infile, *p, *entrydn, *rdn, buf[ 4096 ];
+ char *myname,*infile, *entrydn, *rdn, buf[ 4096 ];
FILE *fp;
int rc, i, kerberos, remove, havedn, authmethod;
- LDAPMod **pmods;
extern char *optarg;
extern int optind;
exit( rc );
}
-domodrdn( ld, dn, rdn, remove )
- LDAP *ld;
- char *dn;
- char *rdn;
- int remove; /* flag: remove old RDN */
+static int domodrdn(
+ LDAP *ld,
+ char *dn,
+ char *rdn,
+ int remove) /* flag: remove old RDN */
{
int i;
ac_default_prefix=/usr/local
ac_help="$ac_help
--enable-debug enable debugging (yes)"
+ac_help="$ac_help
+ --enable-proctitle enable proctitle support (yes)"
ac_help="$ac_help
--enable-libui enable library user interface (yes)"
ac_help="$ac_help
--enable-cache enable caching (yes)"
ac_help="$ac_help
- --enable-dns enable dns support (no)"
+ --enable-dns enable dns support (no)"
ac_help="$ac_help
--enable-referrals enable referrals (yes)"
ac_help="$ac_help
--enable-cldap enable connectionless ldap (no)"
+ac_help="$ac_help
+ --enable-x-compile enable cross compiling (no)"
ac_help="$ac_help
--with-kerberos use Kerberos (auto)"
ac_help="$ac_help
ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
echo $ac_n "checking configure arguments""... $ac_c" 1>&6
-echo "configure:591: checking configure arguments" >&5
+echo "configure:595: checking configure arguments" >&5
# OpenLDAP --enable-debug
ol_enable_debug="yes"
fi
# end --enable-debug
+# OpenLDAP --enable-proctitle
+ # Check whether --enable-proctitle or --disable-proctitle was given.
+if test "${enable_proctitle+set}" = set; then
+ enableval="$enable_proctitle"
+
+ ol_arg=invalid
+ for ol_val in auto yes no ; do
+ if test "$enableval" = "$ol_val" ; then
+ ol_arg="$ol_val"
+ fi
+ done
+ if test "$ol_arg" = "invalid" ; then
+ { echo "configure: error: bad value $enableval for --enable-proctitle" 1>&2; exit 1; }
+ fi
+ ol_enable_proctitle="$ol_arg"
+
+else
+ ol_enable_proctitle="yes"
+fi
+# end --enable-proctitle
# OpenLDAP --enable-libui
# Check whether --enable-libui or --disable-libui was given.
if test "${enable_libui+set}" = set; then
ol_enable_cldap="no"
fi
# end --enable-cldap
+# OpenLDAP --enable-x_compile
+ # Check whether --enable-x_compile or --disable-x_compile was given.
+if test "${enable_x_compile+set}" = set; then
+ enableval="$enable_x_compile"
+
+ ol_arg=invalid
+ for ol_val in yes no ; do
+ if test "$enableval" = "$ol_val" ; then
+ ol_arg="$ol_val"
+ fi
+ done
+ if test "$ol_arg" = "invalid" ; then
+ { echo "configure: error: bad value $enableval for --enable-x_compile" 1>&2; exit 1; }
+ fi
+ ol_enable_x_compile="$ol_arg"
+
+else
+ ol_enable_x_compile="no"
+fi
+# end --enable-x_compile
# OpenLDAP --with-kerberos
# Check whether --with-kerberos or --without-kerberos was given.
echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
-echo "configure:1203: checking whether ln -s works" >&5
+echo "configure:1247: 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
# 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:1234: checking for a BSD compatible install" >&5
+echo "configure:1278: 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
# 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:1286: checking for $ac_word" >&5
+echo "configure:1330: 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
fi
echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:1313: checking whether ${MAKE-make} sets \${MAKE}" >&5
+echo "configure:1357: 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
# 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:1343: checking for $ac_word" >&5
+echo "configure:1387: 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
# 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:1375: checking for $ac_word" >&5
+echo "configure:1419: 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
# 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:1407: checking for $ac_word" >&5
+echo "configure:1451: 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
# 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:1440: checking for $ac_word" >&5
+echo "configure:1484: 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
# 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:1469: checking for $ac_word" >&5
+echo "configure:1513: 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
fi
echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:1517: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
+echo "configure:1561: 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.
cross_compiling=$ac_cv_prog_cc_cross
cat > conftest.$ac_ext <<EOF
-#line 1527 "configure"
+#line 1571 "configure"
#include "confdefs.h"
main(){return(0);}
EOF
-if { (eval echo configure:1531: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1575: \"$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
{ 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:1551: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
+echo "configure:1595: 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:1556: checking whether we are using GNU C" >&5
+echo "configure:1600: 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
yes;
#endif
EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:1565: \"$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:1609: \"$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
ac_save_CFLAGS="$CFLAGS"
CFLAGS=
echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:1580: checking whether ${CC-cc} accepts -g" >&5
+echo "configure:1624: 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
test "${CFLAGS+set}" = set || CFLAGS="-g"
fi
+
+if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
+ echo "configure: warning: cross compiling.... go for it" 1>&2
+
+elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
+ echo "configure: warning: programs compiled here do run here..." 1>&2
+ { echo "configure: error: if not cross compiling, use --disable-x-compile." 1>&2; exit 1; }
+
+elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
+ echo "configure: warning: programs compiled here do not run here..." 1>&2
+ { echo "configure: error: if cross compiling, add --enable-x-compile." 1>&2; exit 1; }
+fi
+
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:1608: checking how to run the C preprocessor" >&5
+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=
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp.
cat > conftest.$ac_ext <<EOF
-#line 1623 "configure"
+#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:1629: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
:
rm -rf conftest*
CPP="${CC-cc} -E -traditional-cpp"
cat > conftest.$ac_ext <<EOF
-#line 1640 "configure"
+#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:1646: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (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
:
if test $ac_cv_prog_gcc = yes; then
echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:1670: checking whether ${CC-cc} needs -traditional" >&5
+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 1676 "configure"
+#line 1733 "configure"
#include "confdefs.h"
#include <sgtty.h>
Autoconf TIOCGETP
if test $ac_cv_prog_gcc_traditional = no; then
cat > conftest.$ac_ext <<EOF
-#line 1694 "configure"
+#line 1751 "configure"
#include "confdefs.h"
#include <termio.h>
Autoconf TCGETA
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
+# 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 1788 "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; }
+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 1805 "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; }
+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
+
+
echo $ac_n "checking for AIX""... $ac_c" 1>&6
-echo "configure:1717: checking for AIX" >&5
+echo "configure:1836: checking for AIX" >&5
cat > conftest.$ac_ext <<EOF
-#line 1719 "configure"
+#line 1838 "configure"
#include "confdefs.h"
#ifdef _AIX
yes
echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:1741: checking for POSIXized ISC" >&5
+echo "configure:1860: 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
ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6
-echo "configure:1763: checking for minix/config.h" >&5
+echo "configure:1882: 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 1768 "configure"
+#line 1887 "configure"
#include "confdefs.h"
#include <minix/config.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1773: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:1892: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for socket""... $ac_c" 1>&6
-echo "configure:1814: checking for socket" >&5
+echo "configure:1933: 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 1819 "configure"
+#line 1938 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char socket(); below. */
; return 0; }
EOF
-if { (eval echo configure:1842: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1961: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_socket=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for main in -lsocket""... $ac_c" 1>&6
-echo "configure:1861: checking for main in -lsocket" >&5
+echo "configure:1980: 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
ac_save_LIBS="$LIBS"
LIBS="-lsocket $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1869 "configure"
+#line 1988 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1876: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:1995: \"$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
fi
echo $ac_n "checking for main in -lnet""... $ac_c" 1>&6
-echo "configure:1904: checking for main in -lnet" >&5
+echo "configure:2023: 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
ac_save_LIBS="$LIBS"
LIBS="-lnet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1912 "configure"
+#line 2031 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1919: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2038: \"$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
fi
echo $ac_n "checking for main in -lnsl_s""... $ac_c" 1>&6
-echo "configure:1947: checking for main in -lnsl_s" >&5
+echo "configure:2066: 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
ac_save_LIBS="$LIBS"
LIBS="-lnsl_s $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1955 "configure"
+#line 2074 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:1962: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2081: \"$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
fi
echo $ac_n "checking for main in -lnsl""... $ac_c" 1>&6
-echo "configure:1990: checking for main in -lnsl" >&5
+echo "configure:2109: 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
ac_save_LIBS="$LIBS"
LIBS="-lnsl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 1998 "configure"
+#line 2117 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2005: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2124: \"$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
fi
echo $ac_n "checking for socket in -linet""... $ac_c" 1>&6
-echo "configure:2033: checking for socket in -linet" >&5
+echo "configure:2152: 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
ac_save_LIBS="$LIBS"
LIBS="-linet $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2041 "configure"
+#line 2160 "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
socket()
; return 0; }
EOF
-if { (eval echo configure:2052: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2171: \"$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
fi
echo $ac_n "checking for main in -lgen""... $ac_c" 1>&6
-echo "configure:2080: checking for main in -lgen" >&5
+echo "configure:2199: 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
ac_save_LIBS="$LIBS"
LIBS="-lgen $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2088 "configure"
+#line 2207 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2095: \"$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
echo $ac_n "checking for sigset in -lV3""... $ac_c" 1>&6
-echo "configure:2127: checking for sigset in -lV3" >&5
+echo "configure:2246: 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
ac_save_LIBS="$LIBS"
LIBS="-lV3 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2135 "configure"
+#line 2254 "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
sigset()
; return 0; }
EOF
-if { (eval echo configure:2146: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2265: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2179: checking for $ac_hdr" >&5
+echo "configure:2298: 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 2184 "configure"
+#line 2303 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2189: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2308: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_kerberosIV_krb_h = yes ; then
echo $ac_n "checking for main in -lkrb4""... $ac_c" 1>&6
-echo "configure:2218: checking for main in -lkrb4" >&5
+echo "configure:2337: 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
ac_save_LIBS="$LIBS"
LIBS="-lkrb4 -lkrb5 -ldes425 $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2226 "configure"
+#line 2345 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2352: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2273: checking for $ac_hdr" >&5
+echo "configure:2392: 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 2278 "configure"
+#line 2397 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2283: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2402: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_krb_h = yes ; then
echo $ac_n "checking for main in -lkrb""... $ac_c" 1>&6
-echo "configure:2312: checking for main in -lkrb" >&5
+echo "configure:2431: 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
ac_save_LIBS="$LIBS"
LIBS="-lkrb -ldes $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2320 "configure"
+#line 2439 "configure"
#include "confdefs.h"
int main() {
main()
; return 0; }
EOF
-if { (eval echo configure:2327: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2446: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2370: checking for $ac_hdr" >&5
+echo "configure:2489: 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 2375 "configure"
+#line 2494 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2380: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_pthread_h = yes ; then
echo $ac_n "checking POSIX thread version""... $ac_c" 1>&6
-echo "configure:2409: checking POSIX thread version" >&5
+echo "configure:2528: 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 2415 "configure"
+#line 2534 "configure"
#include "confdefs.h"
# include <pthread.h>
cat > conftest.$ac_ext <<EOF
-#line 2437 "configure"
+#line 2556 "configure"
#include "confdefs.h"
# include <pthread.h>
echo $ac_n "checking for LinuxThreads""... $ac_c" 1>&6
-echo "configure:2490: checking for LinuxThreads" >&5
+echo "configure:2609: checking for LinuxThreads" >&5
if eval "test \"`echo '$''{'ol_cv_linux_threads'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
echo $ac_n "checking for pthread_create""... $ac_c" 1>&6
-echo "configure:2516: checking for pthread_create" >&5
+echo "configure:2635: 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 2521 "configure"
+#line 2640 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char pthread_create(); below. */
; return 0; }
EOF
-if { (eval echo configure:2544: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_pthread_create=yes"
else
if test $ol_link_threads = no ; then
echo $ac_n "checking for pthread_create with -pthread""... $ac_c" 1>&6
-echo "configure:2566: checking for pthread_create with -pthread" >&5
+echo "configure:2685: 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
save_LIBS="$LIBS"
LIBS="-pthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2574 "configure"
+#line 2693 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {
; return 0; }
EOF
-if { (eval echo configure:2584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2703: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ol_cv_pthread_flag=yes
else
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:2609: checking for pthread_create in -lpthread" >&5
+echo "configure:2728: 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
ac_save_LIBS="$LIBS"
LIBS="-lpthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2617 "configure"
+#line 2736 "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
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:2628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2747: \"$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
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:2656: checking for pthread_create in -lc_r" >&5
+echo "configure:2775: 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
ac_save_LIBS="$LIBS"
LIBS="-lc_r $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2664 "configure"
+#line 2783 "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
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:2675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2794: \"$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
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:2703: checking for pthread_create in -lpthread" >&5
+echo "configure:2822: 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 if test $ol_with_preemptive = auto ; then
- ol_with_preemptive=yes
- fi
- -lmach -lexc -lc $LIBS"
+LIBS="-lpthread -lmach -lexc -lc $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 2714 "configure"
+#line 2830 "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
pthread_create()
; return 0; }
EOF
-if { (eval echo configure:2725: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2841: \"$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
ol_link_threads=posix
LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"
+ if test $ol_with_preemptive = auto ; then
+ ol_with_preemptive=yes
+ fi
+
else
echo "$ac_t""no" 1>&6
fi
for ac_func in sched_yield pthread_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2767: checking for $ac_func" >&5
+echo "configure:2887: 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 2772 "configure"
+#line 2892 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2795: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:2915: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
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
+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
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lrt $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 2951 "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 sched_yield();
+
+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
+ 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
+ LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
+ cat >> confdefs.h <<\EOF
+#define HAVE_SCHED_YIELD 1
+EOF
+
+ ac_cv_func_sched_yield=yes
+else
+ echo "$ac_t""no" 1>&6
+ac_cv_func_sched_yield=no
+fi
+
+ 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
+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
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lposix4 $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 3000 "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 sched_yield();
+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
+ 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
+ LTHREAD_LIBS="$LTHREAD_LIBS -lposix4"
+ cat >> confdefs.h <<\EOF
+#define HAVE_SCHED_YIELD 1
+EOF
+
+ ac_cv_func_sched_yield=yes
+else
+ echo "$ac_t""no" 1>&6
+ac_cv_func_sched_yield=no
+fi
+
+ fi
+ if test $ac_cv_func_sched_yield = no -a \
+ $ac_cv_func_pthread_yield = no ; then
echo "configure: warning: could not locate sched_yield() or pthread_yield()" 1>&2
{ echo "configure: error: POSIX Threads are not usable" 1>&2; exit 1; }
fi
for ac_func in pthread_kill
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2830: checking for $ac_func" >&5
+echo "configure:3047: 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 2835 "configure"
+#line 3052 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:2858: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3075: \"$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_setconcurrency \
+ thr_setconcurrency \
+
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:3106: 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"
+#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:3134: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
if test $ol_with_preemptive = auto ; then
echo $ac_n "checking for preemptive Pthread implementation""... $ac_c" 1>&6
-echo "configure:2885: checking for preemptive Pthread implementation" >&5
+echo "configure:3161: 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 2891 "configure"
+#line 3167 "configure"
#include "confdefs.h"
#include <sys/types.h>
int argc; char **argv;
{
pthread_t t;
+
+#ifdef HAVE_PTHREAD_SETCONCURRENCY
+ (void) pthread_setconcurrency(2);
+#elif HAVE_THR_SETCONCURRENCY
+ /* Set Solaris LWP concurrency to 2 */
+ thr_setconcurrency(2);
+#endif
+
pthread_create(&t, NULL, (void *) task, NULL);
#if HAVE_SCHED_YIELD
}
EOF
-if { (eval echo configure:2935: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3219: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ol_pthread_preemptive=yes
else
fi
fi
+
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
else
fi
fi
-if test $ol_with_threads = auto -o $ol_with_threads = cthreads ; then
+if test $ol_with_threads = auto -o $ol_with_threads = mach ; then
for ac_hdr in mach/cthreads.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2975: checking for $ac_hdr" >&5
+echo "configure:3260: 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 2980 "configure"
+#line 3265 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2985: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3270: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
fi
done
- if test $ac_cv_header_lwp_lwp_h = yes ; then
- echo $ac_n "checking for cthread_fork in -llwp""... $ac_c" 1>&6
-echo "configure:3013: checking for cthread_fork in -llwp" >&5
-ac_lib_var=`echo lwp'_'cthread_fork | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
+ if test $ac_cv_header_mach_cthreads_h = yes ; then
+ ol_with_threads=found
+
+ echo $ac_n "checking for cthread_fork""... $ac_c" 1>&6
+echo "configure:3300: 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
- ac_save_LIBS="$LIBS"
-LIBS="-llwp $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 3021 "configure"
+ cat > conftest.$ac_ext <<EOF
+#line 3305 "configure"
#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char cthread_fork(); 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 cthread_fork();
int main() {
-cthread_fork()
+
+/* 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_cthread_fork) || defined (__stub___cthread_fork)
+choke me
+#else
+cthread_fork();
+#endif
+
; return 0; }
EOF
-if { (eval echo configure:3032: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3328: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
+ eval "ac_cv_func_cthread_fork=yes"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
+ eval "ac_cv_func_cthread_fork=no"
fi
rm -f conftest*
-LIBS="$ac_save_LIBS"
-
fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
+
+if eval "test \"`echo '$ac_cv_func_'cthread_fork`\" = yes"; then
echo "$ac_t""yes" 1>&6
- have_cthreads=yes
+ ol_link_threads=yes
else
echo "$ac_t""no" 1>&6
-have_cthreads=no
fi
- if test $have_cthreads = yes ; then
- cat >> confdefs.h <<\EOF
-#define HAVE_MACH_CTHREADS 1
+ 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
+if eval "test \"`echo '$''{'ol_cv_cthread_all_load'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+
+ save_LIBS="$LIBS"
+ LIBS="-all_load $LIBS"
+ cat > conftest.$ac_ext <<EOF
+#line 3358 "configure"
+#include "confdefs.h"
+#include <mach/cthreads.h>
+int main() {
+
+ cthread_fork((void *)0, (void *)0);
+
+; return 0; }
EOF
+if { (eval echo configure:3367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ol_cv_cthread_all_load=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ol_cv_cthread_all_load=no
+fi
+rm -f conftest*
+ LIBS="$save_LIBS"
+
+fi
- LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
+echo "$ac_t""$ol_cv_cthread_all_load" 1>&6
+
+ if test $ol_cv_cthread_all_load = yes ; then
+ LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
+ ol_link_threads=mach
+ fi
+ fi
+
+ if test $ol_link_threads != no ; then
+ : check for cthread specific functionality here
+ else
+ { echo "configure: error: could not link with Mach CThreads" 1>&2; exit 1; }
fi
fi
+
+ if test $ol_with_threads = mach ; then
+ { echo "configure: error: could not locate Mach CThreads" 1>&2; exit 1; }
+ fi
fi
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:3069: checking for $ac_hdr" >&5
+echo "configure:3406: 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 3074 "configure"
+#line 3411 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3079: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3416: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
fi
done
- if test $ac_cv_header_lwp_lwp_h = yes ; then
+ 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:3107: checking for thr_create in -lthread" >&5
+echo "configure:3444: 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
ac_save_LIBS="$LIBS"
LIBS="-lthread $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3115 "configure"
+#line 3452 "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
thr_create()
; return 0; }
EOF
-if { (eval echo configure:3126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3463: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3165: checking for $ac_hdr" >&5
+echo "configure:3502: 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 3170 "configure"
+#line 3507 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3175: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3512: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
fi
done
- if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
+ 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:3203: checking for lwp_create in -llwp" >&5
+echo "configure:3540: 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
ac_save_LIBS="$LIBS"
LIBS="-llwp $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3211 "configure"
+#line 3548 "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
lwp_create()
; return 0; }
EOF
-if { (eval echo configure:3222: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3559: \"$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
fi
if test $ol_with_threads = manual ; then
- $ol_link_threads=yes
+ ol_link_threads=yes
echo "configure: warning: thread defines and link options must be set manually" 1>&2
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3274: checking for $ac_hdr" >&5
+echo "configure:3611: 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 3279 "configure"
+#line 3616 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3284: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3621: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
for ac_func in sched_yield pthread_yield
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3313: checking for $ac_func" >&5
+echo "configure:3650: 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 3318 "configure"
+#line 3655 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:3341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3678: \"$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 $ac_n "checking for LinuxThreads""... $ac_c" 1>&6
-echo "configure:3367: checking for LinuxThreads" >&5
+echo "configure:3704: checking for LinuxThreads" >&5
if eval "test \"`echo '$''{'ol_cv_linux_threads'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3388: checking for $ac_hdr" >&5
+echo "configure:3725: 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 3393 "configure"
+#line 3730 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3398: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3735: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3428: checking for $ac_hdr" >&5
+echo "configure:3765: 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 3433 "configure"
+#line 3770 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3775: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3468: checking for $ac_hdr" >&5
+echo "configure:3805: 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 3473 "configure"
+#line 3810 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3478: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3815: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
fi
+if test $ol_with_threads = yes ; then
+ cat >> confdefs.h <<\EOF
+#define _REENTRANT 1
+EOF
+
+ cat >> confdefs.h <<\EOF
+#define _THREAD_SAFE 1
+EOF
+
+fi
+
+
if test $ol_link_threads = no ; then
if test $ol_with_threads = yes ; then
{ echo "configure: error: no suitable thread support" 1>&2; exit 1; }
if test $ol_with_threads = auto ; then
echo "configure: warning: no suitable thread support, disabling threads" 1>&2
- $ol_with_threads = no
+ ol_with_threads=no
fi
cat >> confdefs.h <<\EOF
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:3530: checking for DB2 library" >&5
+echo "configure:3879: 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:3536: checking for db_open in -ldb" >&5
+echo "configure:3885: 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
ac_save_LIBS="$LIBS"
LIBS="-ldb $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3544 "configure"
+#line 3893 "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
db_open()
; return 0; }
EOF
-if { (eval echo configure:3555: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:3904: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3586: checking for $ac_hdr" >&5
+echo "configure:3935: 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 3591 "configure"
+#line 3940 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3596: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3945: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ac_cv_header_db_h = yes ; then
echo $ac_n "checking if db.h is DB2""... $ac_c" 1>&6
-echo "configure:3624: checking if db.h is DB2" >&5
+echo "configure:3973: 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 3630 "configure"
+#line 3979 "configure"
#include "confdefs.h"
# include <db.h>
echo $ac_n "checking for Berkeley DB2""... $ac_c" 1>&6
-echo "configure:3662: checking for Berkeley DB2" >&5
+echo "configure:4011: 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
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:3708: checking for Berkeley DB library" >&5
+echo "configure:4057: 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:3714: checking for dbopen" >&5
+echo "configure:4063: 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 3719 "configure"
+#line 4068 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dbopen(); below. */
; return 0; }
EOF
-if { (eval echo configure:3742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4091: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_dbopen=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbopen in -ldb""... $ac_c" 1>&6
-echo "configure:3761: checking for dbopen in -ldb" >&5
+echo "configure:4110: 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
ac_save_LIBS="$LIBS"
LIBS="-ldb $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 3769 "configure"
+#line 4118 "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
dbopen()
; return 0; }
EOF
-if { (eval echo configure:3780: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4129: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3815: checking for $ac_hdr" >&5
+echo "configure:4164: 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 3820 "configure"
+#line 4169 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4174: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for Berkeley DB""... $ac_c" 1>&6
-echo "configure:3861: checking for Berkeley DB" >&5
+echo "configure:4210: 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
fi
if test $ol_with_ldbm_api = manual ; then
- $ol_link_ldbm=yes
+ ol_link_ldbm=yes
echo "configure: warning: LDBM defines and link options must be set manually" 1>&2
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3914: checking for $ac_hdr" >&5
+echo "configure:4263: 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 3919 "configure"
+#line 4268 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3924: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4273: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
echo "configure: warning: Could not find LDBM with BTREE support" 1>&2
- $ol_with_ldbm_api=none
+ ol_with_ldbm_api=none
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:3959: checking for GDBM library" >&5
+echo "configure:4308: 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:3965: checking for gdbm_open" >&5
+echo "configure:4314: 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 3970 "configure"
+#line 4319 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char gdbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:3993: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4342: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_gdbm_open=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for gdbm_open in -lgdbm""... $ac_c" 1>&6
-echo "configure:4012: checking for gdbm_open in -lgdbm" >&5
+echo "configure:4361: 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
ac_save_LIBS="$LIBS"
LIBS="-lgdbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4020 "configure"
+#line 4369 "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
gdbm_open()
; return 0; }
EOF
-if { (eval echo configure:4031: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4380: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4066: checking for $ac_hdr" >&5
+echo "configure:4415: 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 4071 "configure"
+#line 4420 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4076: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:4103: checking for db" >&5
+echo "configure:4452: checking for db" >&5
if eval "test \"`echo '$''{'ol_cv_gdbm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
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:4137: checking for NDBM library" >&5
+echo "configure:4486: 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:4143: checking for dbm_open" >&5
+echo "configure:4492: 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 4148 "configure"
+#line 4497 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char dbm_open(); below. */
; return 0; }
EOF
-if { (eval echo configure:4171: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4520: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_dbm_open=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -lndbm""... $ac_c" 1>&6
-echo "configure:4190: checking for dbm_open in -lndbm" >&5
+echo "configure:4539: 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
ac_save_LIBS="$LIBS"
LIBS="-lndbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4198 "configure"
+#line 4547 "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
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:4209: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4558: \"$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 "$ac_t""no" 1>&6
echo $ac_n "checking for dbm_open in -ldbm""... $ac_c" 1>&6
-echo "configure:4229: checking for dbm_open in -ldbm" >&5
+echo "configure:4578: 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
ac_save_LIBS="$LIBS"
LIBS="-ldbm $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4237 "configure"
+#line 4586 "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
dbm_open()
; return 0; }
EOF
-if { (eval echo configure:4248: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4597: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4285: checking for $ac_hdr" >&5
+echo "configure:4634: 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 4290 "configure"
+#line 4639 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4295: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
done
echo $ac_n "checking for db""... $ac_c" 1>&6
-echo "configure:4322: checking for db" >&5
+echo "configure:4671: checking for db" >&5
if eval "test \"`echo '$''{'ol_cv_ndbm'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
fi
echo "configure: warning: disabling LDBM" 1>&2
- $ol_enable_ldbm=no
+ ol_enable_ldbm=no
fi
if test $ol_enable_wrappers = yes ; then
echo $ac_n "checking for hosts_access in -lwrap""... $ac_c" 1>&6
-echo "configure:4370: checking for hosts_access in -lwrap" >&5
+echo "configure:4719: 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
ac_save_LIBS="$LIBS"
LIBS="-lwrap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4378 "configure"
+#line 4727 "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
hosts_access()
; return 0; }
EOF
-if { (eval echo configure:4389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4738: \"$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
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4435: checking for $ac_hdr" >&5
+echo "configure:4784: 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 4440 "configure"
+#line 4789 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4445: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4794: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
if test $ol_link_termcap = no ; then
echo $ac_n "checking for tputs in -ltermcap""... $ac_c" 1>&6
-echo "configure:4474: checking for tputs in -ltermcap" >&5
+echo "configure:4823: 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
ac_save_LIBS="$LIBS"
LIBS="-ltermcap $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4482 "configure"
+#line 4831 "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
tputs()
; return 0; }
EOF
-if { (eval echo configure:4493: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4842: \"$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
if test $ol_link_termcap = no ; then
echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:4526: checking for initscr in -lncurses" >&5
+echo "configure:4875: 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
ac_save_LIBS="$LIBS"
LIBS="-lncurses $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4534 "configure"
+#line 4883 "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
initscr()
; return 0; }
EOF
-if { (eval echo configure:4545: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4894: \"$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
# 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:4587: checking for crypt" >&5
+echo "configure:4936: 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 4592 "configure"
+#line 4941 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char crypt(); below. */
; return 0; }
EOF
-if { (eval echo configure:4615: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_crypt=yes"
else
echo "$ac_t""no" 1>&6
echo $ac_n "checking for crypt in -lcrypt""... $ac_c" 1>&6
-echo "configure:4634: checking for crypt in -lcrypt" >&5
+echo "configure:4983: 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
ac_save_LIBS="$LIBS"
LIBS="-lcrypt $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4642 "configure"
+#line 4991 "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
crypt()
; return 0; }
EOF
-if { (eval echo configure:4653: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5002: \"$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
fi
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
+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"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char setproctitle(); 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 setproctitle();
+
+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_setproctitle) || defined (__stub___setproctitle)
+choke me
+#else
+setproctitle();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:5074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_setproctitle=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_setproctitle=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'setproctitle`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ have_setproctitle=yes
+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
+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
+else
+ ac_save_LIBS="$LIBS"
+LIBS="-lutil $LIBS"
+cat > conftest.$ac_ext <<EOF
+#line 5101 "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 setproctitle();
+
+int main() {
+setproctitle()
+; return 0; }
+EOF
+if { (eval echo configure:5112: \"$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
+ have_setproctitle=yes
+ LUTIL_LIBS="$LUTIL_LIBS -lutil"
+else
+ echo "$ac_t""no" 1>&6
+have_setproctitle=no
+ LIBOBJS="$LIBOBJS setproctitle.o"
+fi
+
+fi
+
+
+ if test $have_setproctitle = yes ; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_SETPROCTITLE 1
+EOF
+
+ fi
+fi
+
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4695: checking for ANSI C header files" >&5
+echo "configure:5147: 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 4700 "configure"
+#line 5152 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4708: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5160: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf 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 4725 "configure"
+#line 5177 "configure"
#include "confdefs.h"
#include <string.h>
EOF
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 4743 "configure"
+#line 5195 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
:
else
cat > conftest.$ac_ext <<EOF
-#line 4764 "configure"
+#line 5216 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
exit (0); }
EOF
-if { (eval echo configure:4775: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
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:4808: checking for $ac_hdr that defines DIR" >&5
+echo "configure:5260: 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 4813 "configure"
+#line 5265 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <$ac_hdr>
DIR *dirp = 0;
; return 0; }
EOF
-if { (eval echo configure:4821: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5273: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
eval "ac_cv_header_dirent_$ac_safe=yes"
else
# 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:4846: checking for opendir in -ldir" >&5
+echo "configure:5298: 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
ac_save_LIBS="$LIBS"
LIBS="-ldir $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4854 "configure"
+#line 5306 "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
opendir()
; return 0; }
EOF
-if { (eval echo configure:4865: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5317: \"$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
else
echo $ac_n "checking for opendir in -lx""... $ac_c" 1>&6
-echo "configure:4887: checking for opendir in -lx" >&5
+echo "configure:5339: 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
ac_save_LIBS="$LIBS"
LIBS="-lx $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 4895 "configure"
+#line 5347 "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
opendir()
; return 0; }
EOF
-if { (eval echo configure:4906: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:5358: \"$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
fi
echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6
-echo "configure:4929: checking for sys/wait.h that is POSIX.1 compatible" >&5
+echo "configure:5381: 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 4934 "configure"
+#line 5386 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/wait.h>
s = WIFEXITED (s) ? WEXITSTATUS (s) : 1;
; return 0; }
EOF
-if { (eval echo configure:4950: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5402: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_sys_wait_h=yes
else
fi
for ac_hdr in \
+ stdarg.h \
stddef.h \
errno.h \
fcntl.h \
filio.h \
getopt.h \
+ libutil.h \
limits.h \
malloc.h \
regex.h \
sgtty.h \
sys/file.h \
+ sys/filio.h \
sys/errno.h \
sys/ioctl.h \
sys/param.h \
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4995: checking for $ac_hdr" >&5
+echo "configure:5450: 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 5000 "configure"
+#line 5455 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:5005: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:5460: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5033: checking for uid_t in sys/types.h" >&5
+echo "configure:5488: 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 5038 "configure"
+#line 5493 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
fi
echo $ac_n "checking type of array argument to getgroups""... $ac_c" 1>&6
-echo "configure:5067: checking type of array argument to getgroups" >&5
+echo "configure:5522: 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
ac_cv_type_getgroups=cross
else
cat > conftest.$ac_ext <<EOF
-#line 5075 "configure"
+#line 5530 "configure"
#include "confdefs.h"
/* Thanks to Mike Rendell for this test. */
}
EOF
-if { (eval echo configure:5100: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5555: \"$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
if test $ac_cv_type_getgroups = cross; then
cat > conftest.$ac_ext <<EOF
-#line 5114 "configure"
+#line 5569 "configure"
#include "confdefs.h"
#include <unistd.h>
EOF
echo $ac_n "checking for mode_t""... $ac_c" 1>&6
-echo "configure:5138: checking for mode_t" >&5
+echo "configure:5593: 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 5143 "configure"
+#line 5598 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:5171: checking for off_t" >&5
+echo "configure:5626: 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 5176 "configure"
+#line 5631 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for pid_t""... $ac_c" 1>&6
-echo "configure:5204: checking for pid_t" >&5
+echo "configure:5659: 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 5209 "configure"
+#line 5664 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:5237: checking return type of signal handlers" >&5
+echo "configure:5692: 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 5242 "configure"
+#line 5697 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <signal.h>
int i;
; return 0; }
EOF
-if { (eval echo configure:5259: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5714: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_type_signal=void
else
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:5278: checking for size_t" >&5
+echo "configure:5733: 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 5283 "configure"
+#line 5738 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
fi
echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:5311: checking for uid_t in sys/types.h" >&5
+echo "configure:5766: 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 5316 "configure"
+#line 5771 "configure"
#include "confdefs.h"
#include <sys/types.h>
EOF
fi
echo $ac_n "checking for st_blksize in struct stat""... $ac_c" 1>&6
-echo "configure:5345: checking for st_blksize in struct stat" >&5
+echo "configure:5800: 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 5350 "configure"
+#line 5805 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
struct stat s; s.st_blksize;
; return 0; }
EOF
-if { (eval echo configure:5358: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5813: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_st_blksize=yes
else
fi
echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:5379: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:5834: 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 5384 "configure"
+#line 5839 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
struct tm *tp;
; return 0; }
EOF
-if { (eval echo configure:5393: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5848: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_header_time=yes
else
fi
echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
-echo "configure:5414: checking whether struct tm is in sys/time.h or time.h" >&5
+echo "configure:5869: 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 5419 "configure"
+#line 5874 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <time.h>
struct tm *tp; tp->tm_sec;
; return 0; }
EOF
-if { (eval echo configure:5427: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5882: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_struct_tm=time.h
else
echo $ac_n "checking if toupper() requires islower()""... $ac_c" 1>&6
-echo "configure:5450: checking if toupper() requires islower()" >&5
+echo "configure:5905: 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
ol_cv_c_upper_lower=safe
else
cat > conftest.$ac_ext <<EOF
-#line 5459 "configure"
+#line 5914 "configure"
#include "confdefs.h"
#include <ctype.h>
exit(1);
}
EOF
-if { (eval echo configure:5471: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:5926: \"$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
fi
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:5494: checking for working const" >&5
+echo "configure:5949: 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 5499 "configure"
+#line 5954 "configure"
#include "confdefs.h"
int main() {
; return 0; }
EOF
-if { (eval echo configure:5548: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6003: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:5571: checking for 8-bit clean memcmp" >&5
+echo "configure:6026: 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
ac_cv_func_memcmp_clean=no
else
cat > conftest.$ac_ext <<EOF
-#line 5579 "configure"
+#line 6034 "configure"
#include "confdefs.h"
main()
}
EOF
-if { (eval echo configure:5589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6044: \"$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
test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.o"
echo $ac_n "checking for strftime""... $ac_c" 1>&6
-echo "configure:5607: checking for strftime" >&5
+echo "configure:6062: 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 5612 "configure"
+#line 6067 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strftime(); below. */
; return 0; }
EOF
-if { (eval echo configure:5635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6090: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_strftime=yes"
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:5657: checking for strftime in -lintl" >&5
+echo "configure:6112: 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
ac_save_LIBS="$LIBS"
LIBS="-lintl $LIBS"
cat > conftest.$ac_ext <<EOF
-#line 5665 "configure"
+#line 6120 "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
strftime()
; return 0; }
EOF
-if { (eval echo configure:5676: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6131: \"$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
fi
echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:5703: checking for vprintf" >&5
+echo "configure:6158: 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 5708 "configure"
+#line 6163 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vprintf(); below. */
; return 0; }
EOF
-if { (eval echo configure:5731: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6186: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_vprintf=yes"
else
if test "$ac_cv_func_vprintf" != yes; then
echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:5755: checking for _doprnt" >&5
+echo "configure:6210: 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 5760 "configure"
+#line 6215 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char _doprnt(); below. */
; return 0; }
EOF
-if { (eval echo configure:5783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6238: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func__doprnt=yes"
else
fi
+
+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
+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"
+#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:6295: \"$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
+
+fi
+
echo $ac_n "checking for wait3 that fills in rusage""... $ac_c" 1>&6
-echo "configure:5808: checking for wait3 that fills in rusage" >&5
+echo "configure:6322: 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
ac_cv_func_wait3_rusage=no
else
cat > conftest.$ac_ext <<EOF
-#line 5816 "configure"
+#line 6330 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/time.h>
}
}
EOF
-if { (eval echo configure:5847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:6361: \"$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
setsid \
signal \
sigset \
+ snprintf \
socket \
strerror \
strstr \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5901: checking for $ac_func" >&5
+echo "configure:6416: 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 5906 "configure"
+#line 6421 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:5929: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
for ac_func in getopt strdup tempnam
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:5957: checking for $ac_func" >&5
+echo "configure:6472: 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 5962 "configure"
+#line 6477 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
; return 0; }
EOF
-if { (eval echo configure:5985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6500: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
-echo "configure:6015: checking declaration of sys_errlist" >&5
+echo "configure:6530: 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 6021 "configure"
+#line 6536 "configure"
#include "confdefs.h"
#include <stdio.h>
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:6031: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:6546: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
else
EOF
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
-echo "configure:6052: checking existence of sys_errlist" >&5
+echo "configure:6567: 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 6058 "configure"
+#line 6573 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
-if { (eval echo configure:6065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:6580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
#define LDAP_DNS 1
EOF
+fi
+if test $ol_enable_proctitle != no ; then
+ cat >> confdefs.h <<\EOF
+#define LDAP_PROCTITLE 1
+EOF
+
fi
if test $ol_enable_referrals != no ; then
cat >> confdefs.h <<\EOF
BUILD_SLURPD=yes
fi
+if test $ol_enable_ldapd != no ; then
+ BUILD_LDAPD=yes
+fi
+
EOF
cat >> $CONFIG_STATUS <<\EOF
+
date > stamp-h
+echo Please \"make depend\" to build dependencies
+
exit 0
EOF
chmod +x $CONFIG_STATUS
dnl General "enable" options
OL_ARG_ENABLE(debug,[ --enable-debug enable debugging], yes)dnl
dnl OL_ARG_ENABLE(syslog,[ --enable-syslog enable syslog support], auto)dnl
+OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
OL_ARG_ENABLE(libui,[ --enable-libui enable library user interface], yes)dnl
OL_ARG_ENABLE(cache,[ --enable-cache enable caching], yes)dnl
-OL_ARG_ENABLE(dns,[ --enable-dns enable dns support], no)dnl
+OL_ARG_ENABLE(dns,[ --enable-dns enable dns support], no)dnl
OL_ARG_ENABLE(referrals,[ --enable-referrals enable referrals], yes)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
+OL_ARG_ENABLE(x_compile,[ --enable-x-compile enable cross compiling],
+ no, [yes no])dnl
dnl General "with" options
OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
dnl Checks the compiler and UNIX Variants
AC_PROG_CC
+
+if test $cross_compiling = yes -a $ol_enable_x_compile = yes; then
+ AC_WARN([cross compiling.... go for it])
+
+elif test $cross_compiling = no -a $ol_enable_x_compile = yes; then
+ AC_WARN([programs compiled here do run here...])
+ AC_ERROR([ if not cross compiling, use --disable-x-compile.])
+
+elif test $cross_compiling = yes -a $ol_enable_x_compile = no; then
+ AC_WARN([programs compiled here do not run here...])
+ AC_ERROR([ if cross compiling, add --enable-x-compile.])
+fi
+
AC_PROG_GCC_TRADITIONAL
+AC_PROG_CPP
+
AC_AIX
AC_ISC_POSIX
AC_MINIX
-dnl ----------------------------------------------------------------
dnl Checks for libraries
dnl Find socket()
AC_CHECK_LIB(pthread, pthread_create, [
AC_DEFINE(HAVE_DCE)
ol_link_threads=posix
- LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"],,
+ LTHREAD_LIBS="$LTHREAD_LIBS -lpthread -lmach -lexc -lc"
if test $ol_with_preemptive = auto ; then
ol_with_preemptive=yes
fi
- [-lmach -lexc -lc])
+ ],,[-lmach -lexc -lc])
LIBS="$save_LIBS"
fi
if test $ac_cv_func_sched_yield = no -a \
$ac_cv_func_pthread_yield = no ; then
-
+ dnl Digital UNIX has sched_yield() in -lrt
+ AC_CHECK_LIB(rt, sched_yield,
+ [LTHREAD_LIBS="$LTHREAD_LIBS -lrt"
+ AC_DEFINE(HAVE_SCHED_YIELD,1)
+ ac_cv_func_sched_yield=yes],
+ [ac_cv_func_sched_yield=no])
+ fi
+ if test $ac_cv_func_sched_yield = no -a \
+ $ac_cv_func_pthread_yield = no ; then
+ dnl Solaris has sched_yield() in -lposix4
+ AC_CHECK_LIB(posix4, sched_yield,
+ [LTHREAD_LIBS="$LTHREAD_LIBS -lposix4"
+ AC_DEFINE(HAVE_SCHED_YIELD,1)
+ ac_cv_func_sched_yield=yes],
+ [ac_cv_func_sched_yield=no])
+ fi
+ if test $ac_cv_func_sched_yield = no -a \
+ $ac_cv_func_pthread_yield = no ; then
AC_MSG_WARN([could not locate sched_yield() or pthread_yield()])
AC_MSG_ERROR([POSIX Threads are not usable])
fi
dnl Check functions for compatibility
AC_CHECK_FUNCS(pthread_kill)
-dnl AC_CHECK_FUNCS(
+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 )
+ dnl Check for setconcurreny functions
+ AC_CHECK_FUNCS( \
+ pthread_setconcurrency \
+ thr_setconcurrency \
+ )
+
dnl Check PREEMPTIVE Implementation
if test $ol_with_preemptive = auto ; then
AC_MSG_CHECKING([for preemptive Pthread implementation])
int argc; char **argv;
{
pthread_t t;
+
+#ifdef HAVE_PTHREAD_SETCONCURRENCY
+ (void) pthread_setconcurrency(2);
+#elif HAVE_THR_SETCONCURRENCY
+ /* Set Solaris LWP concurrency to 2 */
+ thr_setconcurrency(2);
+#endif
+
pthread_create(&t, NULL, (void *) task, NULL);
#if HAVE_SCHED_YIELD
fi
fi
+dnl dnl check for reentrant/threadsafe functions
+dnl AC_CHECK_FUNCS( \
+dnl feof_unlocked \
+dnl unlocked_feof \
+dnl ftrylockfile \
+dnl flockfile \
+dnl putc_unlocked \
+dnl gmtime_r \
+dnl strtok_r \
+dnl )
+
dnl restore DEFS/LIBS
CPPFLAGS="$save_CPPFLAGS"
LIBS="$save_LIBS"
fi
fi
-if test $ol_with_threads = auto -o $ol_with_threads = cthreads ; then
+if test $ol_with_threads = auto -o $ol_with_threads = mach ; then
dnl check for Mach CThreads
AC_CHECK_HEADERS(mach/cthreads.h)
- if test $ac_cv_header_lwp_lwp_h = yes ; then
- AC_CHECK_LIB(lwp, cthread_fork, [have_cthreads=yes], [have_cthreads=no])
+ if test $ac_cv_header_mach_cthreads_h = yes ; then
+ ol_with_threads=found
- if test $have_cthreads = yes ; then
- AC_DEFINE(HAVE_MACH_CTHREADS)
- LTHREAD_LIBS="$LTHREAD_LIBS -llwp"
+ dnl A few platforms have cthread support in standard libraries
+ AC_CHECK_FUNC(cthread_fork,[ol_link_threads=yes])
+
+ if test $ol_link_threads = no ; then
+ dnl try -all_load
+ dnl this test needs work
+ AC_CACHE_CHECK([for cthread_fork with -all_load],
+ [ol_cv_cthread_all_load], [
+ dnl save the CPPFLAGS
+ save_LIBS="$LIBS"
+ LIBS="-all_load $LIBS"
+ AC_TRY_LINK([#include <mach/cthreads.h>],[
+ cthread_fork((void *)0, (void *)0);
+ ], ol_cv_cthread_all_load=yes, ol_cv_cthread_all_load=no)
+ dnl restore the LIBS
+ LIBS="$save_LIBS"
+ ])
+
+ if test $ol_cv_cthread_all_load = yes ; then
+ LTHREAD_LIBS="$LTHREAD_LIBS -all_load"
+ ol_link_threads=mach
+ fi
+ fi
+
+ if test $ol_link_threads != no ; then
+ : check for cthread specific functionality here
+ else
+ AC_MSG_ERROR([could not link with Mach CThreads])
fi
fi
+
+ if test $ol_with_threads = mach ; then
+ AC_MSG_ERROR([could not locate Mach CThreads])
+ fi
fi
if test $ol_with_threads = auto -o $ol_with_threads = lwp ; then
dnl check for SunOS5 LWP
AC_CHECK_HEADERS(thread.h synch.h)
- if test $ac_cv_header_lwp_lwp_h = yes ; then
+ if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
AC_CHECK_LIB(thread, thr_create, [have_lwp=yes], [have_lwp=no])
if test $have_lwp = yes ; then
dnl check for SunOS4 LWP
AC_CHECK_HEADERS(lwp/lwp.h)
- if test $ac_cv_header_thread_h = yes -a $ac_cv_header_synch_h = yes ; then
+ if test $ac_cv_header_lwp_lwp_h = yes ; then
AC_CHECK_LIB(lwp, lwp_create, [have_lwp=yes], [have_lwp=no])
if test $have_lwp = yes ; then
if test $ol_with_threads = manual ; then
dnl User thinks he can manually configure threads.
- $ol_link_threads=yes
+ ol_link_threads=yes
AC_MSG_WARN([thread defines and link options must be set manually])
AC_CHECK_HEADERS(thread.h synch.h)
fi
+if test $ol_with_threads = yes ; then
+ dnl needed to get reentrant/threadsafe versions
+ dnl
+ dnl hopefully this will not cause problems with
+ dnl non-threaded apps
+ dnl
+ AC_DEFINE(_REENTRANT,1)
+ AC_DEFINE(_THREAD_SAFE,1)
+fi
+
+dnl ----------------------------------------------------------------
+
if test $ol_link_threads = no ; then
if test $ol_with_threads = yes ; then
AC_MSG_ERROR([no suitable thread support])
if test $ol_with_threads = auto ; then
AC_MSG_WARN([no suitable thread support, disabling threads])
- $ol_with_threads = no
+ ol_with_threads=no
fi
AC_DEFINE(NO_THREADS,1)
if test $ol_with_ldbm_api = manual ; then
dnl User thinks he can manually configure LDBM api.
- $ol_link_ldbm=yes
+ ol_link_ldbm=yes
AC_MSG_WARN([LDBM defines and link options must be set manually])
if test $ol_link_ldbm = no -a $ol_with_ldbm_type = btree ; then
AC_MSG_WARN(Could not find LDBM with BTREE support)
- $ol_with_ldbm_api=none
+ ol_with_ldbm_api=none
fi
if test $ol_with_ldbm_api = auto -o $ol_with_ldbm_api = gdbm ; then
fi
AC_MSG_WARN(disabling LDBM)
- $ol_enable_ldbm=no
+ ol_enable_ldbm=no
fi
if test $ol_enable_wrappers = yes ; then
have_crypt=yes], [have_crypt=no])])
if test $have_crypt = yes ; then
- AC_DEFINE(HAVE_CRYPT)
+ AC_DEFINE(HAVE_CRYPT,1)
else
AC_MSG_WARN(could not find crypt)
if test $ol_enable_crypt = yes ; then
fi
fi
+# FreeBSD (and others) have setproctitle(3) in -lutil
+if test $ol_enable_proctitle != no ; then
+ AC_CHECK_FUNC(setproctitle, [have_setproctitle=yes], [
+ AC_CHECK_LIB(util, setproctitle,
+ [have_setproctitle=yes
+ LUTIL_LIBS="$LUTIL_LIBS -lutil"],
+ [have_setproctitle=no
+ LIBOBJS="$LIBOBJS setproctitle.o"])])
+
+ if test $have_setproctitle = yes ; then
+ AC_DEFINE(HAVE_SETPROCTITLE,1)
+ fi
+fi
+
dnl ----------------------------------------------------------------
dnl Checks for header files.
AC_HEADER_STDC
AC_HEADER_DIRENT
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS( \
+ stdarg.h \
stddef.h \
errno.h \
fcntl.h \
filio.h \
getopt.h \
+ libutil.h \
limits.h \
malloc.h \
regex.h \
sgtty.h \
sys/file.h \
+ sys/filio.h \
sys/errno.h \
sys/ioctl.h \
sys/param.h \
AC_FUNC_MEMCMP
AC_FUNC_STRFTIME
AC_FUNC_VPRINTF
+
+if test $ac_cv_func_vprintf = yes ; then
+ dnl check for vsnprintf
+ AC_CHECK_FUNCS(vsnprintf)
+fi
+
AC_FUNC_WAIT3
AC_CHECK_FUNCS( \
setsid \
signal \
sigset \
+ snprintf \
socket \
strerror \
strstr \
if test $ol_enable_dns != no ; then
AC_DEFINE(LDAP_DNS,1)
fi
+if test $ol_enable_proctitle != no ; then
+ AC_DEFINE(LDAP_PROCTITLE,1)
+fi
if test $ol_enable_referrals != no ; then
AC_DEFINE(LDAP_REFERRALS,1)
fi
BUILD_SLURPD=yes
fi
+if test $ol_enable_ldapd != no ; then
+ BUILD_LDAPD=yes
+fi
+
dnl ----------------------------------------------------------------
AC_SUBST(BUILD_LDAPD)
servers/slapd/tools/Makefile:build/top.mk:servers/slapd/tools/Makefile.in \
servers/slurpd/Makefile:build/top.mk:servers/slurpd/Makefile.in:build/srv.mk \
tests/Makefile:build/top.mk:tests/Makefile.in \
-,[date > stamp-h])
+,[
+date > stamp-h
+echo Please \"make depend\" to build dependencies
+])
--- /dev/null
+/* Generic setproctitle.h */
+
+#ifndef _AC_SETPROCTITLE_H
+#define _AC_SETPROCTITLE_H
+
+#ifdef LDAP_PROCTITLE
+
+#if defined( HAVE_LIBUTIL_H )
+# include <libutil.h>
+#else
+ /* use lutil version */
+ void setproctitle LDAP_P((const char *fmt, ...));
+ extern int Argc;
+ extern char **Argv;
+#endif
+
+#endif /* LDAP_PROCTITLE */
+#endif /* _AC_SETPROCTITLE_H */
--- /dev/null
+/* Generic termios.h */
+
+#ifndef _AC_TERMIOS_H
+#define _AC_TERMIOS_H
+
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+
+#define TERMIO_TYPE struct termios
+#define TERMFLAG_TYPE tcflag_t
+#define GETATTR( fd, tiop ) tcgetattr((fd), (tiop))
+#define SETATTR( fd, tiop ) tcsetattr((fd), TCSANOW /* 0 */, (tiop))
+#define GETFLAGS( tio ) ((tio).c_lflag)
+#define SETFLAGS( tio, flags ) ((tio).c_lflag = (flags))
+
+#elif defined( HAVE_SGTTY_H )
+#include <sgtty.h>
+
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+
+#define TERMIO_TYPE struct sgttyb
+#define TERMFLAG_TYPE int
+#define GETATTR( fd, tiop ) ioctl((fd), TIOCGETP, (caddr_t)(tiop))
+#define SETATTR( fd, tiop ) ioctl((fd), TIOCSETP, (caddr_t)(tiop))
+#define GETFLAGS( tio ) ((tio).sg_flags)
+#define SETFLAGS( tio, flags ) ((tio).sg_flags = (flags))
+
+#endif /* HAVE_SGTTY_H */
+
+#endif /* _AC_TERMIOS_H */
--- /dev/null
+#ifndef _LUTIL_H
+#define _LUTIL_H 1
+
+#include <ldap_cdefs.h>
+/*
+ * Include file for LDAP utility routine
+ */
+
+/* ISC Base64 Routines */
+
+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_END_DECL
+
+#endif /* _LUTIL_H */
--- /dev/null
+/* portable.h.bot begin */
+
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
+#include "ldap_cdefs.h"
+
+#endif /* _LDAP_PORTABLE_H */
+
+/* portable.h.bot end */
/* include/portable.h.in. Generated automatically from configure.in by autoheader. */
+/* portable.h.top begin */
/*
Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
All rights reserved.
#ifndef _LDAP_PORTABLE_H
#define _LDAP_PORTABLE_H
+/* portable.h.top end */
/* Define if on AIX 3.
System headers sometimes define this.
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
+/* define this if needed to get reentrant functions */
+#undef _REENTRANT
+
+/* define this if needed to get threadsafe functions */
+#undef _THREAD_SAFE
+
/* define this if toupper() requires tolower() check */
#undef C_UPPER_LOWER
/* define if you have NDBM */
#undef HAVE_NDBM
-/* define if you have Mach CThreads */
-#undef HAVE_MACH_CTHREADS
-
/* define if you have a preemptive POSIX Threads implementation */
#undef HAVE_PREEMPTIVE_PTHREADS
/* define if your POSIX Threads implementation is circa Draft 4 */
#undef HAVE_PTHREADS_D4
+/* define if you have sched_yield() */
+#ifdef __notdef__
+/* see second sched_yield define */
+#undef HAVE_SCHED_YIELD
+#endif
+
+/* define if you have setproctitle() */
+#undef HAVE_SETPROCTITLE
+
/* define if you have -lwrap */
#undef HAVE_TCPD
/* define this to remove -lldap cache support */
#undef LDAP_NOCACHE
+/* define this for LDAP process title support */
+#undef LDAP_PROCTITLE
+
/* define this for LDAP referrals support */
#undef LDAP_REFERRALS
/* Define if you have the pthread_kill function. */
#undef HAVE_PTHREAD_KILL
+/* Define if you have the pthread_setconcurrency function. */
+#undef HAVE_PTHREAD_SETCONCURRENCY
+
/* Define if you have the pthread_yield function. */
#undef HAVE_PTHREAD_YIELD
/* Define if you have the sigset function. */
#undef HAVE_SIGSET
+/* Define if you have the snprintf function. */
+#undef HAVE_SNPRINTF
+
/* Define if you have the socket function. */
#undef HAVE_SOCKET
/* 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. */
#undef HAVE_WAITPID
/* Define if you have the <krb.h> header file. */
#undef HAVE_KRB_H
+/* Define if you have the <libutil.h> header file. */
+#undef HAVE_LIBUTIL_H
+
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <sgtty.h> header file. */
#undef HAVE_SGTTY_H
+/* Define if you have the <stdarg.h> header file. */
+#undef HAVE_STDARG_H
+
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
+/* Define if you have the <sys/filio.h> header file. */
+#undef HAVE_SYS_FILIO_H
+
/* Define if you have the <sys/ioctl.h> header file. */
#undef HAVE_SYS_IOCTL_H
/* Define if you have the socket library (-lsocket). */
#undef HAVE_LIBSOCKET
+/* portable.h.bot begin */
#ifdef HAVE_STDDEF_H
# include <stddef.h>
#include "ldap_cdefs.h"
#endif /* _LDAP_PORTABLE_H */
+
+/* portable.h.bot end */
--- /dev/null
+/* include/portable.h.nt -- manually updated of MS NT (MS VC5) */
+/* synced with portable.h.in 1.8 */
+/*
+Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted only
+as authorized by the OpenLDAP Public License. A copy of this
+license is available at http://www.OpenLDAP.org/license.html or
+in file LICENSE in the top-level directory of the distribution.
+
+This work is derived from the University of Michigan LDAP v3.3
+distribution. Information concerning is available at
+ http://www.umich.edu/~dirsvcs/ldap/ldap.html.
+
+This work also contains materials derived from public sources.
+
+---
+
+Portions Copyright (c) 1992-1996 Regents of the University of Michigan.
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted
+provided that this notice is preserved and that due credit is given
+to the University of Michigan at Ann Arbor. The name of the University
+may not be used to endorse or promote products derived from this
+software without specific prior written permission. This software
+is provided ``as is'' without express or implied warranty.
+
+*/
+
+#ifndef _LDAP_PORTABLE_H
+#define _LDAP_PORTABLE_H
+
+/* we installed Henry Spencer's REGEX */
+#define HAVE_REGEX_H 1
+
+/* win32 specific stuff */
+#define strcasecmp stricmp
+#define strncasecmp strnicmp
+#define strdup _strdup
+
+/* define type for caddr_t */
+typedef char * caddr_t;
+
+/* we have winsock2 */
+#define HAVE_WINSOCK2 1
+
+/* we have winsock */
+#define HAVE_WINSOCK 1
+
+/* we have <io.h> */
+#define HAVE_IO_H 1
+
+/* we have <process.h> */
+#define HAVE_PROCESS_H 1
+
+/* --------------------------------------------------- */
+
+/* Define if on AIX 3.
+ System headers sometimes define this.
+ We just want to avoid a redefinition error message. */
+#ifndef _ALL_SOURCE
+/* #undef _ALL_SOURCE */
+#endif
+
+/* Define to empty if the keyword does not work. */
+/* #undef const */
+
+/* Define to the type of elements in the array set by `getgroups'.
+ Usually this is either `int' or `gid_t'. */
+/* #undef GETGROUPS_T */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define gid_t long
+
+/* Define if you don't have vprintf but do have _doprnt. */
+/* #undef HAVE_DOPRNT */
+
+/* Define if your struct stat has st_blksize. */
+/* #undef HAVE_ST_BLKSIZE */
+
+/* Define if you have the strftime function. */
+#define HAVE_STRFTIME 1
+
+/* 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 */
+
+/* Define if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define mode_t int
+
+/* Define to `long' if <sys/types.h> doesn't define. */
+/* #undef off_t */
+
+/* Define to `int' if <sys/types.h> doesn't define. */
+#define pid_t int
+
+/* Define if the system does not provide POSIX.1 features except
+ with this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define if you need to in order for stat and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define as the return type of signal handlers (int or void). */
+#define RETSIGTYPE void
+
+/* Define to `unsigned' if <sys/types.h> doesn't define. */
+/* #undef size_t */
+
+/* Define if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define if you can safely include both <sys/time.h> and <time.h>. */
+/* #undef TIME_WITH_SYS_TIME */
+
+/* Define if your <sys/time.h> declares struct tm. */
+/* #undef TM_IN_SYS_TIME */
+
+/* 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
+
+/* define this if sys_errlist is not defined in stdio.h or errno.h */
+/* #undef DECL_SYS_ERRLIST */
+
+/* define if you have berkeley db */
+/* #undef HAVE_BERKELEY_DB */
+
+/* define if you have berkeley db2 */
+/* #undef HAVE_BERKELEY_DB2 */
+
+/* define if you have crypt */
+/* #undef HAVE_CRYPT */
+
+/* define if you have DCE */
+/* #undef HAVE_DCE */
+
+/* define if you have GDBM */
+/* #undef HAVE_GDBM */
+
+/* define if you have Kerberos */
+/* #undef HAVE_KERBEROS */
+
+/* define if you have LinuxThreads */
+/* #undef HAVE_LINUX_THREADS */
+
+/* define if you have Sun LWP (SunOS style) */
+/* #undef HAVE_LWP */
+
+/* define if you have -lncurses */
+/* #undef HAVE_NCURSES */
+
+/* define if you have NDBM */
+/* #undef HAVE_NDBM */
+
+/* define if you have Mach CThreads */
+/* #undef HAVE_MACH_CTHREADS */
+
+/* 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 Draft 4 */
+/* #undef HAVE_PTHREADS_D4 */
+
+/* define if you have sched_yield() */
+#ifdef __notdef__
+/* see second sched_yield define */
+/* #undef HAVE_SCHED_YIELD */
+#endif
+
+/* define if you have setproctitle() */
+#undef HAVE_SETPROCTITLE
+
+/* define if you have -lwrap */
+/* #undef HAVE_TCPD */
+
+/* define if you have -ltermcap */
+/* #undef HAVE_TERMCAP */
+
+/* define if you have Solaris LWP Threads */
+/* #undef HAVE_THR */
+
+/* define this for connectionless LDAP support */
+/* #undef LDAP_CONNECTIONLESS */
+
+/* define this to add debugging code */
+#define LDAP_DEBUG 1
+
+/* define this for LDAP DNS support */
+/* #undef LDAP_DNS */
+
+/* define this to remove -lldap cache support */
+/* #undef LDAP_NOCACHE */
+
+/* define this for LDAP process title support */
+/* #undef LDAP_PROCTITLE */
+
+/* define this for LDAP referrals support */
+#define LDAP_REFERRALS 1
+
+/* define this for LDAP User Interface support */
+/* #undef LDAP_LIBUI */
+
+/* define this to use DBBTREE w/ LDBM backend */
+/* #undef LDBM_USE_DBBTREE */
+
+/* define this to use DBHASH w/ LDBM backend */
+/* #undef LDBM_USE_DBHASH */
+
+/* define this if you want no termcap support */
+#define NO_TERMCAP 1
+
+/* define this if you want no thread support */
+#define NO_THREADS 1
+
+/* define this if the thread package is preemptive */
+#define PREEMPTIVE_THREADS 1
+
+/* define this for ACL Group support */
+#define SLAPD_ACLGROUPS
+
+/* define this for crypt(3) password support */
+/* #undef SLAPD_CRYPT */
+
+/* define this to use SLAPD LDBM backend */
+/* #undef SLAPD_LDBM */
+
+/* define this for MD5 password support */
+#define SLAPD_MD5 1
+
+/* define this to use SLAPD passwd backend */
+/* #undef SLAPD_PASSWD */
+
+/* define this for phonetic support */
+/* #undef SLAPD_PHONETIC */
+
+/* define this for Reverse Lookup support */
+#define SLAPD_RLOOKUPS 1
+
+/* define this for SHA1 password support */
+#define SLAPD_SHA1 1
+
+/* define this to use SLAPD shell backend */
+/* #undef SLAPD_SHELL */
+
+/* Define if you have the bcopy function. */
+/* #undef HAVE_BCOPY */
+
+/* Define if you have the flock function. */
+/* #undef HAVE_FLOCK */
+
+/* Define if you have the getdtablesize function. */
+/* #undef HAVE_GETDTABLESIZE */
+
+/* Define if you have the gethostname function. */
+#define HAVE_GETHOSTNAME 1
+
+/* define if you have the getopt function */
+/* #undef HAVE_GETOPT */
+
+/* Define if you have the gettimeofday function. */
+/* #undef HAVE_GETTIMEOFDAY */
+
+/* Define if you have the lockf function. */
+/* #undef HAVE_LOCKF */
+
+/* Define if you have the memcpy function. */
+#define HAVE_MEMCPY 1
+
+/* Define if you have the memmove function. */
+#define HAVE_MEMMOVE 1
+
+/* Define if you have the mkstemp function. */
+/* #undef HAVE_MKSTEMP */
+
+/* Define if you have the mktime function. */
+#define HAVE_MKTIME 1
+
+/* Define if you have the pthread_kill function. */
+/* #undef HAVE_PTHREAD_KILL */
+
+/* Define if you have the pthread_setconcurrency function. */
+/* #undef HAVE_PTHREAD_SETCONCURRENCY */
+
+/* Define if you have the pthread_yield function. */
+/* #undef HAVE_PTHREAD_YIELD */
+
+/* Define if you have the sched_yield function. */
+/* #undef HAVE_SCHED_YIELD */
+
+/* Define if you have the select function. */
+#define HAVE_SELECT 1
+
+/* Define if you have the setpwfile function. */
+/* #undef HAVE_SETPWFILE */
+
+/* Define if you have the setsid function. */
+/* #undef HAVE_SETSID */
+
+/* Define if you have the signal function. */
+#define HAVE_SIGNAL 1
+
+/* Define if you have the sigset function. */
+/* #undef HAVE_SIGSET */
+
+/* Define if you have the snprintf function. */
+/* #undef HAVE_SNPRINTF */
+
+/* Define if you have the socket function. */
+#define HAVE_SOCKET 1
+
+/* Define if you have the strdup function. */
+#define HAVE_STRDUP 1
+
+/* Define if you have the strerror function. */
+#define HAVE_STRERROR 1
+
+/* Define if you have the strrchr function. */
+#define HAVE_STRRCHR 1
+
+/* Define if you have the strsep function. */
+/* #undef HAVE_STRSEP */
+
+/* Define if you have the strstr function. */
+#define HAVE_STRSTR 1
+
+/* Define if you have the strtod function. */
+#define HAVE_STRTOD 1
+
+/* Define if you have the strtol function. */
+#define HAVE_STRTOL 1
+
+/* Define if you have the strtoul function. */
+#define HAVE_STRTOUL 1
+
+/* Define if you have the sysconf function. */
+/* #undef HAVE_SYSCONF */
+
+/* Define if you have the waitpid function. */
+#define HAVE_WAITPID 1
+
+/* Define if you have the <db.h> header file. */
+/* #undef HAVE_DB_H */
+
+/* Define if you have the <db_185.h> header file. */
+/* #undef HAVE_DB_185_H */
+
+/* Define if you have the <des.h> header file. */
+/* #undef HAVE_DES_H */
+
+/* Define if you have the <dirent.h> header file. */
+/* #undef HAVE_DIRENT_H */
+
+/* Define if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
+
+/* Define if you have the <filio.h> header file. */
+/* #undef HAVE_FILIO_H */
+
+/* Define if you have the <gdbm.h> header file. */
+/* #undef HAVE_GDBM_H */
+
+/* Define if you have the <getopt.h> header file. */
+/* #undef HAVE_GETOPT_H */
+
+/* Define if you have the <kerberosIV/des.h> header file. */
+/* #undef HAVE_KERBEROSIV_DES_H */
+
+/* Define if you have the <kerberosIV/krb.h> header file. */
+/* #undef HAVE_KERBEROSIV_KRB_H */
+
+/* Define if you have the <krb.h> header file. */
+/* #undef HAVE_KRB_H */
+
+/* Define if you have the <libutil.h> header file. */
+/* #undef HAVE_LIBUTIL_H */
+
+/* Define if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
+
+/* Define if you have the <lwp/lwp.h> header file. */
+/* #undef HAVE_LWP_LWP_H */
+
+/* Define if you have the <mach/cthreads.h> header file. */
+/* #undef HAVE_MACH_CTHREADS_H */
+
+/* Define if you have the <malloc.h> header file. */
+#define HAVE_MALLOC_H 1
+
+/* Define if you have the <ncurses.h> header file. */
+/* #undef HAVE_NCURSES_H */
+
+/* Define if you have the <ndbm.h> header file. */
+/* #undef HAVE_NDBM_H */
+
+/* Define if you have the <ndir.h> header file. */
+/* #undef HAVE_NDIR_H */
+
+/* Define if you have the <pthread.h> header file. */
+/* #undef HAVE_PTHREAD_H */
+
+/* Define if you have the <regex.h> header file. */
+/* #undef HAVE_REGEX_H */
+
+/* Define if you have the <sched.h> header file. */
+/* #undef HAVE_SCHED_H */
+
+/* Define if you have the <sgtty.h> header file. */
+/* #undef HAVE_SGTTY_H */
+
+/* Define if you have the <stdarg.h> header file. */
+#define HAVE_STDARG_H 1
+
+/* Define if you have the <stddef.h> header file. */
+#define HAVE_STDDEF_H 1
+
+/* Define if you have the <synch.h> header file. */
+/* #undef HAVE_SYNCH_H */
+
+/* Define if you have the <sys/dir.h> header file. */
+/* #undef HAVE_SYS_DIR_H */
+
+/* Define if you have the <sys/errno.h> header file. */
+/* #undef HAVE_SYS_ERRNO_H */
+
+/* Define if you have the <sys/file.h> header file. */
+/* #undef HAVE_SYS_FILE_H */
+
+/* Define if you have the <sys/filio.h> header file. */
+/* #undef HAVE_SYS_FILIO_H */
+
+/* Define if you have the <sys/ioctl.h> header file. */
+/* #undef HAVE_SYS_IOCTL_H */
+
+/* Define if you have the <sys/ndir.h> header file. */
+/* #undef HAVE_SYS_NDIR_H */
+
+/* Define if you have the <sys/param.h> header file. */
+/* #undef HAVE_SYS_PARAM_H */
+
+/* Define if you have the <sys/socket.h> header file. */
+/* #undef HAVE_SYS_SOCKET_H */
+
+/* Define if you have the <sys/syslog.h> header file. */
+/* #undef HAVE_SYS_SYSLOG_H */
+
+/* Define if you have the <sys/time.h> header file. */
+/* #undef HAVE_SYS_TIME_H */
+
+/* Define if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define if you have the <syslog.h> header file. */
+/* #undef HAVE_SYSLOG_H */
+
+/* Define if you have the <termcap.h> header file. */
+/* #undef HAVE_TERMCAP_H */
+
+/* Define if you have the <termios.h> header file. */
+/* #undef HAVE_TERMIOS_H */
+
+/* Define if you have the <thread.h> header file. */
+/* #undef HAVE_THREAD_H */
+
+/* Define if you have the <unistd.h> header file. */
+/* #undef HAVE_UNISTD_H */
+
+/* Define if you have the V3 library (-lV3). */
+/* #undef HAVE_LIBV3 */
+
+/* Define if you have the gen library (-lgen). */
+/* #undef HAVE_LIBGEN */
+
+/* Define if you have the inet library (-linet). */
+/* #undef HAVE_LIBINET */
+
+/* Define if you have the net library (-lnet). */
+/* #undef HAVE_LIBNET */
+
+/* Define if you have the nsl library (-lnsl). */
+/* #undef HAVE_LIBNSL */
+
+/* Define if you have the nsl_s library (-lnsl_s). */
+/* #undef HAVE_LIBNSL_S */
+
+/* Define if you have the socket library (-lsocket). */
+/* #undef HAVE_LIBSOCKET */
+
+#ifdef HAVE_STDDEF_H
+# include <stddef.h>
+#endif
+
+#include "ldap_cdefs.h"
+
+#endif /* _LDAP_PORTABLE_H */
--- /dev/null
+/* portable.h.top begin */
+/*
+Copyright 1998 The OpenLDAP Foundation, Redwood City, California, USA
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted only
+as authorized by the OpenLDAP Public License. A copy of this
+license is available at http://www.OpenLDAP.org/license.html or
+in file LICENSE in the top-level directory of the distribution.
+
+This work is derived from the University of Michigan LDAP v3.3
+distribution. Information concerning is available at
+ http://www.umich.edu/~dirsvcs/ldap/ldap.html.
+
+This work also contains materials derived from public sources.
+
+---
+
+Portions Copyright (c) 1992-1996 Regents of the University of Michigan.
+All rights reserved.
+
+Redistribution and use in source and binary forms are permitted
+provided that this notice is preserved and that due credit is given
+to the University of Michigan at Ann Arbor. The name of the University
+may not be used to endorse or promote products derived from this
+software without specific prior written permission. This software
+is provided ``as is'' without express or implied warranty.
+
+*/
+
+#ifndef _LDAP_PORTABLE_H
+#define _LDAP_PORTABLE_H
+
+/* portable.h.top end */
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include <stdarg.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined(NeXT) || defined(VMS)
+
+#ifdef STDC_HEADERS
#include <stdlib.h>
-#else /* next || vms */
-#include <malloc.h>
-#endif /* next || vms */
-#if defined(BC31) || defined(_WIN32)
+#endif
+
+#if defined( HAVE_STDARG_H ) && __STDC__
#include <stdarg.h>
-#else /* BC31 || _WIN32 */
+#else
#include <varargs.h>
-#endif /* BC31 || _WIN32 */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-#endif /* MACOS */
-
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
-
-#include <string.h>
+#endif
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "lber.h"
#ifdef LDAP_DEBUG
int lber_debug;
#endif
-#ifdef NEEDPROTOS
-static int ber_getnint( BerElement *ber, long *num, int len );
-#endif /* NEEDPROTOS */
-
+static int ber_getnint LDAP_P(( BerElement *ber, long *num, int len ));
/* return the tag - LBER_DEFAULT returned means trouble */
unsigned long
unsigned char xbyte;
unsigned long tag;
char *tagp;
- int i;
+ unsigned int i;
if ( ber_read( ber, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
if ( ber_read( ber, (char *) &netlen + diff, noctets )
!= noctets )
return( LBER_DEFAULT );
- *len = LBER_NTOHL( netlen );
+ *len = AC_NTOHL( netlen );
} else {
*len = lc;
}
{
int diff, sign, i;
long netnum;
+ char *p;
/*
* The tag and length have already been stripped off. We should
if ( ber_read( ber, ((char *) &netnum) + diff, len ) != len )
return( -1 );
- /* sign extend if necessary */
- sign = ((0x80 << ((len - 1) * 8)) & netnum);
- if ( sign && len < sizeof(long) ) {
- for ( i = sizeof(long) - 1; i > len - 1; i-- ) {
- netnum |= (0xffL << (i * 8));
+ /* sign extend if necessary */
+ p = (char *) &netnum;
+ sign = (0x80 & *(p+diff) );
+ if ( sign && len < sizeof(long) ) {
+ for ( i = 0; i < diff; i++ ) {
+ *(p+i) = (unsigned char) 0xff;
}
}
- *num = LBER_NTOHL( netnum );
+ *num = AC_NTOHL( netnum );
return( len );
}
if ( (tag = ber_skip_tag( ber, &len )) == LBER_DEFAULT )
return( LBER_DEFAULT );
- if ( ber_getnint( ber, num, (int)len ) != len )
+ if ( (unsigned long) ber_getnint( ber, num, (int)len ) != len )
return( LBER_DEFAULT );
else
return( tag );
if ( datalen > (*len - 1) )
return( LBER_DEFAULT );
- if ( ber_read( ber, buf, datalen ) != datalen )
+ if ( (unsigned long) ber_read( ber, buf, datalen ) != datalen )
return( LBER_DEFAULT );
buf[datalen] = '\0';
if ( (*buf = (char *) malloc( (size_t)datalen + 1 )) == NULL )
return( LBER_DEFAULT );
- if ( ber_read( ber, *buf, datalen ) != datalen )
+ if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen )
return( LBER_DEFAULT );
(*buf)[datalen] = '\0';
if ( ((*bv)->bv_val = (char *) malloc( (size_t)len + 1 )) == NULL )
return( LBER_DEFAULT );
- if ( ber_read( ber, (*bv)->bv_val, len ) != len )
+ if ( (unsigned long) ber_read( ber, (*bv)->bv_val, len ) != len )
return( LBER_DEFAULT );
((*bv)->bv_val)[len] = '\0';
(*bv)->bv_len = len;
if ( ber_read( ber, (char *)&unusedbits, 1 ) != 1 )
return( LBER_DEFAULT );
- if ( ber_read( ber, *buf, datalen ) != datalen )
+ if ( (unsigned long) ber_read( ber, *buf, datalen ) != datalen )
return( LBER_DEFAULT );
*blen = datalen * 8 - unusedbits;
/* VARARGS */
unsigned long
-ber_scanf(
-#if defined( MACOS ) || defined( BC31 ) || defined( _WIN32 )
- BerElement *ber, char *fmt, ... )
+ber_scanf
+#if defined( HAVE_STDARG_H ) && __STDC__
+ ( BerElement *ber, char *fmt, ... )
#else
- va_alist )
+ ( va_alist )
va_dcl
#endif
{
va_list ap;
-#if !defined( MACOS ) && !defined( BC31 ) && !defined( _WIN32 )
+#if !(defined( HAVE_STDARG_H ) && __STDC__)
BerElement *ber;
char *fmt;
#endif
char *s, **ss, ***sss;
struct berval ***bv, **bvp, *bval;
int *i, j;
- long *l, rc, tag;
- unsigned long len;
+ long *l;
+ unsigned long rc, tag, len;
-#if defined( MACOS ) || defined( BC31 ) || defined( _WIN32 )
+#if defined( HAVE_STDARG_H ) && __STDC__
va_start( ap, fmt );
#else
va_start( ap );
break;
default:
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
fprintf( stderr, "unknown fmt %c\n", *fmt );
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
rc = LBER_DEFAULT;
break;
}
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#ifdef MACOS
-#include <stdlib.h>
-#include <stdarg.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined(NeXT) || defined(VMS)
#include <stdlib.h>
-#else /* next || vms */
-#include <malloc.h>
-#endif /* next || vms */
-#if defined( BC31 ) || defined( _WIN32 )
+
+#if defined( HAVE_STDARG_H ) && __STDC__
#include <stdarg.h>
-#else /* BC31 || _WIN32 */
+#else
#include <varargs.h>
-#endif /* BC31 || _WIN32 */
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-#endif /* MACOS */
-#ifndef VMS
-#include <memory.h>
#endif
-#include <string.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "lber.h"
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS */
+static int ber_put_len LDAP_P(( BerElement *ber,
+ unsigned long len, int nosos ));
-#ifdef NEEDPROTOS
-static int ber_put_len( BerElement *ber, unsigned long len, int nosos );
-static int ber_start_seqorset( BerElement *ber, unsigned long tag );
-static int ber_put_seqorset( BerElement *ber );
-static int ber_put_int_or_enum( BerElement *ber, long num, unsigned long tag );
-#endif /* NEEDPROTOS */
+static int ber_start_seqorset LDAP_P(( BerElement *ber,
+ unsigned long tag ));
+
+static int ber_put_seqorset LDAP_P(( BerElement *ber ));
+
+static int ber_put_int_or_enum LDAP_P(( BerElement *ber,
+ long num, unsigned long tag ));
static int
taglen = ber_calc_taglen( tag );
- ntag = LBER_HTONL( tag );
+ ntag = AC_HTONL( tag );
return( ber_write( ber, ((char *) &ntag) + sizeof(long) - taglen,
taglen, nosos ) );
*/
if ( len <= 127 ) {
- netlen = LBER_HTONL( len );
+ netlen = AC_HTONL( len );
return( ber_write( ber, (char *) &netlen + sizeof(long) - 1,
1, nosos ) );
}
if ( len & mask )
break;
}
- lenlen = ++i;
+ lenlen = (unsigned char) ++i;
if ( lenlen > 4 )
return( -1 );
lenlen |= 0x80;
return( -1 );
/* write the length itself */
- netlen = LBER_HTONL( len );
+ netlen = AC_HTONL( len );
if ( ber_write( ber, (char *) &netlen + (sizeof(long) - i), i, nosos )
!= i )
return( -1 );
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 )
return( -1 );
i++;
- netnum = LBER_HTONL( num );
+ netnum = AC_HTONL( num );
if ( ber_write( ber, (char *) &netnum + (sizeof(long) - i), i, 0 )
!= i )
return( -1 );
#endif /* STR_TRANSLATION */
if ( (lenlen = ber_put_len( ber, len, 0 )) == -1 ||
- ber_write( ber, str, len, 0 ) != len ) {
+ (unsigned long) ber_write( ber, str, len, 0 ) != len ) {
rc = -1;
} else {
/* return length of tag + length + contents */
return( -1 );
len = ( blen + 7 ) / 8;
- unusedbits = len * 8 - blen;
+ unusedbits = (unsigned char) ((len * 8) - blen);
if ( (lenlen = ber_put_len( ber, len + 1, 0 )) == -1 )
return( -1 );
*/
len = (*sos)->sos_clen;
- netlen = LBER_HTONL( len );
+ netlen = AC_HTONL( len );
if ( sizeof(long) > 4 && len > 0xFFFFFFFFL )
return( -1 );
/* the tag */
taglen = ber_calc_taglen( (*sos)->sos_tag );
- ntag = LBER_HTONL( (*sos)->sos_tag );
+ ntag = AC_HTONL( (*sos)->sos_tag );
SAFEMEMCPY( (*sos)->sos_first, (char *) &ntag +
sizeof(long) - taglen, taglen );
if ( ber->ber_options & LBER_USE_DER ) {
- ltag = (lenlen == 1) ? len : 0x80 + (lenlen - 1);
+ ltag = (lenlen == 1)
+ ? (unsigned char) len
+ : 0x80 + (lenlen - 1);
}
/* one byte of length length */
/* VARARGS */
int
-ber_printf(
-#if defined( MACOS ) || defined( _WIN32 ) || defined( BC31 )
- BerElement *ber, char *fmt, ... )
-#else /* MACOS || _WIN32 || BC31 */
- va_alist )
+ber_printf
+#if defined( HAVE_STDARG_H ) && __STDC__
+ ( BerElement *ber, char *fmt, ... )
+#else
+ ( va_alist )
va_dcl
-#endif /* MACOS || _WIN32 || BC31 */
+#endif
{
va_list ap;
-#if !defined( MACOS ) && !defined( _WIN32 ) && !defined( BC31 )
+#if !(defined( HAVE_STDARG_H ) && __STDC__)
BerElement *ber;
char *fmt;
-#endif /* !MACOS && !_WIN32 && !BC31 */
+#endif
char *s, **ss;
struct berval **bv;
int rc, i;
unsigned long len;
-#if defined( MACOS ) || defined( _WIN32 ) || defined( BC31 )
+#if defined( HAVE_STDARG_H ) && __STDC__
va_start( ap, fmt );
-#else /* MACOS || _WIN32 || BC31 */
+#else
va_start( ap );
ber = va_arg( ap, BerElement * );
fmt = va_arg( ap, char * );
-#endif /* MACOS || _WIN32 || BC31 */
+#endif
for ( rc = 0; *fmt && rc != -1; fmt++ ) {
switch ( *fmt ) {
break;
default:
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
fprintf( stderr, "unknown fmt %c\n", *fmt );
-#endif /* NO_USERINTERFACE */
+#endif /* LDAP_LIBUI */
rc = -1;
break;
}
* is provided ``as is'' without express or implied warranty.
*/
-#include <stdio.h>
-#include <ctype.h>
-
-#if defined( DOS ) || defined( _WIN32 )
-#include "msdos.h"
-#endif /* DOS || _WIN32 */
+#include "portable.h"
-#ifdef MACOS
-#include <stdlib.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined(NeXT) || defined(VMS)
+#include <stdio.h>
#include <stdlib.h>
-#else /* next || vms */
-#include <malloc.h>
-#endif /* next || vms */
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#ifdef PCNFS
-#include <tklib.h>
-#endif /* PCNFS */
-#endif /* MACOS */
-#ifndef VMS
-#include <memory.h>
-#endif
-#include <string.h>
-#include "lber.h"
+#include <ac/ctype.h>
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/unistd.h>
-#ifdef _WIN32
-#include <winsock.h>
+#ifdef HAVE_IO_H
#include <io.h>
-#endif /* _WIN32 */
+#endif
+
+#include "lber.h"
-#ifdef NEEDPROTOS
-static int ber_realloc( BerElement *ber, unsigned long len );
-static int ber_filbuf( Sockbuf *sb, long len );
-static long BerRead( Sockbuf *sb, char *buf, long len );
+static int ber_realloc LDAP_P(( BerElement *ber, unsigned long len ));
+static int ber_filbuf LDAP_P(( Sockbuf *sb, long len ));
+static long BerRead LDAP_P(( Sockbuf *sb, char *buf, long len ));
#ifdef PCNFS
-static int BerWrite( Sockbuf *sb, char *buf, long len );
+static int BerWrite LDAP_P(( Sockbuf *sb, char *buf, long len ));
#endif /* PCNFS */
-#else
-int ber_filbuf();
-long BerRead();
-static int ber_realloc();
-#endif /* NEEDPROTOS */
#define bergetc( sb, len ) ( sb->sb_ber.ber_end > sb->sb_ber.ber_ptr ? \
(unsigned char)*sb->sb_ber.ber_ptr++ : \
ber_filbuf( Sockbuf *sb, long len )
{
short rc;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int addrlen;
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
if ( sb->sb_ber.ber_buf == NULL ) {
if ( (sb->sb_ber.ber_buf = (char *) malloc( READBUFSIZ )) ==
}
if ( sb->sb_naddr > 0 ) {
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
rc = udp_read(sb, sb->sb_ber.ber_buf, READBUFSIZ, addrlen );
#ifdef LDAP_DEBUG
if ( lber_debug ) {
lber_bprint( sb->sb_ber.ber_buf, rc );
}
#endif /* LDAP_DEBUG */
-#else /* CLDAP */
+#else /* LDAP_CONNECTIONLESS */
rc = -1;
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
} else {
rc = read( sb->sb_sd, sb->sb_ber.ber_buf,
- ((sb->sb_options & LBER_NO_READ_AHEAD) &&
- (len < READBUFSIZ)) ?
- len : READBUFSIZ );
+ ((sb->sb_options & LBER_NO_READ_AHEAD) && (len < READBUFSIZ)) ?
+ len : READBUFSIZ );
}
if ( rc > 0 ) {
break;
return( c );
}
- *buf++ = c;
+ *buf++ = (char) c;
nread++;
len--;
}
#ifdef LDAP_DEBUG
if ( lber_debug ) {
fprintf( stderr, "ber_flush: %ld bytes to sd %ld%s\n", towrite,
- sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
+ (long) sb->sb_sd, ber->ber_rwptr != ber->ber_buf ? " (re-flush)"
: "" );
if ( lber_debug > 1 )
lber_bprint( ber->ber_rwptr, towrite );
nwritten = 0;
do {
if (sb->sb_naddr > 0) {
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
rc = udp_write( sb, ber->ber_buf + nwritten,
(size_t)towrite );
-#else /* CLDAP */
+#else /* LDAP_CONNECTIONLESS */
rc = -1;
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
if ( rc <= 0 )
return( -1 );
+
/* fake error if write was not atomic */
if (rc < towrite) {
-#if !defined( MACOS ) && !defined( DOS )
+#ifdef EMSGSIZE
errno = EMSGSIZE;
#endif
return( -1 );
if ( (ber = (BerElement *) calloc( 1, sizeof(BerElement) )) == NULLBER )
return( NULLBER );
ber->ber_tag = LBER_DEFAULT;
- ber->ber_options = options;
+ ber->ber_options = (char) options;
return( ber );
}
{
(void) memset( (char *)ber, '\0', sizeof( BerElement ));
ber->ber_tag = LBER_DEFAULT;
- ber->ber_options = options;
+ ber->ber_options = (char) options;
}
ber_dump( BerElement *ber, int inout )
{
fprintf( stderr, "ber_dump: buf 0x%lx, ptr 0x%lx, end 0x%lx\n",
- ber->ber_buf, ber->ber_ptr, ber->ber_end );
+ (long) ber->ber_buf,
+ (long) ber->ber_ptr,
+ (long) ber->ber_end );
if ( inout == 1 ) {
fprintf( stderr, " current len %ld, contents:\n",
- ber->ber_end - ber->ber_ptr );
+ (long) (ber->ber_end - ber->ber_ptr) );
lber_bprint( ber->ber_ptr, ber->ber_end - ber->ber_ptr );
} else {
fprintf( stderr, " current len %ld, contents:\n",
- ber->ber_ptr - ber->ber_buf );
+ (long) (ber->ber_ptr - ber->ber_buf) );
lber_bprint( ber->ber_buf, ber->ber_ptr - ber->ber_buf );
}
}
fprintf( stderr, "*** sos dump ***\n" );
while ( sos != NULLSEQORSET ) {
fprintf( stderr, "ber_sos_dump: clen %ld first 0x%lx ptr 0x%lx\n",
- sos->sos_clen, sos->sos_first, sos->sos_ptr );
+ (long) sos->sos_clen, (long) sos->sos_first, (long) sos->sos_ptr );
fprintf( stderr, " current len %ld contents:\n",
- sos->sos_ptr - sos->sos_first );
+ (long) (sos->sos_ptr - sos->sos_first) );
lber_bprint( sos->sos_first, sos->sos_ptr - sos->sos_first );
sos = sos->sos_next;
unsigned char xbyte;
unsigned long tag;
char *tagp;
- int i;
+ unsigned int i;
if ( BerRead( sb, (char *) &xbyte, 1 ) != 1 )
return( LBER_DEFAULT );
unsigned long
ber_get_next( Sockbuf *sb, unsigned long *len, BerElement *ber )
{
- unsigned long tag, netlen, toread;
+ unsigned long tag = 0, netlen, toread;
unsigned char lc;
long rc;
int noctets, diff;
noctets ) {
return( LBER_DEFAULT );
}
- *len = LBER_NTOHL( netlen );
+ *len = AC_NTOHL( netlen );
} else {
*len = lc;
}
#endif /* DOS && !_WIN32 */
if ( ( sb->sb_options & LBER_MAX_INCOMING_SIZE ) &&
- *len > sb->sb_max_incoming ) {
+ *len > (unsigned long) sb->sb_max_incoming ) {
return( LBER_DEFAULT );
}
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include "lber.h"
#include "ldap.h"
};
static struct ldaperror ldap_errlist[] = {
- LDAP_SUCCESS, "Success",
- LDAP_OPERATIONS_ERROR, "Operations error",
- LDAP_PROTOCOL_ERROR, "Protocol error",
- LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded",
- LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded",
- LDAP_COMPARE_FALSE, "Compare false",
- LDAP_COMPARE_TRUE, "Compare true",
- LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported",
- LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required",
- LDAP_PARTIAL_RESULTS, "Partial results and referral received",
- LDAP_NO_SUCH_ATTRIBUTE, "No such attribute",
- LDAP_UNDEFINED_TYPE, "Undefined attribute type",
- LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching",
- LDAP_CONSTRAINT_VIOLATION, "Constraint violation",
- LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists",
- LDAP_INVALID_SYNTAX, "Invalid syntax",
- LDAP_NO_SUCH_OBJECT, "No such object",
- LDAP_ALIAS_PROBLEM, "Alias problem",
- LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax",
- LDAP_IS_LEAF, "Object is a leaf",
- LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem",
- LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication",
- LDAP_INVALID_CREDENTIALS, "Invalid credentials",
- LDAP_INSUFFICIENT_ACCESS, "Insufficient access",
- LDAP_BUSY, "DSA is busy",
- LDAP_UNAVAILABLE, "DSA is unavailable",
- LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform",
- LDAP_LOOP_DETECT, "Loop detected",
- LDAP_NAMING_VIOLATION, "Naming violation",
- LDAP_OBJECT_CLASS_VIOLATION, "Object class violation",
- LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf",
- LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN",
- LDAP_ALREADY_EXISTS, "Already exists",
- LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class",
- LDAP_RESULTS_TOO_LARGE, "Results too large",
- LDAP_OTHER, "Unknown error",
- LDAP_SERVER_DOWN, "Can't contact LDAP server",
- LDAP_LOCAL_ERROR, "Local error",
- LDAP_ENCODING_ERROR, "Encoding error",
- LDAP_DECODING_ERROR, "Decoding error",
- LDAP_TIMEOUT, "Timed out",
- LDAP_AUTH_UNKNOWN, "Unknown authentication method",
- LDAP_FILTER_ERROR, "Bad search filter",
- LDAP_USER_CANCELLED, "User cancelled operation",
- LDAP_PARAM_ERROR, "Bad parameter to an ldap routine",
- LDAP_NO_MEMORY, "Out of memory",
- -1, 0
+ {LDAP_SUCCESS, "Success" },
+ {LDAP_OPERATIONS_ERROR, "Operations error" },
+ {LDAP_PROTOCOL_ERROR, "Protocol error" },
+ {LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded" },
+ {LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded" },
+ {LDAP_COMPARE_FALSE, "Compare false" },
+ {LDAP_COMPARE_TRUE, "Compare true" },
+ {LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported" },
+ {LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required" },
+ {LDAP_PARTIAL_RESULTS, "Partial results and referral received" },
+ {LDAP_NO_SUCH_ATTRIBUTE, "No such attribute" },
+ {LDAP_UNDEFINED_TYPE, "Undefined attribute type" },
+ {LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching" },
+ {LDAP_CONSTRAINT_VIOLATION, "Constraint violation" },
+ {LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists" },
+ {LDAP_INVALID_SYNTAX, "Invalid syntax" },
+ {LDAP_NO_SUCH_OBJECT, "No such object" },
+ {LDAP_ALIAS_PROBLEM, "Alias problem" },
+ {LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax" },
+ {LDAP_IS_LEAF, "Object is a leaf" },
+ {LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem" },
+ {LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication" },
+ {LDAP_INVALID_CREDENTIALS, "Invalid credentials" },
+ {LDAP_INSUFFICIENT_ACCESS, "Insufficient access" },
+ {LDAP_BUSY, "DSA is busy" },
+ {LDAP_UNAVAILABLE, "DSA is unavailable" },
+ {LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform" },
+ {LDAP_LOOP_DETECT, "Loop detected" },
+ {LDAP_NAMING_VIOLATION, "Naming violation" },
+ {LDAP_OBJECT_CLASS_VIOLATION, "Object class violation" },
+ {LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf" },
+ {LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN" },
+ {LDAP_ALREADY_EXISTS, "Already exists" },
+ {LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class" },
+ {LDAP_RESULTS_TOO_LARGE, "Results too large" },
+ {LDAP_OTHER, "Unknown error" },
+ {LDAP_SERVER_DOWN, "Can't contact LDAP server" },
+ {LDAP_LOCAL_ERROR, "Local error" },
+ {LDAP_ENCODING_ERROR, "Encoding error" },
+ {LDAP_DECODING_ERROR, "Decoding error" },
+ {LDAP_TIMEOUT, "Timed out" },
+ {LDAP_AUTH_UNKNOWN, "Unknown authentication method" },
+ {LDAP_FILTER_ERROR, "Bad search filter" },
+ {LDAP_USER_CANCELLED, "User cancelled operation" },
+ {LDAP_PARAM_ERROR, "Bad parameter to an ldap routine" },
+ {LDAP_NO_MEMORY, "Out of memory" },
+ {-1, 0 }
};
char *
return( "Unknown error" );
}
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
void
ldap_perror( LDAP *ld, char *s )
{
{
}
-#endif /* NO_USERINTERFACE */
+#endif /* !LDAP_LIBUI */
int
LDAPMessage *lm;
BerElement ber;
long along;
- int rc;
+ unsigned long rc;
Debug( LDAP_DEBUG_TRACE, "ldap_result2error\n", 0, 0, 0 );
* result.c - wait for an ldap result
*/
+#include "portable.h"
+
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
#endif
#include <stdio.h>
-#include <string.h>
-#ifdef MACOS
#include <stdlib.h>
-#include <time.h>
-#include "macos.h"
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <time.h>
-#include "msdos.h"
-#ifdef PCNFS
-#include <tklib.h>
-#include <tk_errno.h>
-#include <bios.h>
-#endif /* PCNFS */
-#ifdef NCSA
-#include "externs.h"
-#endif /* NCSA */
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#ifdef _AIX
-#include <sys/select.h>
-#endif /* _AIX */
-#include "portable.h"
-#endif /* DOS */
-#endif /* MACOS */
-#ifdef VMS
-#include "ucx_select.h"
-#endif
+
+#include <ac/errno.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
-#ifdef NEEDPROTOS
-static int ldap_abandoned( LDAP *ld, int msgid );
-static int ldap_mark_abandoned( LDAP *ld, int msgid );
-static int wait4msg( LDAP *ld, int msgid, int all, struct timeval *timeout,
- LDAPMessage **result );
+static int ldap_abandoned LDAP_P(( LDAP *ld, int msgid ));
+static int ldap_mark_abandoned LDAP_P(( LDAP *ld, int msgid ));
+static int wait4msg LDAP_P(( LDAP *ld, int msgid, int all, struct timeval *timeout,
+ LDAPMessage **result ));
#ifdef LDAP_REFERRALS
-static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
- LDAPMessage **result );
-static int build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr );
-static void merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr );
+static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb, LDAPConn *lc,
+ LDAPMessage **result ));
+static unsigned long build_result_ber LDAP_P(( LDAP *ld, BerElement *ber, LDAPRequest *lr ));
+static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr ));
#else /* LDAP_REFERRALS */
-static int read1msg( LDAP *ld, int msgid, int all, Sockbuf *sb,
- LDAPMessage **result );
-#endif /* LDAP_REFERRALS */
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-static int ldap_select1( LDAP *ld, struct timeval *timeout );
-#endif
-#else /* NEEDPROTOS */
-static int ldap_abandoned();
-static int ldap_mark_abandoned();
-static int wait4msg();
-static int read1msg();
-#ifdef LDAP_REFERRALS
-static int build_result_ber();
-static void merge_error_info();
+static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb,
+ LDAPMessage **result ));
#endif /* LDAP_REFERRALS */
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-static int ldap_select1();
-#endif
-#endif /* NEEDPROTOS */
-
-#if !defined( MACOS ) && !defined( DOS )
-extern int errno;
+#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS )
+static int ldap_select1 LDAP_P(( LDAP *ld, struct timeval *timeout ));
#endif
{
int rc;
struct timeval tv, *tvp;
- long start_time, tmp_time;
+ time_t start_time = 0;
+ time_t tmp_time;
#ifdef LDAP_REFERRALS
LDAPConn *lc, *nextlc;
#endif /* LDAP_REFERRALS */
} else {
tv = *timeout;
tvp = &tv;
- start_time = (long)time( NULL );
+ start_time = time( NULL );
}
rc = -2;
if ( ld->ld_sb.sb_ber.ber_ptr >= ld->ld_sb.sb_ber.ber_end ) {
rc = ldap_select1( ld, tvp );
-#if !defined( MACOS ) && !defined( DOS )
if ( rc == 0 || ( rc == -1 && (( ld->ld_options &
LDAP_OPT_RESTART ) == 0 || errno != EINTR ))) {
-#else
- if ( rc == -1 || rc == 0 ) {
-#endif
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
LDAP_TIMEOUT);
return( rc );
#else /* !LDAP_REFERRALS */
#ifdef LDAP_DEBUG
if ( ldap_debug & LDAP_DEBUG_TRACE ) {
- dump_connection( ld, ld->ld_conns, 1 );
- dump_requests_and_responses( ld );
+ ldap_dump_connection( ld, ld->ld_conns, 1 );
+ ldap_dump_requests_and_responses( ld );
}
#endif /* LDAP_DEBUG */
for ( lc = ld->ld_conns; lc != NULL; lc = lc->lconn_next ) {
rc = do_ldap_select( ld, tvp );
-#if defined( LDAP_DEBUG ) && !defined( MACOS ) && !defined( DOS )
+#ifdef LDAP_DEBUG
if ( rc == -1 ) {
Debug( LDAP_DEBUG_TRACE,
"do_ldap_select returned -1: errno %d\n",
}
#endif
-#if !defined( MACOS ) && !defined( DOS )
if ( rc == 0 || ( rc == -1 && (( ld->ld_options &
LDAP_OPT_RESTART ) == 0 || errno != EINTR ))) {
-#else
- if ( rc == -1 || rc == 0 ) {
-#endif
ld->ld_errno = (rc == -1 ? LDAP_SERVER_DOWN :
LDAP_TIMEOUT);
return( rc );
nextlc = lc->lconn_next;
if ( lc->lconn_status ==
LDAP_CONNST_CONNECTED &&
- is_read_ready( ld,
+ ldap_is_read_ready( ld,
lc->lconn_sb )) {
rc = read1msg( ld, msgid, all,
lc->lconn_sb, lc, result );
#endif /* !LDAP_REFERRALS */
if ( rc == -2 && tvp != NULL ) {
- tmp_time = (long)time( NULL );
+ tmp_time = time( NULL );
if (( tv.tv_sec -= ( tmp_time - start_time )) <= 0 ) {
rc = 0; /* timed out */
ld->ld_errno = LDAP_TIMEOUT;
Debug( LDAP_DEBUG_TRACE, "read1msg\n", 0, 0, 0 );
ber_init( &ber, 0 );
- set_ber_options( ld, &ber );
+ ldap_set_ber_options( ld, &ber );
/* get the next message */
if ( (tag = ber_get_next( sb, &len, &ber ))
}
#ifdef LDAP_REFERRALS
- if (( lr = find_request_by_msgid( ld, id )) == NULL ) {
+ if (( lr = ldap_find_request_by_msgid( ld, id )) == NULL ) {
Debug( LDAP_DEBUG_ANY,
"no request for response with msgid %ld (tossing)\n",
id, 0, 0 );
!= LBER_ERROR ) {
if ( lderr != LDAP_SUCCESS ) {
/* referrals are in error string */
- refer_cnt = chase_referrals( ld, lr,
+ refer_cnt = ldap_chase_referrals( ld, lr,
&lr->lr_res_error, &hadref );
}
}
}
- free_request( ld, lr );
+ ldap_free_request( ld, lr );
}
if ( lc != NULL ) {
- free_connection( ld, lc, 0, 1 );
+ ldap_free_connection( ld, lc, 0, 1 );
}
}
}
new->lm_msgtype = tag;
new->lm_ber = ber_dup( &ber );
-#ifndef NO_CACHE
+#ifndef LDAP_NOCACHE
if ( ld->ld_cache != NULL ) {
- add_result_to_cache( ld, new );
+ ldap_add_result_to_cache( ld, new );
}
-#endif /* NO_CACHE */
+#endif /* LDAP_NOCACHE */
/* is this the one we're looking for? */
if ( msgid == LDAP_RES_ANY || id == msgid ) {
prev->lm_next = l->lm_next;
*result = l;
ld->ld_errno = LDAP_SUCCESS;
+#ifdef LDAP_WORLD_P16
+ /*
+ * XXX questionable fix; see text for [P16] on
+ * http://www.critical-angle.com/ldapworld/patch/
+ *
+ * inclusion of this patch causes searchs to hang on
+ * multiple platforms
+ */
+ return( l->lm_msgtype );
+#else /* LDAP_WORLD_P16 */
return( tag );
+#endif /* !LDAP_WORLD_P16 */
}
return( -2 ); /* continue looking */
#ifdef LDAP_REFERRALS
-static int
+static unsigned long
build_result_ber( LDAP *ld, BerElement *ber, LDAPRequest *lr )
{
unsigned long len;
long along;
ber_init( ber, 0 );
- set_ber_options( ld, ber );
+ ldap_set_ber_options( ld, ber );
if ( ber_printf( ber, "{it{ess}}", lr->lr_msgid,
(long)lr->lr_res_msgtype, lr->lr_res_errno,
lr->lr_res_matched ? lr->lr_res_matched : "",
- lr->lr_res_error ? lr->lr_res_error : "" ) == LBER_ERROR ) {
+ lr->lr_res_error ? lr->lr_res_error : "" ) == -1 ) {
return( LBER_ERROR );
}
if ( lr->lr_res_errno == LDAP_PARTIAL_RESULTS ) {
parentr->lr_res_errno = lr->lr_res_errno;
if ( lr->lr_res_error != NULL ) {
- (void)append_referral( ld, &parentr->lr_res_error,
+ (void)ldap_append_referral( ld, &parentr->lr_res_error,
lr->lr_res_error );
}
} else if ( lr->lr_res_errno != LDAP_SUCCESS &&
-#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
-#if !defined( MACOS ) && !defined( DOS ) && !defined( _WIN32 )
+#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS )
+
static int
ldap_select1( LDAP *ld, struct timeval *timeout )
{
static int tblsize;
if ( tblsize == 0 ) {
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
tblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
tblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ tblsize = FD_SETSIZE;
+#endif
+#ifdef FD_SETSIZE
+ if ( tblsize > FD_SETSIZE ) {
+ tblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE */
}
FD_ZERO( &readfds );
return( select( tblsize, &readfds, 0, 0, timeout ) );
}
-#endif /* !MACOS */
-
-
-#ifdef MACOS
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- return( tcpselect( ld->ld_sb.sb_sd, timeout ));
-}
-#endif /* MACOS */
-
-#if ( defined( DOS ) && defined( WINSOCK )) || defined( _WIN32 )
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- fd_set readfds;
- int rc;
-
- FD_ZERO( &readfds );
- FD_SET( ld->ld_sb.sb_sd, &readfds );
-
- rc = select( 1, &readfds, 0, 0, timeout );
- return( rc == SOCKET_ERROR ? -1 : rc );
-}
-#endif /* WINSOCK || _WIN32 */
-
-
-#ifdef DOS
-#ifdef PCNFS
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- fd_set readfds;
- int res;
-
- FD_ZERO( &readfds );
- FD_SET( ld->ld_sb.sb_sd, &readfds );
-
- res = select( FD_SETSIZE, &readfds, NULL, NULL, timeout );
- if ( res == -1 && errno == EINTR) {
- /* We've been CTRL-C'ed at this point. It'd be nice to
- carry on but PC-NFS currently won't let us! */
- printf("\n*** CTRL-C ***\n");
- exit(-1);
- }
- return( res );
-}
-#endif /* PCNFS */
-
-#ifdef NCSA
-static int
-ldap_select1( LDAP *ld, struct timeval *timeout )
-{
- int rc;
- clock_t endtime;
-
- if ( timeout != NULL ) {
- endtime = timeout->tv_sec * CLK_TCK +
- timeout->tv_usec * CLK_TCK / 1000000 + clock();
- }
-
- do {
- Stask();
- rc = netqlen( ld->ld_sb.sb_sd );
- } while ( rc <= 0 && ( timeout == NULL || clock() < endtime ));
-
- return( rc > 0 ? 1 : 0 );
-}
-#endif /* NCSA */
-#endif /* DOS */
#endif /* !LDAP_REFERRALS */
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
{
return( tag );
}
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
* sort.c: LDAP library entry and value sort routines
*/
+#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"
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
#include "lber.h"
#include "ldap.h"
+
struct entrything {
char **et_vals;
LDAPMessage *et_msg;
};
-#ifndef NEEDPROTOS
-static int (*et_cmp_fn)();
-static int et_cmp();
-#else /* !NEEDPROTOS */
-static int (*et_cmp_fn)( char *a, char *b );
-static int et_cmp( void *aa, void *bb);
-#endif /* !NEEDPROTOS */
+static int (*et_cmp_fn) LDAP_P(( char *a, char *b ));
+static int et_cmp LDAP_P(( const void *aa, const void *bb));
+
int
ldap_sort_strcasecmp(
static int
et_cmp(
- void *aa,
- void *bb
+ const void *aa,
+ const void *bb
)
{
int i, rc;
- struct entrything *a = (struct entrything *)aa;
- struct entrything *b = (struct entrything *)bb;
+ const struct entrything *a = (const struct entrything *)aa;
+ const struct entrything *b = (const struct entrything *)bb;
if ( a->et_vals == NULL && b->et_vals == NULL )
return( 0 );
LDAP *ld,
LDAPMessage **chain,
char *attr, /* NULL => sort by DN */
- int (*cmp)()
+ int (*cmp) LDAP_P((char *, char *))
)
{
int i, count;
last = e;
et_cmp_fn = cmp;
- qsort( et, count, sizeof(struct entrything), (void *) et_cmp );
+ qsort( et, count, sizeof(struct entrything), et_cmp );
ep = chain;
for ( i = 0; i < count; i++ ) {
ldap_sort_values(
LDAP *ld,
char **vals,
- int (*cmp)()
+ int (*cmp) LDAP_P((const void *, const void *))
)
{
int nel;
* 12 April 1994 by Mark C Smith
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <time.h>
#include <stdlib.h>
-#ifdef MACOS
-#include "macos.h"
-#else /* MACOS */
-#ifdef DOS
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/file.h>
-#endif /* DOS */
-#endif /* MACOS */
-#ifdef VMS
-#include <sys/socket.h>
-#endif /* VMS */
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/ctype.h>
+#include <ac/time.h>
+
+#ifdef HAVE_SYS_FILE_H
+#include <sys/file.h>
+#endif
#include "lber.h"
#include "ldap.h"
#include "disptmpl.h"
-#ifdef NEEDPROTOS
-static int do_entry2text( LDAP *ld, char *buf, char *base, LDAPMessage *entry,
+#include "ldapconfig.h"
+
+static int do_entry2text LDAP_P((
+ LDAP *ld, char *buf, char *base, LDAPMessage *entry,
struct ldap_disptmpl *tmpl, char **defattrs, char ***defvals,
writeptype writeproc, void *writeparm, char *eol, int rdncount,
- unsigned long opts, char *urlprefix );
-static int do_entry2text_search( LDAP *ld, char *dn, char *base,
+ unsigned long opts, char *urlprefix ));
+static int do_entry2text_search LDAP_P((
+ LDAP *ld, char *dn, char *base,
LDAPMessage *entry, struct ldap_disptmpl *tmpllist, char **defattrs,
char ***defvals, writeptype writeproc, void *writeparm, char *eol,
- int rdncount, unsigned long opts, char *urlprefix );
-static int do_vals2text( LDAP *ld, char *buf, char **vals, char *label,
+ int rdncount, unsigned long opts, char *urlprefix ));
+static int do_vals2text LDAP_P((
+ LDAP *ld, char *buf, char **vals, char *label,
int labelwidth, unsigned long syntaxid, writeptype writeproc,
- void *writeparm, char *eol, int rdncount, char *urlprefix );
-static int max_label_len( struct ldap_disptmpl *tmpl );
-static int output_label( char *buf, char *label, int width,
- writeptype writeproc, void *writeparm, char *eol, int html );
-static int output_dn( char *buf, char *dn, int width, int rdncount,
- writeptype writeproc, void *writeparm, char *eol, char *urlprefix );
-static void strcat_escaped( char *s1, char *s2 );
-static char *time2text( char *ldtimestr, int dateonly );
-static long gtime( struct tm *tm );
-static int searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry,
+ void *writeparm, char *eol, int rdncount, char *urlprefix ));
+static int max_label_len LDAP_P(( struct ldap_disptmpl *tmpl ));
+static int output_label LDAP_P((
+ char *buf, char *label, int width,
+ writeptype writeproc, void *writeparm, char *eol, int html ));
+static int output_dn LDAP_P((
+ char *buf, char *dn, int width, int rdncount,
+ writeptype writeproc, void *writeparm, char *eol, char *urlprefix ));
+static void strcat_escaped LDAP_P(( char *s1, char *s2 ));
+static char *time2text LDAP_P(( char *ldtimestr, int dateonly ));
+static long gtime LDAP_P(( struct tm *tm ));
+static int searchaction LDAP_P((
+ LDAP *ld, char *buf, char *base, LDAPMessage *entry,
char *dn, struct ldap_tmplitem *tip, int labelwidth, int rdncount,
- writeptype writeproc, void *writeparm, char *eol, char *urlprefix );
-#else /* NEEDPROTOS */
-static int do_entry2text();
-static int do_entry2text_search();
-static int do_vals2text();
-static int max_label_len();
-static int output_label();
-static int output_dn();
-static void strcat_escaped();
-static char *time2text();
-static long gtime();
-static int searchaction();
-#endif /* NEEDPROTOS */
+ writeptype writeproc, void *writeparm, char *eol, char *urlprefix ));
#define DEF_LABEL_WIDTH 15
#define SEARCH_TIMEOUT_SECS 120
sprintf( buf + strlen( buf ),
"%s\">Move Up To <EM>%s</EM></A>%s<BR>",
( vals[ 1 ] == NULL ) ? "??one" : "",
- ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol, eol );
+ ( untagged != NULL ) ? untagged + 1 : vals[ 1 ], eol );
(*writeproc)( writeparm, buf, strlen( buf ));
/*
freevals = 1;
}
- if ( islower( *attr )) { /* cosmetic -- upcase attr. name */
- *attr = toupper( *attr );
- }
+ *attr = TOUPPER( *attr );
err = do_vals2text( ld, buf, vals, attr, labelwidth,
LDAP_SYN_CASEIGNORESTR, writeproc, writeparm, eol,
if ( show && LDAP_GET_SYN_TYPE( colp->ti_syntaxid )
== LDAP_SYN_TYPE_BOOLEAN && LDAP_IS_TMPLITEM_OPTION_SET(
colp, LDAP_DITEM_OPT_HIDEIFFALSE ) &&
- toupper( vals[ 0 ][ 0 ] ) != 'T' ) {
+ TOUPPER( vals[ 0 ][ 0 ] ) != 'T' ) {
show = 0;
}
if ( colp->ti_syntaxid == LDAP_SYN_SEARCHACTION ) {
if (( opts & LDAP_DISP_OPT_DOSEARCHACTIONS ) != 0 ) {
if ( colp->ti_attrname == NULL || ( show &&
- toupper( vals[ 0 ][ 0 ] ) == 'T' )) {
+ TOUPPER( vals[ 0 ][ 0 ] ) == 'T' )) {
err = searchaction( ld, buf, base, entry, dn, colp,
labelwidth, rdncount, writeproc,
writeparm, eol, urlprefix );
ocattrs[0] = OCATTRNAME;
ocattrs[1] = NULL;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_CLDAP( ld ))
err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE,
"objectClass=*", ocattrs, 0, &ldmp, NULL );
else
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE,
"objectClass=*", ocattrs, 0, &timeout, &ldmp );
fetchattrs = ldap_tmplattrs( tmpl, NULL, 1, LDAP_SYN_OPT_DEFER );
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_CLDAP( ld ))
err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
fetchattrs, 0, &ldmp, NULL );
else
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
fetchattrs, 0, &timeout, &ldmp );
break;
case LDAP_SYN_BOOLEAN:
- outval = toupper( outval[ 0 ] ) == 'T' ? "TRUE" : "FALSE";
+ outval = TOUPPER( outval[ 0 ] ) == 'T' ? "TRUE" : "FALSE";
++writeoutval;
break;
/* gtime.c - inverse gmtime */
-
-#if !defined( MACOS ) && !defined( _WIN32 ) && !defined( DOS )
-#include <sys/time.h>
-#endif /* !MACOS */
-
/* gtime(): the inverse of localtime().
This routine was supplied by Mike Accetta at CMU many years ago.
*/
struct ldap_tmplitem *tip, int labelwidth, int rdncount,
writeptype writeproc, void *writeparm, char *eol, char *urlprefix )
{
- int err, lderr, i, count, html;
+ int err = 0, lderr, i, count, html;
char **vals, **members;
char *value, *filtpattern, *attr, *selectname;
char *retattrs[2], filter[ 256 ];
timeout.tv_sec = SEARCH_TIMEOUT_SECS;
timeout.tv_usec = 0;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( LDAP_IS_CLDAP( ld ))
lderr = cldap_search_s( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs,
0, &ldmp, NULL );
else
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
lderr = ldap_search_st( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs,
0, &timeout, &ldmp );
/* ldbm.c - ldap dbm compatibility routines */
+/* Patched for Berkeley DB version 2.0; /KSp; 98/02/23
+ *
+ * - basic implementation; 1998/02/23, /KSp
+ * - DB_DBT_MALLOC ; 1998/03/22, /KSp
+ */
+
+#include "portable.h"
+
+#ifdef SLAPD_LDBM
+
#include <stdio.h>
-#include "ldbm.h"
+#include <stdlib.h>
+#include <ac/errno.h>
-#ifdef LDBM_USE_GDBM
+#include "ldbm.h"
-#include <sys/types.h>
-#include <sys/stat.h>
+#if defined( LDBM_USE_DBHASH ) || defined( LDBM_USE_DBBTREE )
/*****************************************************************
* *
- * use gdbm *
+ * use berkeley db hash or btree package *
* *
*****************************************************************/
+#ifdef HAVE_BERKELEY_DB2
+/*************************************************
+ * *
+ * A malloc routine for use with DB_DBT_MALLOC *
+ * *
+ *************************************************/
+
+void *
+ldbm_malloc( size_t size )
+{
+ return( calloc( 1, size ));
+}
+
+#endif
+
+
LDBM
ldbm_open( char *name, int rw, int mode, int dbcachesize )
{
- LDBM db;
- struct stat st;
+ LDBM ret = NULL;
- if ( (db = gdbm_open( name, 0, rw | GDBM_FAST, mode, 0 )) == NULL ) {
- return( NULL );
- }
- if ( dbcachesize > 0 && stat( name, &st ) == 0 ) {
- dbcachesize = (dbcachesize / st.st_blksize);
- gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) );
+#ifdef HAVE_BERKELEY_DB2
+ DB_INFO dbinfo;
+
+ memset( &dbinfo, 0, sizeof( dbinfo ));
+ dbinfo.db_cachesize = dbcachesize;
+ dbinfo.db_pagesize = DEFAULT_DB_PAGE_SIZE;
+ dbinfo.db_malloc = ldbm_malloc;
+
+ db_open( name, DB_TYPE, rw, mode, NULL, &dbinfo, &ret );
+
+#else
+ void *info;
+ BTREEINFO binfo;
+ HASHINFO hinfo;
+
+ if ( DB_TYPE == DB_HASH ) {
+ memset( (char *) &hinfo, '\0', sizeof(hinfo) );
+ hinfo.cachesize = dbcachesize;
+ info = &hinfo;
+ } else if ( DB_TYPE == DB_BTREE ) {
+ memset( (char *) &binfo, '\0', sizeof(binfo) );
+ binfo.cachesize = dbcachesize;
+ info = &binfo;
+ } else {
+ info = NULL;
}
- return( db );
+ ret = dbopen( name, rw, mode, DB_TYPE, info );
+
+#endif
+
+ return( ret );
}
void
ldbm_close( LDBM ldbm )
{
- gdbm_close( ldbm );
+#ifdef HAVE_BERKELEY_DB2
+ (*ldbm->close)( ldbm, 0 );
+#else
+ (*ldbm->close)( ldbm );
+#endif
}
void
ldbm_sync( LDBM ldbm )
{
- gdbm_sync( ldbm );
+ (*ldbm->sync)( ldbm, 0 );
}
void
{
Datum dup;
+#ifdef HAVE_BERKELEY_DB2
+ memset( &dup, 0, sizeof( dup ));
+#endif
+
if ( data.dsize == 0 ) {
dup.dsize = 0;
dup.dptr = NULL;
Datum
ldbm_fetch( LDBM ldbm, Datum key )
{
- return( gdbm_fetch( ldbm, key ) );
+ Datum data;
+ int rc;
+
+#ifdef HAVE_BERKELEY_DB2
+ memset( &data, 0, sizeof( data ));
+
+ data.flags = DB_DBT_MALLOC;
+
+ if ( (rc = (*ldbm->get)( ldbm, NULL, &key, &data, 0 )) != 0 ) {
+ if ( data.dptr ) free( data.dptr );
+#else
+ if ( (rc = (*ldbm->get)( ldbm, &key, &data, 0 )) == 0 ) {
+ data = ldbm_datum_dup( ldbm, data );
+ } else {
+#endif
+ data.dptr = NULL;
+ data.dsize = 0;
+ }
+
+ return( data );
}
int
{
int rc;
- rc = gdbm_store( ldbm, key, data, flags & ~LDBM_SYNC );
+#ifdef HAVE_BERKELEY_DB2
+ rc = (*ldbm->put)( ldbm, NULL, &key, &data, flags & ~LDBM_SYNC );
+ rc = (-1 ) * rc;
+#else
+ rc = (*ldbm->put)( ldbm, &key, &data, flags & ~LDBM_SYNC );
+#endif
if ( flags & LDBM_SYNC )
- gdbm_sync( ldbm );
+ (*ldbm->sync)( ldbm, 0 );
return( rc );
}
{
int rc;
- rc = gdbm_delete( ldbm, key );
- gdbm_sync( ldbm );
+#ifdef HAVE_BERKELEY_DB2
+ rc = (*ldbm->del)( ldbm, NULL, &key, 0 );
+ rc = (-1 ) * rc;
+#else
+ rc = (*ldbm->del)( ldbm, &key, 0 );
+#endif
+ (*ldbm->sync)( ldbm, 0 );
return( rc );
}
Datum
+#ifdef HAVE_BERKELEY_DB2
+ldbm_firstkey( LDBM ldbm, DBC **dbch )
+#else
ldbm_firstkey( LDBM ldbm )
+#endif
{
- return( gdbm_firstkey( ldbm ) );
+ Datum key, data;
+ int rc;
+
+#ifdef HAVE_BERKELEY_DB2
+ DBC *dbci;
+
+ memset( &key, 0, sizeof( key ));
+ memset( &data, 0, sizeof( data ));
+
+ key.flags = data.flags = DB_DBT_MALLOC;
+
+ /* acquire a cursor for the DB */
+ if ( (*ldbm->cursor)( ldbm, NULL, &dbci )) {
+ return( key );
+ } else {
+ *dbch = dbci;
+ if ( (*dbci->c_get)( dbci, &key, &data, DB_NEXT ) == 0 ) {
+ if ( data.dptr ) free( data.dptr );
+#else
+ if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_FIRST )) == 0 ) {
+ key = ldbm_datum_dup( ldbm, key );
+#endif
+ } else {
+ key.dptr = NULL;
+ key.dsize = 0;
+ }
+
+#ifdef HAVE_BERKELEY_DB2
+ }
+#endif
+
+ return( key );
}
Datum
+#ifdef HAVE_BERKELEY_DB2
+ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp )
+#else
ldbm_nextkey( LDBM ldbm, Datum key )
+#endif
{
- return( gdbm_nextkey( ldbm, key ) );
+ Datum data;
+ int rc;
+
+#ifdef HAVE_BERKELEY_DB2
+ void *oldKey = key.dptr;
+
+ memset( &data, 0, sizeof( data ));
+
+ data.flags = DB_DBT_MALLOC;
+
+ if ( (*dbcp->c_get)( dbcp, &key, &data, DB_NEXT ) == 0 ) {
+ if ( data.dptr ) free( data.dptr );
+#else
+ if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_NEXT )) == 0 ) {
+ key = ldbm_datum_dup( ldbm, key );
+#endif
+ } else {
+ key.dptr = NULL;
+ key.dsize = 0;
+ }
+#ifdef HAVE_BERKELEY_DB2
+ if ( oldKey ) free( oldKey );
+#endif
+
+ return( key );
}
int
ldbm_errno( LDBM ldbm )
{
- return( (int) gdbm_errno );
+ return( errno );
}
-#else
-#if defined( LDBM_USE_DBHASH ) || defined( LDBM_USE_DBBTREE )
+#elif defined( HAVE_GDBM )
+
+#include <sys/stat.h>
/*****************************************************************
* *
- * use berkeley db hash or btree package *
+ * use gdbm *
* *
*****************************************************************/
LDBM
ldbm_open( char *name, int rw, int mode, int dbcachesize )
{
- LDBM ret;
- void *info;
- BTREEINFO binfo;
- HASHINFO hinfo;
+ LDBM db;
+ struct stat st;
- if ( DB_TYPE == DB_HASH ) {
- memset( (char *) &hinfo, '\0', sizeof(hinfo) );
- hinfo.cachesize = dbcachesize;
- info = &hinfo;
- } else if ( DB_TYPE == DB_BTREE ) {
- memset( (char *) &binfo, '\0', sizeof(binfo) );
- binfo.cachesize = dbcachesize;
- info = &binfo;
- } else {
- info = NULL;
+ if ( (db = gdbm_open( name, 0, rw | GDBM_FAST, mode, 0 )) == NULL ) {
+ return( NULL );
}
- ret = dbopen( name, rw, mode, DB_TYPE, info );
- return( ret );
+ if ( dbcachesize > 0 && stat( name, &st ) == 0 ) {
+ dbcachesize = (dbcachesize / st.st_blksize);
+ gdbm_setopt( db, GDBM_CACHESIZE, &dbcachesize, sizeof(int) );
+ }
+
+ return( db );
}
void
ldbm_close( LDBM ldbm )
{
- (*ldbm->close)( ldbm );
+ gdbm_close( ldbm );
}
void
ldbm_sync( LDBM ldbm )
{
- (*ldbm->sync)( ldbm, 0 );
+ gdbm_sync( ldbm );
}
void
Datum
ldbm_fetch( LDBM ldbm, Datum key )
{
- Datum data;
- int rc;
-
- if ( (rc = (*ldbm->get)( ldbm, &key, &data, 0 )) == 0 ) {
- data = ldbm_datum_dup( ldbm, data );
- } else {
- data.dptr = NULL;
- data.dsize = 0;
- }
-
- return( data );
+ return( gdbm_fetch( ldbm, key ) );
}
int
{
int rc;
- rc = (*ldbm->put)( ldbm, &key, &data, flags & ~LDBM_SYNC );
+ rc = gdbm_store( ldbm, key, data, flags & ~LDBM_SYNC );
if ( flags & LDBM_SYNC )
- (*ldbm->sync)( ldbm, 0 );
+ gdbm_sync( ldbm );
return( rc );
}
{
int rc;
- rc = (*ldbm->del)( ldbm, &key, 0 );
- (*ldbm->sync)( ldbm, 0 );
+ rc = gdbm_delete( ldbm, key );
+ gdbm_sync( ldbm );
return( rc );
}
Datum
ldbm_firstkey( LDBM ldbm )
{
- Datum key, data;
- int rc;
-
- if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_FIRST )) == 0 ) {
- key = ldbm_datum_dup( ldbm, key );
- } else {
- key.dptr = NULL;
- key.dsize = 0;
- }
- return( key );
+ return( gdbm_firstkey( ldbm ) );
}
Datum
ldbm_nextkey( LDBM ldbm, Datum key )
{
- Datum data;
- int rc;
-
- if ( (rc = (*ldbm->seq)( ldbm, &key, &data, R_NEXT )) == 0 ) {
- key = ldbm_datum_dup( ldbm, key );
- } else {
- key.dptr = NULL;
- key.dsize = 0;
- }
- return( key );
+ return( gdbm_nextkey( ldbm, key ) );
}
int
ldbm_errno( LDBM ldbm )
{
- return( errno );
+ return( (int) gdbm_errno );
}
-#else
-
-#ifdef LDBM_USE_NDBM
+#elif defined( HAVE_NDBM )
/*****************************************************************
* *
return( dup );
}
dup.dsize = data.dsize;
- if ( dup.dptr = (char *) malloc( data.dsize ) )
+ dup.dptr = (char *) malloc( data.dsize );
+ if ( dup.dptr )
memcpy( dup.dptr, data.dptr, data.dsize );
return( dup );
}
#endif /* ndbm */
-#endif /* db */
-#endif /* gdbm */
+#endif /* ldbm */
*(*next)++ = '\0';
break;
}
- *(*next)++;
+ (*next)++;
}
return( l );
b64 = 0;
stop = (unsigned char *) (val + vlen);
- if ( isascii( val[0] ) && isspace( val[0] ) || val[0] == ':' ) {
+ if ( isascii( val[0] ) && (isspace( val[0] ) || val[0] == ':') ) {
b64 = 1;
} else {
for ( byte = (unsigned char *) val; byte < stop;
--- /dev/null
+##
+## Makefile for -lutil
+##
+
+LIBRARY = liblutil.a
+SRCS = base64.c md5.c sha1.c detach.c
+OBJS = base64.o md5.o sha1.o detach.o @LIBOBJS@
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
--- /dev/null
+/*
+ * Modified by Kurt D. Zeilenga for inclusion into OpenLDAP
+ */
+
+/*
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software. No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include "portable.h"
+
+#include <stdlib.h>
+#include <stddef.h>
+#include <ctype.h>
+
+#include <ac/string.h>
+
+/* include socket.h to get sys/types.h and/or winsock2.h */
+#include <ac/socket.h>
+
+#include "lutil.h"
+
+#define Assert(Cond) if (!(Cond)) abort()
+
+static const char Base64[] =
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+ The following encoding technique is taken from RFC 1521 by Borenstein
+ and Freed. It is reproduced here in a slightly edited form for
+ convenience.
+
+ A 65-character subset of US-ASCII is used, enabling 6 bits to be
+ represented per printable character. (The extra 65th character, "=",
+ is used to signify a special processing function.)
+
+ The encoding process represents 24-bit groups of input bits as output
+ strings of 4 encoded characters. Proceeding from left to right, a
+ 24-bit input group is formed by concatenating 3 8-bit input groups.
+ These 24 bits are then treated as 4 concatenated 6-bit groups, each
+ of which is translated into a single digit in the base64 alphabet.
+
+ Each 6-bit group is used as an index into an array of 64 printable
+ characters. The character referenced by the index is placed in the
+ output string.
+
+ Table 1: The Base64 Alphabet
+
+ Value Encoding Value Encoding Value Encoding Value Encoding
+ 0 A 17 R 34 i 51 z
+ 1 B 18 S 35 j 52 0
+ 2 C 19 T 36 k 53 1
+ 3 D 20 U 37 l 54 2
+ 4 E 21 V 38 m 55 3
+ 5 F 22 W 39 n 56 4
+ 6 G 23 X 40 o 57 5
+ 7 H 24 Y 41 p 58 6
+ 8 I 25 Z 42 q 59 7
+ 9 J 26 a 43 r 60 8
+ 10 K 27 b 44 s 61 9
+ 11 L 28 c 45 t 62 +
+ 12 M 29 d 46 u 63 /
+ 13 N 30 e 47 v
+ 14 O 31 f 48 w (pad) =
+ 15 P 32 g 49 x
+ 16 Q 33 h 50 y
+
+ Special processing is performed if fewer than 24 bits are available
+ at the end of the data being encoded. A full encoding quantum is
+ always completed at the end of a quantity. When fewer than 24 input
+ bits are available in an input group, zero bits are added (on the
+ right) to form an integral number of 6-bit groups. Padding at the
+ end of the data is performed using the '=' character.
+
+ Since all base64 input is an integral number of octets, only the
+ -------------------------------------------------
+ following cases can arise:
+
+ (1) the final quantum of encoding input is an integral
+ multiple of 24 bits; here, the final unit of encoded
+ output will be an integral multiple of 4 characters
+ with no "=" padding,
+ (2) the final quantum of encoding input is exactly 8 bits;
+ here, the final unit of encoded output will be two
+ characters followed by two "=" padding characters, or
+ (3) the final quantum of encoding input is exactly 16 bits;
+ here, the final unit of encoded output will be three
+ characters followed by one "=" padding character.
+ */
+
+int
+b64_ntop(
+ u_char const *src,
+ size_t srclength,
+ char *target,
+ size_t targsize)
+{
+ size_t datalength = 0;
+ u_char input[3];
+ u_char output[4];
+ size_t i;
+
+ while (2 < srclength) {
+ input[0] = *src++;
+ input[1] = *src++;
+ input[2] = *src++;
+ srclength -= 3;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ output[3] = input[2] & 0x3f;
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+ Assert(output[3] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Base64[output[3]];
+ }
+
+ /* Now we worry about padding. */
+ if (0 != srclength) {
+ /* Get what's left. */
+ input[0] = input[1] = input[2] = '\0';
+ for (i = 0; i < srclength; i++)
+ input[i] = *src++;
+
+ output[0] = input[0] >> 2;
+ output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+ output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+ Assert(output[0] < 64);
+ Assert(output[1] < 64);
+ Assert(output[2] < 64);
+
+ if (datalength + 4 > targsize)
+ return (-1);
+ target[datalength++] = Base64[output[0]];
+ target[datalength++] = Base64[output[1]];
+ if (srclength == 1)
+ target[datalength++] = Pad64;
+ else
+ target[datalength++] = Base64[output[2]];
+ target[datalength++] = Pad64;
+ }
+ if (datalength >= targsize)
+ return (-1);
+ target[datalength] = '\0'; /* Returned value doesn't count \0. */
+ return (datalength);
+}
+
+/* skips all whitespace anywhere.
+ converts characters, four at a time, starting at (or after)
+ src from base - 64 numbers into three 8 bit bytes in the target area.
+ it returns the number of data bytes stored at the target, or -1 on error.
+ */
+
+int
+b64_pton(
+ char const *src,
+ u_char *target,
+ size_t targsize)
+{
+ int tarindex, state, ch;
+ char *pos;
+
+ state = 0;
+ tarindex = 0;
+
+ while ((ch = *src++) != '\0') {
+ if (isascii(ch) && isspace(ch)) /* Skip whitespace anywhere. */
+ continue;
+
+ if (ch == Pad64)
+ break;
+
+ pos = strchr(Base64, ch);
+ if (pos == 0) /* A non-base64 character. */
+ return (-1);
+
+ switch (state) {
+ case 0:
+ if (target) {
+ if ((size_t)tarindex >= targsize)
+ return (-1);
+ target[tarindex] = (pos - Base64) << 2;
+ }
+ state = 1;
+ break;
+ case 1:
+ if (target) {
+ if ((size_t)tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 4;
+ target[tarindex+1] = ((pos - Base64) & 0x0f)
+ << 4 ;
+ }
+ tarindex++;
+ state = 2;
+ break;
+ case 2:
+ if (target) {
+ if ((size_t)tarindex + 1 >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64) >> 2;
+ target[tarindex+1] = ((pos - Base64) & 0x03)
+ << 6;
+ }
+ tarindex++;
+ state = 3;
+ break;
+ case 3:
+ if (target) {
+ if ((size_t)tarindex >= targsize)
+ return (-1);
+ target[tarindex] |= (pos - Base64);
+ }
+ tarindex++;
+ state = 0;
+ break;
+ default:
+ abort();
+ }
+ }
+
+ /*
+ * We are done decoding Base-64 chars. Let's see if we ended
+ * on a byte boundary, and/or with erroneous trailing characters.
+ */
+
+ if (ch == Pad64) { /* We got a pad char. */
+ ch = *src++; /* Skip it, get next. */
+ switch (state) {
+ case 0: /* Invalid = in first position */
+ case 1: /* Invalid = in second position */
+ return (-1);
+
+ case 2: /* Valid, means one byte of info */
+ /* Skip any number of spaces. */
+ for ((void)NULL; ch != '\0'; ch = *src++)
+ if (! (isascii(ch) && isspace(ch)))
+ break;
+ /* Make sure there is another trailing = sign. */
+ if (ch != Pad64)
+ return (-1);
+ ch = *src++; /* Skip the = */
+ /* Fall through to "single trailing =" case. */
+ /* FALLTHROUGH */
+
+ case 3: /* Valid, means two bytes of info */
+ /*
+ * We know this char is an =. Is there anything but
+ * whitespace after it?
+ */
+ for ((void)NULL; ch != '\0'; ch = *src++)
+ if (! (isascii(ch) && isspace(ch)))
+ return (-1);
+
+ /*
+ * Now make sure for cases 2 and 3 that the "extra"
+ * bits that slopped past the last full byte were
+ * zeros. If we don't check them, they become a
+ * subliminal channel.
+ */
+ if (target && target[tarindex] != 0)
+ return (-1);
+ }
+ } else {
+ /*
+ * We ended by seeing the end of the string. Make sure we
+ * have no partial bytes lying around.
+ */
+ if (state != 0)
+ return (-1);
+ }
+
+ return (tarindex);
+}
--- /dev/null
+/*
+ * Copyright (c) 1990, 1994 Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+#include "portable.h"
+
+#include <stdio.h>
+
+#include <ac/signal.h>
+#include <ac/unistd.h>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+
+#include "portable.h"
+
+
+/* I'd really like to make do_close an fd_set, but that isn't portable. */
+void
+lutil_detach( int debug, int do_close )
+{
+ int i, sd, nbits;
+
+#ifdef HAVE_SYSCONF
+ nbits = sysconf( _SC_OPEN_MAX );
+#elif HAVE_GETDTABLESIZE
+ nbits = getdtablesize();
+#else
+ nbits = FD_SETSIZE;
+#endif
+
+#ifdef FD_SETSIZE
+ if ( nbits > FD_SETSIZE ) {
+ nbits = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE */
+
+ if ( debug == 0 ) {
+ for ( i = 0; i < 5; i++ ) {
+#if HAVE_THR
+ switch ( fork1() )
+#else
+ switch ( fork() )
+#endif
+ {
+ case -1:
+ sleep( 5 );
+ continue;
+
+ case 0:
+ break;
+
+ default:
+ _exit( 0 );
+ }
+ break;
+ }
+
+ if ( do_close )
+ for ( i = 3; i < nbits; i++ )
+ close( i );
+
+ (void) chdir( "/" );
+
+ if ( (sd = open( "/dev/null", O_RDWR )) == -1 ) {
+ perror( "/dev/null" );
+ exit( 1 );
+ }
+ for ( i = 0; i < 3; i++ )
+ if ( sd != i && isatty( i ) )
+ (void) dup2( sd, i );
+ if ( sd > 2 )
+ close( sd );
+
+#ifdef HAVE_SETSID
+ (void) setsid();
+#else /* HAVE_SETSID */
+ if ( (sd = open( "/dev/tty", O_RDWR )) != -1 ) {
+ (void) ioctl( sd, TIOCNOTTY, NULL );
+ (void) close( sd );
+ }
+#endif /* HAVE_SETSID */
+ }
+
+ (void) SIGNAL( SIGPIPE, SIG_IGN );
+}
--- /dev/null
+#include "portable.h"
+
+#include <ac/string.h>
+
+/*
+ * Memory Compare
+ */
+int
+memcmp(const void *v1, const void *v2, int n)
+{
+ if (n != 0) {
+ register const unsigned char *s1=v1, *s2=v2;
+ do {
+ if (*s1++ != *s2++)
+ return (*--s1 - *--s2);
+ } while (--n != 0);
+ }
+ return (0);
+}
--- /dev/null
+#include "portable.h"
+
+#ifndef HAVE_SETPROCTITLE
+
+#include <stdlib.h>
+
+#if defined( HAVE_STDARG_H ) && __STDC__
+#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
+#include <ac/setproctitle.h>
+
+/*
+ * Copyright (c) 1990,1991 Regents of the University of Michigan.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that this notice is preserved and that due credit is given
+ * to the University of Michigan at Ann Arbor. The name of the University
+ * may not be used to endorse or promote products derived from this
+ * software without specific prior written permission. This software
+ * is provided ``as is'' without express or implied warranty.
+ */
+
+char **Argv; /* pointer to original (main's) argv */
+int Argc; /* original argc */
+
+/*
+ * takes a printf-style format string (fmt) and up to three parameters (a,b,c)
+ * this clobbers the original argv...
+ */
+
+/* VARARGS */
+void setproctitle
+#if defined( HAVE_STDARG_H ) && __STDC__
+ ( const char *fmt, ... )
+#else
+ ( fmt, va_alist )
+const char *fmt;
+va_dcl
+#endif
+{
+ static char *endargv = (char *)0;
+ char *s;
+ int i;
+ char buf[ 1024 ];
+ va_list ap;
+
+#if defined( HAVE_STDARG_H ) && __STDC__
+ va_start(ap, fmt);
+#else
+ va_start(ap);
+#endif
+
+#ifdef HAVE_VSNPRINTF
+ buf[sizeof(buf) - 1] = '\0';
+ vsnprintf( buf, sizeof(buf)-1, fmt, ap );
+#elif HAVE_VPRINTF
+ vsprintf( buf, fmt, ap ); /* hope it's not too long */
+#else
+ /* use doprnt() */
+ chokeme = "choke me! I don't have a doprnt() manual handy";
+#endif
+
+ va_end(ap);
+
+ if ( endargv == (char *)0 ) {
+ /* set pointer to end of original argv */
+ endargv = Argv[ Argc-1 ] + strlen( Argv[ Argc-1 ] );
+ }
+ /* make ps print "([prog name])" */
+ s = Argv[0];
+ *s++ = '-';
+ i = strlen( buf );
+ if ( i > endargv - s - 2 ) {
+ i = endargv - s - 2;
+ buf[ i ] = '\0';
+ }
+ strcpy( s, buf );
+ s += i;
+ while ( s < endargv ) *s++ = ' ';
+}
+#endif /* NOSETPROCTITLE */
--- /dev/null
+##
+## Makefile.in for ldapd
+##
+PROGRAMS=ldapd
+XPROGRAMS=sldapd
+SRCS = main.c request.c bind.c result.c error.c \
+ search.c util.c compare.c message.c add.c delete.c modrdn.c modify.c \
+ abandon.c syntax.c association.c kerberos.c certificate.c
+OBJS = main.o request.o bind.o result.o error.o \
+ search.o util.o compare.o message.o add.o delete.o modrdn.o modify.o \
+ abandon.o syntax.o association.o kerberos.o LDAP_tables.o \
+ certificate.o
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+BUILD_OPT = "--enable-ldapd"
+BUILD_SRV = @BUILD_LDAPD@
+
+XLIBS= @LDAPD_LIBS@ -llutil @LUTIL_LIBS@
+
+all-local: $(PROGRAMS)
+
+ldapd: version.o
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) version.o $(LIBS)
+
+sldapd: version.o
+ $(CC) $(LDFLAGS) -static -o $@ $(OBJS) version.o $(LDFLAGS) $(LIBS) -lresolv
+
+version.c: $(OBJS) $(LDAP_LIBDIR)/liblber/liblber.a
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Version.c > $@)
+
+request.o: LDAP-types.h
+
+LDAP_tables.c: ldap.py
+ @if [ ! -z "$(PEPSY)" ]; then \
+ $(PEPSY) -A ldap.py; \
+ else \
+ touch LDAP_tables.c LDAP-types.h; \
+ fi
+
+LDAP-types.h: LDAP_tables.c
+
+install-local: FORCE
+ @$(MKDIR) -p $(libexecdir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 ldapd $(LDAP_LIBEXECDIR)
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-#include <netinet/in.h>
+
+#include <ac/socket.h>
+#include <ac/string.h> /* get SAFEMEMCPY */
+
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include <quipu/ds_error.h>
#include <quipu/bind.h>
#include <quipu/compare.h>
+
#include "lber.h"
#include "ldap.h"
#include "common.h"
-#ifdef COMPAT20
+#ifdef LDAP_COMPAT20
extern int ldap_compat;
#define BINDTAG (ldap_compat == 20 ? OLD_LDAP_RES_BIND : LDAP_RES_BIND)
#else
LDAP_PROTOCOL_ERROR, NULL, "Decoding error" );
return( 0 );
}
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
if ( ldap_compat == 30 )
method = ber_skip_tag( ber, &len );
else
struct DSError dse;
char *dn = dsaconn->c_dn;
int err;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
u_long nonce;
#endif
extern DN ldap_str2dn();
}
switch ( dsaconn->c_method ) {
-#ifdef COMPAT20
+#ifdef LDAP_COMPAT20
case OLD_LDAP_AUTH_SIMPLE:
#endif
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
case LDAP_AUTH_SIMPLE_30:
#endif
case LDAP_AUTH_SIMPLE: /* x.500 simple authentication */
ba.dba_version = DBA_VERSION_V1988;
break;
-#ifdef KERBEROS
-#ifdef COMPAT20
+#ifdef HAVE_KERBEROS
+#ifdef LDAP_COMPAT20
case OLD_LDAP_AUTH_KRBV4:
#endif
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
case LDAP_AUTH_KRBV41_30:
#endif
case LDAP_AUTH_KRBV41: /* kerberos authentication to ldap server */
dsaconn->c_credlen ) );
break;
-#ifdef COMPAT20
+#ifdef LDAP_COMPAT20
case OLD_LDAP_AUTH_KRBV42:
#endif
-#ifdef COMPAT30
+#ifdef LDAP_COMPAT30
case LDAP_AUTH_KRBV42_30:
#endif
case LDAP_AUTH_KRBV42: /* kerberos authentication to x500 dsa */
Debug( LDAP_DEBUG_TRACE, "dap_bind successful\n", 0, 0, 0 );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
/* XXX why doesn't this work??
if ( dsaconn->c_method == LDAP_AUTH_KRBV42 &&
kerberos_check_mutual( &br, nonce ) != 0 ) {
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
+/* ac/socket.h must precede ISODE #includes or p_type must be #undeffed
+ * after it is included. (Because ISODE uses p_type as a field name, and
+ * SunOS 5.5:sys/vtype.h defines it (and ac/socket.h indirectly includes it) */
+#include <ac/socket.h>
+
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include <quipu/ds_error.h>
#include <quipu/remove.h>
#include <quipu/dap2.h>
#include <quipu/dua.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
#include "lber.h"
#include "ldap.h"
#include "common.h"
-#ifdef COMPAT20
+#ifdef HAVE_COMPAT20
extern int ldap_compat;
#define DELTAG (ldap_compat == 20 ? OLD_LDAP_RES_DELETE : LDAP_RES_DELETE)
#else
* University of Minnesota Microcomputer Workstation and Networks Center
*/
+#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 <sys/wait.h>
-#include <signal.h>
-#ifdef _AIX
-#include <sys/select.h>
-#endif
-#include <syslog.h>
+
+#include <ac/signal.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
+
+#ifdef LDAP_PROCTITLE
+#include <ac/setproctitle.h>
+#endif
+
#include <quipu/commonarg.h>
#include <quipu/ds_error.h>
-#include "portable.h"
+
#include "lber.h"
#include "ldap.h"
#include "common.h"
-#ifdef USE_SYSCONF
-#include <unistd.h>
-#endif /* USE_SYSCONF */
+#ifdef HAVE_TCPD
+#include <tcpd.h>
+
+int allow_severity = LOG_INFO;
+int deny_severity = LOG_NOTICE;
+#endif /* TCP_WRAPPERS */
void log_and_exit();
static set_socket();
static do_queries();
-static SIG_FN wait4child();
-#ifdef CLDAP
+static RETSIGTYPE wait4child();
+#ifdef LDAP_CONNECTIONLESS
static udp_init();
#endif
int ldap_debug;
#endif
int version;
-#ifdef COMPAT
+#ifdef LDAP_COMPAT
int ldap_compat;
#endif
int dosyslog;
int do_tcp = 1;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int do_udp = 0;
#endif
int idletime = DEFAULT_TIMEOUT;
int referral_connection_timeout = DEFAULT_REFERRAL_TIMEOUT;
struct timeval conn_start_tv;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
char *krb_ldap_service = "ldapserver";
char *krb_x500_service = "x500dsa";
char *krb_x500_instance;
char *name;
{
fprintf( stderr, "usage: %s [-d debuglvl] [-p port] [-l] [-c dsa] [-r referraltimeout]", name );
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
fprintf( stderr, " [ -U | -t timeout ]" );
#else
fprintf( stderr, " [ -t timeout ]" );
#endif
fprintf( stderr, " [-I]" );
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
fprintf( stderr, " [-i dsainstance]" );
#endif
fprintf( stderr, "\n" );
char **argv;
{
int tcps, ns;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int udps;
#endif
int myport = LDAP_PORT;
int len;
int dsapargc;
char **dsapargv;
- SIG_FN wait4child();
-#ifndef NOSETPROCTITLE
+ RETSIGTYPE wait4child();
+#ifdef LDAP_PROCTITLE
char title[80];
- extern char **Argv;
- extern int Argc;
#endif
extern char *optarg;
extern int optind;
dsapargv[2] = 0;
dsapargv[3] = 0;
dsapargc = 1;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
kerberos_keyfile = "";
#endif
idletime = atoi( optarg );
break;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
case 'f': /* kerberos key file */
kerberos_keyfile = strdup( optarg );
break;
RunFromInetd = 1;
break;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
case 'U': /* UDP only (no TCP) */
do_tcp = 0;
do_udp = 1;
break;
#endif /* NOTYET */
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
default:
usage( argv[0] );
exit( 1 );
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_udp && !do_tcp && idletime != DEFAULT_TIMEOUT ) {
usage( argv[ 0 ] );
exit( 1 );
Debug( LDAP_DEBUG_TRACE, "%s", Versionstr, 0, 0 );
-#ifdef USE_SYSCONF
+#ifdef HAVE_SYSCONF
dtblsize = sysconf( _SC_OPEN_MAX );
-#else /* USE_SYSCONF */
+#elif HAVE_GETDTABLESIZE
dtblsize = getdtablesize();
-#endif /* USE_SYSCONF */
+#else
+ dtblsize = FD_SETSIZE;
+#endif
-#ifndef NOSETPROCTITLE
+#ifdef FD_SETSIZE
+ if( dtblsize > FD_SETSIZE ) {
+ dtblsize = FD_SETSIZE;
+ }
+#endif /* FD_SETSIZE */
+
+#if defined(LDAP_PROCTITLE) && !defined( HAVE_SETPROCTITLE )
/* for setproctitle */
Argv = argv;
Argc = argc;
* that have exited
*/
if (!RunFromInetd) {
-#ifndef NOSETPROCTITLE
+#ifdef LDAP_PROCTITLE
setproctitle( "initializing" );
#endif
#ifndef VMS
- (void) detach();
+# ifdef LDAP_DEBUG
+ lutil_detach( ldap_debug, 1 );
+# else
+ lutil_detach( 0, 1 );
+# endif
#endif
(void) SIGNAL( SIGCHLD, (void *) wait4child );
(void) SIGNAL( SIGINT, (void *) log_and_exit );
len = sizeof( socktype );
getsockopt( ns, SOL_SOCKET, SO_TYPE, &socktype, &len );
if ( socktype == SOCK_DGRAM ) {
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
Debug( LDAP_DEBUG_ARGS,
"CLDAP request from unknown (%s)\n",
inet_ntoa( from.sin_addr ), 0, 0 );
conn_start_tv.tv_sec = 0;
udp_init( 0, 0 );
do_queries( ns, 1 );
-#else /* CLDAP */
+#else /* LDAP_CONNECTIONLESS */
Debug( LDAP_DEBUG_ARGS,
- "Compile with -DCLDAP for UDP support\n",0,0,0 );
-#endif /* CLDAP */
+ "Compile with -DLDAP_CONNECTIONLESS for UDP support\n",0,0,0 );
+#endif /* LDAP_CONNECTIONLESS */
exit( 0 );
}
inet_ntoa( from.sin_addr ) );
}
-#ifndef NOSETPROCTITLE
+#ifdef LDAP_PROCTITLE
sprintf( title, "%s %d\n", hp == NULL ?
inet_ntoa( from.sin_addr ) : hp->h_name, myport );
setproctitle( title );
if ( do_tcp )
tcps = set_socket( myport, 0 );
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_udp )
udps = udp_init( myport, 1 );
#endif
* if we are doing CLDAP as well, handle those requests on the fly
*/
-#ifndef NOSETPROCTITLE
-#ifdef CLDAP
+#ifdef LDAP_PROCTITLE
+#ifdef LDAP_CONNECTIONLESS
sprintf( title, "listening %s/%s %d", do_tcp ? "tcp" : "",
do_udp ? "udp" : "", myport );
#else
FD_ZERO( &readfds );
if ( do_tcp )
FD_SET( tcps, &readfds );
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_udp )
FD_SET( udps, &readfds );
#endif
continue;
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
if ( do_udp && FD_ISSET( udps, &readfds ) ) {
do_queries( udps, 1 );
}
hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr),
sizeof(from.sin_addr.s_addr), AF_INET );
+
+#ifdef HAVE_TCPD
+ if ( !hosts_ctl("ldapd", (hp == NULL) ? "unknown" : hp->h_name,
+ inet_ntoa( from.sin_addr ), STRING_UNKNOWN ) {
+
+ Debug( LDAP_DEBUG_ARGS, "connection from %s (%s) denied.\n",
+ (hp == NULL) ? "unknown" : hp->h_name,
+ inet_ntoa( from.sin_addr ), 0 );
+
+ if ( dosyslog ) {
+ syslog( LOG_NOTICE, "connection from %s (%s) denied.",
+ (hp == NULL) ? "unknown" : hp->h_name,
+ inet_ntoa( from.sin_addr ) );
+ }
+
+ close(ns);
+ continue;
+ }
+#endif /* TCP_WRAPPERS */
+
Debug( LDAP_DEBUG_ARGS, "connection from %s (%s)\n",
(hp == NULL) ? "unknown" : hp->h_name,
inet_ntoa( from.sin_addr ), 0 );
+
if ( dosyslog ) {
syslog( LOG_INFO, "connection from %s (%s)",
(hp == NULL) ? "unknown" : hp->h_name,
#ifdef VMS
/* This is for debug on terminal on VMS */
close( tcps );
-#ifndef NOSETPROCTITLE
+#ifdef LDAP_PROCTITLE
setproctitle( hp == NULL ? inet_ntoa( from.sin_addr ) :
hp->h_name );
#endif
switch( pid = fork() ) {
case 0: /* child */
close( tcps );
-#ifndef NOSETPROCTITLE
+#ifdef LDAP_PROCTITLE
sprintf( title, "%s (%d)\n", hp == NULL ?
inet_ntoa( from.sin_addr ) : hp->h_name,
myport );
int rc, i;
struct timeval timeout;
Sockbuf sb;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
struct sockaddr saddr, faddr;
struct sockaddr *saddrlist[ 1 ];
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
Debug( LDAP_DEBUG_TRACE, "do_queries%s\n",
udp ? " udp" : "", 0, 0 );
(void) memset( (void *) &sb, '\0', sizeof( sb ) );
sb.sb_sd = clientsock;
sb.sb_naddr = ( udp ) ? 1 : 0;
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
sb.sb_addrs = (void **)saddrlist;
sb.sb_fromaddr = &faddr;
sb.sb_useaddr = saddrlist[ 0 ] = &saddr;
return( s );
}
-static SIG_FN wait4child()
+static RETSIGTYPE wait4child()
{
- WAITSTATUSTYPE status;
+#ifndef HAVE_WAITPID
+ WAITSTATUSTYPE status;
+#endif
Debug( LDAP_DEBUG_TRACE, "parent: catching child status\n", 0, 0, 0 );
-#ifdef USE_WAITPID
- while( waitpid( (pid_t) -1, 0, WAIT_FLAGS ) > 0 )
+#ifdef HAVE_WAITPID
+ while( waitpid( (pid_t) -1, NULL, WAIT_FLAGS ) > 0 )
; /* NULL */
#else
- while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
- ; /* NULL */
+ while ( wait3( &status, WAIT_FLAGS, 0 ) > 0 )
+ ; /* NULL */
#endif
(void) SIGNAL( SIGCHLD, (void *) wait4child );
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
static int
udp_init(
int port,
* is provided ``as is'' without express or implied warranty.
*/
+#include "portable.h"
+
#include <stdio.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h> /* get SAFEMEMCPY */
+
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include <quipu/ds_error.h>
#include <quipu/modify.h>
#include <quipu/dap2.h>
#include <quipu/dua.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
#include "lber.h"
#include "ldap.h"
#include "common.h"
extern short ldap_rtl_syntax;
extern short ldap_octetstring_syntax;
+static int replace_mod( struct entrymod *, Attr_Sequence, Attr_Sequence );
-#ifdef COMPAT20
+#ifdef LDAP_COMPAT20
extern int ldap_compat;
#define MODTAG (ldap_compat == 20 ? OLD_LDAP_RES_MODIFY : LDAP_RES_MODIFY)
#else
* that are not in the new set and by only adding what isn't in old set
*/
-int
+static int
replace_mod(
struct entrymod *rem,
Attr_Sequence oas,
--- /dev/null
+##
+## Makefile.in for slapd
+##
+PROGRAMS=slapd
+XPROGRAMS=libbackends.a .backend
+SRCS = main.c daemon.c connection.c search.c filter.c add.c charray.c \
+ attr.c entry.c config.c backend.c result.c operation.c \
+ dn.c compare.c modify.c delete.c modrdn.c ch_malloc.c \
+ value.c ava.c bind.c unbind.c abandon.c filterentry.c \
+ phonetic.c acl.c str2filter.c aclparse.c init.c \
+ repl.c lock.c \
+ suffixalias.c schema.c schemaparse.c monitor.c configinfo.c
+OBJS = main.o daemon.o connection.o search.o filter.o add.o charray.o \
+ attr.o entry.o config.o backend.o result.o operation.o \
+ dn.o compare.o modify.o delete.o modrdn.o ch_malloc.o \
+ value.o ava.o bind.o unbind.o abandon.o filterentry.o \
+ phonetic.o acl.o str2filter.o aclparse.o init.o \
+ repl.o lock.o \
+ suffixalias.o schema.o schemaparse.o monitor.o configinfo.o
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+BUILD_OPT = "--enable-slapd"
+BUILD_SRV = @BUILD_SLAPD@
+
+all-local: FORCE
+ $(MAKE) $(MFLAGS) backendslib
+ $(MAKE) $(MFLAGS) slapd
+ (cd tools; $(MAKE) $(MFLAGS) all)
+
+XLIBS = @SLAPD_LIBS@ libbackends.a \
+ -lavl -lldbm @LDBM_LIBS@ -llthread @LTHREAD_LIBS@ -llutil @LUTIL_LIBS@
+
+slapd: version.o
+ $(CC) $(LDFLGS) -o $@ $(OBJS) version.o $(LIBS)
+
+backendslib: FORCE
+ @for i in back-*; do \
+ if [ -d $$i ]; then \
+ echo " "; echo " cd $$i; $(MAKE) $(MFLAGS) all"; \
+ ( cd $$i; $(MAKE) $(MFLAGS) all ); \
+ fi; \
+ done; \
+ echo " "; \
+ $(MAKE) $(MFLAGS) libbackends.a
+
+libbackends.a: .backend
+ @$(RM) -r tmp
+ @$(MKDIR) tmp
+ @-for i in back-*/*.a; do \
+ ( \
+ cd tmp; \
+ $(AR) x ../$$i; \
+ pre=`echo $$i | sed -e 's/\/.*$$//' -e 's/back-//'`; \
+ for j in *.o; do \
+ mv $$j $${pre}$$j; \
+ done; \
+ $(AR) ruv libbackends.a *.o 2>&1 | grep -v truncated; \
+ $(RM) *.o __.SYMDEF; \
+ echo "added backend library $$i"; \
+ ); \
+ done
+ @mv -f tmp/libbackends.a ./libbackends.a
+ @$(RM) -r tmp
+ @if [ ! -z "$(RANLIB)" ]; then \
+ $(RANLIB) libbackends.a; \
+ fi
+ @ls -l libbackends.a
+
+version.c: libbackends.a $(OBJS) $(LDAP_LIBDEPEND) \
+ $(LDAP_LIBDIR)/libldbm.a \
+ $(LDAP_LIBDIR)/libavl.a \
+ $(LDAP_LIBDIR)/libldif.a \
+ $(LDAP_LIBDIR)/liblutil.a \
+ $(LDAP_LIBDIR)/liblthread.a
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Version.c > $@)
+
+clean-local: FORCE
+ @for i in back-* tools; do \
+ if [ -d $$i ]; then \
+ echo; echo " cd $$i; $(MAKE) $(MFLAGS) clean"; \
+ ( cd $$i; $(MAKE) $(MFLAGS) clean ); \
+ fi; \
+ done
+
+install-local: install-slapd install-conf install-tools
+
+install-slapd: FORCE
+ @-$(MKDIR) $(libexecdir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 slapd $(libexecdir)
+
+install-conf: FORCE
+ @-$(MKDIR) -p $(sysconfdir)
+ $(SED) -e 's;%SYSCONFDIR%;$(sysconfdir);' slapd.conf > /tmp/slapd.$$
+ -$(MV) $(sysconfdir)/slapd.conf $(sysconfdir)/slapd.conf-
+ $(INSTALL) $(INSTALLFLAGS) -m 644 /tmp/slapd.$$ $(sysconfdir)/slapd.conf
+ $(RM) -f /tmp/slapd.$$
+ -$(MV) $(sysconfdir)/slapd.at.conf $(sysconfdir)/slapd.at.conf-
+ $(INSTALL) $(INSTALLFLAGS) -m 644 slapd.at.conf $(sysconfdir)
+ -$(MV) $(sysconfdir)/slapd.oc.conf $(sysconfdir)/slapd.oc.conf-
+ $(INSTALL) $(INSTALLFLAGS) -m 644 slapd.oc.conf $(sysconfdir)
+
+install-tools: FORCE
+ @-$(MKDIR) $(sbindir)
+ (cd tools; $(MAKE) $(MFLAGS) install)
+
} else {
- if (ldap_debug&LDAP_DEBUG_ACL)
- print_acl(a);
-
+#ifdef LDAP_DEBUG
+ if (ldap_debug & LDAP_DEBUG_ACL)
+ print_acl(a);
+#endif
if ( a->acl_access == NULL ) {
fprintf( stderr,
f->f_and = (Filter *) ch_malloc( sizeof(Filter) );
f->f_and->f_choice = LDAP_FILTER_EQUALITY;
f->f_and->f_ava.ava_type = strdup( "id2children" );
- sprintf( buf, "%d", e != NULL ? e->e_id : 0 );
+ sprintf( buf, "%ld", e != NULL ? e->e_id : 0 );
f->f_and->f_ava.ava_value.bv_val = strdup( buf );
f->f_and->f_ava.ava_value.bv_len = strlen( buf );
f->f_and->f_next = filter;
/* lock.c - routines to open and apply an advisory lock to a file */
-#include <stdio.h>
-#include <sys/time.h>
-#include <sys/types.h>
#include "portable.h"
-#ifdef USE_LOCKF
-#include <unistd.h>
-#endif
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+
#include <sys/file.h>
#include <sys/param.h>
-#include <sys/socket.h>
#include "slap.h"
FILE *
}
/* acquire the lock */
-#ifdef USE_LOCKF
- while ( lockf( fileno( *lfp ), F_LOCK, 0 ) != 0 ) {
-#else
+#ifdef HAVE_FLOCK
while ( flock( fileno( *lfp ), LOCK_EX ) != 0 ) {
+#else
+ while ( lockf( fileno( *lfp ), F_LOCK, 0 ) != 0 ) {
#endif
; /* NULL */
}
/* open the log file */
if ( (fp = fopen( fname, type )) == NULL ) {
Debug( LDAP_DEBUG_ANY, "could not open \"%s\"\n", fname, 0, 0 );
-#ifdef USE_LOCKF
- lockf( fileno( *lfp ), F_ULOCK, 0 );
-#else
+#ifdef HAVE_FLOCK
flock( fileno( *lfp ), LOCK_UN );
+#else
+ lockf( fileno( *lfp ), F_ULOCK, 0 );
#endif
return( NULL );
}
lock_fclose( FILE *fp, FILE *lfp )
{
/* unlock */
-#ifdef USE_LOCKF
- lockf( fileno( lfp ), F_ULOCK, 0 );
-#else
+#ifdef HAVE_FLOCK
flock( fileno( lfp ), LOCK_UN );
+#else
+ lockf( fileno( lfp ), F_ULOCK, 0 );
#endif
fclose( lfp );
-#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 "portable.h"
+
+#include <stdio.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include "slap.h"
#include "ldapconfig.h"
-extern void daemon();
+extern void slapd_daemon();
extern int lber_debug;
extern char Versionstr[];
+
/*
* read-only global variables or variables only written by the listener
* thread (after they are initialized) - no need to protect them with a mutex.
*/
-int ldap_debug;
+int ldap_debug = 0;
#ifdef LDAP_DEBUG
int ldap_syslog = LDAP_DEBUG_STATS;
#else
*/
pthread_mutex_t entry2str_mutex;
pthread_mutex_t replog_mutex;
-#ifndef sunos5
-pthread_mutex_t regex_mutex;
-#endif
static
usage( name )
char *name;
{
- fprintf( stderr, "usage: %s [-d debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
+ fprintf( stderr, "usage: %s [-d ?|debuglevel] [-f configfile] [-p portnumber] [-s sysloglevel]\n", name );
}
main( argc, argv )
LDAP_DEBUG_CONFIG );
printf( "\tLDAP_DEBUG_ACL\t\t%d\n",
LDAP_DEBUG_ACL );
- printf( "\tLDAP_DEBUG_STATS\t\t%d\n",
+ printf( "\tLDAP_DEBUG_STATS\t%d\n",
LDAP_DEBUG_STATS );
- printf( "\tLDAP_DEBUG_STATS2\t\t%d\n",
+ printf( "\tLDAP_DEBUG_STATS2\t%d\n",
LDAP_DEBUG_STATS2 );
- printf( "\tLDAP_DEBUG_SHELL\t\t%d\n",
+ printf( "\tLDAP_DEBUG_SHELL\t%d\n",
LDAP_DEBUG_SHELL );
- printf( "\tLDAP_DEBUG_PARSE\t\t%d\n",
+ printf( "\tLDAP_DEBUG_PARSE\t%d\n",
LDAP_DEBUG_PARSE );
printf( "\tLDAP_DEBUG_ANY\t\t%d\n",
LDAP_DEBUG_ANY );
exit( 0 );
} else {
- ldap_debug = atoi( optarg );
+ ldap_debug |= atoi( optarg );
lber_debug = (ldap_debug & LDAP_DEBUG_BER);
}
break;
if ( ! inetd ) {
/* pre-open config file before detach in case it is a relative path */
fp = fopen( configfile, "r" );
- detach();
+#ifdef LDAP_DEBUG
+ lutil_detach( ldap_debug, 0 );
+#else
+ lutil_detach( 0, 0 );
+#endif
}
#ifdef LOG_LOCAL4
openlog( myname, OPENLOG_OPTIONS, LOG_LOCAL4 );
pthread_attr_init( &attr );
pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
- if ( pthread_create( &listener_tid, attr, (void *) daemon,
+#if !defined(HAVE_PTHREADS_D4) && !defined(HAVE_DCE)
+ /* POSIX_THREADS or compatible
+ * This is a draft 10 or standard pthreads implementation
+ */
+ if ( pthread_create( &listener_tid, &attr, slapd_daemon,
+ (void *) port ) != 0 ) {
+ Debug( LDAP_DEBUG_ANY,
+ "listener pthread_create failed\n", 0, 0, 0 );
+ exit( 1 );
+ }
+#else /* draft4 */
+ /*
+ * This is a draft 4 or earlier pthreads implementation
+ */
+ if ( pthread_create( &listener_tid, attr, slapd_daemon,
(void *) port ) != 0 ) {
Debug( LDAP_DEBUG_ANY,
"listener pthread_create failed\n", 0, 0, 0 );
exit( 1 );
}
+#endif /* !draft4 */
pthread_attr_destroy( &attr );
pthread_join( listener_tid, (void *) &status );
pthread_exit( 0 );
#endif
flen = sizeof(from);
if ( getpeername( 0, (struct sockaddr *) &from, &flen ) == 0 ) {
-#ifdef REVERSE_LOOKUP
+#ifdef SLAPD_RLOOKUPS
hp = gethostbyaddr( (char *) &(from.sin_addr.s_addr),
sizeof(from.sin_addr.s_addr), AF_INET );
#else
* is provided ``as is'' without express or implied warranty.
*/
+/* Revision history
+ *
+ * 5-Jun-96 jeff.hodges@stanford.edu
+ * Added locking of new_conn_mutex when traversing the c[] array.
+ * Added locking of currenttime_mutex to protect call(s) to localtime().
+ */
+
+#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 <ac/time.h>
+
#include "slap.h"
#include "ldapconfig.h"
extern time_t starttime;
extern int num_conns;
+extern pthread_mutex_t new_conn_mutex;
+extern pthread_mutex_t currenttime_mutex;
extern char Versionstr[];
-/*
- * no mutex protection in here - take our chances!
- */
-
void
monitor_info( Connection *conn, Operation *op )
{
Entry *e;
- char buf[BUFSIZ], buf2[20];
+ char buf[BUFSIZ], buf2[22];
struct berval val;
struct berval *vals[2];
int i, nconns, nwritewaiters, nreadwaiters;
vals[1] = NULL;
e = (Entry *) ch_calloc( 1, sizeof(Entry) );
+ /* initialize reader/writer lock */
+ entry_rdwr_init(e);
e->e_attrs = NULL;
e->e_dn = strdup( SLAPD_MONITOR_DN );
nconns = 0;
nwritewaiters = 0;
nreadwaiters = 0;
+
+ pthread_mutex_lock( &new_conn_mutex );
for ( i = 0; i < dtblsize; i++ ) {
if ( c[i].c_sb.sb_sd != -1 ) {
nconns++;
if ( c[i].c_gettingber ) {
nreadwaiters++;
}
+ pthread_mutex_lock( ¤ttime_mutex );
+#ifndef LDAP_LOCALTIME
+ ltm = gmtime( &c[i].c_starttime );
+ strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
+#else
ltm = localtime( &c[i].c_starttime );
strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
+#endif
+ pthread_mutex_unlock( ¤ttime_mutex );
+
pthread_mutex_lock( &c[i].c_dnmutex );
sprintf( buf, "%d : %s : %ld : %ld : %s : %s%s", i,
buf2, c[i].c_opsinitiated, c[i].c_opscompleted,
attr_merge( e, "connection", vals );
}
}
+ pthread_mutex_unlock( &new_conn_mutex );
+
sprintf( buf, "%d", nconns );
val.bv_val = buf;
val.bv_len = strlen( buf );
val.bv_len = strlen( buf );
attr_merge( e, "bytessent", vals );
- ltm = localtime( ¤ttime );
- strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
+ pthread_mutex_lock( ¤ttime_mutex );
+#ifndef LDAP_LOCALTIME
+ ltm = gmtime( ¤ttime );
+ strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
+#else
+ ltm = localtime( ¤ttime );
+ strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
+#endif
+ pthread_mutex_unlock( ¤ttime_mutex );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "currenttime", vals );
- ltm = localtime( &starttime );
- strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
+ pthread_mutex_lock( ¤ttime_mutex );
+#ifndef LDAP_LOCALTIME
+ ltm = gmtime( &starttime );
+ strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
+#else
+ ltm = localtime( &starttime );
+ strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
+#endif
+ pthread_mutex_unlock( ¤ttime_mutex );
val.bv_val = buf;
val.bv_len = strlen( buf );
attr_merge( e, "starttime", vals );
val.bv_len = strlen( buf );
attr_merge( e, "nbackends", vals );
-#ifdef THREAD_SUNOS5_LWP
+#ifdef HAVE_THR
sprintf( buf, "%d", thr_getconcurrency() );
val.bv_val = buf;
val.bv_len = strlen( buf );
#include "lthread.h"
#include "lthread_rdwr.h"
#include "ldif.h"
+#ifdef f_next
+#undef f_next /* name conflict between sys/file.h on SCO and struct filter */
+#endif
#define DN_DNS 0
#define DN_X500 1
/* centipede.c - generate and install indexing information (view w/tabstop=4) */
+#include "portable.h"
+
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/time.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
#include <lber.h>
#include <ldap.h>
+
#include <ldapconfig.h>
#include <ldbm.h>
main( int argc, char **argv )
{
- char *ldapfilter, *ldapref;
+ char *ldapfilter;
char *ldapsrcurl, *ldapdesturl;
LDAP *ld;
LDAPMod **mods;
srcldapauthmethod = LDAP_AUTH_KRBV4;
} else {
fprintf( stderr, "%s: unknown auth method\n", optarg );
- fprintf( stderr, "expecting \"simple\" or \"kerberos\"\n",
- optarg );
+ fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
exit( 1 );
}
break;
destldapauthmethod = LDAP_AUTH_KRBV4;
} else {
fprintf( stderr, "%s: unknown auth method\n", optarg );
- fprintf( stderr, "expecting \"simple\" or \"kerberos\"\n",
- optarg );
+ fputs( "expecting \"simple\" or \"kerberos\"\n", stderr );
exit( 1 );
}
break;
char *s, *s2;
int i;
- if ( strncmp( ldapsrcurl, "ldap://", 7 ) == 0 ) {
- s = ldapsrcurl + 7;
+ if ( strncmp( ldapsrcurl, "ldap://", 7 ) != 0 ) {
+ fputs( "Not an LDAP URL", stderr ); /* Should be smarter? */
+ return( NULL );
}
+ s = ldapsrcurl + 7;
if ( (s2 = strchr( s, '/' )) == NULL ) {
ldapbase = strdup( s );
} else {
/* normalize the value */
for ( s = val[j]; *s; s++ ) {
if ( isascii( *s ) ) {
- *s = tolower( *s );
+ *s = TOLOWER( *s );
}
last = *s;
}
int amax, acur, dmax, dcur;
char **vals;
+#ifdef HAVE_BERKELEY_DB2
+ DBC *ocursorp;
+ DBC *ncursorp;
+#endif /* HAVE_BERKELEY_DB2 */
+
if ( verbose ) {
printf( "Generating mods for differential %s centroid...", attr );
fflush( stdout );
olast.dptr = NULL;
nlast.dptr = NULL;
+#ifdef HAVE_BERKELEY_DB2
+ for ( okey = ldbm_firstkey( oldbm, &ocursorp ),
+ nkey = ldbm_firstkey( nldbm, &ncursorp );
+ okey.dptr != NULL && nkey.dptr != NULL; )
+#else
for ( okey = ldbm_firstkey( oldbm ), nkey = ldbm_firstkey( nldbm );
okey.dptr != NULL && nkey.dptr != NULL; )
+#endif
{
rc = strcmp( okey.dptr, nkey.dptr );
}
nlast = nkey;
+#ifdef HAVE_BERKELEY_DB2
+ okey = ldbm_nextkey( oldbm, olast, ocursorp );
+ nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
+#else
okey = ldbm_nextkey( oldbm, olast );
nkey = ldbm_nextkey( nldbm, nlast );
+#endif
} else if ( rc > 0 ) {
/* new value is not in old centroid - add it */
if ( charray_add_dup( &avals, &acur, &amax, nkey.dptr ) == NULL ) {
ldbm_datum_free( nldbm, nlast );
}
nlast = nkey;
+
+#ifdef HAVE_BERKELEY_DB2
+ nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
+#else
nkey = ldbm_nextkey( nldbm, nlast );
+#endif
} else {
/* old value is not in new centroid - delete it */
if ( charray_add_dup( &dvals, &dcur, &dmax, okey.dptr ) == NULL ) {
ldbm_datum_free( oldbm, olast );
}
olast = okey;
+
+#ifdef HAVE_BERKELEY_DB2
+ okey = ldbm_nextkey( oldbm, olast, ocursorp );
+#else
okey = ldbm_nextkey( oldbm, olast );
+#endif
}
}
return( NULL );
}
+#ifdef HAVE_BERKELEY_DB2
+ okey = ldbm_nextkey( oldbm, olast, ocursorp );
+#else
okey = ldbm_nextkey( oldbm, olast );
+#endif
if ( olast.dptr != NULL ) {
ldbm_datum_free( oldbm, olast );
}
return( NULL );
}
+#ifdef HAVE_BERKELEY_DB2
+ nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
+#else
nkey = ldbm_nextkey( nldbm, nlast );
+#endif
if ( nlast.dptr != NULL ) {
ldbm_datum_free( nldbm, nlast );
}
/* generate list of values to add */
lastkey.dptr = NULL;
+#ifdef HAVE_BERKELEY_DB2
+ for ( key = ldbm_firstkey( nldbm, &ncursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( nldbm, lastkey, ncursorp ) )
+#else
for ( key = ldbm_firstkey( nldbm ); key.dptr != NULL;
- key = ldbm_nextkey( nldbm, lastkey ) ) {
+ key = ldbm_nextkey( nldbm, lastkey ) )
+#endif
+ {
/* see if it's in the old one */
data = ldbm_fetch( oldbm, key );
/* generate list of values to delete */
lastkey.dptr = NULL;
+#ifdef HAVE_BERKELEY_DB2
+ for ( key = ldbm_firstkey( oldbm, &ocursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( oldbm, lastkey, ocursorp ) )
+#else
for ( key = ldbm_firstkey( oldbm ); key.dptr != NULL;
- key = ldbm_nextkey( oldbm, lastkey ) ) {
+ key = ldbm_nextkey( oldbm, lastkey ) )
+#endif
+ {
/* see if it's in the new one */
data = ldbm_fetch( nldbm, key );
char **vals;
int vcur, vmax;
+#ifdef HAVE_BERKELEY_DB2
+ DBC *cursorp;
+#endif
+
if ( verbose ) {
printf( "Generating mods for full %s centroid...", attr );
fflush( stdout );
lastkey.dptr = NULL;
vals = NULL;
vcur = vmax = 0;
+#ifdef HAVE_BERKELEY_DB2
+ for ( key = ldbm_firstkey( ldbm, &cursorp ); key.dptr != NULL;
+ key = ldbm_nextkey( ldbm, lastkey, cursorp ) )
+#else
for ( key = ldbm_firstkey( ldbm ); key.dptr != NULL;
- key = ldbm_nextkey( ldbm, lastkey ) ) {
+ key = ldbm_nextkey( ldbm, lastkey ) )
+#endif
+ {
if ( charray_add_dup( &vals, &vcur, &vmax, key.dptr ) == NULL ) {
ldap_mods_free( mods, 1 );
return( NULL );
/* first, pick out the destination ldap server info */
if ( ldapbase != NULL ) {
free( ldapbase );
+ ldapbase = NULL;
}
- if ( strncmp( ldapdesturl, "ldap://", 7 ) == 0 ) {
- s = ldapdesturl + 7;
+ if ( strncmp( ldapdesturl, "ldap://", 7 ) != 0 ) {
+ fputs( "Not an LDAP URL", stderr ); /* Should be smarter? */
+ return( NULL );
}
+ s = ldapdesturl + 7;
if ( (s2 = strchr( s, '/' )) == NULL ) {
ldapbase = strdup( s );
} else {
--- /dev/null
+##
+## Makefile.in for slurpd
+##
+
+PROGRAMS = slurpd
+SRCS = admin.c args.c ch_malloc.c config.c \
+ fm.c globals.c ldap_op.c lock.c main.c re.c \
+ reject.c replica.c replog.c ri.c rq.c sanity.c st.c \
+ tsleep.c
+OBJS = admin.o args.o ch_malloc.o config.o \
+ fm.o globals.o ldap_op.o lock.o main.o re.o \
+ reject.o replica.o replog.o ri.o rq.o sanity.o st.o \
+ tsleep.o
+
+LDAP_INCDIR= ../../include
+LDAP_LIBDIR= ../../libraries
+
+BUILD_OPT = "--enable-slurpd"
+BUILD_SRV = @BUILD_SLURPD@
+
+all-local: slurpd
+
+XLIBS = @SLURPD_LIBS@ -llthread @LTHREAD_LIBS@ -llutil @LUTIL_LIBS@
+
+slurpd: version.o
+ $(CC) $(LDFLAGS) -o $@ $(OBJS) version.o $(LIBS)
+
+version.c: $(OBJS) $(LDAP_LIBDEPEND)
+ $(RM) $@
+ (u=$${USER-root} v=`$(CAT) $(VERSIONFILE)` d=`$(PWD)` h=`$(HOSTNAME)` \
+ t=`$(DATE)`; $(SED) -e "s|%WHEN%|$${t}|" \
+ -e "s|%WHOANDWHERE%|$${u}@$${h}:$${d}|" \
+ -e "s|%VERSION%|$${v}|" \
+ < $(srcdir)/Version.c > $@)
+
+install-local: FORCE
+ @-$(MKDIR) -p $(libexecdir)
+ $(INSTALL) $(INSTALLFLAGS) -m 755 slurpd $(libexecdir)
* is provided ``as is'' without express or implied warranty.
*/
+#ifndef SLURPD_GLOBALS_H
+#define SLURPD_GLOBALS_H 1
/*
* globals.h - definition of structure holding global data.
#include "slurp.h"
+LDAP_BEGIN_DECL
+
typedef struct globals {
/* Thread ID for file manager thread */
pthread_t fm_tid;
St *st;
/* Pointer to replication queue */
Rq *rq;
-#ifdef KERBEROS
+#ifdef HAVE_KERBEROS
/* Default name of kerberos srvtab file */
char *default_srvtab;
-#endif /* KERBEROS */
-#if defined( THREAD_SUNOS4_LWP )
+#endif /* HAVE_KERBEROS */
+#if defined( HAVE_LWP ) && !defined( HAVE_THR )
tl_t *tsl_list;
mon_t tsl_mon;
#endif /* THREAD_SUNOS4_LWP */
extern Globals *sglob;
+
+LDAP_END_DECL
+
+#endif /* SLURPD_GLOBALS_H */
* main.c - main routine for slurpd.
*/
+#include "portable.h"
+
#include <stdio.h>
#include "slurp.h"
#include "globals.h"
+#include "lutil.h"
extern int doargs( int, char **, Globals * );
extern int start_replica_thread( Ri * );
extern Globals *init_globals();
extern int sanity();
-#if defined( THREAD_SUNOS4_LWP )
+
+#if defined( HAVE_LWP )
extern void start_lwp_scheduler();
-#endif /* THREAD_SUNOS4_LWP */
+#endif /* HAVE_LWP */
main(
int argc,
int status;
int i;
-#ifndef _THREAD
+#ifdef NO_THREADS
/* Haven't yet written the non-threaded version */
fprintf( stderr, "slurpd currently requires threads support\n" );
exit( 1 );
-#endif /* !_THREAD */
+#else
/*
* Create and initialize globals. init_globals() also initializes
* and if not in one-shot mode.
*/
#ifdef LDAP_DEBUG
- if (( ldap_debug == 0 ) && !sglob->one_shot_mode ) {
+ if (( ldap_debug == 0 ) && !sglob->one_shot_mode )
#else /* LDAP_DEBUG */
- if ( !sglob->one_shot_mode ) {
+ if ( !sglob->one_shot_mode )
#endif /* LDAP_DEBUG */
- detach();
- }
+ lutil_detach( 0, 0 );
-#ifdef _THREAD
-
-#if defined( THREAD_SUNOS4_LWP )
+#if defined( HAVE_LWP )
/*
* Need to start a scheduler thread under SunOS 4
*/
start_lwp_scheduler();
-#endif /* THREAD_SUNOS4_LWP */
+#endif /* HAVE_LWP */
/*
* Start the main file manager thread (in fm.c).
*/
pthread_attr_init( &attr );
- if ( pthread_create( &(sglob->fm_tid), attr, (void *) fm, (void *) NULL )
+
+#if !defined(HAVE_PTHREADS_D4) && !defined(HAVE_DCE)
+ /* POSIX_THREADS or compatible
+ * This is a draft 10 or standard pthreads implementation
+ */
+ if ( pthread_create( &(sglob->fm_tid), &attr, fm, (void *) NULL )
+ != 0 ) {
+ Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
+ 0, 0, 0 );
+ exit( 1 );
+
+ }
+#else /* !PTHREADS_FINAL */
+ /*
+ * This is a draft 4 or earlier pthreads implementation
+ */
+ if ( pthread_create( &(sglob->fm_tid), attr, fm, (void *) NULL )
!= 0 ) {
Debug( LDAP_DEBUG_ANY, "file manager pthread_create failed\n",
0, 0, 0 );
exit( 1 );
}
+#endif /* !PTHREADS_FINAL */
+
pthread_attr_destroy( &attr );
/*
* Wait for the fm thread to finish.
*/
+#ifdef HAVE_PTHREADS_FINAL
+ pthread_join( sglob->fm_tid, (void *) NULL );
+#else
pthread_join( sglob->fm_tid, (void *) &status );
+#endif
/*
* Wait for the replica threads to finish.
*/
for ( i = 0; sglob->replicas[ i ] != NULL; i++ ) {
+#ifdef HAVE_PTHREADS_FINAL
+ pthread_join( sglob->replicas[ i ]->ri_tid, (void *) NULL );
+#else
pthread_join( sglob->replicas[ i ]->ri_tid, (void *) &status );
+#endif
}
Debug( LDAP_DEBUG_ANY, "slurpd: terminating normally\n", 0, 0, 0 );
sglob->slurpd_shutdown = 1;
pthread_exit( 0 );
-#else /* !_THREAD */
- /*
- * Non-threaded case.
- */
- exit( 0 );
-
-#endif /* !_THREAD */
-
+#endif /* !NO_THREADS */
}