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 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 ));
- if ( ld->ld_cache == NULLLDCACHE ) {
- if (( ld->ld_cache = (LDAPCache *)malloc( sizeof( LDAPCache )))
- == NULLLDCACHE ) {
+ if ( ld->ld_cache == NULL ) {
+ if (( ld->ld_cache = (LDAPCache *)LDAP_MALLOC( sizeof( LDAPCache )))
+ == NULL ) {
Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "ldap_flush_cache\n", 0, 0, 0 );
/* delete all messages in the cache */
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
for ( m = ld->ld_cache->lc_buckets[ i ];
/* delete all messages in the cache */
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
for ( m = ld->ld_cache->lc_buckets[ i ];
static void
uncache_entry_or_req( LDAP *ld,
const char *dn, /* if non-NULL, uncache entry */
static void
uncache_entry_or_req( LDAP *ld,
const char *dn, /* if non-NULL, uncache entry */
- "ldap_uncache_entry_or_req dn %s msgid %d ld_cache %lx\n",
- dn, msgid, (long) ld->ld_cache );
+ "ldap_uncache_entry_or_req dn %s msgid %ld ld_cache %lx\n",
+ dn, (long) msgid, (long) ld->ld_cache );
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
m = next ) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
m = next ) {
next = m->lm_next;
if (( dn != NULL && chain_contains_dn( m, dn )) ||
( dn == NULL && m->lm_msgid == msgid )) {
Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS;
Debug( LDAP_DEBUG_TRACE, "ldap_add_request_to_cache\n", 0, 0, 0 );
ld->ld_errno = LDAP_SUCCESS;
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
result->lm_msgid, result->lm_msgtype, 0 );
Debug( LDAP_DEBUG_TRACE, "ldap_add_result_to_cache: id %d, type %d\n",
result->lm_msgid, result->lm_msgtype, 0 );
( ld->ld_cache->lc_enabled == 0 )) {
Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
return;
( ld->ld_cache->lc_enabled == 0 )) {
Debug( LDAP_DEBUG_TRACE, "artc: cache disabled\n", 0, 0, 0 );
return;
* result to it. if this result completes the results for the
* request, add the request/result chain to the cache proper.
*/
* result to it. if this result completes the results for the
* request, add the request/result chain to the cache proper.
*/
for ( m = ld->ld_cache->lc_requests; m != NULL; m = m->lm_next ) {
if ( m->lm_msgid == result->lm_msgid ) {
break;
for ( m = ld->ld_cache->lc_requests; m != NULL; m = m->lm_next ) {
if ( m->lm_msgid == result->lm_msgid ) {
break;
{
#ifndef LDAP_NOCACHE
LDAPMessage *m, *new, *prev, *next;
{
#ifndef LDAP_NOCACHE
LDAPMessage *m, *new, *prev, *next;
Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE, "ldap_check_cache\n", 0, 0, 0 );
Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
m->lm_msgid, m->lm_msgtype, 0 );
if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
Debug( LDAP_DEBUG_TRACE,"cc: examining id %d,type %d\n",
m->lm_msgid, m->lm_msgtype, 0 );
if ( difftime(c_time, m->lm_time) > ld->ld_cache->lc_timeout ) {
(size_t)len )) == NULL ) {
ber_free( new->lm_ber, 0 );
(size_t)len )) == NULL ) {
ber_free( new->lm_ber, 0 );
- if ( ber_scanf( &ber, "{i{a", &msgid, &s ) != LBER_ERROR ) {
+ if ( ber_scanf( &ber, "{i{a" /*}}*/, &msgid, &s ) != LBER_ERROR ) {
while ( lc->lc_memused > lc->lc_maxmem * SIZE_FACTOR ) {
c_time = time( NULL );
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {
while ( lc->lc_memused > lc->lc_maxmem * SIZE_FACTOR ) {
c_time = time( NULL );
for ( i = 0; i < LDAP_CACHE_BUCKETS; ++i ) {