mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
Everything compiles.... but tests fail...
This commit is contained in:
parent
46c3cddad4
commit
0c0f011dc0
@ -1,7 +1,10 @@
|
||||
/* 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;
|
||||
|
26
configure
vendored
26
configure
vendored
@ -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 */
|
||||
|
131
include/lber.h
131
include/lber.h
@ -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"
|
||||
#else
|
||||
#include "proto-lber.h"
|
||||
#endif
|
||||
#endif /* NEEDPROTOS */
|
||||
|
||||
/*
|
||||
* 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
|
||||
LDAP_F int ber_printf ( );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* 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 );
|
||||
}
|
||||
|
@ -1,21 +1,14 @@
|
||||
/* testavl.c - Test Tim Howes AVL code */
|
||||
#include <sys/types.h>
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "avl.h"
|
||||
|
||||
char *strdup( s )
|
||||
char *s;
|
||||
{
|
||||
char *new;
|
||||
|
||||
if ( (new = (char *) malloc( strlen( s ) + 1 )) == NULL )
|
||||
return( NULL );
|
||||
|
||||
strcpy( new, s );
|
||||
|
||||
return( new );
|
||||
}
|
||||
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
@ -39,7 +32,7 @@ char **argv;
|
||||
case 't': /* traverse with first, next */
|
||||
printf( "***\n" );
|
||||
for ( p = (char * ) avl_getfirst( tree );
|
||||
p != NULL; p = (char *) avl_getnext( tree, p ) )
|
||||
p != NULL; p = (char *) avl_getnext( /* tree, p */ ) )
|
||||
printf( "%s\n", p );
|
||||
printf( "***\n" );
|
||||
break;
|
||||
@ -60,7 +53,7 @@ char **argv;
|
||||
exit( 0 );
|
||||
name[ strlen( name ) - 1 ] = '\0';
|
||||
if ( avl_insert( &tree, strdup( name ), strcmp,
|
||||
avl_dup_error ) != OK )
|
||||
avl_dup_error ) != 0 )
|
||||
printf( "\nNot inserted!\n" );
|
||||
break;
|
||||
case 'd': /* delete */
|
||||
|
@ -16,30 +16,26 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#ifdef STDC_HEADERS
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include "macos.h"
|
||||
#else /* MACOS */
|
||||
|
||||
#if defined(NeXT) || defined(VMS) || defined(__FreeBSD__)
|
||||
#include <stdlib.h>
|
||||
#else /* next || vms || freebsd */
|
||||
#include <malloc.h>
|
||||
#endif /* next || vms || freebsd */
|
||||
#if defined(BC31) || defined(_WIN32)
|
||||
#include <stdarg.h>
|
||||
#else /* BC31 || _WIN32 */
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif /* BC31 || _WIN32 */
|
||||
#endif
|
||||
|
||||
#include <ac/string.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#include "macos.h"
|
||||
#endif /* MACOS */
|
||||
|
||||
#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 */
|
||||
@ -387,16 +383,16 @@ ber_next_element( BerElement *ber, unsigned long *len, char *last )
|
||||
|
||||
/* VARARGS */
|
||||
unsigned long
|
||||
ber_scanf(
|
||||
#if defined( MACOS ) || defined( BC31 ) || defined( _WIN32 )
|
||||
BerElement *ber, char *fmt, ... )
|
||||
ber_scanf
|
||||
#ifdef STDC_HEADERS
|
||||
( BerElement *ber, char *fmt, ... )
|
||||
#else
|
||||
va_alist )
|
||||
( va_alist )
|
||||
va_dcl
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if !defined( MACOS ) && !defined( BC31 ) && !defined( _WIN32 )
|
||||
#ifndef STDC_HEADERS
|
||||
BerElement *ber;
|
||||
char *fmt;
|
||||
#endif
|
||||
@ -407,7 +403,7 @@ va_dcl
|
||||
long *l, rc, tag;
|
||||
unsigned long len;
|
||||
|
||||
#if defined( MACOS ) || defined( BC31 ) || defined( _WIN32 )
|
||||
#if STDC_HEADERS
|
||||
va_start( ap, fmt );
|
||||
#else
|
||||
va_start( ap );
|
||||
@ -541,9 +537,9 @@ va_dcl
|
||||
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;
|
||||
}
|
||||
|
@ -11,45 +11,47 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#ifdef MACOS
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#ifdef STDC_HEADERS
|
||||
#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 )
|
||||
#include <stdarg.h>
|
||||
#else /* BC31 || _WIN32 */
|
||||
#else
|
||||
#include <varargs.h>
|
||||
#endif /* BC31 || _WIN32 */
|
||||
#endif
|
||||
|
||||
#ifdef MACOS
|
||||
#include "macos.h"
|
||||
#endif /* MACOS */
|
||||
|
||||
#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"
|
||||
|
||||
#if defined( DOS ) || defined( _WIN32 )
|
||||
#include "msdos.h"
|
||||
#endif /* DOS */
|
||||
|
||||
#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 */
|
||||
#include "lber.h"
|
||||
|
||||
static int ber_put_len LDAP_P(( BerElement *ber,
|
||||
unsigned long len, int nosos ));
|
||||
|
||||
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
|
||||
@ -519,31 +521,31 @@ ber_put_set( BerElement *ber )
|
||||
|
||||
/* VARARGS */
|
||||
int
|
||||
ber_printf(
|
||||
#if defined( MACOS ) || defined( _WIN32 ) || defined( BC31 )
|
||||
BerElement *ber, char *fmt, ... )
|
||||
#else /* MACOS || _WIN32 || BC31 */
|
||||
va_alist )
|
||||
ber_printf
|
||||
#ifdef STDC_HEADERS
|
||||
( BerElement *ber, char *fmt, ... )
|
||||
#else
|
||||
( va_alist )
|
||||
va_dcl
|
||||
#endif /* MACOS || _WIN32 || BC31 */
|
||||
#endif
|
||||
{
|
||||
va_list ap;
|
||||
#if !defined( MACOS ) && !defined( _WIN32 ) && !defined( BC31 )
|
||||
#ifndef STDC_HEADERS
|
||||
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 )
|
||||
#ifdef STDC_HEADERS
|
||||
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 ) {
|
||||
@ -625,9 +627,9 @@ va_dcl
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifndef NO_USERINTERFACE
|
||||
#ifdef LDAP_LIBUI
|
||||
fprintf( stderr, "unknown fmt %c\n", *fmt );
|
||||
#endif /* NO_USERINTERFACE */
|
||||
#endif /* LDAP_LIBUI */
|
||||
rc = -1;
|
||||
break;
|
||||
}
|
||||
|
@ -11,22 +11,23 @@
|
||||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <ac/string.h>
|
||||
#include <ctype.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if defined( DOS ) || defined( _WIN32 )
|
||||
#include "msdos.h"
|
||||
#endif /* DOS || _WIN32 */
|
||||
|
||||
#ifdef MACOS
|
||||
#include <stdlib.h>
|
||||
#include "macos.h"
|
||||
#else /* MACOS */
|
||||
#if defined(NeXT) || defined(VMS)
|
||||
#include <stdlib.h>
|
||||
#else /* next || vms */
|
||||
#include <malloc.h>
|
||||
#endif /* next || vms */
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -36,29 +37,19 @@
|
||||
#endif /* PCNFS */
|
||||
#endif /* MACOS */
|
||||
|
||||
#ifndef VMS
|
||||
#include <memory.h>
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include "lber.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <winsock.h>
|
||||
#include <io.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#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 );
|
||||
#include "lber.h"
|
||||
|
||||
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++ : \
|
||||
@ -301,7 +292,7 @@ ber_flush( Sockbuf *sb, BerElement *ber, int freeit )
|
||||
#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 );
|
||||
@ -419,14 +410,16 @@ void
|
||||
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 );
|
||||
}
|
||||
}
|
||||
@ -437,9 +430,9 @@ ber_sos_dump( Seqorset *sos )
|
||||
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;
|
||||
@ -487,7 +480,7 @@ get_tag( Sockbuf *sb )
|
||||
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;
|
||||
|
@ -5,6 +5,9 @@
|
||||
* cache.c - local caching support for LDAP
|
||||
*/
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#ifndef NO_CACHE
|
||||
|
||||
#ifndef lint
|
||||
@ -12,9 +15,10 @@ static char copyright[] = "@(#) Copyright (c) 1993 The Regents of the University
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#ifdef MACOS
|
||||
#include <ac/string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#include <time.h>
|
||||
#include "macos.h"
|
||||
#else /* MACOS */
|
||||
@ -32,28 +36,18 @@ static char copyright[] = "@(#) Copyright (c) 1993 The Regents of the University
|
||||
#include <sys/socket.h>
|
||||
#endif /* DOS */
|
||||
#endif /* MACOS */
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "ldap-int.h"
|
||||
|
||||
#ifdef NEEDPROTOS
|
||||
static int cache_hash( BerElement *ber );
|
||||
static LDAPMessage *msg_dup( LDAPMessage *msg );
|
||||
static int request_cmp( BerElement *req1, BerElement *req2 );
|
||||
static int chain_contains_dn( LDAPMessage *msg, char *dn );
|
||||
static long msg_size( LDAPMessage *msg );
|
||||
static void check_cache_memused( LDAPCache *lc );
|
||||
static void uncache_entry_or_req( LDAP *ld, char *dn, int msgid );
|
||||
#else /* NEEDPROTOS */
|
||||
static int cache_hash();
|
||||
static LDAPMessage *msg_dup();
|
||||
static int request_cmp();
|
||||
static int chain_contains_dn();
|
||||
static long msg_size();
|
||||
static void check_cache_memused();
|
||||
static void uncache_entry_or_req();
|
||||
#endif /* NEEDPROTOS */
|
||||
|
||||
static int cache_hash LDAP_P(( BerElement *ber ));
|
||||
static LDAPMessage *msg_dup LDAP_P(( LDAPMessage *msg ));
|
||||
static int request_cmp LDAP_P(( BerElement *req1, BerElement *req2 ));
|
||||
static int chain_contains_dn LDAP_P(( LDAPMessage *msg, char *dn ));
|
||||
static long msg_size LDAP_P(( LDAPMessage *msg ));
|
||||
static void check_cache_memused LDAP_P(( LDAPCache *lc ));
|
||||
static void uncache_entry_or_req LDAP_P(( LDAP *ld, char *dn, int msgid ));
|
||||
|
||||
int
|
||||
ldap_enable_cache( LDAP *ld, long timeout, long maxmem )
|
||||
@ -139,8 +133,8 @@ ldap_flush_cache( LDAP *ld )
|
||||
void
|
||||
ldap_uncache_request( LDAP *ld, int msgid )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %x\n",
|
||||
msgid, ld->ld_cache, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %lx\n",
|
||||
msgid, (long) ld->ld_cache, 0 );
|
||||
|
||||
uncache_entry_or_req( ld, NULL, msgid );
|
||||
}
|
||||
@ -149,8 +143,8 @@ ldap_uncache_request( LDAP *ld, int msgid )
|
||||
void
|
||||
ldap_uncache_entry( LDAP *ld, char *dn )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %x\n",
|
||||
dn, ld->ld_cache, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n",
|
||||
dn, (long) ld->ld_cache, 0 );
|
||||
|
||||
uncache_entry_or_req( ld, dn, 0 );
|
||||
}
|
||||
@ -165,8 +159,8 @@ uncache_entry_or_req( LDAP *ld,
|
||||
LDAPMessage *m, *prev, *next;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"ldap_uncache_entry_or_req dn %s msgid %d ld_cache %x\n",
|
||||
dn, msgid, ld->ld_cache );
|
||||
"ldap_uncache_entry_or_req dn %s msgid %d ld_cache %lx\n",
|
||||
dn, msgid, (long) ld->ld_cache );
|
||||
|
||||
if ( ld->ld_cache == NULLLDCACHE ) {
|
||||
return;
|
||||
@ -214,12 +208,12 @@ uncache_entry_or_req( LDAP *ld,
|
||||
|
||||
|
||||
void
|
||||
add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
|
||||
ldap_add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
|
||||
{
|
||||
LDAPMessage *new;
|
||||
long len;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "add_request_to_cache\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
|
||||
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
if ( ld->ld_cache == NULLLDCACHE ||
|
||||
@ -229,7 +223,7 @@ add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
|
||||
|
||||
if (( new = (LDAPMessage *) calloc( 1, sizeof(LDAPMessage) ))
|
||||
!= NULL ) {
|
||||
if (( new->lm_ber = alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
if (( new->lm_ber = ldap_alloc_ber_with_options( ld )) == NULLBER ) {
|
||||
free( (char *)new );
|
||||
return;
|
||||
}
|
||||
@ -256,12 +250,12 @@ add_request_to_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
|
||||
|
||||
|
||||
void
|
||||
add_result_to_cache( LDAP *ld, LDAPMessage *result )
|
||||
ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
|
||||
{
|
||||
LDAPMessage *m, **mp, *req, *new, *prev;
|
||||
int err, keep;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "add_result_to_cache: id %d, type %d\n",
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
|
||||
result->lm_msgid, result->lm_msgtype, 0 );
|
||||
|
||||
if ( ld->ld_cache == NULLLDCACHE ||
|
||||
@ -369,14 +363,14 @@ add_result_to_cache( LDAP *ld, LDAPMessage *result )
|
||||
* will find them.
|
||||
*/
|
||||
int
|
||||
check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
|
||||
ldap_check_cache( LDAP *ld, unsigned long msgtype, BerElement *request )
|
||||
{
|
||||
LDAPMessage *m, *new, *prev, *next;
|
||||
BerElement reqber;
|
||||
int first, hash;
|
||||
unsigned long validtime;
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "check_cache\n", 0, 0, 0 );
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
|
||||
|
||||
if ( ld->ld_cache == NULLLDCACHE ||
|
||||
( ld->ld_cache->lc_enabled == 0 )) {
|
||||
|
@ -5,6 +5,8 @@
|
||||
* cldap.c - synchronous, retrying interface to the cldap protocol
|
||||
*/
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#ifdef CLDAP
|
||||
|
||||
@ -13,22 +15,22 @@ static char copyright[] = "@(#) Copyright (c) 1990, 1994 Regents of the Universi
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ac/string.h>
|
||||
#include <errno.h>
|
||||
#ifdef MACOS
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#include "macos.h"
|
||||
#else /* MACOS */
|
||||
#endif /* MACOS */
|
||||
#ifdef DOS
|
||||
#include "msdos.h"
|
||||
#else /* DOS */
|
||||
#endif /* DOS */
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
#endif /* DOS */
|
||||
#endif /* MACOS */
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
@ -170,7 +172,7 @@ cldap_open( char *host, int port )
|
||||
|
||||
if ( ld->ld_sb.sb_addrs == NULL
|
||||
#ifdef LDAP_REFERRALS
|
||||
|| ( ld->ld_defconn = new_connection( ld, NULL, 1,0,0 )) == NULL
|
||||
|| ( ld->ld_defconn = ldap_new_connection( ld, NULL, 1,0,0 )) == NULL
|
||||
#endif /* LDAP_REFERRALS */
|
||||
) {
|
||||
free( ld );
|
||||
@ -316,7 +318,7 @@ cldap_result( LDAP *ld, int msgid, LDAPMessage **res,
|
||||
"cldap_result waiting up to %d seconds for a response\n",
|
||||
tv.tv_sec, 0, 0 );
|
||||
ber_init( &ber, 0 );
|
||||
set_ber_options( ld, &ber );
|
||||
ldap_set_ber_options( ld, &ber );
|
||||
|
||||
if ( cldap_getmsg( ld, &tv, &ber ) == -1 ) {
|
||||
ret = ld->ld_errno;
|
||||
@ -432,7 +434,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
|
||||
tag != LBER_DEFAULT && rc != LDAP_SUCCESS;
|
||||
tag = ber_next_element( ber, &len, cookie )) {
|
||||
if (( ldm = (LDAPMessage *)calloc( 1, sizeof(LDAPMessage)))
|
||||
== NULL || ( ldm->lm_ber = alloc_ber_with_options( ld ))
|
||||
== NULL || ( ldm->lm_ber = ldap_alloc_ber_with_options( ld ))
|
||||
== NULLBER ) {
|
||||
rc = LDAP_NO_MEMORY;
|
||||
break; /* return w/error*/
|
||||
@ -506,7 +508,7 @@ cldap_parsemsg( LDAP *ld, int msgid, BerElement *ber,
|
||||
|
||||
#ifndef NO_CACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
add_result_to_cache( ld, ldm );
|
||||
ldap_add_result_to_cache( ld, ldm );
|
||||
}
|
||||
#endif /* NO_CACHE */
|
||||
|
||||
|
@ -9,11 +9,15 @@
|
||||
static char copyright[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
|
||||
#endif
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#ifdef MACOS
|
||||
#include <ac/string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#include "macos.h"
|
||||
#else /* MACOS */
|
||||
#if defined( DOS ) || defined( _WIN32 )
|
||||
|
@ -5,18 +5,21 @@
|
||||
* getfilter.c -- optional add-on to libldap
|
||||
*/
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#if defined(NeXT)
|
||||
#include <regex.h>
|
||||
#endif
|
||||
#ifdef MACOS
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
|
||||
#ifdef MACOS
|
||||
#include "macos.h"
|
||||
#else /* MACOS */
|
||||
#ifdef DOS
|
||||
@ -25,7 +28,6 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
|
||||
#else /* DOS */
|
||||
#include <sys/types.h>
|
||||
#include <sys/file.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/errno.h>
|
||||
#ifndef VMS
|
||||
#include <unistd.h>
|
||||
@ -35,22 +37,10 @@ static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of
|
||||
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
#include "regex.h"
|
||||
|
||||
#ifdef NEEDPROTOS
|
||||
static int break_into_words( char *str, char *delims, char ***wordsp );
|
||||
int next_line_tokens( char **bufp, long *blenp, char ***toksp );
|
||||
void free_strarray( char **sap );
|
||||
#else /* NEEDPROTOS */
|
||||
static int break_into_words();
|
||||
int next_line_tokens();
|
||||
void free_strarray();
|
||||
#endif /* NEEDPROTOS */
|
||||
|
||||
#if !defined( MACOS ) && !defined( DOS )
|
||||
extern int errno;
|
||||
extern char *re_comp();
|
||||
#endif
|
||||
static int break_into_words LDAP_P(( char *str, char *delims, char ***wordsp ));
|
||||
int next_line_tokens LDAP_P(( char **bufp, long *blenp, char ***toksp ));
|
||||
void free_strarray LDAP_P(( char **sap ));
|
||||
|
||||
#define FILT_MAX_LINE_LEN 1024
|
||||
|
||||
@ -107,8 +97,10 @@ ldap_init_getfilter_buf( char *buf, long buflen )
|
||||
LDAPFiltDesc *lfdp;
|
||||
LDAPFiltList *flp, *nextflp;
|
||||
LDAPFiltInfo *fip, *nextfip;
|
||||
char *tag, **tok;
|
||||
int tokcnt, i;
|
||||
char *tag, **tok;
|
||||
int tokcnt, i;
|
||||
int rc;
|
||||
regex_t re;
|
||||
|
||||
if (( lfdp = (LDAPFiltDesc *)calloc( 1, sizeof( LDAPFiltDesc))) == NULL ) {
|
||||
return( NULL );
|
||||
@ -138,11 +130,13 @@ ldap_init_getfilter_buf( char *buf, long buflen )
|
||||
}
|
||||
nextflp->lfl_tag = strdup( tag );
|
||||
nextflp->lfl_pattern = tok[ 0 ];
|
||||
if ( re_comp( nextflp->lfl_pattern ) != NULL ) {
|
||||
if ( (rc = regcomp( &re, nextflp->lfl_pattern, 0 )) != 0 ) {
|
||||
#ifndef NO_USERINTERFACE
|
||||
char error[512];
|
||||
regerror(rc, &re, error, sizeof(error));
|
||||
ldap_getfilter_free( lfdp );
|
||||
fprintf( stderr, "bad regular expresssion %s\n",
|
||||
nextflp->lfl_pattern );
|
||||
fprintf( stderr, "bad regular expresssion %s, %s\n",
|
||||
nextflp->lfl_pattern, error );
|
||||
#if !defined( MACOS ) && !defined( DOS )
|
||||
errno = EINVAL;
|
||||
#endif
|
||||
@ -150,6 +144,7 @@ ldap_init_getfilter_buf( char *buf, long buflen )
|
||||
free_strarray( tok );
|
||||
return( NULL );
|
||||
}
|
||||
regfree(&re);
|
||||
|
||||
nextflp->lfl_delims = tok[ 1 ];
|
||||
nextflp->lfl_ilist = NULL;
|
||||
@ -247,6 +242,8 @@ LDAPFiltInfo *
|
||||
ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
|
||||
{
|
||||
LDAPFiltList *flp;
|
||||
int rc;
|
||||
regex_t re;
|
||||
|
||||
if ( lfdp->lfd_curvalcopy != NULL ) {
|
||||
free( lfdp->lfd_curvalcopy );
|
||||
@ -256,13 +253,30 @@ ldap_getfirstfilter( LDAPFiltDesc *lfdp, char *tagpat, char *value )
|
||||
lfdp->lfd_curval = value;
|
||||
lfdp->lfd_curfip = NULL;
|
||||
|
||||
for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
|
||||
if ( re_comp( tagpat ) == NULL && re_exec( flp->lfl_tag ) == 1
|
||||
&& re_comp( flp->lfl_pattern ) == NULL
|
||||
&& re_exec( lfdp->lfd_curval ) == 1 ) {
|
||||
lfdp->lfd_curfip = flp->lfl_ilist;
|
||||
break;
|
||||
}
|
||||
for ( flp = lfdp->lfd_filtlist; flp != NULL; flp = flp->lfl_next ) {
|
||||
/* compile tagpat, continue if we fail */
|
||||
if (regcomp(&re, tagpat, 0) != 0)
|
||||
continue;
|
||||
|
||||
/* match tagpatern and tag, continue if we fail */
|
||||
rc = regexec(&re, flp->lfl_tag, 0, NULL, 0);
|
||||
regfree(&re);
|
||||
if (rc != 0)
|
||||
continue;
|
||||
|
||||
/* compile flp->ifl_pattern, continue if we fail */
|
||||
if (regcomp(&re, flp->lfl_pattern, 0) != 0)
|
||||
continue;
|
||||
|
||||
/* match ifl_pattern and lfd_curval, continue if we fail */
|
||||
rc = regexec(&re, lfdp->lfd_curval, 0, NULL, 0);
|
||||
regfree(&re);
|
||||
if (rc != 0)
|
||||
continue;
|
||||
|
||||
/* we successfully compiled both patterns and matched both values */
|
||||
lfdp->lfd_curfip = flp->lfl_ilist;
|
||||
break;
|
||||
}
|
||||
|
||||
if ( lfdp->lfd_curfip == NULL ) {
|
||||
|
@ -9,8 +9,12 @@
|
||||
static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of Michigan.\nAll rights reserved.\n";
|
||||
#endif
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ac/string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -21,7 +25,9 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#endif /* _WIN32 */
|
||||
#ifdef _AIX
|
||||
#include <sys/select.h>
|
||||
@ -29,6 +35,7 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of
|
||||
#ifdef VMS
|
||||
#include "ucx_select.h"
|
||||
#endif /* VMS */
|
||||
|
||||
#include "portable.h"
|
||||
#include "lber.h"
|
||||
#include "ldap.h"
|
||||
@ -64,9 +71,10 @@ static char copyright[] = "@(#) Copyright (c) 1995 Regents of the University of
|
||||
#endif /* DOS */
|
||||
#endif /* MACOS */
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
int
|
||||
connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
||||
ldap_connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
||||
int port, int async )
|
||||
/*
|
||||
* if host == NULL, connect using address
|
||||
@ -76,16 +84,17 @@ connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
||||
* XXX async is not used yet!
|
||||
*/
|
||||
{
|
||||
int rc, i, s, connected, use_hp;
|
||||
int rc, i, s = 0;
|
||||
int connected, use_hp;
|
||||
struct sockaddr_in sin;
|
||||
struct hostent *hp;
|
||||
struct hostent *hp = NULL;
|
||||
#ifdef notyet
|
||||
#ifdef LDAP_REFERRALS
|
||||
int status; /* for ioctl call */
|
||||
#endif /* LDAP_REFERRALS */
|
||||
#endif /* notyet */
|
||||
|
||||
Debug( LDAP_DEBUG_TRACE, "connect_to_host: %s:%d\n",
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_connect_to_host: %s:%d\n",
|
||||
( host == NULL ) ? "(by address)" : host, ntohs( port ), 0 );
|
||||
|
||||
connected = use_hp = 0;
|
||||
@ -174,7 +183,7 @@ connect_to_host( Sockbuf *sb, char *host, unsigned long address,
|
||||
|
||||
|
||||
void
|
||||
close_connection( Sockbuf *sb )
|
||||
ldap_close_connection( Sockbuf *sb )
|
||||
{
|
||||
tcp_close( sb->sb_sd );
|
||||
}
|
||||
@ -182,7 +191,7 @@ close_connection( Sockbuf *sb )
|
||||
|
||||
#ifdef KERBEROS
|
||||
char *
|
||||
host_connected_to( Sockbuf *sb )
|
||||
ldap_host_connected_to( Sockbuf *sb )
|
||||
{
|
||||
struct hostent *hp;
|
||||
char *p;
|
||||
@ -223,7 +232,7 @@ struct selectinfo {
|
||||
|
||||
|
||||
void
|
||||
mark_select_write( LDAP *ld, Sockbuf *sb )
|
||||
ldap_mark_select_write( LDAP *ld, Sockbuf *sb )
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
@ -236,7 +245,7 @@ mark_select_write( LDAP *ld, Sockbuf *sb )
|
||||
|
||||
|
||||
void
|
||||
mark_select_read( LDAP *ld, Sockbuf *sb )
|
||||
ldap_mark_select_read( LDAP *ld, Sockbuf *sb )
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
@ -249,7 +258,7 @@ mark_select_read( LDAP *ld, Sockbuf *sb )
|
||||
|
||||
|
||||
void
|
||||
mark_select_clear( LDAP *ld, Sockbuf *sb )
|
||||
ldap_mark_select_clear( LDAP *ld, Sockbuf *sb )
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
@ -261,7 +270,7 @@ mark_select_clear( LDAP *ld, Sockbuf *sb )
|
||||
|
||||
|
||||
int
|
||||
is_write_ready( LDAP *ld, Sockbuf *sb )
|
||||
ldap_is_write_ready( LDAP *ld, Sockbuf *sb )
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
@ -272,7 +281,7 @@ is_write_ready( LDAP *ld, Sockbuf *sb )
|
||||
|
||||
|
||||
int
|
||||
is_read_ready( LDAP *ld, Sockbuf *sb )
|
||||
ldap_is_read_ready( LDAP *ld, Sockbuf *sb )
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
@ -283,7 +292,7 @@ is_read_ready( LDAP *ld, Sockbuf *sb )
|
||||
|
||||
|
||||
void *
|
||||
new_select_info()
|
||||
ldap_new_select_info()
|
||||
{
|
||||
struct selectinfo *sip;
|
||||
|
||||
@ -298,7 +307,7 @@ new_select_info()
|
||||
|
||||
|
||||
void
|
||||
free_select_info( void *sip )
|
||||
ldap_free_select_info( void *sip )
|
||||
{
|
||||
free( sip );
|
||||
}
|
||||
@ -315,9 +324,15 @@ do_ldap_select( LDAP *ld, struct timeval *timeout )
|
||||
if ( tblsize == 0 ) {
|
||||
#ifdef USE_SYSCONF
|
||||
tblsize = sysconf( _SC_OPEN_MAX );
|
||||
#else /* USE_SYSCONF */
|
||||
#else /* !USE_SYSCONF */
|
||||
tblsize = getdtablesize();
|
||||
#endif /* USE_SYSCONF */
|
||||
#endif /* !USE_SYSCONF */
|
||||
|
||||
#ifdef FD_SETSIZE
|
||||
if( tblsize > FD_SETSIZE ) {
|
||||
tblsize = FD_SETSIZE;
|
||||
}
|
||||
#endif /* FD_SETSIZE*/
|
||||
}
|
||||
|
||||
sip = (struct selectinfo *)ld->ld_selectinfo;
|
||||
|
@ -298,7 +298,7 @@ attr_syntax_config(
|
||||
a->asi_names = charray_dup( argv );
|
||||
argv[lasti] = save;
|
||||
|
||||
switch ( avl_insert( &attr_syntaxes, a, attr_syntax_cmp,
|
||||
switch ( avl_insert( &attr_syntaxes, (caddr_t) a, attr_syntax_cmp,
|
||||
attr_syntax_dup ) ) {
|
||||
case -1: /* duplicate - different syntaxes */
|
||||
Debug( LDAP_DEBUG_ARGS, "%s: line %d: duplicate attribute\n",
|
||||
|
@ -141,7 +141,7 @@ attr_index_config(
|
||||
a->ai_indexmask |= INDEX_FROMINIT;
|
||||
}
|
||||
|
||||
switch (avl_insert( &li->li_attrs, a, ainfo_cmp, ainfo_dup )) {
|
||||
switch (avl_insert( &li->li_attrs, (caddr_t) a, ainfo_cmp, ainfo_dup )) {
|
||||
case 1: /* duplicate - updating init version */
|
||||
free( a->ai_type );
|
||||
free( (char *) a );
|
||||
|
@ -110,8 +110,9 @@ cache_add_entry_lock(
|
||||
/* set cache mutex */
|
||||
pthread_mutex_lock( &cache->c_mutex );
|
||||
|
||||
if ( avl_insert( &cache->c_dntree, e, cache_entrydn_cmp, avl_dup_error )
|
||||
!= 0 ) {
|
||||
if ( avl_insert( &cache->c_dntree, (caddr_t) e,
|
||||
cache_entrydn_cmp, avl_dup_error ) != 0 )
|
||||
{
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"entry %20s id %d already in dn cache\n", e->e_dn,
|
||||
e->e_id, 0 );
|
||||
@ -122,14 +123,16 @@ cache_add_entry_lock(
|
||||
}
|
||||
|
||||
/* id tree */
|
||||
if ( avl_insert( &cache->c_idtree, e, cache_entryid_cmp, avl_dup_error )
|
||||
!= 0 ) {
|
||||
if ( avl_insert( &cache->c_idtree, (caddr_t) e,
|
||||
cache_entryid_cmp, avl_dup_error ) != 0 )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY, "entry %20s id %d already in id cache\n",
|
||||
e->e_dn, e->e_id, 0 );
|
||||
|
||||
/* delete from dn tree inserted above */
|
||||
if ( avl_delete( &cache->c_dntree, e, cache_entrydn_cmp )
|
||||
== NULL ) {
|
||||
if ( avl_delete( &cache->c_dntree, (caddr_t) e,
|
||||
cache_entrydn_cmp ) == NULL )
|
||||
{
|
||||
Debug( LDAP_DEBUG_ANY, "can't delete from dn cache\n",
|
||||
0, 0, 0 );
|
||||
}
|
||||
@ -196,8 +199,9 @@ cache_find_entry_dn(
|
||||
pthread_mutex_lock( &cache->c_mutex );
|
||||
|
||||
e.e_dn = dn;
|
||||
if ( (ep = (Entry *) avl_find( cache->c_dntree, &e, cache_entrydn_cmp ))
|
||||
!= NULL ) {
|
||||
if ( (ep = (Entry *) avl_find( cache->c_dntree, (caddr_t) &e,
|
||||
cache_entrydn_cmp )) != NULL )
|
||||
{
|
||||
/*
|
||||
* entry is deleted or not fully created yet
|
||||
*/
|
||||
@ -238,8 +242,9 @@ cache_find_entry_id(
|
||||
pthread_mutex_lock( &cache->c_mutex );
|
||||
|
||||
e.e_id = id;
|
||||
if ( (ep = (Entry *) avl_find( cache->c_idtree, &e, cache_entryid_cmp ))
|
||||
!= NULL ) {
|
||||
if ( (ep = (Entry *) avl_find( cache->c_idtree, (caddr_t) &e,
|
||||
cache_entryid_cmp )) != NULL )
|
||||
{
|
||||
/*
|
||||
* entry is deleted or not fully created yet
|
||||
*/
|
||||
@ -299,12 +304,16 @@ cache_delete_entry_internal(
|
||||
)
|
||||
{
|
||||
/* dn tree */
|
||||
if ( avl_delete( &cache->c_dntree, e, cache_entrydn_cmp ) == NULL ) {
|
||||
if ( avl_delete( &cache->c_dntree, (caddr_t) e, cache_entrydn_cmp )
|
||||
== NULL )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/* id tree */
|
||||
if ( avl_delete( &cache->c_idtree, e, cache_entryid_cmp ) == NULL ) {
|
||||
if ( avl_delete( &cache->c_idtree, (caddr_t) e, cache_entryid_cmp )
|
||||
== NULL )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include "back-ldbm.h"
|
||||
#include "ldapconfig.h"
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
@ -1,8 +1,15 @@
|
||||
/* idl.c - ldap id list handling routines */
|
||||
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef CLDAP
|
||||
#include <sys/socket.h>
|
||||
#endif
|
||||
#include "slap.h"
|
||||
#include "ldapconfig.h"
|
||||
#include "back-ldbm.h"
|
||||
@ -57,6 +64,11 @@ idl_fetch_one(
|
||||
char *kstr;
|
||||
int i, nids;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &k2, 0, sizeof( k2 ) );
|
||||
memset( &data, 0, sizeof( data ) );
|
||||
#endif
|
||||
|
||||
/* Debug( LDAP_DEBUG_TRACE, "=> idl_fetch_one\n", 0, 0, 0 ); */
|
||||
|
||||
data = ldbm_cache_fetch( db, key );
|
||||
@ -79,6 +91,11 @@ idl_fetch(
|
||||
char *kstr;
|
||||
int i, nids;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &k2, 0, sizeof( k2 ) );
|
||||
memset( &data, 0, sizeof( data ) );
|
||||
#endif
|
||||
|
||||
/* Debug( LDAP_DEBUG_TRACE, "=> idl_fetch\n", 0, 0, 0 ); */
|
||||
|
||||
data = ldbm_cache_fetch( db, key );
|
||||
@ -164,15 +181,27 @@ idl_store(
|
||||
IDList *idl
|
||||
)
|
||||
{
|
||||
int rc;
|
||||
int rc, flags;
|
||||
Datum data;
|
||||
struct ldbminfo *li = (struct ldbminfo *) be->be_private;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &data, 0, sizeof( data ) );
|
||||
#endif
|
||||
|
||||
/* Debug( LDAP_DEBUG_TRACE, "=> idl_store\n", 0, 0, 0 ); */
|
||||
|
||||
data.dptr = (char *) idl;
|
||||
data.dsize = (2 + idl->b_nmax) * sizeof(ID);
|
||||
|
||||
#ifdef LDBM_DEBUG
|
||||
Statslog( LDAP_DEBUG_STATS, "<= idl_store(): rc=%d\n",
|
||||
rc, 0, 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
rc = ldbm_cache_store( db, key, data, LDBM_REPLACE );
|
||||
flags = LDBM_REPLACE;
|
||||
if( li->li_flush_wrt ) flags |= LDBM_SYNC;
|
||||
rc = ldbm_cache_store( db, key, data, flags );
|
||||
|
||||
/* Debug( LDAP_DEBUG_TRACE, "<= idl_store %d\n", rc, 0, 0 ); */
|
||||
return( rc );
|
||||
@ -278,7 +307,16 @@ idl_insert_key(
|
||||
char *kstr;
|
||||
Datum k2;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
memset( &k2, 0, sizeof( k2 ) );
|
||||
#endif
|
||||
|
||||
if ( (idl = idl_fetch_one( be, db, key )) == NULL ) {
|
||||
#ifdef LDBM_DEBUG
|
||||
Statslog( LDAP_DEBUG_STATS, "=> idl_insert_key(): no key yet\n",
|
||||
0, 0, 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
idl = idl_alloc( 1 );
|
||||
idl->b_ids[idl->b_nids++] = id;
|
||||
rc = idl_store( be, db, key, idl );
|
||||
@ -726,12 +764,9 @@ idl_notin(
|
||||
if ( a == NULL ) {
|
||||
return( NULL );
|
||||
}
|
||||
if ( b == NULL ) {
|
||||
if ( b == NULL || ALLIDS( b )) {
|
||||
return( idl_dup( a ) );
|
||||
}
|
||||
if ( ALLIDS( b ) ) {
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
if ( ALLIDS( a ) ) {
|
||||
n = idl_alloc( SLAPD_LDBM_MIN_MAXIDS );
|
||||
|
@ -19,7 +19,7 @@ extern long ops_completed;
|
||||
extern pthread_mutex_t ops_mutex;
|
||||
extern pthread_t listener_tid;
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
@ -41,7 +41,7 @@ int deny_severity = LOG_NOTICE;
|
||||
|
||||
extern Operation *op_add();
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
@ -222,7 +222,7 @@ slapd_daemon(
|
||||
zero.tv_usec = 0;
|
||||
Debug( LDAP_DEBUG_CONNS, "before select active_threads %d\n",
|
||||
active_threads, 0, 0 );
|
||||
#if defined(PTHREAD_PREEMPTIVE) || defined(NO_THREADS)
|
||||
#if defined(THREAD_PREEMPTIVE) || defined(NO_THREADS)
|
||||
tvp = NULL;
|
||||
#else
|
||||
tvp = active_threads ? &zero : NULL;
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include <signal.h>
|
||||
#include "slap.h"
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern int sys_nerr;
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
@ -1,5 +1,8 @@
|
||||
#define DISABLE_BRIDGE
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ac/string.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
@ -10,7 +13,7 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/stat.h>
|
||||
#include <limits.h>
|
||||
#include "portable.h"
|
||||
|
||||
#include "ldapconfig.h"
|
||||
#include "../slap.h"
|
||||
#include "../back-ldbm/back-ldbm.h"
|
||||
@ -64,6 +67,10 @@ main( argc, argv )
|
||||
int i;
|
||||
extern char *optarg;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
DBC *cursorp;
|
||||
#endif
|
||||
|
||||
tailorfile = SLAPD_DEFAULT_CONFIGFILE;
|
||||
while ( (i = getopt( argc, argv, "d:f:" )) != EOF ) {
|
||||
switch ( i ) {
|
||||
@ -151,9 +158,16 @@ main( argc, argv )
|
||||
}
|
||||
|
||||
savekey.dptr = NULL;
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( key = ldbm_firstkey( dbc->dbc_db, &cursorp );
|
||||
key.dptr != NULL;
|
||||
key = ldbm_nextkey( dbc->dbc_db, key, cursorp ) )
|
||||
#else
|
||||
for ( key = ldbm_firstkey( dbc->dbc_db );
|
||||
key.dptr != NULL;
|
||||
key = ldbm_nextkey( dbc->dbc_db, key ) ) {
|
||||
key = ldbm_nextkey( dbc->dbc_db, key ) )
|
||||
#endif
|
||||
{
|
||||
if ( savekey.dptr != NULL )
|
||||
ldbm_datum_free( dbc->dbc_db, savekey );
|
||||
savekey = key;
|
||||
@ -313,8 +327,16 @@ main( argc, argv )
|
||||
}
|
||||
|
||||
last.dptr = NULL;
|
||||
|
||||
#ifdef LDBM_USE_DB2
|
||||
for ( key = ldbm_firstkey( dbp, &cursorp );
|
||||
key.dptr != NULL;
|
||||
key = ldbm_nextkey( dbp, last, cursorp ) )
|
||||
#else
|
||||
for ( key = ldbm_firstkey( dbp ); key.dptr != NULL;
|
||||
key = ldbm_nextkey( dbp, last ) ) {
|
||||
key = ldbm_nextkey( dbp, last ) )
|
||||
#endif
|
||||
{
|
||||
if ( last.dptr != NULL ) {
|
||||
ldbm_datum_free( dbp, last );
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ static void populate_queue LDAP_P(( char *f ));
|
||||
static void set_shutdown LDAP_P((void));
|
||||
void do_nothing LDAP_P((void));
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif /* DECL_SYS_ERRLIST */
|
||||
|
||||
|
@ -54,7 +54,7 @@ static int do_unbind LDAP_P(( Ri * ));
|
||||
|
||||
|
||||
/* External references */
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif /* DECL_SYS_ERRLIST */
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
extern char *str_getline LDAP_P(( char **next ));
|
||||
extern void ch_free LDAP_P(( char *p ));
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif /* DECL_SYS_ERRLIST */
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "slurp.h"
|
||||
#include "globals.h"
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif /* DECL_SYS_ERRLIST */
|
||||
|
||||
|
@ -45,7 +45,7 @@ extern char *ch_malloc LDAP_P(( unsigned long ));
|
||||
int file_nonempty LDAP_P(( char * ));
|
||||
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif
|
||||
|
||||
|
@ -43,7 +43,7 @@
|
||||
/* externs */
|
||||
extern void Re_dump LDAP_P(( Re *re ));
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif /* DECL_SYS_ERRLIST */
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "slurp.h"
|
||||
#include "globals.h"
|
||||
|
||||
#ifndef DECL_SYS_ERRLIST
|
||||
#ifdef DECL_SYS_ERRLIST
|
||||
extern char *sys_errlist[];
|
||||
#endif /* DECL_SYS_ERRLIST */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user