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

SLAPD and tools compile and link!

LTHREAD still needs work.
parent 43e6fc8e
......@@ -5862,6 +5862,7 @@ for ac_func in \
lockf \
memcpy \
memmove \
mkstemp \
mktime \
select \
setpwfile \
......@@ -5881,12 +5882,12 @@ for ac_func in \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5885: checking for $ac_func" >&5
echo "configure:5886: 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 5890 "configure"
#line 5891 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
......@@ -5909,7 +5910,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5913: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:5914: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
......@@ -5937,12 +5938,12 @@ done
for ac_func in getopt strdup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5941: checking for $ac_func" >&5
echo "configure:5942: 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 5946 "configure"
#line 5947 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
......@@ -5965,7 +5966,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:5970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
......@@ -5995,13 +5996,13 @@ done
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
echo "configure:5999: checking declaration of sys_errlist" >&5
echo "configure:6000: 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 6005 "configure"
#line 6006 "configure"
#include "confdefs.h"
#include <stdio.h>
......@@ -6011,7 +6012,7 @@ int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if { (eval echo configure:6015: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:6016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
else
......@@ -6032,20 +6033,20 @@ if test $ol_cv_dcl_sys_errlist = no ; then
EOF
echo $ac_n "checking existence of sys_errlist""... $ac_c" 1>&6
echo "configure:6036: checking existence of sys_errlist" >&5
echo "configure:6037: 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 6042 "configure"
#line 6043 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if { (eval echo configure:6049: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:6050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
......
......@@ -740,6 +740,7 @@ AC_CHECK_FUNCS( \
lockf \
memcpy \
memmove \
mkstemp \
mktime \
select \
setpwfile \
......
......@@ -3,43 +3,11 @@
#ifndef _LDBM_H_
#define _LDBM_H_
#ifdef LDBM_USE_GDBM
/*****************************************************************
* *
* use gdbm if possible *
* *
*****************************************************************/
#include <gdbm.h>
typedef datum Datum;
typedef GDBM_FILE LDBM;
extern gdbm_error gdbm_errno;
/* for ldbm_open */
#define LDBM_READER GDBM_READER
#define LDBM_WRITER GDBM_WRITER
#define LDBM_WRCREAT GDBM_WRCREAT
#define LDBM_NEWDB GDBM_NEWDB
#define LDBM_FAST GDBM_FAST
#define LDBM_SUFFIX ".gdbm"
/* for ldbm_insert */
#define LDBM_INSERT GDBM_INSERT
#define LDBM_REPLACE GDBM_REPLACE
#define LDBM_SYNC 0x80000000
#else /* end of gdbm */
#ifdef LDBM_USE_DBHASH
#ifdef LDBM_USE_DBBTREE
/*****************************************************************
* *
* use berkeley db hash package *
* use berkeley db btree package *
* *
*****************************************************************/
......@@ -47,26 +15,27 @@ extern gdbm_error gdbm_errno;
#include <limits.h>
#include <fcntl.h>
#ifdef LDBM_USE_DB2_COMPAT185
#ifdef HAVE_DB185_H
# include <db_185.h>
#else
# include <db.h>
# ifdef LDBM_USE_DB2
# ifdef HAVE_BERKELEY_DB2
# define R_NOOVERWRITE DB_NOOVERWRITE
# define DEFAULT_DB_PAGE_SIZE 1024
# endif
#endif
typedef DBT Datum;
#define dsize size
#define dptr data
typedef DB *LDBM;
#define DB_TYPE DB_HASH
#define DB_TYPE DB_BTREE
/* for ldbm_open */
#ifdef LDBM_USE_DB2
#ifdef HAVE_BERKELEY_DB2
# define LDBM_READER DB_RDONLY
# define LDBM_WRITER 0x00000 /* hopefully */
# define LDBM_WRCREAT (DB_NOMMAP|DB_CREATE|DB_THREAD)
......@@ -76,25 +45,23 @@ typedef DB *LDBM;
# define LDBM_WRITER O_RDWR
# define LDBM_WRCREAT (O_RDWR|O_CREAT)
# define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
# define LDBM_FAST 0
#endif
#define LDBM_SUFFIX ".dbh"
# define LDBM_FAST 0
#define LDBM_SUFFIX ".dbb"
#define LDBM_ORDERED 1
/* for ldbm_insert */
#define LDBM_INSERT R_NOOVERWRITE
#define LDBM_REPLACE 0
#define LDBM_SYNC 0x80000000
extern int errno;
#else /* end of db hash */
#ifdef LDBM_USE_DBBTREE
#elif defined( LDBM_USE_DBHASH )
/*****************************************************************
* *
* use berkeley db btree package *
* use berkeley db hash package *
* *
*****************************************************************/
......@@ -102,7 +69,7 @@ extern int errno;
#include <limits.h>
#include <fcntl.h>
#ifdef LDBM_USE_DB2_COMPAT185
#ifdef HAVE_DB185_H
# include <db_185.h>
#else
# include <db.h>
......@@ -112,14 +79,13 @@ extern int errno;
# endif
#endif
typedef DBT Datum;
#define dsize size
#define dptr data
typedef DB *LDBM;
#define DB_TYPE DB_BTREE
#define DB_TYPE DB_HASH
/* for ldbm_open */
#ifdef LDBM_USE_DB2
......@@ -132,23 +98,48 @@ typedef DB *LDBM;
# define LDBM_WRITER O_RDWR
# define LDBM_WRCREAT (O_RDWR|O_CREAT)
# define LDBM_NEWDB (O_RDWR|O_TRUNC|O_CREAT)
# define LDBM_FAST 0
#endif
# define LDBM_FAST 0
#define LDBM_SUFFIX ".dbb"
#define LDBM_ORDERED 1
#define LDBM_SUFFIX ".dbh"
/* for ldbm_insert */
#define LDBM_INSERT R_NOOVERWRITE
#define LDBM_REPLACE 0
#define LDBM_SYNC 0x80000000
extern int errno;
#elif defined( HAVE_GDBM )
/*****************************************************************
* *
* use gdbm if possible *
* *
*****************************************************************/
#include <gdbm.h>
typedef datum Datum;
typedef GDBM_FILE LDBM;
extern gdbm_error gdbm_errno;
/* for ldbm_open */
#define LDBM_READER GDBM_READER
#define LDBM_WRITER GDBM_WRITER
#define LDBM_WRCREAT GDBM_WRCREAT
#define LDBM_NEWDB GDBM_NEWDB
#define LDBM_FAST GDBM_FAST
#define LDBM_SUFFIX ".gdbm"
/* for ldbm_insert */
#define LDBM_INSERT GDBM_INSERT
#define LDBM_REPLACE GDBM_REPLACE
#define LDBM_SYNC 0x80000000
#else /* end of db btree */
#ifdef LDBM_USE_NDBM
#elif defined( HAVE_NDBM )
/*****************************************************************
* *
......@@ -157,6 +148,7 @@ extern int errno;
*****************************************************************/
#include <ndbm.h>
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
......@@ -179,10 +171,7 @@ typedef DBM *LDBM;
#define LDBM_REPLACE DBM_REPLACE
#define LDBM_SYNC 0
#endif /* ndbm */
#endif /* db hash */
#endif /* db btree */
#endif /* gdbm */
#endif
int ldbm_errno( LDBM ldbm );
LDBM ldbm_open( char *name, int rw, int mode, int dbcachesize );
......@@ -194,7 +183,7 @@ Datum ldbm_fetch( LDBM ldbm, Datum key );
int ldbm_store( LDBM ldbm, Datum key, Datum data, int flags );
int ldbm_delete( LDBM ldbm, Datum key );
#if LDBM_USE_DB2
#if HAVE_BERKELEY_DB2
void *ldbm_malloc( size_t size );
Datum ldbm_firstkey( LDBM ldbm, DBC **dbch );
Datum ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp );
......
......@@ -248,6 +248,9 @@ is provided ``as is'' without express or implied warranty.
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the mkstemp function. */
#undef HAVE_MKSTEMP
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
......
......@@ -99,18 +99,18 @@ do_abandon( LDAP *ld, int origid, int msgid )
err = -1;
ld->ld_errno = LDAP_NO_MEMORY;
} else {
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
if ( ld->ld_sb.sb_naddr > 0 ) {
err = ber_printf( ber, "{isti}",
++ld->ld_msgid, ld->ld_cldapdn,
LDAP_REQ_ABANDON, msgid );
} else {
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
err = ber_printf( ber, "{iti}", ++ld->ld_msgid,
LDAP_REQ_ABANDON, msgid );
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
}
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
if ( err == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
......
......@@ -7,7 +7,7 @@
#include "portable.h"
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
#ifndef lint
static char copyright[] = "@(#) Copyright (c) 1990, 1994 Regents of the University of Michigan.\nAll rights reserved.\n";
......@@ -40,17 +40,14 @@ struct cldap_retinfo {
long cri_timeout;
};
#ifdef NEEDPROTOS
static int add_addr( LDAP *ld, struct sockaddr *sap );
static int cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
struct cldap_retinfo *crip, char *base );
static int cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
LDAPMessage **res, char *base );
#else /* NEEDPROTOS */
static int add_addr();
static int cldap_result();
static int cldap_parsemsg();
#endif /* NEEDPROTOS */
static int add_addr LDAP_P((
LDAP *ld, struct sockaddr *sap ));
static int cldap_result LDAP_P((
LDAP *ld, int msgid, LDAPMessage **res,
struct cldap_retinfo *crip, char *base ));
static int cldap_parsemsg LDAP_P((
LDAP *ld, int msgid, BerElement *ber,
LDAPMessage **res, char *base ));
/*
* cldap_open - initialize and connect to an ldap server. A magic cookie to
......@@ -525,4 +522,4 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
*res = chain;
return(( *res == NULLMSG ) ? rc : ldap_result2error( ld, *res, 0 ));
}
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
......@@ -80,7 +80,7 @@ ldap_err2string( int err )
return( "Unknown error" );
}
#ifndef NO_USERINTERFACE
#ifdef LDAP_LIBUI
void
ldap_perror( LDAP *ld, char *s )
{
......@@ -119,7 +119,7 @@ ldap_perror( LDAP *ld, char *s )
{
}
#endif /* NO_USERINTERFACE */
#endif /* !LDAP_LIBUI */
int
......
......@@ -255,10 +255,10 @@ ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
Debug( LDAP_DEBUG_TRACE, "ldap_get_kerberosv4_credentials\n", 0, 0, 0 );
if ( (err = krb_get_tf_realm( tkt_string(), realm )) != KSUCCESS ) {
#ifndef NO_USERINTERFACE
#ifdef LDAP_LIBUI
fprintf( stderr, "krb_get_tf_realm failed (%s)\n",
krb_err_txt[err] );
#endif /* NO_USERINTERFACE */
#endif /* LDAP_LIBUI */
ld->ld_errno = LDAP_INVALID_CREDENTIALS;
return( NULL );
}
......@@ -271,9 +271,9 @@ ldap_get_kerberosv4_credentials( LDAP *ld, char *who, char *service, int *len )
if ( (err = krb_mk_req( &ktxt, service, krbinstance, realm, 0 ))
!= KSUCCESS ) {
#ifndef NO_USERINTERFACE
#ifdef LDAP_LIBUI
fprintf( stderr, "krb_mk_req failed (%s)\n", krb_err_txt[err] );
#endif /* NO_USERINTERFACE */
#endif /* LDAP_LIBUI */
ld->ld_errno = LDAP_INVALID_CREDENTIALS;
return( NULL );
}
......
......@@ -38,7 +38,7 @@ static void merge_error_info LDAP_P(( LDAP *ld, LDAPRequest *parentr, LDAPReques
static int read1msg LDAP_P(( LDAP *ld, int msgid, int all, Sockbuf *sb,
LDAPMessage **result ));
#endif /* LDAP_REFERRALS */
#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS )
static int ldap_select1 LDAP_P(( LDAP *ld, struct timeval *timeout ));
#endif
......@@ -588,7 +588,7 @@ merge_error_info( LDAP *ld, LDAPRequest *parentr, LDAPRequest *lr )
#if defined( CLDAP ) || !defined( LDAP_REFERRALS )
#if defined( LDAP_CONNECTIONLESS ) || !defined( LDAP_REFERRALS )
#if !defined( MACOS ) && !defined( DOS ) && !defined( _WIN32 )
static int
ldap_select1( LDAP *ld, struct timeval *timeout )
......@@ -597,11 +597,13 @@ 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;
......@@ -782,7 +784,7 @@ ldap_mark_abandoned( LDAP *ld, int msgid )
}
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
int
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
{
......@@ -808,4 +810,4 @@ cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
return( tag );
}
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
......@@ -117,19 +117,19 @@ ldap_build_search_req( LDAP *ld, char *base, int scope, char *filter,
base = "";
}
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
if ( ld->ld_sb.sb_naddr > 0 ) {
err = ber_printf( ber, "{ist{seeiib", ++ld->ld_msgid,
ld->ld_cldapdn, LDAP_REQ_SEARCH, base, scope, ld->ld_deref,
ld->ld_sizelimit, ld->ld_timelimit, attrsonly );
} else {
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
err = ber_printf( ber, "{it{seeiib", ++ld->ld_msgid,
LDAP_REQ_SEARCH, base, scope, ld->ld_deref,
ld->ld_sizelimit, ld->ld_timelimit, attrsonly );
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
}
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
if ( err == -1 ) {
ld->ld_errno = LDAP_ENCODING_ERROR;
......
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#ifdef MACOS
#include <stdlib.h>
#ifdef MACOS
#ifdef THINK_C
#include <console.h>
#include <unix.h>
......@@ -31,21 +32,20 @@
#include "lber.h"
#include "ldap.h"
/* including the "internal" defs is legit and nec. since this test routine has
* a-priori knowledge of libldap internal workings.
* hodges@stanford.edu 5-Feb-96
*/
#include "ldap-int.h"
#if !defined( PCNFS ) && !defined( WINSOCK ) && !defined( MACOS )
#define MOD_USE_BVALS
#endif /* !PCNFS && !WINSOCK && !MACOS */
#ifdef NEEDPROTOS
static void handle_result( LDAP *ld, LDAPMessage *lm );
static void print_ldap_result( LDAP *ld, LDAPMessage *lm, char *s );
static void print_search_entry( LDAP *ld, LDAPMessage *res );
static void free_list( char **list );
#else
static void handle_result();
static void print_ldap_result();
static void print_search_entry();
static void free_list();
#endif /* NEEDPROTOS */
static void handle_result LDAP_P(( LDAP *ld, LDAPMessage *lm ));
static void print_ldap_result LDAP_P(( LDAP *ld, LDAPMessage *lm, char *s ));
static void print_search_entry LDAP_P(( LDAP *ld, LDAPMessage *res ));
static void free_list LDAP_P(( char **list ));
#define NOCACHEERRMSG "don't compile with -DNO_CACHE if you desire local caching"
......@@ -281,7 +281,7 @@ main(
#endif /* WINSOCK */
int argc, char **argv )
{
LDAP *ld;
LDAP *ld = NULL;
int i, c, port, cldapflg, errflg, method, id, msgtype;
char line[256], command1, command2, command3;
char passwd[64], dn[256], rdn[64], attr[64], value[256];
......@@ -316,11 +316,11 @@ main(
while (( c = getopt( argc, argv, "uh:d:s:p:t:T:" )) != -1 ) {
switch( c ) {
case 'u':
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
cldapflg++;
#else /* CLDAP */
printf( "Compile with -DCLDAP for UDP support\n" );
#endif /* CLDAP */
#else /* LDAP_CONNECTIONLESS */
printf( "Compile with -DLDAP_CONNECTIONLESS for UDP support\n" );
#endif /* LDAP_CONNECTIONLESS */
break;
case 'd':
......@@ -377,9 +377,9 @@ main(
host == NULL ? "(null)" : host, port );
if ( cldapflg ) {
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
ld = cldap_open( host, port );
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
} else {
ld = ldap_open( host, port );
}
......@@ -567,10 +567,10 @@ main(
break;
case 'q': /* quit */
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
if ( cldapflg )
cldap_close( ld );
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
#ifdef LDAP_REFERRALS
if ( !cldapflg )
#else /* LDAP_REFERRALS */
......@@ -636,7 +636,7 @@ main(
attrsonly = atoi( line );
if ( cldapflg ) {
#ifdef CLDAP
#ifdef LDAP_CONNECTIONLESS
getline( line, sizeof(line), stdin,
"Requestor DN (for logging)? " );
if ( cldap_search_s( ld, dn, scope, filter, types,
......@@ -648,7 +648,7 @@ main(
handle_result( ld, res );
res = NULLMSG;
}
#endif /* CLDAP */
#endif /* LDAP_CONNECTIONLESS */
} else {
if (( id = ldap_search( ld, dn, scope, filter,
types, attrsonly )) == -1 ) {
......
......@@ -8,6 +8,7 @@
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
#ifdef MACOS
#include "macos.h"
#else /* MACOS */
......@@ -29,41 +30,36 @@
#include "ldap.h"
#include "disptmpl.h"