/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2003 The OpenLDAP Foundation.
+ * Copyright 2000-2004 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
ei = NULL;
rs->sr_err = bdb_cache_find_id(op, NULL, ido, &ei,
0, locker, &locka );
- if (rs->sr_err != LDAP_SUCCESS) goto nextido;
+ if ( rs->sr_err != LDAP_SUCCESS ) goto nextido;
e = ei->bei_e;
}
return rs->sr_err;
int entry_sync_state = -1;
AttributeName null_attr;
int no_sync_state_change = 0;
- struct slap_limits_set *limit = NULL;
- int isroot = 0;
u_int32_t locker = 0;
DB_LOCK lock;
if ( ps_list->o_sync_slog_omitcsn.bv_len != 0 ) {
mr = slap_schema.si_ad_entryCSN->ad_type->sat_ordering;
if ( sop->o_sync_state.ctxcsn &&
- sop->o_sync_state.ctxcsn->bv_val != NULL ) {
- value_match( &match, slap_schema.si_ad_entryCSN, mr,
- SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
- sop->o_sync_state.ctxcsn,
- &ps_list->o_sync_slog_omitcsn,
- &text );
+ sop->o_sync_state.ctxcsn->bv_val != NULL )
+ {
+ value_match( &match, slap_schema.si_ad_entryCSN, mr,
+ SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX,
+ sop->o_sync_state.ctxcsn,
+ &ps_list->o_sync_slog_omitcsn,
+ &text );
} else {
match = -1;
}
manageDSAit = get_manageDSAit( sop );
/* Sync control overrides manageDSAit */
-
if ( !IS_PSEARCH && sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
if ( manageDSAit == SLAP_NO_CONTROL ) {
manageDSAit = SLAP_CRITICAL_CONTROL;
}
}
- rs->sr_err = LOCK_ID (bdb->bi_dbenv, &locker );
+ rs->sr_err = LOCK_ID( bdb->bi_dbenv, &locker );
switch(rs->sr_err) {
case 0:
return rs->sr_err;
}
- if (!manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
+ if ( !manageDSAit && e != &slap_entry_root && is_entry_referral( e ) ) {
/* entry is a referral, don't allow add */
struct berval matched_dn;
BerVarray erefs;
return 1;
}
- /* if not root, get appropriate limits */
- if ( be_isroot( op->o_bd, &sop->o_ndn ) ) {
- isroot = 1;
- } else {
- ( void ) get_limits( op->o_bd, &sop->o_ndn, &limit );
- }
-
- /* The time/size limits come first because they require very little
- * effort, so there's no chance the candidates are selected and then
- * the request is not honored only because of time/size constraints */
-
- /* if no time limit requested, use soft limit (unless root!) */
- if ( isroot ) {
- if ( sop->oq_search.rs_tlimit == 0 ) {
- sop->oq_search.rs_tlimit = -1; /* allow root to set no limit */
- }
-
- if ( sop->oq_search.rs_slimit == 0 ) {
- sop->oq_search.rs_slimit = -1;
- }
-
- } else {
- /* if no limit is required, use soft limit */
- if ( sop->oq_search.rs_tlimit <= 0 ) {
- sop->oq_search.rs_tlimit = limit->lms_t_soft;
-
- /* if requested limit higher than hard limit, abort */
- } else if ( sop->oq_search.rs_tlimit > limit->lms_t_hard ) {
- /* no hard limit means use soft instead */
- if ( limit->lms_t_hard == 0
- && limit->lms_t_soft > -1
- && sop->oq_search.rs_tlimit > limit->lms_t_soft ) {
- sop->oq_search.rs_tlimit = limit->lms_t_soft;
-
- /* positive hard limit means abort */
- } else if ( limit->lms_t_hard > 0 ) {
- rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
- send_ldap_result( sop, rs );
- rs->sr_err = LDAP_SUCCESS;
- goto done;
- }
-
- /* negative hard limit means no limit */
- }
-
- /* if no limit is required, use soft limit */
- if ( sop->oq_search.rs_slimit <= 0 ) {
- if ( get_pagedresults(sop) && limit->lms_s_pr != 0 ) {
- sop->oq_search.rs_slimit = limit->lms_s_pr;
- } else {
- sop->oq_search.rs_slimit = limit->lms_s_soft;
- }
-
- /* if requested limit higher than hard limit, abort */
- } else if ( sop->oq_search.rs_slimit > limit->lms_s_hard ) {
- /* no hard limit means use soft instead */
- if ( limit->lms_s_hard == 0
- && limit->lms_s_soft > -1
- && sop->oq_search.rs_slimit > limit->lms_s_soft ) {
- sop->oq_search.rs_slimit = limit->lms_s_soft;
-
- /* positive hard limit means abort */
- } else if ( limit->lms_s_hard > 0 ) {
- rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
- send_ldap_result( sop, rs );
- rs->sr_err = LDAP_SUCCESS;
- goto done;
- }
-
- /* negative hard limit means no limit */
- }
- }
-
/* compute it anyway; root does not use it */
- stoptime = op->o_time + sop->oq_search.rs_tlimit;
+ stoptime = op->o_time + sop->ors_tlimit;
/* need normalized dn below */
ber_dupbv( &realbase, &e->e_nname );
locker, candidates, scopes );
}
- if ( !IS_PSEARCH ) {
- if ( sop->o_sync_mode != SLAP_SYNC_NONE ) {
- bdb_cache_entry_db_unlock( bdb->bi_dbenv, &ctxcsn_lock );
- }
+ if ( !IS_PSEARCH && sop->o_sync_mode != SLAP_SYNC_NONE ) {
+ bdb_cache_entry_db_unlock( bdb->bi_dbenv, &ctxcsn_lock );
}
/* start cursor at beginning of candidates.
rs->sr_err = LDAP_SUCCESS;
goto done;
}
- } else {
- if ( ps_e->e_id < BDB_IDL_RANGE_FIRST(candidates)
- || ps_e->e_id > BDB_IDL_RANGE_LAST(candidates)){
- rs->sr_err = LDAP_SUCCESS;
- goto done;
- }
+ } else if ( ps_e->e_id < BDB_IDL_RANGE_FIRST( candidates ) ||
+ ps_e->e_id > BDB_IDL_RANGE_LAST( candidates ))
+ {
+ rs->sr_err = LDAP_SUCCESS;
+ goto done;
}
candidates[0] = 1;
candidates[1] = ps_e->e_id;
0, 0, 0 );
#endif
- rs->sr_err = LDAP_SUCCESS;
- rs->sr_entry = NULL;
- send_ldap_result( sop, rs );
- goto done;
+ goto nochange;
}
/* if not root and candidates exceed to-be-checked entries, abort */
- if ( !isroot && limit->lms_s_unchecked != -1 ) {
- if ( BDB_IDL_N(candidates) > (unsigned) limit->lms_s_unchecked ) {
- rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
- send_ldap_result( sop, rs );
- rs->sr_err = LDAP_SUCCESS;
- goto done;
- }
+ if ( sop->ors_limit /* isroot == TRUE */
+ && sop->ors_limit->lms_s_unchecked != -1
+ && BDB_IDL_N(candidates) > (unsigned) sop->ors_limit->lms_s_unchecked )
+ {
+ rs->sr_err = LDAP_ADMINLIMIT_EXCEEDED;
+ send_ldap_result( sop, rs );
+ rs->sr_err = LDAP_SUCCESS;
+ goto done;
}
- if ( isroot || !limit->lms_s_pr_hide ) {
+ if ( sop->ors_limit == NULL /* isroot == FALSE */
+ || !sop->ors_limit->lms_s_pr_hide ) {
tentries = BDB_IDL_N(candidates);
}
}
for ( id = bdb_idl_first( candidates, &cursor );
id != NOID && id <= (ID)( sop->o_pagedresults_state.ps_cookie );
- id = bdb_idl_next( candidates, &cursor ) );
+ id = bdb_idl_next( candidates, &cursor ) ) /* empty */;
}
if ( cursor == NOID ) {
#ifdef NEW_LOGGING
goto loop_begin;
}
- if ( (sop->o_sync_mode & SLAP_SYNC_REFRESH) || IS_PSEARCH ) {
+ if (( sop->o_sync_mode & SLAP_SYNC_REFRESH ) || IS_PSEARCH ) {
int match;
cookief.f_choice = LDAP_FILTER_AND;
}
/* check time limit */
- if ( sop->oq_search.rs_tlimit != -1 && slap_get_time() > stoptime ) {
+ if ( sop->ors_tlimit != -1 && slap_get_time() > stoptime ) {
rs->sr_err = LDAP_TIMELIMIT_EXCEEDED;
rs->sr_ref = rs->sr_v2ref;
send_ldap_result( sop, rs );
goto done;
}
-
if (!IS_PSEARCH) {
id2entry_retry:
/* get the entry with reader lock */
}
rs->sr_entry = e;
+
#ifdef BDB_SUBENTRIES
/* FIXME: send all but syncrepl */
#if 0
case LDAP_SCOPE_SUBTREE: {
EntryInfo *tmp;
- for ( tmp = BEI(e); tmp->bei_parent;
- tmp = tmp->bei_parent )
- {
+ for (tmp = BEI(e); tmp->bei_parent;
+ tmp = tmp->bei_parent ) {
if ( tmp->bei_id == base.e_id ) {
scopeok = 1;
break;
if ( rs->sr_err == LDAP_COMPARE_TRUE ) {
/* check size limit */
- if ( --sop->oq_search.rs_slimit == -1 &&
+ if ( --sop->ors_slimit == -1 &&
sop->o_sync_slog_size == -1 )
{
if (!IS_PSEARCH) {