mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-18 18:18:06 -05:00
sync with HEAD
This commit is contained in:
parent
c71bafbf82
commit
a6de32518e
9 changed files with 238 additions and 184 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, Redwood City, California, USA
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
|
@ -434,8 +434,9 @@ typedef struct ldapcontrol {
|
|||
#define LDAP_IS_LEAF 0x23 /* not LDAPv3 */
|
||||
#define LDAP_ALIAS_DEREF_PROBLEM 0x24
|
||||
|
||||
#define LDAP_SECURITY_ERROR(n) LDAP_RANGE((n),0x30,0x32) /* 48-50 */
|
||||
#define LDAP_SECURITY_ERROR(n) LDAP_RANGE((n),0x2F,0x32) /* 47-50 */
|
||||
|
||||
#define LDAP_PROXY_AUTHZ_FAILURE 0x2F /* LDAPv3 proxy authorization */
|
||||
#define LDAP_INAPPROPRIATE_AUTH 0x30
|
||||
#define LDAP_INVALID_CREDENTIALS 0x31
|
||||
#define LDAP_INSUFFICIENT_ACCESS 0x32
|
||||
|
|
@ -712,6 +713,14 @@ ldap_parse_extended_partial LDAP_P((
|
|||
LDAPControl ***serverctrls,
|
||||
int freeit ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_parse_intermediate_resp_result LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPMessage *res,
|
||||
char **retoidp,
|
||||
struct berval **retdatap,
|
||||
int freeit ));
|
||||
|
||||
/*
|
||||
* in abandon.c:
|
||||
*/
|
||||
|
|
@ -910,6 +919,24 @@ LDAP_F( void )
|
|||
ldap_uncache_request LDAP_P(( LDAP *ld, int msgid ));
|
||||
|
||||
|
||||
/*
|
||||
* LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt>
|
||||
*/
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_cancel LDAP_P(( LDAP *ld,
|
||||
int cancelid,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_cancel_s LDAP_P((
|
||||
LDAP *ld,
|
||||
int cancelid,
|
||||
LDAPControl **sctrl,
|
||||
LDAPControl **cctrl ));
|
||||
|
||||
/*
|
||||
* in compare.c:
|
||||
*/
|
||||
|
|
@ -1686,6 +1713,28 @@ ldap_parse_vlv_control LDAP_P((
|
|||
struct berval **contextp,
|
||||
int *errcodep ));
|
||||
|
||||
/*
|
||||
* LDAP Who Am I? (whoami.c)
|
||||
*/
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_parse_whoami LDAP_P((
|
||||
LDAP *ld,
|
||||
LDAPMessage *res,
|
||||
struct berval **authzid ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_whoami LDAP_P(( LDAP *ld,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls,
|
||||
int *msgidp ));
|
||||
|
||||
LDAP_F( int )
|
||||
ldap_whoami_s LDAP_P((
|
||||
LDAP *ld,
|
||||
struct berval **authzid,
|
||||
LDAPControl **sctrls,
|
||||
LDAPControl **cctrls ));
|
||||
|
||||
LDAP_END_DECL
|
||||
#endif /* _LDAP_H */
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# $OpenLDAP$
|
||||
## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
##
|
||||
## LIBAVL
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
/* avl.c - routines to implement an avl tree */
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1993 Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
|
|
@ -11,34 +16,41 @@
|
|||
* is provided ``as is'' without express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char copyright[] = "@(#) Copyright (c) 1993 Regents of the University of Michigan.\nAll rights reserved.\n";
|
||||
static char avl_version[] = "AVL library version 1.0\n";
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ac/stdlib.h>
|
||||
|
||||
#ifdef CSRIMALLOC
|
||||
#define ber_memalloc malloc
|
||||
#define ber_memrealloc realloc
|
||||
#define ber_memfree free
|
||||
#else
|
||||
#include "lber.h"
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#define AVL_INTERNAL
|
||||
#include "avl.h"
|
||||
|
||||
#define ROTATERIGHT(x) { \
|
||||
Avlnode *tmp;\
|
||||
if ( *x == NULL || (*x)->avl_left == NULL ) {\
|
||||
(void) printf("RR error\n"); exit(1); \
|
||||
if ( *(x) == NULL || (*(x))->avl_left == NULL ) {\
|
||||
(void) fputs("RR error\n", stderr); exit( EXIT_FAILURE ); \
|
||||
}\
|
||||
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 ) {\
|
||||
(void) printf("RL error\n"); exit(1); \
|
||||
if ( *(x) == NULL || (*(x))->avl_right == NULL ) {\
|
||||
(void) fputs("RL error\n", stderr); exit( EXIT_FAILURE ); \
|
||||
}\
|
||||
tmp = (*x)->avl_right;\
|
||||
(*x)->avl_right = tmp->avl_left;\
|
||||
tmp->avl_left = *x;\
|
||||
*x = tmp;\
|
||||
tmp = (*(x))->avl_right;\
|
||||
(*(x))->avl_right = tmp->avl_left;\
|
||||
tmp->avl_left = *(x);\
|
||||
*(x) = tmp;\
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -46,20 +58,21 @@ static char avl_version[] = "AVL library version 1.0\n";
|
|||
* and balance of an avl tree.
|
||||
*/
|
||||
|
||||
static
|
||||
ravl_insert( iroot, data, taller, fcmp, fdup, depth )
|
||||
Avlnode **iroot;
|
||||
caddr_t data;
|
||||
int *taller;
|
||||
IFP fcmp; /* comparison function */
|
||||
IFP fdup; /* function to call for duplicates */
|
||||
int depth;
|
||||
static int
|
||||
ravl_insert(
|
||||
Avlnode **iroot,
|
||||
void* data,
|
||||
int *taller,
|
||||
AVL_CMP fcmp, /* comparison function */
|
||||
AVL_DUP fdup, /* function to call for duplicates */
|
||||
int depth
|
||||
)
|
||||
{
|
||||
int rc, cmp, tallersub;
|
||||
Avlnode *l, *r;
|
||||
|
||||
if ( *iroot == 0 ) {
|
||||
if ( (*iroot = (Avlnode *) malloc( sizeof( Avlnode ) ))
|
||||
if ( (*iroot = (Avlnode *) ber_memalloc( sizeof( Avlnode ) ))
|
||||
== NULL ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
|
@ -200,11 +213,8 @@ ravl_insert( iroot, data, taller, fcmp, fdup, depth )
|
|||
* NOTE: this routine may malloc memory
|
||||
*/
|
||||
|
||||
avl_insert( root, data, fcmp, fdup )
|
||||
Avlnode **root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
IFP fdup;
|
||||
int
|
||||
avl_insert( Avlnode **root, void* data, AVL_CMP fcmp, AVL_DUP fdup )
|
||||
{
|
||||
int taller;
|
||||
|
||||
|
|
@ -216,11 +226,10 @@ avl_insert( root, data, fcmp, fdup )
|
|||
* been shortened because of a deletion.
|
||||
*/
|
||||
|
||||
static
|
||||
right_balance( root )
|
||||
Avlnode **root;
|
||||
static int
|
||||
right_balance( Avlnode **root )
|
||||
{
|
||||
int shorter;
|
||||
int shorter = -1;
|
||||
Avlnode *r, *l;
|
||||
|
||||
switch( (*root)->avl_bf ) {
|
||||
|
|
@ -281,11 +290,10 @@ right_balance( root )
|
|||
* been shortened because of a deletion.
|
||||
*/
|
||||
|
||||
static
|
||||
left_balance( root )
|
||||
Avlnode **root;
|
||||
static int
|
||||
left_balance( Avlnode **root )
|
||||
{
|
||||
int shorter;
|
||||
int shorter = -1;
|
||||
Avlnode *r, *l;
|
||||
|
||||
switch( (*root)->avl_bf ) {
|
||||
|
|
@ -348,16 +356,12 @@ left_balance( root )
|
|||
* rebalancing.
|
||||
*/
|
||||
|
||||
static caddr_t
|
||||
ravl_delete( root, data, fcmp, shorter )
|
||||
Avlnode **root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
int *shorter;
|
||||
static void*
|
||||
ravl_delete( Avlnode **root, void* data, AVL_CMP fcmp, int *shorter )
|
||||
{
|
||||
int shortersubtree = 0;
|
||||
int cmp;
|
||||
caddr_t savedata;
|
||||
void* savedata;
|
||||
Avlnode *minnode, *savenode;
|
||||
|
||||
if ( *root == NULLAVL )
|
||||
|
|
@ -374,13 +378,13 @@ ravl_delete( root, data, fcmp, shorter )
|
|||
if ( (*root)->avl_left == 0 ) {
|
||||
*root = (*root)->avl_right;
|
||||
*shorter = 1;
|
||||
free( (char *) savenode );
|
||||
ber_memfree( (char *) savenode );
|
||||
return( savedata );
|
||||
/* no right child */
|
||||
} else if ( (*root)->avl_right == 0 ) {
|
||||
*root = (*root)->avl_left;
|
||||
*shorter = 1;
|
||||
free( (char *) savenode );
|
||||
ber_memfree( (char *) savenode );
|
||||
return( savedata );
|
||||
}
|
||||
|
||||
|
|
@ -441,23 +445,16 @@ ravl_delete( root, data, fcmp, shorter )
|
|||
* the avl tree rooted at root.
|
||||
*/
|
||||
|
||||
caddr_t
|
||||
avl_delete( root, data, fcmp )
|
||||
Avlnode **root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
void*
|
||||
avl_delete( Avlnode **root, void* data, AVL_CMP fcmp )
|
||||
{
|
||||
int shorter;
|
||||
|
||||
return( ravl_delete( root, data, fcmp, &shorter ) );
|
||||
}
|
||||
|
||||
static
|
||||
avl_inapply( root, fn, arg, stopflag )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
static int
|
||||
avl_inapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
|
||||
{
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
|
@ -476,12 +473,8 @@ avl_inapply( root, fn, arg, stopflag )
|
|||
return( avl_inapply( root->avl_right, fn, arg, stopflag ) );
|
||||
}
|
||||
|
||||
static
|
||||
avl_postapply( root, fn, arg, stopflag )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
static int
|
||||
avl_postapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
|
||||
{
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
|
@ -499,12 +492,8 @@ avl_postapply( root, fn, arg, stopflag )
|
|||
return( (*fn)( root->avl_data, arg ) );
|
||||
}
|
||||
|
||||
static
|
||||
avl_preapply( root, fn, arg, stopflag )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
static int
|
||||
avl_preapply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag )
|
||||
{
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
|
@ -531,12 +520,8 @@ avl_preapply( root, fn, arg, stopflag )
|
|||
* of nodes.
|
||||
*/
|
||||
|
||||
avl_apply( root, fn, arg, stopflag, type )
|
||||
Avlnode *root;
|
||||
IFP fn;
|
||||
caddr_t arg;
|
||||
int stopflag;
|
||||
int type;
|
||||
int
|
||||
avl_apply( Avlnode *root, AVL_APPLY fn, void* arg, int stopflag, int type )
|
||||
{
|
||||
switch ( type ) {
|
||||
case AVL_INORDER:
|
||||
|
|
@ -564,21 +549,23 @@ avl_apply( root, fn, arg, stopflag, type )
|
|||
* AVL_NOMORE is returned.
|
||||
*/
|
||||
|
||||
avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
|
||||
Avlnode *root;
|
||||
caddr_t data;
|
||||
IFP fmatch;
|
||||
caddr_t marg;
|
||||
IFP fcmp;
|
||||
caddr_t carg;
|
||||
int stopflag;
|
||||
int
|
||||
avl_prefixapply(
|
||||
Avlnode *root,
|
||||
void* data,
|
||||
AVL_CMP fmatch,
|
||||
void* marg,
|
||||
AVL_CMP fcmp,
|
||||
void* carg,
|
||||
int stopflag
|
||||
)
|
||||
{
|
||||
int cmp;
|
||||
|
||||
if ( root == 0 )
|
||||
return( AVL_NOMORE );
|
||||
|
||||
cmp = (*fcmp)( data, root->avl_data, carg );
|
||||
cmp = (*fcmp)( data, root->avl_data /* , carg */);
|
||||
if ( cmp == 0 ) {
|
||||
if ( (*fmatch)( root->avl_data, marg ) == stopflag )
|
||||
return( stopflag );
|
||||
|
|
@ -613,9 +600,8 @@ avl_prefixapply( root, data, fmatch, marg, fcmp, carg, stopflag )
|
|||
* number of items actually freed is returned.
|
||||
*/
|
||||
|
||||
avl_free( root, dfree )
|
||||
Avlnode *root;
|
||||
IFP dfree;
|
||||
int
|
||||
avl_free( Avlnode *root, AVL_FREE dfree )
|
||||
{
|
||||
int nleft, nright;
|
||||
|
||||
|
|
@ -631,6 +617,7 @@ avl_free( root, dfree )
|
|||
|
||||
if ( dfree )
|
||||
(*dfree)( root->avl_data );
|
||||
ber_memfree( root );
|
||||
|
||||
return( nleft + nright + 1 );
|
||||
}
|
||||
|
|
@ -642,11 +629,8 @@ avl_free( root, dfree )
|
|||
* < 0 if arg1 is less than arg2 and > 0 if arg1 is greater than arg2.
|
||||
*/
|
||||
|
||||
caddr_t
|
||||
avl_find( root, data, fcmp )
|
||||
Avlnode *root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
void*
|
||||
avl_find( Avlnode *root, const void* data, AVL_CMP fcmp )
|
||||
{
|
||||
int cmp;
|
||||
|
||||
|
|
@ -667,13 +651,10 @@ avl_find( root, data, fcmp )
|
|||
* they match, non-zero otherwise.
|
||||
*/
|
||||
|
||||
caddr_t
|
||||
avl_find_lin( root, data, fcmp )
|
||||
Avlnode *root;
|
||||
caddr_t data;
|
||||
IFP fcmp;
|
||||
void*
|
||||
avl_find_lin( Avlnode *root, const void* data, AVL_CMP fcmp )
|
||||
{
|
||||
caddr_t res;
|
||||
void* res;
|
||||
|
||||
if ( root == 0 )
|
||||
return( NULL );
|
||||
|
|
@ -692,28 +673,28 @@ avl_find_lin( root, data, fcmp )
|
|||
return( avl_find_lin( root->avl_right, data, fcmp ) );
|
||||
}
|
||||
|
||||
static caddr_t *avl_list;
|
||||
/* NON-REENTRANT INTERFACE */
|
||||
|
||||
static void* *avl_list;
|
||||
static int avl_maxlist;
|
||||
static int avl_nextlist;
|
||||
|
||||
#define AVL_GRABSIZE 100
|
||||
|
||||
/* ARGSUSED */
|
||||
static
|
||||
avl_buildlist( data, arg )
|
||||
caddr_t data;
|
||||
int arg;
|
||||
static int
|
||||
avl_buildlist( void* data, void* arg )
|
||||
{
|
||||
static int slots;
|
||||
|
||||
if ( avl_list == (caddr_t *) 0 ) {
|
||||
avl_list = (caddr_t *) malloc(AVL_GRABSIZE * sizeof(caddr_t));
|
||||
if ( avl_list == (void* *) 0 ) {
|
||||
avl_list = (void* *) ber_memalloc(AVL_GRABSIZE * sizeof(void*));
|
||||
slots = AVL_GRABSIZE;
|
||||
avl_maxlist = 0;
|
||||
} else if ( avl_maxlist == slots ) {
|
||||
slots += AVL_GRABSIZE;
|
||||
avl_list = (caddr_t *) realloc( (char *) avl_list,
|
||||
(unsigned) slots * sizeof(caddr_t));
|
||||
avl_list = (void* *) ber_memrealloc( (char *) avl_list,
|
||||
(unsigned) slots * sizeof(void*));
|
||||
}
|
||||
|
||||
avl_list[ avl_maxlist++ ] = data;
|
||||
|
|
@ -733,13 +714,12 @@ avl_buildlist( data, arg )
|
|||
* different trees) cannot be active at once.
|
||||
*/
|
||||
|
||||
caddr_t
|
||||
avl_getfirst( root )
|
||||
Avlnode *root;
|
||||
void*
|
||||
avl_getfirst( Avlnode *root )
|
||||
{
|
||||
if ( avl_list ) {
|
||||
free( (char *) avl_list);
|
||||
avl_list = (caddr_t *) 0;
|
||||
ber_memfree( (char *) avl_list);
|
||||
avl_list = (void* *) 0;
|
||||
}
|
||||
avl_maxlist = 0;
|
||||
avl_nextlist = 0;
|
||||
|
|
@ -747,32 +727,37 @@ avl_getfirst( root )
|
|||
if ( root == 0 )
|
||||
return( 0 );
|
||||
|
||||
(void) avl_apply( root, avl_buildlist, (caddr_t) 0, -1, AVL_INORDER );
|
||||
(void) avl_apply( root, avl_buildlist, (void*) 0, -1, AVL_INORDER );
|
||||
|
||||
return( avl_list[ avl_nextlist++ ] );
|
||||
}
|
||||
|
||||
caddr_t
|
||||
avl_getnext()
|
||||
void*
|
||||
avl_getnext( void )
|
||||
{
|
||||
if ( avl_list == 0 )
|
||||
return( 0 );
|
||||
|
||||
if ( avl_nextlist == avl_maxlist ) {
|
||||
free( (caddr_t) avl_list);
|
||||
avl_list = (caddr_t *) 0;
|
||||
ber_memfree( (void*) avl_list);
|
||||
avl_list = (void* *) 0;
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
return( avl_list[ avl_nextlist++ ] );
|
||||
}
|
||||
|
||||
avl_dup_error()
|
||||
/* end non-reentrant code */
|
||||
|
||||
|
||||
int
|
||||
avl_dup_error( void* left, void* right )
|
||||
{
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
avl_dup_ok()
|
||||
int
|
||||
avl_dup_ok( void* left, void* right )
|
||||
{
|
||||
return( 0 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +1,61 @@
|
|||
/* testavl.c - Test Tim Howes AVL code */
|
||||
#include <sys/types.h>
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/stdlib.h>
|
||||
#include <ac/string.h>
|
||||
|
||||
#define AVL_INTERNAL
|
||||
#define AVL_NONREENTRANT
|
||||
#include "avl.h"
|
||||
|
||||
char *strdup( s )
|
||||
char *s;
|
||||
static void ravl_print LDAP_P(( Avlnode *root, int depth ));
|
||||
static void myprint LDAP_P(( Avlnode *root ));
|
||||
static int avl_strcmp LDAP_P(( const void *s, const void *t ));
|
||||
|
||||
int
|
||||
main( int argc, char **argv )
|
||||
{
|
||||
char *new;
|
||||
|
||||
if ( (new = (char *) malloc( strlen( s ) + 1 )) == NULL )
|
||||
return( NULL );
|
||||
|
||||
strcpy( new, s );
|
||||
|
||||
return( new );
|
||||
}
|
||||
|
||||
main( argc, argv )
|
||||
int argc;
|
||||
char **argv;
|
||||
{
|
||||
Avlnode *tree = NULLAVL;
|
||||
Avlnode *tree = NULL;
|
||||
char command[ 10 ];
|
||||
char name[ 80 ];
|
||||
char *p;
|
||||
int free(), strcmp();
|
||||
|
||||
printf( "> " );
|
||||
while ( fgets( command, sizeof( command ), stdin ) != NULL ) {
|
||||
switch( *command ) {
|
||||
case 'n': /* new tree */
|
||||
( void ) avl_free( tree, free );
|
||||
tree = NULLAVL;
|
||||
tree = NULL;
|
||||
break;
|
||||
case 'p': /* print */
|
||||
( void ) myprint( tree );
|
||||
break;
|
||||
case 't': /* traverse with first, next */
|
||||
#ifdef AVL_NONREENTRANT
|
||||
printf( "***\n" );
|
||||
for ( p = (char * ) avl_getfirst( tree );
|
||||
p != NULL; p = (char *) avl_getnext( tree, p ) )
|
||||
p != NULL;
|
||||
p = (char *) avl_getnext())
|
||||
printf( "%s\n", p );
|
||||
printf( "***\n" );
|
||||
#else
|
||||
printf( "*** reentrant interface not implemented ***" );
|
||||
#endif
|
||||
break;
|
||||
case 'f': /* find */
|
||||
printf( "data? " );
|
||||
if ( fgets( name, sizeof( name ), stdin ) == NULL )
|
||||
exit( 0 );
|
||||
exit( EXIT_SUCCESS );
|
||||
name[ strlen( name ) - 1 ] = '\0';
|
||||
if ( (p = (char *) avl_find( tree, name, strcmp ))
|
||||
if ( (p = (char *) avl_find( tree, name, avl_strcmp ))
|
||||
== NULL )
|
||||
printf( "Not found.\n\n" );
|
||||
else
|
||||
|
|
@ -57,22 +64,22 @@ char **argv;
|
|||
case 'i': /* insert */
|
||||
printf( "data? " );
|
||||
if ( fgets( name, sizeof( name ), stdin ) == NULL )
|
||||
exit( 0 );
|
||||
exit( EXIT_SUCCESS );
|
||||
name[ strlen( name ) - 1 ] = '\0';
|
||||
if ( avl_insert( &tree, strdup( name ), strcmp,
|
||||
avl_dup_error ) != OK )
|
||||
if ( avl_insert( &tree, strdup( name ), avl_strcmp,
|
||||
avl_dup_error ) != 0 )
|
||||
printf( "\nNot inserted!\n" );
|
||||
break;
|
||||
case 'd': /* delete */
|
||||
printf( "data? " );
|
||||
if ( fgets( name, sizeof( name ), stdin ) == NULL )
|
||||
exit( 0 );
|
||||
exit( EXIT_SUCCESS );
|
||||
name[ strlen( name ) - 1 ] = '\0';
|
||||
if ( avl_delete( &tree, name, strcmp ) == NULL )
|
||||
if ( avl_delete( &tree, name, avl_strcmp ) == NULL )
|
||||
printf( "\nNot found!\n" );
|
||||
break;
|
||||
case 'q': /* quit */
|
||||
exit( 0 );
|
||||
exit( EXIT_SUCCESS );
|
||||
break;
|
||||
case '\n':
|
||||
break;
|
||||
|
|
@ -82,12 +89,11 @@ char **argv;
|
|||
|
||||
printf( "> " );
|
||||
}
|
||||
/* NOTREACHED */
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static ravl_print( root, depth )
|
||||
Avlnode *root;
|
||||
int depth;
|
||||
static void ravl_print( Avlnode *root, int depth )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -98,20 +104,24 @@ int depth;
|
|||
|
||||
for ( i = 0; i < depth; i++ )
|
||||
printf( " " );
|
||||
printf( "%s %d\n", root->avl_data, root->avl_bf );
|
||||
printf( "%s %d\n", (char *) root->avl_data, root->avl_bf );
|
||||
|
||||
ravl_print( root->avl_left, depth+1 );
|
||||
}
|
||||
|
||||
myprint( root )
|
||||
Avlnode *root;
|
||||
static void myprint( Avlnode *root )
|
||||
{
|
||||
printf( "********\n" );
|
||||
|
||||
if ( root == 0 )
|
||||
printf( "\tNULL\n" );
|
||||
else
|
||||
( void ) ravl_print( root, 0 );
|
||||
ravl_print( root, 0 );
|
||||
|
||||
printf( "********\n" );
|
||||
}
|
||||
|
||||
static int avl_strcmp( const void *s, const void *t )
|
||||
{
|
||||
return strcmp( s, t );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
# $OpenLDAP$
|
||||
## Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
## COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
##
|
||||
## Makefile.in for LDAP -lldap
|
||||
|
|
@ -12,20 +12,22 @@ SRCS = bind.c open.c result.c error.c compare.c search.c \
|
|||
controls.c messages.c references.c extended.c cyrus.c \
|
||||
modify.c add.c modrdn.c delete.c abandon.c cache.c \
|
||||
sasl.c sbind.c kbind.c unbind.c \
|
||||
filter.c free.c sort.c \
|
||||
filter.c free.c sort.c passwd.c whoami.c \
|
||||
getdn.c getentry.c getattr.c getvalues.c addentry.c \
|
||||
request.c os-ip.c url.c sortctrl.c vlvctrl.c whoami.c \
|
||||
request.c os-ip.c url.c sortctrl.c vlvctrl.c \
|
||||
init.c options.c print.c string.c util-int.c schema.c \
|
||||
charray.c tls.c os-local.c dnssrv.c utf-8.c utf-8-conv.c
|
||||
charray.c tls.c os-local.c dnssrv.c utf-8.c utf-8-conv.c \
|
||||
cancel.c
|
||||
OBJS = bind.lo open.lo result.lo error.lo compare.lo search.lo \
|
||||
controls.lo messages.lo references.lo extended.lo cyrus.lo \
|
||||
modify.lo add.lo modrdn.lo delete.lo abandon.lo cache.lo \
|
||||
sasl.lo sbind.lo kbind.lo unbind.lo \
|
||||
filter.lo free.lo sort.lo \
|
||||
filter.lo free.lo sort.lo passwd.lo whoami.lo \
|
||||
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
|
||||
request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo whoami.lo \
|
||||
request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo \
|
||||
init.lo options.lo print.lo string.lo util-int.lo schema.lo \
|
||||
charray.lo tls.lo os-local.lo dnssrv.lo utf-8.lo utf-8-conv.lo
|
||||
charray.lo tls.lo os-local.lo dnssrv.lo utf-8.lo utf-8-conv.lo \
|
||||
cancel.lo
|
||||
|
||||
LDAP_INCDIR= ../../include
|
||||
LDAP_LIBDIR= ../../libraries
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
|
|
@ -360,7 +360,7 @@ ldap_control_dup( const LDAPControl *c )
|
|||
}
|
||||
|
||||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/* Adapted for inclusion into OpenLDAP by Kurt D. Zeilenga */
|
||||
|
|
@ -410,7 +410,6 @@ ldap_create_control(
|
|||
LDAPControl **ctrlp )
|
||||
{
|
||||
LDAPControl *ctrl;
|
||||
struct berval *bvalp;
|
||||
|
||||
assert( requestOID != NULL );
|
||||
assert( ber != NULL );
|
||||
|
|
@ -421,14 +420,11 @@ ldap_create_control(
|
|||
return LDAP_NO_MEMORY;
|
||||
}
|
||||
|
||||
if ( ber_flatten( ber, &bvalp ) == -1 ) {
|
||||
if ( ber_flatten2( ber, &ctrl->ldctl_value, 1 ) == -1 ) {
|
||||
LDAP_FREE( ctrl );
|
||||
return LDAP_NO_MEMORY;
|
||||
}
|
||||
|
||||
ctrl->ldctl_value = *bvalp;
|
||||
ber_memfree( bvalp );
|
||||
|
||||
ctrl->ldctl_oid = LDAP_STRDUP( requestOID );
|
||||
ctrl->ldctl_iscritical = iscritical;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
|
||||
|
|
@ -53,6 +53,7 @@ static struct ldaperror ldap_builtin_errlist[] = {
|
|||
{LDAP_IS_LEAF, "Entry is a leaf" },
|
||||
{LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem" },
|
||||
|
||||
{LDAP_PROXY_AUTHZ_FAILURE, "Proxy Authorization Failure" },
|
||||
{LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication" },
|
||||
{LDAP_INVALID_CREDENTIALS, "Invalid credentials" },
|
||||
{LDAP_INSUFFICIENT_ACCESS, "Insufficient access" },
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/* OpenLDAP Filter API Test */
|
||||
|
|
@ -76,7 +76,7 @@ main( int argc, char *argv[] )
|
|||
static int filter2ber( char *filter )
|
||||
{
|
||||
int rc;
|
||||
struct berval *bv = NULL;
|
||||
struct berval bv = {0};
|
||||
BerElement *ber;
|
||||
|
||||
printf( "Filter: %s\n", filter );
|
||||
|
|
@ -93,17 +93,16 @@ static int filter2ber( char *filter )
|
|||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
rc = ber_flatten( ber, &bv );
|
||||
rc = ber_flatten2( ber, &bv, 0 );
|
||||
if( rc < 0 ) {
|
||||
perror( "ber_flatten" );
|
||||
perror( "ber_flatten2" );
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
printf( "BER encoding (len=%ld):\n", (long) bv->bv_len );
|
||||
ber_bprint( bv->bv_val, bv->bv_len );
|
||||
printf( "BER encoding (len=%ld):\n", (long) bv.bv_len );
|
||||
ber_bprint( bv.bv_val, bv.bv_len );
|
||||
|
||||
ber_free( ber, 0 );
|
||||
ber_bvfree( bv );
|
||||
ber_free( ber, 1 );
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -147,6 +147,10 @@ SOURCE=.\cache.c
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\cancel.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\charray.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -283,6 +287,10 @@ SOURCE=".\os-ip.c"
|
|||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\passwd.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\include\portable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
|
@ -357,5 +365,9 @@ SOURCE=".\util-int.c"
|
|||
|
||||
SOURCE=.\vlvctrl.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\whoami.c
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
|
|
|
|||
Loading…
Reference in a new issue