LTHREAD still needs work.
lockf \
memcpy \
memmove \
+ mkstemp \
mktime \
select \
setpwfile \
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. */
; 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
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. */
; 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
# 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>
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
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
lockf \
memcpy \
memmove \
+ mkstemp \
mktime \
select \
setpwfile \
#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 *
* *
*****************************************************************/
#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)
# 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 *
* *
*****************************************************************/
#include <limits.h>
#include <fcntl.h>
-#ifdef LDBM_USE_DB2_COMPAT185
+#ifdef HAVE_DB185_H
# include <db_185.h>
#else
# include <db.h>
# 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
# 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 )
/*****************************************************************
* *
*****************************************************************/
#include <ndbm.h>
+
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#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 );
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 );
/* 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
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;
#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";
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
*res = chain;
return(( *res == NULLMSG ) ? rc : ldap_result2error( ld, *res, 0 ));
}
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
return( "Unknown error" );
}
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
void
ldap_perror( LDAP *ld, char *s )
{
{
}
-#endif /* NO_USERINTERFACE */
+#endif /* !LDAP_LIBUI */
int
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 );
}
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 );
}
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
-#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 )
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;
}
-#ifdef CLDAP
+#ifdef LDAP_CONNECTIONLESS
int
cldap_getmsg( LDAP *ld, struct timeval *timeout, BerElement *ber )
{
return( tag );
}
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
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>
#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"
#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];
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':
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 );
}
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 */
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,
handle_result( ld, res );
res = NULLMSG;
}
-#endif /* CLDAP */
+#endif /* LDAP_CONNECTIONLESS */
} else {
if (( id = ldap_search( ld, dn, scope, filter,
types, attrsonly )) == -1 ) {
#include <ctype.h>
#include <time.h>
#include <stdlib.h>
+
#ifdef MACOS
#include "macos.h"
#else /* MACOS */
#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
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 );
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 );
* - DB_DBT_MALLOC ; 1998/03/22, /KSp
*/
-#ifdef LDAP_LDBM
+#include "portable.h"
-#include <stdio.h>
-#include "ldbm.h"
-
-#ifdef LDBM_USE_GDBM
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-/*****************************************************************
- * *
- * use gdbm *
- * *
- *****************************************************************/
-
-LDBM
-ldbm_open( char *name, int rw, int mode, int dbcachesize )
-{
- LDBM db;
- struct stat st;
-
- 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) );
- }
-
- return( db );
-}
-
-void
-ldbm_close( LDBM ldbm )
-{
- gdbm_close( ldbm );
-}
-
-void
-ldbm_sync( LDBM ldbm )
-{
- gdbm_sync( ldbm );
-}
-
-void
-ldbm_datum_free( LDBM ldbm, Datum data )
-{
- free( data.dptr );
-}
-
-Datum
-ldbm_datum_dup( LDBM ldbm, Datum data )
-{
- Datum dup;
-
- if ( data.dsize == 0 ) {
- dup.dsize = 0;
- dup.dptr = NULL;
+#ifdef SLAPD_LDBM
- return( dup );
- }
- dup.dsize = data.dsize;
- if ( dup.dptr = (char *) malloc( data.dsize ) )
- memcpy( dup.dptr, data.dptr, data.dsize );
-
- return( dup );
-}
-
-Datum
-ldbm_fetch( LDBM ldbm, Datum key )
-{
- return( gdbm_fetch( ldbm, key ) );
-}
-
-int
-ldbm_store( LDBM ldbm, Datum key, Datum data, int flags )
-{
- int rc;
-
- rc = gdbm_store( ldbm, key, data, flags & ~LDBM_SYNC );
- if ( flags & LDBM_SYNC )
- gdbm_sync( ldbm );
- return( rc );
-}
-
-int
-ldbm_delete( LDBM ldbm, Datum key )
-{
- int rc;
-
- rc = gdbm_delete( ldbm, key );
- gdbm_sync( ldbm );
- return( rc );
-}
-
-Datum
-ldbm_firstkey( LDBM ldbm )
-{
- return( gdbm_firstkey( ldbm ) );
-}
-
-Datum
-ldbm_nextkey( LDBM ldbm, Datum key )
-{
- return( gdbm_nextkey( ldbm, key ) );
-}
+#include <stdio.h>
+#include <ac/errno.h>
-int
-ldbm_errno( LDBM ldbm )
-{
- return( (int) gdbm_errno );
-}
+#include "ldbm.h"
-#else
#if defined( LDBM_USE_DBHASH ) || defined( LDBM_USE_DBBTREE )
/*****************************************************************
* *
*****************************************************************/
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
/*************************************************
* *
* A malloc routine for use with DB_DBT_MALLOC *
* *
*************************************************/
-#include <stdlib.h>
-
-
void *
ldbm_malloc( size_t size )
{
{
LDBM ret = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
DB_INFO dbinfo;
memset( &dbinfo, 0, sizeof( dbinfo ));
void
ldbm_close( LDBM ldbm )
{
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
(*ldbm->close)( ldbm, 0 );
#else
(*ldbm->close)( ldbm );
{
Datum dup;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
memset( &dup, 0, sizeof( dup ));
#endif
Datum data;
int rc;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
memset( &data, 0, sizeof( data ));
data.flags = DB_DBT_MALLOC;
{
int rc;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
rc = (*ldbm->put)( ldbm, NULL, &key, &data, flags & ~LDBM_SYNC );
rc = (-1 ) * rc;
#else
{
int rc;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
rc = (*ldbm->del)( ldbm, NULL, &key, 0 );
rc = (-1 ) * rc;
#else
}
Datum
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
ldbm_firstkey( LDBM ldbm, DBC **dbch )
#else
ldbm_firstkey( LDBM ldbm )
Datum key, data;
int rc;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
DBC *dbci;
memset( &key, 0, sizeof( key ));
key.dsize = 0;
}
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
}
#endif
}
Datum
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
ldbm_nextkey( LDBM ldbm, Datum key, DBC *dbcp )
#else
ldbm_nextkey( LDBM ldbm, Datum key )
Datum data;
int rc;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
void *oldKey = key.dptr;
memset( &data, 0, sizeof( data ));
key.dptr = NULL;
key.dsize = 0;
}
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
if ( oldKey ) free( oldKey );
#endif
return( errno );
}
-#else
+#elif defined( HAVE_GDBM )
+
+/*****************************************************************
+ * *
+ * use gdbm *
+ * *
+ *****************************************************************/
+
+LDBM
+ldbm_open( char *name, int rw, int mode, int dbcachesize )
+{
+ LDBM db;
+ struct stat st;
+
+ 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) );
+ }
+
+ return( db );
+}
+
+void
+ldbm_close( LDBM ldbm )
+{
+ gdbm_close( ldbm );
+}
+
+void
+ldbm_sync( LDBM ldbm )
+{
+ gdbm_sync( ldbm );
+}
+
+void
+ldbm_datum_free( LDBM ldbm, Datum data )
+{
+ free( data.dptr );
+}
+
+Datum
+ldbm_datum_dup( LDBM ldbm, Datum data )
+{
+ Datum dup;
+
+ if ( data.dsize == 0 ) {
+ dup.dsize = 0;
+ dup.dptr = NULL;
+
+ return( dup );
+ }
+ dup.dsize = data.dsize;
+ if ( dup.dptr = (char *) malloc( data.dsize ) )
+ memcpy( dup.dptr, data.dptr, data.dsize );
+
+ return( dup );
+}
+
+Datum
+ldbm_fetch( LDBM ldbm, Datum key )
+{
+ return( gdbm_fetch( ldbm, key ) );
+}
+
+int
+ldbm_store( LDBM ldbm, Datum key, Datum data, int flags )
+{
+ int rc;
+
+ rc = gdbm_store( ldbm, key, data, flags & ~LDBM_SYNC );
+ if ( flags & LDBM_SYNC )
+ gdbm_sync( ldbm );
+ return( rc );
+}
+
+int
+ldbm_delete( LDBM ldbm, Datum key )
+{
+ int rc;
+
+ rc = gdbm_delete( ldbm, key );
+ gdbm_sync( ldbm );
+ return( rc );
+}
+
+Datum
+ldbm_firstkey( LDBM ldbm )
+{
+ return( gdbm_firstkey( ldbm ) );
+}
+
+Datum
+ldbm_nextkey( LDBM ldbm, Datum key )
+{
+ return( gdbm_nextkey( ldbm, key ) );
+}
+
+int
+ldbm_errno( LDBM ldbm )
+{
+ return( (int) gdbm_errno );
+}
-#ifdef LDBM_USE_NDBM
+#elif defined( HAVE_NDBM )
/*****************************************************************
* *
}
#endif /* ndbm */
-#endif /* db */
-#endif /* gdbm */
#endif /* ldbm */
#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>
int amax, acur, dmax, dcur;
char **vals;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
DBC *ocursorp;
DBC *ncursorp;
-#endif /* LDBM_USE_DB2 */
+#endif /* HAVE_BERKELEY_DB2 */
if ( verbose ) {
printf( "Generating mods for differential %s centroid...", attr );
olast.dptr = NULL;
nlast.dptr = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( okey = ldbm_firstkey( oldbm, &ocursorp ),
nkey = ldbm_firstkey( nldbm, &ncursorp );
okey.dptr != NULL && nkey.dptr != NULL; )
}
nlast = nkey;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
okey = ldbm_nextkey( oldbm, olast, ocursorp );
nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
#else
}
nlast = nkey;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
#else
nkey = ldbm_nextkey( nldbm, nlast );
}
olast = okey;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
okey = ldbm_nextkey( oldbm, olast, ocursorp );
#else
okey = ldbm_nextkey( oldbm, olast );
return( NULL );
}
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
okey = ldbm_nextkey( oldbm, olast, ocursorp );
#else
okey = ldbm_nextkey( oldbm, olast );
return( NULL );
}
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
nkey = ldbm_nextkey( nldbm, nlast, ncursorp );
#else
nkey = ldbm_nextkey( nldbm, nlast );
/* generate list of values to add */
lastkey.dptr = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( key = ldbm_firstkey( nldbm, &ncursorp ); key.dptr != NULL;
key = ldbm_nextkey( nldbm, lastkey, ncursorp ) )
#else
/* generate list of values to delete */
lastkey.dptr = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( key = ldbm_firstkey( oldbm, &ocursorp ); key.dptr != NULL;
key = ldbm_nextkey( oldbm, lastkey, ocursorp ) )
#else
char **vals;
int vcur, vmax;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
DBC *cursorp;
#endif
lastkey.dptr = NULL;
vals = NULL;
vcur = vmax = 0;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( key = ldbm_firstkey( ldbm, &cursorp ); key.dptr != NULL;
key = ldbm_nextkey( ldbm, lastkey, cursorp ) )
#else
#include "portable.h"
#include <stdio.h>
-#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <dirent.h>
#include <stdlib.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/dirent.h>
+#include <ac/string.h>
+
#include <sys/types.h>
#include <sys/stat.h>
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
+
+#include <ac/ctype.h>
+#include <ac/string.h>
+
#include <quipu/commonarg.h>
#include <quipu/attrvalue.h>
#include <quipu/ds_error.h>
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/ctype.h>
+#include <ac/socket.h>
+#include <ac/string.h>
+
#include "ldbm.h"
#include "../slap.h"
char *file, *s;
int printid = 1;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
DBC *cursorp;
#endif
last.dptr = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( key = ldbm_firstkey( dbp, &cursorp ); key.dptr != NULL;
key = ldbm_nextkey( dbp, last, cursorp ) )
#else
#include "portable.h"
#include <stdio.h>
-#include <ac/string.h>
#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/time.h>
+#include <limits.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+#include <ac/unistd.h>
+#include <ac/wait.h>
+
#include <sys/resource.h>
-#include <sys/wait.h>
#include <sys/param.h>
#include <sys/stat.h>
-#include <limits.h>
+
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
#include "ldapconfig.h"
#include "../slap.h"
int i;
extern char *optarg;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
DBC *cursorp;
#endif
}
savekey.dptr = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( key = ldbm_firstkey( dbc->dbc_db, &cursorp );
key.dptr != NULL;
key = ldbm_nextkey( dbc->dbc_db, key, cursorp ) )
last.dptr = NULL;
-#ifdef LDBM_USE_DB2
+#ifdef HAVE_BERKELEY_DB2
for ( key = ldbm_firstkey( dbp, &cursorp );
key.dptr != NULL;
key = ldbm_nextkey( dbp, last, cursorp ) )
int fd, pid;
char tmpname[20];
FILE *fp;
+#ifndef HAVE_WAITPID
WAITSTATUSTYPE status;
+#endif
strcpy( tmpname, "/tmp/dbtestXXXXXX" );
-#ifdef ultrix
+#ifndef HAVE_MKSTEMP
if ( (fd = open( mktemp( tmpname ), O_RDWR, 0600 )) == -1 ) {
perror( tmpname );
return;
fclose( fp );
-#ifdef USE_WAITPID
- if ( waitpid( (pid_t) -1, 0, WAIT_FLAGS ) < 0 ) {
+#ifdef HAVE_WAITPID
+ if ( waitpid( (pid_t) -1, NULL, WAIT_FLAGS ) < 0 ) {
#else
if ( wait3( &status, WAIT_FLAGS, 0 ) < 0 ) {
#endif
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <memory.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "lber.h"
#include "ldap.h"
#include "ldif.h"
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "../slap.h"
#include "../back-ldbm/back-ldbm.h"
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include "../slap.h"
#include "../back-ldbm/back-ldbm.h"
#include "portable.h"
#include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/string.h>
+#include <ac/socket.h>
+
#include <sys/param.h>
+
#include "../slap.h"
#include "../back-ldbm/back-ldbm.h"
#include "ldapconfig.h"