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 ));
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;
( ld->ld_cache->lc_enabled == 0 )) {
return;
}
if (( new = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) ))
!= NULL ) {
( ld->ld_cache->lc_enabled == 0 )) {
return;
}
if (( new = (LDAPMessage *) LDAP_CALLOC( 1, sizeof(LDAPMessage) ))
!= NULL ) {
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 ) {
if (( new = (LDAPMessage *)LDAP_MALLOC( sizeof(LDAPMessage))) != NULL ) {
*new = *msg; /* struct copy */
if (( new = (LDAPMessage *)LDAP_MALLOC( sizeof(LDAPMessage))) != NULL ) {
*new = *msg; /* struct copy */
}
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 );
}
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 );
- 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 ) {