mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
unifdef -DLDAP_NOCACHE
This commit is contained in:
parent
db427d725d
commit
4b3396f5fd
@ -133,8 +133,6 @@ dnl General "enable" options
|
||||
OL_ARG_ENABLE(debug,[ --enable-debug enable debugging], yes)dnl
|
||||
OL_ARG_ENABLE(syslog,[ --enable-syslog enable syslog support], auto)dnl
|
||||
OL_ARG_ENABLE(proctitle,[ --enable-proctitle enable proctitle support], yes)dnl
|
||||
dnl OL_ARG_ENABLE(cache,[ --enable-cache enable caching (experimental)], no)dnl
|
||||
ol_enable_cache=${ol_enable_cache-no}
|
||||
dnl OL_ARG_ENABLE(referrals,[ --enable-referrals enable LDAPv2+ Referrals (experimental)], no)dnl
|
||||
ol_enable_referrals=${ol_enable_referrals-no}
|
||||
dnl OL_ARG_ENABLE(kbind,[ --enable-kbind enable LDAPv2+ Kerberos IV bind (deprecated)], no)dnl
|
||||
@ -2544,10 +2542,6 @@ if test "$ol_enable_syslog" = yes ; then
|
||||
AC_DEFINE(LDAP_SYSLOG,1,
|
||||
[define this to add syslog code])
|
||||
fi
|
||||
if test "$ol_enable_cache" = no ; then
|
||||
AC_DEFINE(LDAP_NOCACHE,1,
|
||||
[define this to remove -lldap cache support])
|
||||
fi
|
||||
if test "$ol_link_kbind" != no ; then
|
||||
AC_DEFINE(LDAP_API_FEATURE_X_OPENLDAP_V2_KBIND,LDAP_VENDOR_VERSION)
|
||||
fi
|
||||
|
@ -888,31 +888,6 @@ ldap_kerberos_bind2_s LDAP_P(( /* deprecated */
|
||||
LDAP *ld,
|
||||
LDAP_CONST char *who ));
|
||||
|
||||
/*
|
||||
* in cache.c
|
||||
* (deprecated)
|
||||
*/
|
||||
LDAP_F( int )
|
||||
ldap_enable_cache LDAP_P(( LDAP *ld, long timeout, ber_len_t maxmem ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_disable_cache LDAP_P(( LDAP *ld ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_set_cache_options LDAP_P(( LDAP *ld, unsigned long opts ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_destroy_cache LDAP_P(( LDAP *ld ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_flush_cache LDAP_P(( LDAP *ld ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_uncache_entry LDAP_P(( LDAP *ld, LDAP_CONST char *dn ));
|
||||
|
||||
LDAP_F( void )
|
||||
ldap_uncache_request LDAP_P(( LDAP *ld, int msgid ));
|
||||
|
||||
|
||||
/*
|
||||
* LDAP Cancel Extended Operation <draft-zeilenga-ldap-cancel-xx.txt>
|
||||
|
@ -905,9 +905,6 @@
|
||||
/* define this to add syslog code */
|
||||
#undef LDAP_SYSLOG
|
||||
|
||||
/* define this to remove -lldap cache support */
|
||||
#undef LDAP_NOCACHE
|
||||
|
||||
/* define this for LDAP process title support */
|
||||
#undef LDAP_PROCTITLE
|
||||
|
||||
|
@ -10,7 +10,7 @@ PROGRAMS = apitest dntest ftest ltest
|
||||
|
||||
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 \
|
||||
modify.c add.c modrdn.c delete.c abandon.c \
|
||||
sasl.c sbind.c kbind.c unbind.c cancel.c \
|
||||
filter.c free.c sort.c passwd.c whoami.c \
|
||||
getdn.c getentry.c getattr.c getvalues.c addentry.c \
|
||||
@ -19,7 +19,7 @@ SRCS = bind.c open.c result.c error.c compare.c search.c \
|
||||
charray.c tls.c os-local.c dnssrv.c utf-8.c utf-8-conv.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 \
|
||||
modify.lo add.lo modrdn.lo delete.lo abandon.lo \
|
||||
sasl.lo sbind.lo kbind.lo unbind.lo cancel.lo \
|
||||
filter.lo free.lo sort.lo passwd.lo whoami.lo \
|
||||
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
|
||||
|
@ -1,816 +0,0 @@
|
||||
/* $OpenLDAP$ */
|
||||
/*
|
||||
* Copyright 1998-2003 The OpenLDAP Foundation, All Rights Reserved.
|
||||
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
||||
*/
|
||||
/* Portions
|
||||
* Copyright (c) 1993 The Regents of the University of Michigan.
|
||||
* All rights reserved.
|
||||
*
|
||||
* cache.c - local caching support for LDAP
|
||||
*/
|
||||
|
||||
#include "portable.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <ac/stdlib.h>
|
||||
|
||||
#include <ac/socket.h>
|
||||
#include <ac/string.h>
|
||||
#include <ac/time.h>
|
||||
|
||||
#include "ldap-int.h"
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
|
||||
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, LDAP_CONST char *dn ));
|
||||
static ber_len_t 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, LDAP_CONST char *dn, ber_int_t msgid ));
|
||||
|
||||
#endif
|
||||
|
||||
int
|
||||
ldap_enable_cache( LDAP *ld, long timeout, ber_len_t maxmem )
|
||||
{
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache == NULL ) {
|
||||
if (( ld->ld_cache = (LDAPCache *)LDAP_MALLOC( sizeof( LDAPCache )))
|
||||
== NULL ) {
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
return( -1 );
|
||||
}
|
||||
(void) memset( ld->ld_cache, '\0', sizeof( LDAPCache ));
|
||||
ld->ld_cache->lc_memused = sizeof( LDAPCache );
|
||||
}
|
||||
|
||||
ld->ld_cache->lc_timeout = timeout;
|
||||
ld->ld_cache->lc_maxmem = maxmem;
|
||||
check_cache_memused( ld->ld_cache );
|
||||
ld->ld_cache->lc_enabled = 1;
|
||||
return( 0 );
|
||||
#else
|
||||
return( -1 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_disable_cache( LDAP *ld )
|
||||
{
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ld->ld_cache->lc_enabled = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
ldap_set_cache_options( LDAP *ld, unsigned long opts )
|
||||
{
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ld->ld_cache->lc_options = opts;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_destroy_cache( LDAP *ld )
|
||||
{
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ldap_flush_cache( ld );
|
||||
LDAP_FREE( (char *)ld->ld_cache );
|
||||
ld->ld_cache = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_flush_cache( LDAP *ld )
|
||||
{
|
||||
#ifndef LDAP_NOCACHE
|
||||
int i;
|
||||
LDAPMessage *m, *next;
|
||||
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, ENTRY, "ldap_flush_cache\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
/* delete all requests in the queue */
|
||||
for ( m = ld->ld_cache->lc_requests; m != NULL; m = next ) {
|
||||
next = m->lm_next;
|
||||
ldap_msgfree( m );
|
||||
}
|
||||
ld->ld_cache->lc_requests = NULL;
|
||||
|
||||
/* delete all messages in the cache */
|
||||
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
|
||||
for ( m = ld->ld_cache->lc_buckets[ i ];
|
||||
m != NULL; m = next ) {
|
||||
next = m->lm_next;
|
||||
ldap_msgfree( m );
|
||||
}
|
||||
ld->ld_cache->lc_buckets[ i ] = NULL;
|
||||
}
|
||||
ld->ld_cache->lc_memused = sizeof( LDAPCache );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_uncache_request( LDAP *ld, int msgid )
|
||||
{
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
#ifdef NEW_LOGGING
|
||||
|
||||
LDAP_LOG ( CACHE, ARGS, "ldap_uncache_request %d ld_cache %lx\n",
|
||||
msgid, (long) ld->ld_cache, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_request %d ld_cache %lx\n",
|
||||
msgid, (long) ld->ld_cache, 0 );
|
||||
#endif
|
||||
|
||||
uncache_entry_or_req( ld, NULL, msgid );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_uncache_entry( LDAP *ld, LDAP_CONST char *dn )
|
||||
{
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
assert( dn != NULL );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
#ifdef NEW_LOGGING
|
||||
|
||||
LDAP_LOG ( CACHE, ARGS, "ldap_uncache_entry %s ld_cache %lx\n",
|
||||
dn, (long) ld->ld_cache, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_uncache_entry %s ld_cache %lx\n",
|
||||
dn, (long) ld->ld_cache, 0 );
|
||||
#endif
|
||||
|
||||
uncache_entry_or_req( ld, dn, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
|
||||
static void
|
||||
uncache_entry_or_req( LDAP *ld,
|
||||
const char *dn, /* if non-NULL, uncache entry */
|
||||
ber_int_t msgid ) /* request to uncache (if dn == NULL) */
|
||||
{
|
||||
int i;
|
||||
LDAPMessage *m, *prev, *next;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
||||
LDAP_LOG ( CACHE, ARGS,
|
||||
"uncache_entry_or_req dn %s msgid %ld ld_cache %lx\n",
|
||||
dn, (long) msgid, (long) ld->ld_cache );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"ldap_uncache_entry_or_req dn %s msgid %ld ld_cache %lx\n",
|
||||
dn, (long) msgid, (long) ld->ld_cache );
|
||||
#endif
|
||||
|
||||
if ( ld->ld_cache == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* first check the request queue */
|
||||
prev = NULL;
|
||||
for ( m = ld->ld_cache->lc_requests; m != NULL; m = next ) {
|
||||
next = m->lm_next;
|
||||
if (( dn != NULL && chain_contains_dn( m, dn )) ||
|
||||
( dn == NULL && m->lm_msgid == msgid )) {
|
||||
if ( prev == NULL ) {
|
||||
ld->ld_cache->lc_requests = next;
|
||||
} else {
|
||||
prev->lm_next = next;
|
||||
}
|
||||
ld->ld_cache->lc_memused -= msg_size( m );
|
||||
ldap_msgfree( m );
|
||||
} else {
|
||||
prev = m;
|
||||
}
|
||||
}
|
||||
|
||||
/* now check the rest of the cache */
|
||||
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
|
||||
prev = NULL;
|
||||
for ( m = ld->ld_cache->lc_buckets[ i ]; m != NULL;
|
||||
m = next ) {
|
||||
next = m->lm_next;
|
||||
if (( dn != NULL && chain_contains_dn( m, dn )) ||
|
||||
( dn == NULL && m->lm_msgid == msgid )) {
|
||||
if ( prev == NULL ) {
|
||||
ld->ld_cache->lc_buckets[ i ] = next;
|
||||
} else {
|
||||
prev->lm_next = next;
|
||||
}
|
||||
ld->ld_cache->lc_memused -= msg_size( m );
|
||||
ldap_msgfree( m );
|
||||
} else {
|
||||
prev = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
ldap_add_request_to_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
|
||||
{
|
||||
#ifndef LDAP_NOCACHE
|
||||
LDAPMessage *new;
|
||||
ber_len_t len;
|
||||
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, ENTRY, "ldap_add_request_to_cache\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
if ( ld->ld_cache == NULL ||
|
||||
( ld->ld_cache->lc_enabled == 0 )) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (( new = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) ))
|
||||
!= NULL ) {
|
||||
if (( new->lm_ber = ldap_alloc_ber_with_options( ld )) == NULL ) {
|
||||
LDAP_FREE( (char *)new );
|
||||
return;
|
||||
}
|
||||
len = request->ber_ptr - request->ber_buf;
|
||||
if (( new->lm_ber->ber_buf = (char *) ber_memalloc( (size_t)len ))
|
||||
== NULL ) {
|
||||
ber_free( new->lm_ber, 0 );
|
||||
LDAP_FREE( (char *)new );
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
return;
|
||||
}
|
||||
AC_MEMCPY( new->lm_ber->ber_buf, request->ber_buf,
|
||||
(size_t)len );
|
||||
new->lm_ber->ber_ptr = new->lm_ber->ber_buf;
|
||||
new->lm_ber->ber_end = new->lm_ber->ber_buf + len;
|
||||
new->lm_msgid = ld->ld_msgid;
|
||||
new->lm_msgtype = msgtype;;
|
||||
new->lm_next = ld->ld_cache->lc_requests;
|
||||
ld->ld_cache->lc_requests = new;
|
||||
} else {
|
||||
ld->ld_errno = LDAP_NO_MEMORY;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ldap_add_result_to_cache( LDAP *ld, LDAPMessage *result )
|
||||
{
|
||||
#ifndef LDAP_NOCACHE
|
||||
LDAPMessage *m, **mp, *req, *new, *prev;
|
||||
int err, keep;
|
||||
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
assert( result != NULL );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
|
||||
LDAP_LOG ( CACHE, ARGS,
|
||||
"ldap_add_result_to_cache: id %ld, type %ld\n",
|
||||
(long) result->lm_msgid, (long) result->lm_msgtype, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %ld, type %ld\n",
|
||||
(long) result->lm_msgid, (long) result->lm_msgtype, 0 );
|
||||
#endif
|
||||
|
||||
if ( ld->ld_cache == NULL ||
|
||||
( ld->ld_cache->lc_enabled == 0 )) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1,
|
||||
"ldap_add_result_to_cache: cache disabled\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
if ( result->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
|
||||
result->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
|
||||
result->lm_msgtype != LDAP_RES_SEARCH_RESULT &&
|
||||
result->lm_msgtype != LDAP_RES_COMPARE ) {
|
||||
/*
|
||||
* only cache search and compare operations
|
||||
*/
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1,
|
||||
"ldap_add_result_to_cache: only caching search & "
|
||||
"compare operations\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"artc: only caching search & compare operations\n", 0, 0, 0 );
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* if corresponding request is in the lc_requests list, add this
|
||||
* result to it. if this result completes the results for the
|
||||
* request, add the request/result chain to the cache proper.
|
||||
*/
|
||||
prev = NULL;
|
||||
for ( m = ld->ld_cache->lc_requests; m != NULL; m = m->lm_next ) {
|
||||
if ( m->lm_msgid == result->lm_msgid ) {
|
||||
break;
|
||||
}
|
||||
prev = m;
|
||||
}
|
||||
|
||||
if ( m != NULL ) { /* found request; add to end of chain */
|
||||
req = m;
|
||||
for ( ; m->lm_chain != NULL; m = m->lm_chain )
|
||||
;
|
||||
if (( new = msg_dup( result )) != NULL ) {
|
||||
new->lm_chain = NULL;
|
||||
m->lm_chain = new;
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, RESULTS,
|
||||
"ldap_add_result_to_cache: "
|
||||
"result added to cache request chain\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"artc: result added to cache request chain\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
if ( result->lm_msgtype == LDAP_RES_SEARCH_RESULT ||
|
||||
result->lm_msgtype == LDAP_RES_COMPARE ) {
|
||||
/*
|
||||
* this result completes the chain of results
|
||||
* add to cache proper if appropriate
|
||||
*/
|
||||
keep = 0; /* pessimistic */
|
||||
err = ldap_result2error( ld, result, 0 );
|
||||
if ( err == LDAP_SUCCESS ||
|
||||
( result->lm_msgtype == LDAP_RES_COMPARE &&
|
||||
( err == LDAP_COMPARE_FALSE ||
|
||||
err == LDAP_COMPARE_TRUE ||
|
||||
err == LDAP_NO_SUCH_ATTRIBUTE ))) {
|
||||
keep = 1;
|
||||
}
|
||||
|
||||
if ( ld->ld_cache->lc_options == 0 ) {
|
||||
if ( err == LDAP_SIZELIMIT_EXCEEDED ) {
|
||||
keep = 1;
|
||||
}
|
||||
} else if (( ld->ld_cache->lc_options &
|
||||
LDAP_CACHE_OPT_CACHEALLERRS ) != 0 ) {
|
||||
keep = 1;
|
||||
}
|
||||
|
||||
if ( prev == NULL ) {
|
||||
ld->ld_cache->lc_requests = req->lm_next;
|
||||
} else {
|
||||
prev->lm_next = req->lm_next;
|
||||
}
|
||||
|
||||
if ( !keep ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, RESULTS,
|
||||
"ldap_add_result_to_cache: "
|
||||
"not caching result with error\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"artc: not caching result with error %d\n",
|
||||
err, 0, 0 );
|
||||
#endif
|
||||
ldap_msgfree( req );
|
||||
} else {
|
||||
mp = &ld->ld_cache->lc_buckets[
|
||||
cache_hash( req->lm_ber ) ];
|
||||
req->lm_next = *mp;
|
||||
*mp = req;
|
||||
req->lm_time = (long) time( NULL );
|
||||
ld->ld_cache->lc_memused += msg_size( req );
|
||||
check_cache_memused( ld->ld_cache );
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, RESULTS,
|
||||
"ldap_add_result_to_cache: "
|
||||
"cached result with error\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"artc: cached result with error %d\n",
|
||||
err, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, RESULTS,
|
||||
"ldap_add_result_to_cache: msgid not in request list\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "artc: msgid not in request list\n",
|
||||
0, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* look in the cache for this request
|
||||
* return 0 if found, -1 if not
|
||||
* if found, the corresponding result messages are added to the incoming
|
||||
* queue with the correct (new) msgid so that subsequent ldap_result calls
|
||||
* will find them.
|
||||
*/
|
||||
int
|
||||
ldap_check_cache( LDAP *ld, ber_tag_t msgtype, BerElement *request )
|
||||
{
|
||||
#ifndef LDAP_NOCACHE
|
||||
LDAPMessage *m, *new, *prev, *next;
|
||||
BerElement reqber;
|
||||
int first, hash;
|
||||
time_t c_time;
|
||||
|
||||
assert( ld != NULL );
|
||||
assert( LDAP_VALID( ld ) );
|
||||
assert( request != NULL );
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, ENTRY, "ldap_check_cache\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
|
||||
#endif
|
||||
|
||||
if ( ld->ld_cache == NULL ||
|
||||
( ld->ld_cache->lc_enabled == 0 )) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
memset( &reqber, '\0', sizeof(reqber) );
|
||||
reqber.ber_valid = LBER_VALID_BERELEMENT;
|
||||
reqber.ber_buf = reqber.ber_ptr = request->ber_buf;
|
||||
reqber.ber_end = request->ber_ptr;
|
||||
reqber.ber_debug = ber_int_debug;
|
||||
|
||||
c_time = time( NULL );
|
||||
|
||||
prev = NULL;
|
||||
hash = cache_hash( &reqber );
|
||||
for ( m = ld->ld_cache->lc_buckets[ hash ]; m != NULL; m = next ) {
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1,
|
||||
"ldap_check_cache: examining id %ld, type %ld\n",
|
||||
(long) m->lm_msgid, (long) m->lm_msgtype, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,"cc: examining id %ld,type %ld\n",
|
||||
(long) m->lm_msgid, (long) m->lm_msgtype, 0 );
|
||||
#endif
|
||||
if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
|
||||
/* delete expired message */
|
||||
next = m->lm_next;
|
||||
if ( prev == NULL ) {
|
||||
ld->ld_cache->lc_buckets[ hash ] = next;
|
||||
} else {
|
||||
prev->lm_next = next;
|
||||
}
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1, "ldap_check_cache: expired id %ld\n",
|
||||
(long) m->lm_msgid, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "cc: expired id %d\n",
|
||||
m->lm_msgid, 0, 0 );
|
||||
#endif
|
||||
ld->ld_cache->lc_memused -= msg_size( m );
|
||||
ldap_msgfree( m );
|
||||
} else {
|
||||
if ( m->lm_msgtype == msgtype &&
|
||||
request_cmp( m->lm_ber, &reqber ) == 0 ) {
|
||||
break;
|
||||
}
|
||||
next = m->lm_next;
|
||||
prev = m;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m == NULL ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/*
|
||||
* add duplicates of responses to incoming queue
|
||||
*/
|
||||
first = 1;
|
||||
for ( m = m->lm_chain; m != NULL; m = m->lm_chain ) {
|
||||
if (( new = msg_dup( m )) == NULL ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
new->lm_msgid = ld->ld_msgid;
|
||||
new->lm_chain = NULL;
|
||||
if ( first ) {
|
||||
new->lm_next = ld->ld_responses;
|
||||
ld->ld_responses = new;
|
||||
first = 0;
|
||||
} else {
|
||||
prev->lm_chain = new;
|
||||
}
|
||||
prev = new;
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1, "ldap_check_cache: added type %ld\n",
|
||||
(long) m->lm_msgtype, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "cc: added type %ld\n",
|
||||
(long) new->lm_msgtype, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, RESULTS,
|
||||
"ldap_check_cache: result returned from cache\n", 0, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "cc: result returned from cache\n", 0, 0, 0 );
|
||||
#endif
|
||||
return( 0 );
|
||||
#else
|
||||
return( -1 );
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
|
||||
static int
|
||||
cache_hash( BerElement *ber )
|
||||
{
|
||||
BerElement bercpy;
|
||||
ber_len_t len;
|
||||
|
||||
/*
|
||||
* just take the length of the packet and mod with # of buckets
|
||||
*/
|
||||
bercpy = *ber;
|
||||
if ( ber_skip_tag( &bercpy, &len ) == LBER_ERROR
|
||||
|| ber_scanf( &bercpy, "x" ) == LBER_ERROR ) {
|
||||
len = 0; /* punt: just return zero */
|
||||
} else {
|
||||
len = bercpy.ber_end - bercpy.ber_ptr;
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, RESULTS, "cache_hash: len is %ld, returning %ld\n",
|
||||
len, len % LDAP_CACHE_BUCKETS, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "cache_hash: len is %ld, returning %ld\n",
|
||||
len, len % LDAP_CACHE_BUCKETS, 0 );
|
||||
#endif
|
||||
return( (int) ( len % LDAP_CACHE_BUCKETS ));
|
||||
}
|
||||
|
||||
|
||||
static LDAPMessage *
|
||||
msg_dup( LDAPMessage *msg )
|
||||
{
|
||||
LDAPMessage *new;
|
||||
ber_len_t len;
|
||||
|
||||
if (( new = (LDAPMessage *)LDAP_MALLOC( sizeof(LDAPMessage))) != NULL ) {
|
||||
*new = *msg; /* struct copy */
|
||||
if (( new->lm_ber = ber_dup( msg->lm_ber )) == NULL ) {
|
||||
LDAP_FREE( (char *)new );
|
||||
return( NULL );
|
||||
}
|
||||
len = msg->lm_ber->ber_end - msg->lm_ber->ber_buf;
|
||||
if (( new->lm_ber->ber_buf = (char *) ber_memalloc(
|
||||
(size_t)len )) == NULL ) {
|
||||
ber_free( new->lm_ber, 0 );
|
||||
LDAP_FREE( (char *)new );
|
||||
return( NULL );
|
||||
}
|
||||
AC_MEMCPY( new->lm_ber->ber_buf, msg->lm_ber->ber_buf,
|
||||
(size_t)len );
|
||||
new->lm_ber->ber_ptr = new->lm_ber->ber_buf +
|
||||
( msg->lm_ber->ber_ptr - msg->lm_ber->ber_buf );
|
||||
new->lm_ber->ber_end = new->lm_ber->ber_buf + len;
|
||||
}
|
||||
|
||||
return( new );
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
request_cmp( BerElement *req1, BerElement *req2 )
|
||||
{
|
||||
ber_len_t len;
|
||||
BerElement r1, r2;
|
||||
|
||||
r1 = *req1; /* struct copies */
|
||||
r2 = *req2;
|
||||
|
||||
/*
|
||||
* skip the enclosing tags (sequence markers) and the msg ids
|
||||
*/
|
||||
if ( ber_skip_tag( &r1, &len ) == LBER_ERROR || ber_scanf( &r1, "x" )
|
||||
== LBER_ERROR ) {
|
||||
return( -1 );
|
||||
}
|
||||
if ( ber_skip_tag( &r2, &len ) == LBER_ERROR || ber_scanf( &r2, "x" )
|
||||
== LBER_ERROR ) {
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
/*
|
||||
* check remaining length and bytes if necessary
|
||||
*/
|
||||
if (( len = r1.ber_end - r1.ber_ptr ) !=
|
||||
(ber_len_t) (r2.ber_end - r2.ber_ptr) )
|
||||
{
|
||||
return( -1 ); /* different lengths */
|
||||
}
|
||||
return( memcmp( r1.ber_ptr, r2.ber_ptr, (size_t)len ));
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
chain_contains_dn( LDAPMessage *msg, const char *dn )
|
||||
{
|
||||
LDAPMessage *m;
|
||||
BerElement ber;
|
||||
ber_int_t msgid;
|
||||
char *s;
|
||||
int rc;
|
||||
|
||||
|
||||
/*
|
||||
* first check the base or dn of the request
|
||||
*/
|
||||
ber = *msg->lm_ber; /* struct copy */
|
||||
if ( ber_scanf( &ber, "{i{a" /*}}*/, &msgid, &s ) != LBER_ERROR ) {
|
||||
rc = ( strcasecmp( dn, s ) == 0 ) ? 1 : 0;
|
||||
LDAP_FREE( s );
|
||||
if ( rc != 0 ) {
|
||||
return( rc );
|
||||
}
|
||||
}
|
||||
|
||||
if ( msg->lm_msgtype == LDAP_REQ_COMPARE ) {
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* now check the dn of each search result
|
||||
*/
|
||||
rc = 0;
|
||||
for ( m = msg->lm_chain; m != NULL && rc == 0 ; m = m->lm_chain ) {
|
||||
if ( m->lm_msgtype != LDAP_RES_SEARCH_ENTRY ) {
|
||||
continue;
|
||||
}
|
||||
ber = *m->lm_ber; /* struct copy */
|
||||
if ( ber_scanf( &ber, "{a" /*}*/, &s ) != LBER_ERROR ) {
|
||||
rc = ( strcasecmp( dn, s ) == 0 ) ? 1 : 0;
|
||||
LDAP_FREE( s );
|
||||
}
|
||||
}
|
||||
|
||||
return( rc );
|
||||
}
|
||||
|
||||
|
||||
static ber_len_t
|
||||
msg_size( LDAPMessage *msg )
|
||||
{
|
||||
LDAPMessage *m;
|
||||
ber_len_t size;
|
||||
|
||||
size = 0;
|
||||
for ( m = msg; m != NULL; m = m->lm_chain ) {
|
||||
size += ( sizeof( LDAPMessage ) + m->lm_ber->ber_end -
|
||||
m->lm_ber->ber_buf );
|
||||
}
|
||||
|
||||
return( size );
|
||||
}
|
||||
|
||||
|
||||
#define THRESHOLD_FACTOR 3 / 4
|
||||
#define SIZE_FACTOR 2 / 3
|
||||
|
||||
static void
|
||||
check_cache_memused( LDAPCache *lc )
|
||||
{
|
||||
/*
|
||||
* this routine is called to check if the cache is too big (lc_maxmem >
|
||||
* minimum cache size and lc_memused > lc_maxmem). If too big, it reduces
|
||||
* the cache size to < SIZE_FACTOR * lc_maxmem. The algorithm is as follows:
|
||||
* remove_threshold = lc_timeout seconds;
|
||||
* do {
|
||||
* remove everything older than remove_threshold seconds;
|
||||
* remove_threshold = remove_threshold * THRESHOLD_FACTOR;
|
||||
* } while ( cache size is > SIZE_FACTOR * lc_maxmem )
|
||||
*/
|
||||
int i;
|
||||
unsigned long remove_threshold;
|
||||
time_t c_time;
|
||||
LDAPMessage *m, *prev, *next;
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1,
|
||||
"check_cache_memused: %ld bytes in use (%ld max)\n",
|
||||
lc->lc_memused, lc->lc_maxmem, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "check_cache_memused: %ld bytes in use (%ld max)\n",
|
||||
lc->lc_memused, lc->lc_maxmem, 0 );
|
||||
#endif
|
||||
|
||||
if ( (unsigned) lc->lc_maxmem <= sizeof( LDAPCache )
|
||||
|| lc->lc_memused <= lc->lc_maxmem * SIZE_FACTOR ) {
|
||||
return;
|
||||
}
|
||||
|
||||
remove_threshold = lc->lc_timeout;
|
||||
while ( lc->lc_memused > lc->lc_maxmem * SIZE_FACTOR ) {
|
||||
c_time = time( NULL );
|
||||
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
|
||||
prev = NULL;
|
||||
for ( m = lc->lc_buckets[ i ]; m != NULL;
|
||||
m = next ) {
|
||||
next = m->lm_next;
|
||||
if ( difftime(c_time, m->lm_time) > remove_threshold) {
|
||||
if ( prev == NULL ) {
|
||||
lc->lc_buckets[ i ] = next;
|
||||
} else {
|
||||
prev->lm_next = next;
|
||||
}
|
||||
lc->lc_memused -= msg_size( m );
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1,
|
||||
"check_cache_memused: removed %ld\n", m->lm_msgid,0,0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE,
|
||||
"ccm: removed %d\n",
|
||||
m->lm_msgid, 0, 0 );
|
||||
#endif
|
||||
ldap_msgfree( m );
|
||||
} else {
|
||||
prev = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
remove_threshold *= THRESHOLD_FACTOR;
|
||||
}
|
||||
|
||||
#ifdef NEW_LOGGING
|
||||
LDAP_LOG ( CACHE, DETAIL1,
|
||||
"check_cache_memused: reduced usage to %ld bytes\n",
|
||||
lc->lc_memused, 0, 0 );
|
||||
#else
|
||||
Debug( LDAP_DEBUG_TRACE, "ccm: reduced usage to %ld bytes\n",
|
||||
lc->lc_memused, 0, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !NO_CACHE */
|
@ -97,17 +97,6 @@ ldap_compare_ext(
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
if ( ldap_check_cache( ld, LDAP_REQ_COMPARE, ber ) == 0 ) {
|
||||
ber_free( ber, 1 );
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
*msgidp = ld->ld_msgid;
|
||||
return( ld->ld_errno );
|
||||
}
|
||||
ldap_add_request_to_cache( ld, LDAP_REQ_COMPARE, ber );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
|
||||
/* send the message */
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_COMPARE, dn, ber );
|
||||
|
@ -101,11 +101,6 @@ ldap_kerberos_bind1( LDAP *ld, LDAP_CONST char *dn )
|
||||
|
||||
LDAP_FREE( cred );
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ldap_flush_cache( ld );
|
||||
}
|
||||
#endif /* !LDAP_NOCACHE */
|
||||
|
||||
/* send the message */
|
||||
return ( ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber ));
|
||||
|
@ -811,11 +811,6 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
|
||||
new->lm_msgtype = tag;
|
||||
new->lm_ber = ber;
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ldap_add_result_to_cache( ld, new );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
|
||||
/* is this the one we're looking for? */
|
||||
if ( msgid == LDAP_RES_ANY || id == msgid ) {
|
||||
@ -883,18 +878,7 @@ lr->lr_res_matched ? lr->lr_res_matched : "" );
|
||||
prev->lm_next = l->lm_next;
|
||||
*result = l;
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
#ifdef LDAP_WORLD_P16
|
||||
/*
|
||||
* XXX questionable fix; see text for [P16] on
|
||||
* http://www.critical-angle.com/ldapworld/patch/
|
||||
*
|
||||
* inclusion of this patch causes searchs to hang on
|
||||
* multiple platforms
|
||||
*/
|
||||
return( l->lm_msgtype );
|
||||
#else /* LDAP_WORLD_P16 */
|
||||
return( tag );
|
||||
#endif /* !LDAP_WORLD_P16 */
|
||||
}
|
||||
|
||||
leave:
|
||||
|
@ -138,11 +138,6 @@ ldap_sasl_bind(
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ldap_flush_cache( ld );
|
||||
}
|
||||
#endif /* !LDAP_NOCACHE */
|
||||
|
||||
/* send the message */
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_BIND, dn, ber );
|
||||
|
@ -98,17 +98,6 @@ ldap_search_ext(
|
||||
return ld->ld_errno;
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
if ( ldap_check_cache( ld, LDAP_REQ_SEARCH, ber ) == 0 ) {
|
||||
ber_free( ber, 1 );
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
*msgidp = ld->ld_msgid;
|
||||
return ld->ld_errno;
|
||||
}
|
||||
ldap_add_request_to_cache( ld, LDAP_REQ_SEARCH, ber );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
|
||||
/* send the message */
|
||||
*msgidp = ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber );
|
||||
@ -199,16 +188,6 @@ ldap_search(
|
||||
return( -1 );
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
if ( ldap_check_cache( ld, LDAP_REQ_SEARCH, ber ) == 0 ) {
|
||||
ber_free( ber, 1 );
|
||||
ld->ld_errno = LDAP_SUCCESS;
|
||||
return( ld->ld_msgid );
|
||||
}
|
||||
ldap_add_request_to_cache( ld, LDAP_REQ_SEARCH, ber );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
|
||||
/* send the message */
|
||||
return ( ldap_send_initial_request( ld, LDAP_REQ_SEARCH, base, ber ));
|
||||
|
@ -47,8 +47,6 @@ static void print_ldap_result LDAP_P(( LDAP *ld, LDAPMessage *lm,
|
||||
static void print_search_entry LDAP_P(( LDAP *ld, LDAPMessage *res ));
|
||||
static void free_list LDAP_P(( char **list ));
|
||||
|
||||
#define NOCACHEERRMSG "don't compile with -DLDAP_NOCACHE if you desire local caching"
|
||||
|
||||
static char *dnsuffix;
|
||||
|
||||
#ifndef HAVE_GETLINE
|
||||
@ -646,39 +644,6 @@ main( int argc, char **argv )
|
||||
strcpy( dnsuffix, line );
|
||||
break;
|
||||
|
||||
case 'e': /* enable cache */
|
||||
#ifdef LDAP_NOCACHE
|
||||
printf( NOCACHEERRMSG );
|
||||
#else /* LDAP_NOCACHE */
|
||||
getline( line, sizeof(line), stdin, "Cache timeout (secs)? " );
|
||||
i = atoi( line );
|
||||
getline( line, sizeof(line), stdin, "Maximum memory to use (bytes)? " );
|
||||
if ( ldap_enable_cache( ld, i, atoi( line )) == 0 ) {
|
||||
printf( "local cache is on\n" );
|
||||
} else {
|
||||
printf( "ldap_enable_cache failed\n" );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
break;
|
||||
|
||||
case 'x': /* uncache entry */
|
||||
#ifdef LDAP_NOCACHE
|
||||
printf( NOCACHEERRMSG );
|
||||
#else /* LDAP_NOCACHE */
|
||||
getline( line, sizeof(line), stdin, "DN? " );
|
||||
ldap_uncache_entry( ld, line );
|
||||
#endif /* LDAP_NOCACHE */
|
||||
break;
|
||||
|
||||
case 'X': /* uncache request */
|
||||
#ifdef LDAP_NOCACHE
|
||||
printf( NOCACHEERRMSG );
|
||||
#else /* LDAP_NOCACHE */
|
||||
getline( line, sizeof(line), stdin, "request msgid? " );
|
||||
ldap_uncache_request( ld, atoi( line ));
|
||||
#endif /* LDAP_NOCACHE */
|
||||
break;
|
||||
|
||||
case 'o': /* set ldap options */
|
||||
getline( line, sizeof(line), stdin, "alias deref (0=never, 1=searching, 2=finding, 3=always)?" );
|
||||
ld->ld_deref = atoi( line );
|
||||
@ -701,39 +666,16 @@ main( int argc, char **argv )
|
||||
}
|
||||
break;
|
||||
|
||||
case 'O': /* set cache options */
|
||||
#ifdef LDAP_NOCACHE
|
||||
printf( NOCACHEERRMSG );
|
||||
#else /* LDAP_NOCACHE */
|
||||
getline( line, sizeof(line), stdin, "cache errors (0=smart, 1=never, 2=always)?" );
|
||||
switch( atoi( line )) {
|
||||
case 0:
|
||||
ldap_set_cache_options( ld, 0 );
|
||||
break;
|
||||
case 1:
|
||||
ldap_set_cache_options( ld,
|
||||
LDAP_CACHE_OPT_CACHENOERRS );
|
||||
break;
|
||||
case 2:
|
||||
ldap_set_cache_options( ld,
|
||||
LDAP_CACHE_OPT_CACHEALLERRS );
|
||||
break;
|
||||
default:
|
||||
printf( "not a valid cache option\n" );
|
||||
}
|
||||
#endif /* LDAP_NOCACHE */
|
||||
break;
|
||||
|
||||
case '?': /* help */
|
||||
printf( "Commands: [ad]d [ab]andon [b]ind\n" );
|
||||
printf( " [B]ind async [c]ompare\n" );
|
||||
printf( " [modi]fy [modr]dn [rem]ove\n" );
|
||||
printf( " [res]ult [s]earch [q]uit/unbind\n\n" );
|
||||
printf( " [d]ebug [e]nable cache set ms[g]id\n" );
|
||||
printf( " d[n]suffix [t]imeout [v]ersion\n" );
|
||||
printf( " [?]help [o]ptions [O]cache options\n" );
|
||||
printf( " [E]xplode dn [p]arse LDAP URL\n" );
|
||||
printf( " [x]uncache entry [X]uncache request\n" );
|
||||
printf(
|
||||
"Commands: [ad]d [ab]andon [b]ind\n"
|
||||
" [B]ind async [c]ompare\n"
|
||||
" [modi]fy [modr]dn [rem]ove\n"
|
||||
" [res]ult [s]earch [q]uit/unbind\n\n"
|
||||
" [d]ebug set ms[g]id\n"
|
||||
" d[n]suffix [t]imeout [v]ersion\n"
|
||||
" [?]help [o]ptions"
|
||||
" [E]xplode dn [p]arse LDAP URL\n" );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -93,12 +93,6 @@ ldap_ld_free(
|
||||
ldap_msgfree( lm );
|
||||
}
|
||||
|
||||
#ifndef LDAP_NOCACHE
|
||||
if ( ld->ld_cache != NULL ) {
|
||||
ldap_destroy_cache( ld );
|
||||
ld->ld_cache = NULL;
|
||||
}
|
||||
#endif /* !LDAP_NOCACHE */
|
||||
|
||||
if ( ld->ld_error != NULL ) {
|
||||
LDAP_FREE( ld->ld_error );
|
||||
|
@ -12,7 +12,7 @@ XXDIR = $(srcdir)/../libldap
|
||||
XXSRCS = apitest.c test.c \
|
||||
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 \
|
||||
modify.c add.c modrdn.c delete.c abandon.c \
|
||||
sasl.c sbind.c kbind.c unbind.c cancel.c \
|
||||
filter.c free.c sort.c passwd.c whoami.c \
|
||||
getdn.c getentry.c getattr.c getvalues.c addentry.c \
|
||||
@ -27,7 +27,7 @@ OBJS = threads.lo rdwr.lo tpool.lo \
|
||||
thr_pth.lo thr_stub.lo \
|
||||
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 \
|
||||
modify.lo add.lo modrdn.lo delete.lo abandon.lo \
|
||||
sasl.lo sbind.lo kbind.lo unbind.lo cancel.lo \
|
||||
filter.lo free.lo sort.lo passwd.lo whoami.lo \
|
||||
getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo \
|
||||
|
Loading…
Reference in New Issue
Block a user