Commit 0c0f011d authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Everything compiles.... but tests fail...

parent 46c3cdda
/* ldapmodify.c - generic program to modify or add entries using LDAP */
#define DISABLE_BRIDGE
#include "portable.h"
#include <stdio.h>
#include <string.h>
#include <ac/string.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/types.h>
......@@ -11,6 +14,7 @@
#ifndef VMS
#include <unistd.h>
#endif /* VMS */
#include <lber.h>
#include <ldap.h>
#include <ldif.h>
......@@ -19,7 +23,7 @@
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;
......
......@@ -5700,12 +5700,14 @@ fi
for ac_func in \
bcopy \
flock \
gethostname \
gettimeofday \
getdtablesize \
lockf \
memcpy \
memmove \
mktime \
select \
setpwfile \
......@@ -5724,12 +5726,12 @@ for ac_func in \
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5728: checking for $ac_func" >&5
echo "configure:5730: 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 5733 "configure"
#line 5735 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
......@@ -5752,7 +5754,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5756: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:5758: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
......@@ -5780,12 +5782,12 @@ done
for ac_func in strdup
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:5784: checking for $ac_func" >&5
echo "configure:5786: 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 5789 "configure"
#line 5791 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
......@@ -5808,7 +5810,7 @@ $ac_func();
; return 0; }
EOF
if { (eval echo configure:5812: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:5814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
......@@ -5838,13 +5840,13 @@ done
# Check Configuration
echo $ac_n "checking declaration of sys_errlist""... $ac_c" 1>&6
echo "configure:5842: checking declaration of sys_errlist" >&5
echo "configure:5844: 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 5848 "configure"
#line 5850 "configure"
#include "confdefs.h"
#include <stdio.h>
......@@ -5854,7 +5856,7 @@ int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if { (eval echo configure:5858: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:5860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ol_cv_dcl_sys_errlist=yes
else
......@@ -5875,20 +5877,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:5879: checking existence of sys_errlist" >&5
echo "configure:5881: 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 5885 "configure"
#line 5887 "configure"
#include "confdefs.h"
#include <errno.h>
int main() {
char *c = (char *) *sys_errlist
; return 0; }
EOF
if { (eval echo configure:5892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
if { (eval echo configure:5894: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
ol_cv_have_sys_errlist=yes
else
......
......@@ -28,7 +28,7 @@ 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(referrals,[ --enable-referrals enable referrals], yes)dnl
OL_ARG_ENABLE(cldap,[ --enable-clapd enable connectionless ldap], no)dnl
OL_ARG_ENABLE(cldap,[ --enable-cldap enable connectionless ldap], no)dnl
dnl General "with" options
OL_ARG_WITH(kerberos,[ --with-kerberos use Kerberos],
......@@ -746,12 +746,14 @@ AC_FUNC_VPRINTF
AC_FUNC_WAIT3
AC_CHECK_FUNCS( \
bcopy \
flock \
gethostname \
gettimeofday \
getdtablesize \
lockf \
memcpy \
memmove \
mktime \
select \
setpwfile \
......
......@@ -4,17 +4,32 @@
#define _AC_STRING_H
#if STDC_HEADERS
# include <string.h>
# include <string.h>
#else
# ifndef HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
char *strchr (), *strrchr ();
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
# ifndef HAVE_STRCHR
# define strchr index
# define strrchr rindex
# endif
char *strchr (), *strrchr ();
# ifndef HAVE_MEMCPY
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# define memmove(d, s, n) bcopy ((s), (d), (n))
# endif
#endif
#ifdef HAVE_MEMMOVE
# define SAFEMEMCPY( d, s, n ) memmove((s), (d), (n))
#else
# ifdef HAVE_BCOPY
# define SAFEMEMCPY( d, s, n ) bcopy((s), (d), (n))
# else
# ifdef MACOS
# define SAFEMEMCPY( d, s, n ) BlockMoveData((Ptr)(s), (Ptr)(d), (n))
# else
# define SAFEMEMCPY( d, s, n ) memmove((s), (d), (n))
# endif
# endif
#endif
#endif /* _AC_STRING_H */
......@@ -15,13 +15,15 @@
#ifndef _AVL
#define _AVL
#include <ldap_cdefs.h>
/*
* this structure represents a generic avl tree node.
*/
typedef struct avlnode {
caddr_t avl_data;
char avl_bf;
signed char avl_bf;
struct avlnode *avl_left;
struct avlnode *avl_right;
} Avlnode;
......@@ -34,15 +36,38 @@ typedef struct avlnode {
#define RH 1
/* avl routines */
#define avl_getone(x) (x == 0 ? 0 : (x)->avl_data)
#define avl_onenode(x) (x == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
extern int avl_insert();
extern caddr_t avl_delete();
extern caddr_t avl_find();
extern caddr_t avl_getfirst();
extern caddr_t avl_getnext();
extern int avl_dup_error();
extern int avl_apply();
#define avl_getone(x) ((x) == 0 ? 0 : (x)->avl_data)
#define avl_onenode(x) ((x) == 0 || ((x)->avl_left == 0 && (x)->avl_right == 0))
/* looks like this function pointer is not used consistently */
/* typedef int (*IFP)LDAP_P((caddr_t, caddr_t)); */
typedef int (*IFP)();
LDAP_F int
avl_insert LDAP_P((Avlnode **, caddr_t, IFP, IFP));
LDAP_F caddr_t
avl_delete LDAP_P((Avlnode **, caddr_t, IFP));
LDAP_F caddr_t
avl_find LDAP_P((Avlnode *, caddr_t, IFP));
LDAP_F caddr_t
avl_getfirst LDAP_P((Avlnode *));
#ifdef AVL_REENTRANT
LDAP_F caddr_t
avl_getnext LDAP_P((Avlnode *, caddr_t ));
#else
LDAP_F caddr_t
avl_getnext LDAP_P((void));
#endif
LDAP_F int
avl_dup_error LDAP_P((void));
LDAP_F int
avl_apply LDAP_P((Avlnode *, IFP, caddr_t, int, int));
/* apply traversal types */
#define AVL_PREORDER 1
......@@ -51,6 +76,4 @@ extern int avl_apply();
/* what apply returns if it ran out of nodes */
#define AVL_NOMORE -6
typedef int (*IFP)();
#endif /* _AVL */
......@@ -13,13 +13,9 @@
#ifndef _LBER_H
#define _LBER_H
#ifdef __cplusplus
extern "C" {
#endif
#include <ldap_cdefs.h>
#if !defined( NEEDPROTOS ) && defined(__STDC__)
#define NEEDPROTOS 1
#endif
LDAP_BEGIN_DECL
/* BER classes and mask */
#define LBER_CLASS_UNIVERSAL 0x00
......@@ -58,12 +54,9 @@ extern "C" {
#define OLD_LBER_SEQUENCE 0x10L /* w/o constructed bit - broken */
#define OLD_LBER_SET 0x11L /* w/o constructed bit - broken */
#ifdef NEEDPROTOS
typedef int (*BERTranslateProc)( char **bufp, unsigned long *buflenp,
int free_input );
#else /* NEEDPROTOS */
typedef int (*BERTranslateProc)();
#endif /* NEEDPROTOS */
typedef int (*BERTranslateProc) LDAP_P(( char **bufp,
unsigned long *buflenp,
int free_input ));
typedef struct berelement {
char *ber_buf;
......@@ -123,27 +116,85 @@ struct berval {
char *bv_val;
};
#ifndef NEEDPROTOS
extern BerElement *ber_alloc();
extern BerElement *der_alloc();
extern BerElement *ber_alloc_t();
extern BerElement *ber_dup();
#ifdef LDAP_DEBUG
extern int lber_debug;
extern void ber_bvfree();
extern void ber_bvecfree();
extern struct berval *ber_bvdup();
extern void ber_dump();
extern void ber_sos_dump();
extern void lber_bprint();
extern void ber_reset();
extern void ber_init();
#else /* NEEDPROTOS */
#if defined(WINSOCK)
#include "proto-lb.h"
#endif
/*
* in bprint.c:
*/
LDAP_F void lber_bprint LDAP_P(( char *data, int len ));
/*
* in decode.c:
*/
LDAP_F unsigned long ber_get_tag LDAP_P(( BerElement *ber ));
LDAP_F unsigned long ber_skip_tag LDAP_P(( BerElement *ber, unsigned long *len ));
LDAP_F unsigned long ber_peek_tag LDAP_P(( BerElement *ber, unsigned long *len ));
LDAP_F unsigned long ber_get_int LDAP_P(( BerElement *ber, long *num ));
LDAP_F unsigned long ber_get_stringb LDAP_P(( BerElement *ber, char *buf,
unsigned long *len ));
LDAP_F unsigned long ber_get_stringa LDAP_P(( BerElement *ber, char **buf ));
LDAP_F unsigned long ber_get_stringal LDAP_P(( BerElement *ber, struct berval **bv ));
LDAP_F unsigned long ber_get_bitstringa LDAP_P(( BerElement *ber, char **buf,
unsigned long *len ));
LDAP_F unsigned long ber_get_null LDAP_P(( BerElement *ber ));
LDAP_F unsigned long ber_get_boolean LDAP_P(( BerElement *ber, int *boolval ));
LDAP_F unsigned long ber_first_element LDAP_P(( BerElement *ber, unsigned long *len,
char **last ));
LDAP_F unsigned long ber_next_element LDAP_P(( BerElement *ber, unsigned long *len,
char *last ));
LDAP_F unsigned long ber_scanf LDAP_P(( BerElement *ber, char *fmt, ... ));
LDAP_F void ber_bvfree LDAP_P(( struct berval *bv ));
LDAP_F void ber_bvecfree LDAP_P(( struct berval **bv ));
LDAP_F struct berval *ber_bvdup LDAP_P(( struct berval *bv ));
#ifdef STR_TRANSLATION
LDAP_F void ber_set_string_translators LDAP_P(( BerElement *ber,
BERTranslateProc encode_proc, BERTranslateProc decode_proc ));
#endif /* STR_TRANSLATION */
/*
* in encode.c
*/
LDAP_F int ber_put_enum LDAP_P(( BerElement *ber, long num, unsigned long tag ));
LDAP_F int ber_put_int LDAP_P(( BerElement *ber, long num, unsigned long tag ));
LDAP_F int ber_put_ostring LDAP_P(( BerElement *ber, char *str, unsigned long len,
unsigned long tag ));
LDAP_F int ber_put_string LDAP_P(( BerElement *ber, char *str, unsigned long tag ));
LDAP_F int ber_put_bitstring LDAP_P(( BerElement *ber, char *str,
unsigned long bitlen, unsigned long tag ));
LDAP_F int ber_put_null LDAP_P(( BerElement *ber, unsigned long tag ));
LDAP_F int ber_put_boolean LDAP_P(( BerElement *ber, int boolval,
unsigned long tag ));
LDAP_F int ber_start_seq LDAP_P(( BerElement *ber, unsigned long tag ));
LDAP_F int ber_start_set LDAP_P(( BerElement *ber, unsigned long tag ));
LDAP_F int ber_put_seq LDAP_P(( BerElement *ber ));
LDAP_F int ber_put_set LDAP_P(( BerElement *ber ));
#ifdef __STDC__
LDAP_F int ber_printf LDAP_P(( BerElement *ber, char *fmt, ... ));
#else
#include "proto-lber.h"
LDAP_F int ber_printf ( );
#endif
#endif /* NEEDPROTOS */
/*
* in io.c:
*/
LDAP_F long ber_read LDAP_P(( BerElement *ber, char *buf, unsigned long len ));
LDAP_F long ber_write LDAP_P(( BerElement *ber, char *buf, unsigned long len,
int nosos ));
LDAP_F void ber_free LDAP_P(( BerElement *ber, int freebuf ));
LDAP_F int ber_flush LDAP_P(( Sockbuf *sb, BerElement *ber, int freeit ));
LDAP_F BerElement *ber_alloc LDAP_P(( void ));
LDAP_F BerElement *der_alloc LDAP_P(( void ));
LDAP_F BerElement *ber_alloc_t LDAP_P(( int options ));
LDAP_F BerElement *ber_dup LDAP_P(( BerElement *ber ));
LDAP_F void ber_dump LDAP_P(( BerElement *ber, int inout ));
LDAP_F void ber_sos_dump LDAP_P(( Seqorset *sos ));
LDAP_F unsigned long ber_get_next LDAP_P(( Sockbuf *sb, unsigned long *len,
BerElement *ber ));
LDAP_F void ber_init LDAP_P(( BerElement *ber, int options ));
LDAP_F void ber_reset LDAP_P(( BerElement *ber, int was_writing ));
#if !defined(__alpha) || defined(VMS)
......@@ -163,22 +214,6 @@ extern void ber_init();
| ntohl( ( (l) & 0xFFFFFFFF00000000 ) >> 32 ))
#endif /* __alpha */
LDAP_END_DECL
/*
* SAFEMEMCPY is an overlap-safe copy from s to d of n bytes
*/
#ifdef MACOS
#define SAFEMEMCPY( d, s, n ) BlockMoveData( (Ptr)s, (Ptr)d, n )
#else /* MACOS */
#ifdef sunos4
#define SAFEMEMCPY( d, s, n ) bcopy( s, d, n )
#else /* sunos4 */
#define SAFEMEMCPY( d, s, n ) memmove( d, s, n )
#endif /* sunos4 */
#endif /* MACOS */
#ifdef __cplusplus
}
#endif
#endif /* _LBER_H */
......@@ -121,6 +121,9 @@
/* define this for phonetic support */
#undef SLAPD_PHONETIC
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
/* Define if you have the flock function. */
#undef HAVE_FLOCK
......@@ -139,6 +142,9 @@
/* Define if you have the memcpy function. */
#undef HAVE_MEMCPY
/* Define if you have the memmove function. */
#undef HAVE_MEMMOVE
/* Define if you have the mktime function. */
#undef HAVE_MKTIME
......@@ -318,5 +324,6 @@
#endif
#include "bridge.h"
#include "ldap_cdefs.h"
#endif /* _LDAP_PORTABLE_H */
......@@ -18,27 +18,28 @@ static char avl_version[] = "AVL library version 1.0\n";
#include <sys/types.h>
#include <stdio.h>
#include <stdlib.h>
#include "avl.h"
#define ROTATERIGHT(x) { \
Avlnode *tmp;\
if ( *x == NULL || (*x)->avl_left == NULL ) {\
if ( *(x) == NULL || (*(x))->avl_left == NULL ) {\
(void) printf("RR error\n"); exit(1); \
}\
tmp = (*x)->avl_left;\
(*x)->avl_left = tmp->avl_right;\
tmp->avl_right = *x;\
*x = tmp;\
tmp = (*(x))->avl_left;\
(*(x))->avl_left = tmp->avl_right;\
tmp->avl_right = *(x);\
*(x) = tmp;\
}
#define ROTATELEFT(x) { \
Avlnode *tmp;\
if ( *x == NULL || (*x)->avl_right == NULL ) {\
if ( *(x) == NULL || (*(x))->avl_right == NULL ) {\
(void) printf("RL error\n"); exit(1); \
}\
tmp = (*x)->avl_right;\
(*x)->avl_right = tmp->avl_left;\
tmp = (*(x))->avl_right;\
(*(x))->avl_right = tmp->avl_left;\
tmp->avl_left = *x;\
*x = tmp;\
*(x) = tmp;\
}
/*
......@@ -47,7 +48,7 @@ static char avl_version[] = "AVL library version 1.0\n";
*/
static
ravl_insert( iroot, data, taller, fcmp, fdup, depth )
int ravl_insert( iroot, data, taller, fcmp, fdup, depth )
Avlnode **iroot;
caddr_t data;
int *taller;
......@@ -200,7 +201,7 @@ ravl_insert( iroot, data, taller, fcmp, fdup, depth )
* NOTE: this routine may malloc memory
*/
avl_insert( root, data, fcmp, fdup )
int avl_insert( root, data, fcmp, fdup )
Avlnode **root;
caddr_t data;
IFP fcmp;
......@@ -216,11 +217,11 @@ avl_insert( root, data, fcmp, fdup )
* been shortened because of a deletion.
*/
static
static int
right_balance( root )
Avlnode **root;
{
int shorter;
int shorter = -1;
Avlnode *r, *l;
switch( (*root)->avl_bf ) {
......@@ -282,10 +283,10 @@ right_balance( root )
*/
static
left_balance( root )
int left_balance( root )
Avlnode **root;
{
int shorter;
int shorter = -1;
Avlnode *r, *l;
switch( (*root)->avl_bf ) {
......@@ -453,7 +454,7 @@ avl_delete( root, data, fcmp )
}
static
avl_inapply( root, fn, arg, stopflag )
int avl_inapply( root, fn, arg, stopflag )
Avlnode *root;
IFP fn;
caddr_t arg;
......@@ -477,7 +478,7 @@ avl_inapply( root, fn, arg, stopflag )
}
static
avl_postapply( root, fn, arg, stopflag )
int avl_postapply( root, fn, arg, stopflag )
Avlnode *root;
IFP fn;
caddr_t arg;
......@@ -500,7 +501,7 @@ avl_postapply( root, fn, arg, stopflag )
}
static
avl_preapply( root, fn, arg, stopflag )
int avl_preapply( root, fn, arg, stopflag )
Avlnode *root;
IFP fn;
caddr_t arg;
......@@ -531,7 +532,7 @@ avl_preapply( root, fn, arg, stopflag )
* of nodes.
*/
avl_apply( root, fn, arg, stopflag, type )
int avl_apply( root, fn, arg, stopflag, type )
Avlnode *root;
IFP fn;
caddr_t arg;
......@@ -564,7 +565,7 @@ avl_apply( root, fn, arg, stopflag, type )
* AVL_NOMORE is returned.
*/
avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
int avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
Avlnode *root;
caddr_t data;
IFP fmatch;
......@@ -613,7 +614,7 @@ avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
* number of items actually freed is returned.
*/
avl_free( root, dfree )
int avl_free( root, dfree )
Avlnode *root;
IFP dfree;
{
......@@ -700,7 +701,7 @@ static int avl_nextlist;
/* ARGSUSED */
static
avl_buildlist( data, arg )
int avl_buildlist( data, arg )
caddr_t data;
int arg;
{
......@@ -767,12 +768,12 @@ avl_getnext()
return( avl_list[ avl_nextlist++ ] );
}
avl_dup_error()
int avl_dup_error()
{
return( -1 );
}
avl_dup_ok()
int avl_dup_ok()
{
return( 0 );
}
/* testavl.c - Test Tim Howes AVL code */
#include <sys/types.h>
#include <stdio.h>
#include "avl.h"
char *strdup( s )
char *s;
{
char *new;
if ( (new = (char *) malloc( strlen( s ) + 1 )) == NULL )
return( NULL );
#define DISABLE_BRIDGE
#include "portable.h"
strcpy( new, s );