From: Kurt Zeilenga Date: Mon, 29 Dec 2003 22:25:43 +0000 (+0000) Subject: Misc code cleanup X-Git-Tag: OPENLDAP_REL_ENG_2_1_MP~85 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fcad25da47183653527e700f5741d9c45e3e4ef5;p=openldap Misc code cleanup --- diff --git a/libraries/libldap/cancel.c b/libraries/libldap/cancel.c index 0770389d3f..f314d9816d 100644 --- a/libraries/libldap/cancel.c +++ b/libraries/libldap/cancel.c @@ -29,8 +29,6 @@ #include "ldap-int.h" #include "ldap_log.h" -#ifdef LDAP_EXOP_X_CANCEL - int ldap_cancel( LDAP *ld, @@ -72,4 +70,3 @@ ldap_cancel_s( return rc; } -#endif /* LDAP_EXOP_X_CANCEL */ diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index c537d398b6..00cb5d68df 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -108,12 +108,10 @@ static struct ldaperror ldap_builtin_errlist[] = { {LDAP_SYNC_REFRESH_REQUIRED, N_("Content Sync Refresh Required")}, {LDAP_ASSERTION_FAILED, N_("Assertion Failed")}, -#ifdef LDAP_EXOP_X_CANCEL {LDAP_CANCELLED, N_("Cancelled")}, {LDAP_NO_SUCH_OPERATION, N_("No Operation to Cancel")}, {LDAP_TOO_LATE, N_("Too Late to Cancel")}, {LDAP_CANNOT_CANCEL, N_("Cannot Cancel")}, -#endif {0, NULL} }; diff --git a/servers/slapd/back-bdb/search.c b/servers/slapd/back-bdb/search.c index 98c23d2309..382817c8d1 100644 --- a/servers/slapd/back-bdb/search.c +++ b/servers/slapd/back-bdb/search.c @@ -386,7 +386,8 @@ bdb_do_search( Operation *op, SlapReply *rs, Operation *sop, ID lastid = NOID; AttributeName *attrs; - Filter contextcsnand, contextcsnle, cookief, csnfnot, csnfeq, csnfand, csnfge; + Filter contextcsnand, contextcsnle, cookief, csnfnot, + csnfeq, csnfand, csnfge; AttributeAssertion aa_ge, aa_eq, aa_le; int entry_count = 0; struct berval *search_context_csn = NULL; @@ -440,8 +441,10 @@ bdb_do_search( Operation *op, SlapReply *rs, Operation *sop, ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_INSERT_HEAD( &bdb->bi_psearch_list, sop, o_ps_link ); ldap_pvt_thread_rdwr_wunlock( &bdb->bi_pslist_rwlock ); + } else if ( !IS_PSEARCH && sop->o_sync_mode & SLAP_SYNC_REFRESH_AND_PERSIST - && sop->o_sync_slog_size >= 0 ) { + && sop->o_sync_slog_size >= 0 ) + { ldap_pvt_thread_rdwr_wlock( &bdb->bi_pslist_rwlock ); LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) { if ( ps_list->o_sync_slog_size >= 0 ) { @@ -504,11 +507,13 @@ bdb_do_search( Operation *op, SlapReply *rs, Operation *sop, /* Sync control overrides manageDSAit */ if ( !IS_PSEARCH && sop->o_sync_mode & SLAP_SYNC_REFRESH ) { - if ( manageDSAit == SLAP_NO_CONTROL ) + if ( manageDSAit == SLAP_NO_CONTROL ) { manageDSAit = SLAP_CRITICAL_CONTROL; + } } else if ( IS_PSEARCH ) { - if ( manageDSAit == SLAP_NO_CONTROL ) + if ( manageDSAit == SLAP_NO_CONTROL ) { manageDSAit = SLAP_CRITICAL_CONTROL; + } } rs->sr_err = LOCK_ID (bdb->bi_dbenv, &locker ); @@ -534,9 +539,11 @@ dn2entry_retry: switch(rs->sr_err) { case DB_NOTFOUND: - matched = ei->bei_e; break; + matched = ei->bei_e; + break; case 0: - e = ei->bei_e; break; + e = ei->bei_e; + break; case LDAP_BUSY: send_ldap_error( sop, rs, LDAP_BUSY, "ldap server busy" ); LOCK_ID_FREE (bdb->bi_dbenv, locker ); @@ -736,16 +743,19 @@ dn2entry_retry: e = NULL; if ( !IS_PSEARCH ) { - rs->sr_err = bdb_get_commit_csn( sop, rs, &search_context_csn, locker, &ctxcsn_lock ); + rs->sr_err = bdb_get_commit_csn( sop, rs, &search_context_csn, + locker, &ctxcsn_lock ); if ( rs->sr_err != LDAP_SUCCESS ) { - send_ldap_error( sop, rs, rs->sr_err, "error in csn management in search" ); + send_ldap_error( sop, rs, rs->sr_err, + "error in csn management in search" ); goto done; } - if ( sop->o_sync_mode != SLAP_SYNC_NONE && sop->o_sync_state.ctxcsn && - sop->o_sync_state.ctxcsn->bv_val && - ber_bvcmp( &sop->o_sync_state.ctxcsn[0], search_context_csn ) == 0 ) + if ( sop->o_sync_mode != SLAP_SYNC_NONE && + sop->o_sync_state.ctxcsn && + sop->o_sync_state.ctxcsn->bv_val && + ber_bvcmp( &sop->o_sync_state.ctxcsn[0], search_context_csn ) == 0 ) { bdb_cache_entry_db_unlock( bdb->bi_dbenv, &ctxcsn_lock ); goto nochange; @@ -761,7 +771,8 @@ dn2entry_retry: } else { BDB_IDL_ZERO( candidates ); BDB_IDL_ZERO( scopes ); - rs->sr_err = search_candidates( op, sop, rs, &base, locker, candidates, scopes ); + rs->sr_err = search_candidates( op, sop, rs, &base, + locker, candidates, scopes ); } if ( !IS_PSEARCH ) { @@ -852,9 +863,8 @@ dn2entry_retry: goto loop_begin; } - if ( (sop->o_sync_mode & SLAP_SYNC_REFRESH) || IS_PSEARCH ) - { - int match; + if ( (sop->o_sync_mode & SLAP_SYNC_REFRESH) || IS_PSEARCH ) { + int match; cookief.f_choice = LDAP_FILTER_AND; cookief.f_and = &csnfnot; @@ -901,7 +911,8 @@ dn2entry_retry: mr = slap_schema.si_ad_entryCSN->ad_type->sat_ordering; if ( sop->o_sync_state.ctxcsn && - sop->o_sync_state.ctxcsn->bv_val != NULL ) { + 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[0], search_context_csn, @@ -931,7 +942,6 @@ loop_begin: goto done; } -#ifdef LDAP_EXOP_X_CANCEL if ( sop->o_cancel ) { assert( sop->o_cancel == SLAP_CANCEL_REQ ); rs->sr_err = LDAP_CANCELLED; @@ -940,7 +950,6 @@ loop_begin: rs->sr_err = LDAP_SUCCESS; goto done; } -#endif /* check time limit */ if ( sop->oq_search.rs_tlimit != -1 && slap_get_time() > stoptime ) { @@ -998,9 +1007,11 @@ id2entry_retry: rs->sr_entry = e; #ifdef BDB_SUBENTRIES - /* FIXME: send all but syncrepl - if ( !is_sync_protocol( sop ) ) { - */ + /* FIXME: send all but syncrepl */ +#if 0 + if ( !is_sync_protocol( sop ) ) +#endif + { if ( is_entry_subentry( e ) ) { if( sop->oq_search.rs_scope != LDAP_SCOPE_BASE ) { if(!get_subentries_visibility( sop )) { @@ -1019,10 +1030,8 @@ id2entry_retry: /* only subentries are visible */ goto loop_continue; } - /* } - */ -#endif +#endif /* BDB_SUBENTRIES */ /* Does this candidate actually satisfy the search scope? * @@ -1036,23 +1045,24 @@ id2entry_retry: switch( sop->ors_scope ) { case LDAP_SCOPE_BASE: /* This is always true, yes? */ - if ( id == base.e_id ) - scopeok = 1; + if ( id == base.e_id ) scopeok = 1; break; + case LDAP_SCOPE_ONELEVEL: - if ( ei->bei_parent->bei_id == base.e_id ) - scopeok = 1; + if ( ei->bei_parent->bei_id == base.e_id ) scopeok = 1; break; - case LDAP_SCOPE_SUBTREE: - { EntryInfo *tmp; + + case LDAP_SCOPE_SUBTREE: { + EntryInfo *tmp; for ( tmp = BEI(e); tmp->bei_parent; - tmp = tmp->bei_parent ) { + tmp = tmp->bei_parent ) + { if ( tmp->bei_id == base.e_id ) { scopeok = 1; break; } - } } - break; + } + } break; } #ifdef BDB_ALIASES @@ -1062,8 +1072,8 @@ id2entry_retry: * deref it when finding, return it. */ if ( is_entry_alias(e) && - ((sop->ors_deref & LDAP_DEREF_FINDING) - || !bvmatch(&e->e_nname, &op->o_req_ndn))) + ((sop->ors_deref & LDAP_DEREF_FINDING) || + !bvmatch(&e->e_nname, &op->o_req_ndn))) { goto loop_continue; } @@ -1079,10 +1089,8 @@ id2entry_retry: } else { /* subtree, walk up the tree */ EntryInfo *tmp = BEI(e); - for (;tmp->bei_parent; - tmp=tmp->bei_parent) { - x = bdb_idl_search( - scopes, tmp->bei_id ); + for (;tmp->bei_parent; tmp=tmp->bei_parent) { + x = bdb_idl_search( scopes, tmp->bei_id ); if ( scopes[x] == tmp->bei_id ) { scopeok = 1; break; @@ -1176,7 +1184,8 @@ id2entry_retry: if ( rs->sr_err == LDAP_COMPARE_TRUE ) { /* check size limit */ if ( --sop->oq_search.rs_slimit == -1 && - sop->o_sync_slog_size == -1 ) { + sop->o_sync_slog_size == -1 ) + { if (!IS_PSEARCH) { bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, e, &lock ); @@ -1581,9 +1590,7 @@ static void search_stack_free( void *key, void *data ) ber_memfree_x(data, NULL); } -static void *search_stack( - Operation *op -) +static void *search_stack( Operation *op ) { struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private; void *ret = NULL; diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index e45cf3bca8..9a17e4f10b 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -904,27 +904,19 @@ backend_check_restrictions( break; } - { - if( bvmatch( opdata, &slap_EXOP_START_TLS ) ) { - session++; - starttls++; - break; - } + if( bvmatch( opdata, &slap_EXOP_START_TLS ) ) { + session++; + starttls++; + break; } - { - if( bvmatch( opdata, &slap_EXOP_WHOAMI ) ) { - break; - } + if( bvmatch( opdata, &slap_EXOP_WHOAMI ) ) { + break; } -#ifdef LDAP_EXOP_X_CANCEL - { - if ( bvmatch( opdata, &slap_EXOP_CANCEL ) ) { - break; - } + if ( bvmatch( opdata, &slap_EXOP_CANCEL ) ) { + break; } -#endif /* treat everything else as a modify */ opflag = SLAP_RESTRICT_OP_MODIFY; diff --git a/servers/slapd/cancel.c b/servers/slapd/cancel.c index 5dcea54114..65d5fe8ba5 100644 --- a/servers/slapd/cancel.c +++ b/servers/slapd/cancel.c @@ -25,8 +25,6 @@ #include "slap.h" -#ifdef LDAP_EXOP_X_CANCEL - #include #include @@ -127,5 +125,3 @@ int cancel_extop( Operation *op, SlapReply *rs ) return rc; } - -#endif /* LDAP_EXOP_X_CANCEL */ diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 01b17e5886..9fe27be408 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1105,7 +1105,6 @@ operations_error: #endif /* SLAPD_MONITOR */ ldap_pvt_thread_mutex_unlock( &num_ops_mutex ); -#ifdef LDAP_EXOP_X_CANCEL if ( op->o_cancel == SLAP_CANCEL_REQ ) { op->o_cancel = LDAP_TOO_LATE; } @@ -1115,7 +1114,6 @@ operations_error: { ldap_pvt_thread_yield(); } -#endif ldap_pvt_thread_mutex_lock( &conn->c_mutex ); diff --git a/servers/slapd/extended.c b/servers/slapd/extended.c index 83e9af4a8b..639b3b78ff 100644 --- a/servers/slapd/extended.c +++ b/servers/slapd/extended.c @@ -65,9 +65,7 @@ static SLAP_EXTOP_MAIN_FN whoami_extop; * just a way to get built-in extops onto the extop list without * having a separate init routine for each built-in extop. */ -#ifdef LDAP_EXOP_X_CANCEL const struct berval slap_EXOP_CANCEL = BER_BVC(LDAP_EXOP_X_CANCEL); -#endif const struct berval slap_EXOP_WHOAMI = BER_BVC(LDAP_EXOP_X_WHO_AM_I); const struct berval slap_EXOP_MODIFY_PASSWD = BER_BVC(LDAP_EXOP_MODIFY_PASSWD); const struct berval slap_EXOP_START_TLS = BER_BVC(LDAP_EXOP_START_TLS); @@ -77,9 +75,7 @@ static struct { slap_mask_t flags; SLAP_EXTOP_MAIN_FN *ext_main; } builtin_extops[] = { -#ifdef LDAP_EXOP_X_CANCEL { &slap_EXOP_CANCEL, SLAP_EXOP_HIDE, cancel_extop }, -#endif { &slap_EXOP_WHOAMI, 0, whoami_extop }, { &slap_EXOP_MODIFY_PASSWD, 0, passwd_extop }, #ifdef HAVE_TLS diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 6227b18fcd..a81c5ebeab 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -505,9 +505,7 @@ LDAP_SLAPD_F (Entry *) entry_dup LDAP_P(( Entry *e )); */ LDAP_SLAPD_F (int) exop_root_dse_info LDAP_P ((Entry *e)); -#ifdef LDAP_EXOP_X_CANCEL LDAP_SLAPD_V( const struct berval ) slap_EXOP_CANCEL; -#endif LDAP_SLAPD_V( const struct berval ) slap_EXOP_WHOAMI; LDAP_SLAPD_V( const struct berval ) slap_EXOP_MODIFY_PASSWD; LDAP_SLAPD_V( const struct berval ) slap_EXOP_START_TLS;