mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-12-22 15:49:34 -05:00
cached entries are deleted if volatile; small improvements
This commit is contained in:
parent
c8335e7d14
commit
1a349907f3
3 changed files with 39 additions and 29 deletions
|
|
@ -74,13 +74,18 @@ monitor_cache_dup(
|
||||||
struct monitorcache *cc1 = ( struct monitorcache * )c1;
|
struct monitorcache *cc1 = ( struct monitorcache * )c1;
|
||||||
struct monitorcache *cc2 = ( struct monitorcache * )c2;
|
struct monitorcache *cc2 = ( struct monitorcache * )c2;
|
||||||
|
|
||||||
int d = cc1->mc_ndn->bv_len - cc2->mc_ndn->bv_len;
|
|
||||||
int cmp;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* case sensitive, because the dn MUST be normalized
|
* case sensitive, because the dn MUST be normalized
|
||||||
*/
|
*/
|
||||||
cmp = d != 0 ? d : strcmp( cc1->mc_ndn->bv_val, cc2->mc_ndn->bv_val );
|
#if 0
|
||||||
|
int cmp = monitor_cache_cmp( c1, c2 );
|
||||||
|
#else
|
||||||
|
int d = cc1->mc_ndn->bv_len - cc2->mc_ndn->bv_len;
|
||||||
|
int cmp =
|
||||||
|
d != 0 ? d : strcmp( cc1->mc_ndn->bv_val, cc2->mc_ndn->bv_val );
|
||||||
|
#endif
|
||||||
|
|
||||||
return cmp == 0 ? -1 : 0;
|
return cmp == 0 ? -1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,16 +208,19 @@ monitor_cache_dn2entry(
|
||||||
}
|
}
|
||||||
|
|
||||||
/* try with parent/ancestors */
|
/* try with parent/ancestors */
|
||||||
if ( ndn && ndn->bv_len ) {
|
if ( ndn->bv_len ) {
|
||||||
p_ndn.bv_val = dn_parent( NULL, ndn->bv_val );
|
p_ndn.bv_val = dn_parent( NULL, ndn->bv_val );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( p_ndn.bv_val == NULL ) {
|
if ( p_ndn.bv_val == NULL ) {
|
||||||
p_ndn.bv_val = "";
|
p_ndn.bv_val = "";
|
||||||
p_ndn.bv_len = 0;
|
p_ndn.bv_len = 0;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
p_ndn.bv_len = ndn->bv_len
|
p_ndn.bv_len = ndn->bv_len
|
||||||
- ( ber_len_t ) ( p_ndn.bv_val - ndn->bv_val );
|
- ( ber_len_t ) ( p_ndn.bv_val - ndn->bv_val );
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = monitor_cache_dn2entry( mi, &p_ndn, &e_parent, matched );
|
rc = monitor_cache_dn2entry( mi, &p_ndn, &e_parent, matched );
|
||||||
if ( rc || e_parent == NULL) {
|
if ( rc || e_parent == NULL) {
|
||||||
return( -1 );
|
return( -1 );
|
||||||
|
|
@ -253,15 +261,26 @@ monitor_cache_release(
|
||||||
mp = ( struct monitorentrypriv * )e->e_private;
|
mp = ( struct monitorentrypriv * )e->e_private;
|
||||||
|
|
||||||
if ( mp->mp_flags & MONITOR_F_VOLATILE ) {
|
if ( mp->mp_flags & MONITOR_F_VOLATILE ) {
|
||||||
|
struct monitorcache *mc, tmp_mc;
|
||||||
|
|
||||||
/* volatile entries do not return to cache */
|
/* volatile entries do not return to cache */
|
||||||
|
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
|
||||||
|
tmp_mc.mc_ndn = &e->e_nname;
|
||||||
|
mc = avl_delete( &mi->mi_cache,
|
||||||
|
( caddr_t )&tmp_mc, monitor_cache_cmp );
|
||||||
|
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
|
||||||
|
ch_free( mc );
|
||||||
|
|
||||||
ldap_pvt_thread_mutex_destroy( &mp->mp_mutex );
|
ldap_pvt_thread_mutex_destroy( &mp->mp_mutex );
|
||||||
ch_free( mp );
|
ch_free( mp );
|
||||||
e->e_private = NULL;
|
e->e_private = NULL;
|
||||||
entry_free( e );
|
entry_free( e );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
ldap_pvt_thread_mutex_unlock( &mp->mp_mutex );
|
ldap_pvt_thread_mutex_unlock( &mp->mp_mutex );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -399,21 +399,31 @@ monitor_subsys_conn_create(
|
||||||
*ep = e;
|
*ep = e;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
char **values;
|
char **values = NULL;
|
||||||
struct berval rdn;
|
|
||||||
unsigned long connid;
|
unsigned long connid;
|
||||||
|
|
||||||
/* create exactly the required entry */
|
/* create exactly the required entry */
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
struct berval rdn;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FIXME: we can pass the entire DN
|
||||||
|
* only if rdn_attrs does not complain.
|
||||||
|
*/
|
||||||
if ( dnExtractRdn( ndn, &rdn ) != LDAP_SUCCESS ) {
|
if ( dnExtractRdn( ndn, &rdn ) != LDAP_SUCCESS ) {
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( rdn_attrs( rdn.bv_val, NULL, &values ) != LDAP_SUCCESS ) {
|
if ( rdn_attrs( rdn.bv_val, NULL, &values ) != LDAP_SUCCESS ) {
|
||||||
free( rdn.bv_val );
|
free( rdn.bv_val );
|
||||||
return( -1 );
|
return( -1 );
|
||||||
}
|
}
|
||||||
free( rdn.bv_val );
|
free( rdn.bv_val );
|
||||||
|
#else
|
||||||
|
if ( rdn_attrs( ndn->bv_val, NULL, &values ) != LDAP_SUCCESS ) {
|
||||||
|
return( -1 );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
assert( values );
|
assert( values );
|
||||||
assert( values[ 0 ] );
|
assert( values[ 0 ] );
|
||||||
|
|
|
||||||
|
|
@ -148,26 +148,8 @@ monitor_subsys_log_modify(
|
||||||
Modification *mod = &ml->sml_mod;
|
Modification *mod = &ml->sml_mod;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Operational attributes
|
* accept all operational attributes
|
||||||
*/
|
*/
|
||||||
#if 0
|
|
||||||
if ( mod->sm_desc == slap_schema.si_ad_modifyTimestamp
|
|
||||||
|| mod->sm_desc == slap_schema.si_ad_modifiersName ) {
|
|
||||||
( void ) attr_delete( &e->e_attrs, mod->sm_desc );
|
|
||||||
rc = attr_merge( e, mod->sm_desc, mod->sm_bvalues );
|
|
||||||
if ( rc != 0 ) {
|
|
||||||
rc = LDAP_OTHER;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* unhandled operational attributes
|
|
||||||
*/
|
|
||||||
} else if ( is_at_operational( mod->sm_desc->ad_type ) ) {
|
|
||||||
continue;
|
|
||||||
|
|
||||||
#else
|
|
||||||
if ( is_at_operational( mod->sm_desc->ad_type ) ) {
|
if ( is_at_operational( mod->sm_desc->ad_type ) ) {
|
||||||
( void ) attr_delete( &e->e_attrs, mod->sm_desc );
|
( void ) attr_delete( &e->e_attrs, mod->sm_desc );
|
||||||
rc = attr_merge( e, mod->sm_desc, mod->sm_bvalues );
|
rc = attr_merge( e, mod->sm_desc, mod->sm_bvalues );
|
||||||
|
|
@ -177,7 +159,6 @@ monitor_subsys_log_modify(
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
* only the monitor description attribute can be modified
|
* only the monitor description attribute can be modified
|
||||||
*/
|
*/
|
||||||
|
|
@ -234,7 +215,7 @@ monitor_subsys_log_modify(
|
||||||
|
|
||||||
ldap_syslog = newlevel;
|
ldap_syslog = newlevel;
|
||||||
|
|
||||||
#if 0
|
#if 0 /* debug rather than log */
|
||||||
slap_debug = newlevel;
|
slap_debug = newlevel;
|
||||||
lutil_set_debug_level( "slapd", slap_debug );
|
lutil_set_debug_level( "slapd", slap_debug );
|
||||||
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug);
|
ber_set_option(NULL, LBER_OPT_DEBUG_LEVEL, &slap_debug);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue