]> git.sur5r.net Git - openldap/commitdiff
Initial subordinate implementation (for chaining)
authorKurt Zeilenga <kurt@openldap.org>
Tue, 30 Dec 2003 03:53:03 +0000 (03:53 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 30 Dec 2003 03:53:03 +0000 (03:53 +0000)
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/search.c

index 62f6f13023db73768956461a095b66af6fbe83ca..30ba4cbb40be1faf00a7b88eb06f1a7f121c26b5 100644 (file)
@@ -122,10 +122,11 @@ bdb_dn2id_add(
 #ifndef BDB_MULTIPLE_SUFFIXES
        }
 
-       while( !be_issuffix( op->o_bd, &ptr )) {
+       while( !be_issuffix( op->o_bd, &ptr ))
 #else
-       for (;;) {
+       for (;;)
 #endif
+       {
                ptr.bv_val[-1] = DN_SUBTREE_PREFIX;
 
                rc = bdb_idl_insert_key( op->o_bd, db, txn, &key, e->e_id );
@@ -427,19 +428,19 @@ bdb_dn2idl(
        DBT             key;
        struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
        DB *db = bdb->bi_dn2id->bdi_db;
-       int prefix = op->ors_scope == LDAP_SCOPE_SUBTREE ? DN_SUBTREE_PREFIX :
-                       DN_ONE_PREFIX;
+       int prefix = ( op->ors_scope == LDAP_SCOPE_ONELEVEL )
+               ? DN_ONE_PREFIX : DN_SUBTREE_PREFIX;
 
 #ifdef NEW_LOGGING
-       LDAP_LOG ( INDEX, ARGS, 
-               "=> bdb_dn2ididl( \"%s\" )\n", e->e_nname.bv_val, 0, 0 );
+       LDAP_LOG ( INDEX, ARGS, "=> bdb_dn2ididl( \"%s\" )\n",
+               e->e_nname.bv_val, 0, 0 );
 #else
-       Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2idl( \"%s\" )\n", e->e_nname.bv_val, 0, 0 );
+       Debug( LDAP_DEBUG_TRACE, "=> bdb_dn2idl( \"%s\" )\n",
+               e->e_nname.bv_val, 0, 0 );
 #endif
 
 #ifndef        BDB_MULTIPLE_SUFFIXES
-       if (prefix == DN_SUBTREE_PREFIX && BEI(e)->bei_parent->bei_id == 0 )
-       {
+       if ( prefix == DN_SUBTREE_PREFIX && BEI(e)->bei_parent->bei_id == 0 ) {
                BDB_IDL_ALL(bdb, ids);
                return 0;
        }
@@ -1092,8 +1093,9 @@ hdb_dn2idl(
 #endif
 
 #ifndef BDB_MULTIPLE_SUFFIXES
-       if ( op->ors_scope == LDAP_SCOPE_SUBTREE && 
-               BEI(e)->bei_parent->bei_id == 0 ) {
+       if ( op->ors_scope != LDAP_SCOPE_ONELEVEL && 
+               BEI(e)->bei_parent->bei_id == 0 )
+       {
                BDB_IDL_ALL( bdb, ids );
                return 0;
        }
@@ -1103,8 +1105,8 @@ hdb_dn2idl(
        cx.ei = BEI(e);
        cx.bdb = bdb;
        cx.db = cx.bdb->bi_dn2id->bdi_db;
-       cx.prefix = op->ors_scope == LDAP_SCOPE_SUBTREE ? DN_SUBTREE_PREFIX :
-                       DN_ONE_PREFIX;
+       cx.prefix = op->ors_scope == LDAP_SCOPE_ONELEVEL
+               ? DN_ONE_PREFIX : DN_SUBTREE_PREFIX;
        cx.ids = ids;
        cx.buf = stack;
        cx.op = op;
index 24f68defadeca8e3e739e6370a5bcefab691f54c..422dea39289ae66ecd4f291c0a757f0323e61881 100644 (file)
@@ -65,6 +65,9 @@ bdb_filter_candidates(
 #else
        Debug( LDAP_DEBUG_FILTER, "=> bdb_filter_candidates\n", 0, 0, 0 );
 #endif
+#if 0
+       char *subtree="SUBTREE";
+#endif
 
        switch ( f->f_choice ) {
        case SLAPD_FILTER_COMPUTED:
@@ -73,7 +76,7 @@ bdb_filter_candidates(
                /* This technically is not the same as FALSE, but it
                 * certainly will produce no matches.
                 */
-               /* FALLTHRU */
+               /* FALL THRU */
                case LDAP_COMPARE_FALSE:
                        BDB_IDL_ZERO( ids );
                        break;
@@ -82,14 +85,15 @@ bdb_filter_candidates(
                        BDB_IDL_ALL( bdb, ids );
                        } break;
                case LDAP_SUCCESS:
-               /* this is a pre-computed scope, leave it alone */
+                       /* this is a pre-computed scope, leave it alone */
                        break;
                }
                break;
 #if 0  /* Not used any more, search calls bdb_dn2idl directly */
        case SLAPD_FILTER_DN_ONE:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN ONE\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN ONE\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tDN ONE\n", 0, 0, 0 );
 #endif
@@ -101,11 +105,16 @@ bdb_filter_candidates(
                }
                break;
 
+       case SLAPD_FILTER_DN_CHILDREN:
+               subtree="CHILDREN";
+               /* Fall Thru */
        case SLAPD_FILTER_DN_SUBTREE:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN SUBTREE\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tDN %s\n",
+                       subtree, 0, 0 );
 #else
-               Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
+               Debug( LDAP_DEBUG_FILTER, "\tDN %s\n",
+                       subtree, 0, 0 );
 #endif
                rc = bdb_dn2idl( op->o_bd, f->f_dn, DN_SUBTREE_PREFIX, ids,
                        stack, op->o_tmpmemctx );
@@ -113,7 +122,8 @@ bdb_filter_candidates(
 #endif
        case LDAP_FILTER_PRESENT:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tPRESENT\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tPRESENT\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tPRESENT\n", 0, 0, 0 );
 #endif
@@ -122,7 +132,8 @@ bdb_filter_candidates(
 
        case LDAP_FILTER_EQUALITY:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tEQUALITY\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tEQUALITY\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
 #endif
@@ -131,7 +142,8 @@ bdb_filter_candidates(
 
        case LDAP_FILTER_APPROX:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tAPPROX\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tAPPROX\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tAPPROX\n", 0, 0, 0 );
 #endif
@@ -140,7 +152,8 @@ bdb_filter_candidates(
 
        case LDAP_FILTER_SUBSTRINGS:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tSUBSTRINGS\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tSUBSTRINGS\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tSUBSTRINGS\n", 0, 0, 0 );
 #endif
@@ -150,7 +163,8 @@ bdb_filter_candidates(
        case LDAP_FILTER_GE:
                /* no GE index, use pres */
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tGE\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tGE\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tGE\n", 0, 0, 0 );
 #endif
@@ -160,7 +174,8 @@ bdb_filter_candidates(
        case LDAP_FILTER_LE:
                /* no LE index, use pres */
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tLE\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tLE\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tLE\n", 0, 0, 0 );
 #endif
@@ -170,7 +185,8 @@ bdb_filter_candidates(
        case LDAP_FILTER_NOT:
                /* no indexing to support NOT filters */
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tNOT\n",0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tNOT\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tNOT\n", 0, 0, 0 );
 #endif
@@ -181,7 +197,8 @@ bdb_filter_candidates(
 
        case LDAP_FILTER_AND:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tAND\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tAND\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tAND\n", 0, 0, 0 );
 #endif
@@ -191,7 +208,8 @@ bdb_filter_candidates(
 
        case LDAP_FILTER_OR:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tOR\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tOR\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tOR\n", 0, 0, 0 );
 #endif
@@ -201,7 +219,8 @@ bdb_filter_candidates(
 
        default:
 #ifdef NEW_LOGGING
-               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tUNKNOWN\n", 0, 0, 0 );
+               LDAP_LOG ( INDEX, ARGS, "=> bdb_filter_candidates: \tUNKNOWN\n",
+                       0, 0, 0 );
 #else
                Debug( LDAP_DEBUG_FILTER, "\tUNKNOWN %lu\n",
                        (unsigned long) f->f_choice, 0, 0 );
index 7223daecc0208fdd88450d359a9a3b1ad5ab2d72..66fedc5e9ba823506c33a169d05163bbf47c3b15 100644 (file)
@@ -65,7 +65,6 @@ static Entry * deref_base (
        rs->sr_text = "maximum deref depth exceeded";
 
        while (BDB_IDL_N(tmp) < op->o_bd->be_max_deref_depth) {
-
                /* Remember the last entry we looked at, so we can
                 * report broken links
                 */
@@ -100,8 +99,11 @@ static Entry * deref_base (
                rs->sr_err = bdb_dn2entry( op, NULL, &ndn, &ei,
                        0, locker, &lockr );
 
-               if ( ei ) e = ei->bei_e;
-               else    e = NULL;
+               if ( ei ) {
+                       e = ei->bei_e;
+               } else {
+                       e = NULL;
+               }
 
                if (!e) {
                        rs->sr_err = LDAP_ALIAS_PROBLEM;
@@ -140,8 +142,7 @@ static int search_aliases(
        u_int32_t locker,
        ID *ids,
        ID *scopes,
-       ID *stack
-)
+       ID *stack )
 {
        struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
        ID *aliases, *curscop, *subscop, *visited, *newsubs, *oldsubs, *tmp;
@@ -198,7 +199,7 @@ static int search_aliases(
                 */
                BDB_IDL_CPY( curscop, aliases );
                rs->sr_err = bdb_dn2idl( op, e, subscop,
-                                       subscop2+BDB_IDL_DB_SIZE );
+                       subscop2+BDB_IDL_DB_SIZE );
                if (first) {
                        first = 0;
                } else {
@@ -259,7 +260,7 @@ static int search_aliases(
                /* If this is a OneLevel search, we're done; oldsubs only had one
                 * ID in it. For a Subtree search, oldsubs may be a list of scope IDs.
                 */
-               if (op->ors_scope != LDAP_SCOPE_SUBTREE) break;
+               if ( op->ors_scope == LDAP_SCOPE_ONELEVEL ) break;
 nextido:
                ido = bdb_idl_next( oldsubs, &cursoro );
                
@@ -288,14 +289,9 @@ nextido:
        return rs->sr_err;
 }
 
-static
-int is_sync_protocol( Operation *op )
-{
-       if ( op->o_sync_mode & SLAP_SYNC_REFRESH_AND_PERSIST )
-               return 1;
-       return 0;
-}
-       
+#define is_sync_protocol(op)   \
+       ((op)->o_sync_mode & SLAP_SYNC_REFRESH_AND_PERSIST)
+
 #define IS_BDB_REPLACE(type) (( type == LDAP_PSEARCH_BY_DELETE ) || \
        ( type == LDAP_PSEARCH_BY_SCOPEOUT ))
 #define IS_PSEARCH (op != sop)
@@ -930,7 +926,7 @@ dn2entry_retry:
                id != NOID && !no_sync_state_change;
                id = bdb_idl_next( candidates, &cursor ) )
        {
-               int             scopeok = 0;
+               int scopeok = 0;
 
 loop_begin:
                /* check for abandon */
@@ -1052,6 +1048,9 @@ id2entry_retry:
                        if ( ei->bei_parent->bei_id == base.e_id ) scopeok = 1;
                        break;
 
+               case LDAP_SCOPE_CHILDREN:
+                       if ( id == base.e_id ) break;
+                       /* Fall-thru */
                case LDAP_SCOPE_SUBTREE: {
                        EntryInfo *tmp;
                        for ( tmp = BEI(e); tmp->bei_parent;
@@ -1082,12 +1081,10 @@ id2entry_retry:
                        if ( !scopeok && BDB_IDL_N(scopes) ) {
                                unsigned x;
                                if ( sop->ors_scope == LDAP_SCOPE_ONELEVEL ) {
-                                       x = bdb_idl_search( scopes,
-                                               e->e_id );
-                                       if ( scopes[x] == e->e_id )
-                                               scopeok = 1;
+                                       x = bdb_idl_search( scopes, e->e_id );
+                                       if ( scopes[x] == e->e_id ) scopeok = 1;
                                } else {
-                               /* subtree, walk up the tree */
+                                       /* 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 );
@@ -1124,11 +1121,9 @@ id2entry_retry:
                        && is_entry_referral( e ) )
                {
                        BerVarray erefs = get_entry_referrals( sop, e );
-                       rs->sr_ref = referral_rewrite( erefs,
-                               &e->e_name, NULL,
-                               sop->oq_search.rs_scope == LDAP_SCOPE_SUBTREE
-                                       ? LDAP_SCOPE_SUBTREE
-                                       : LDAP_SCOPE_BASE );
+                       rs->sr_ref = referral_rewrite( erefs, &e->e_name, NULL,
+                               sop->oq_search.rs_scope == LDAP_SCOPE_ONELEVEL
+                                       ? LDAP_SCOPE_BASE : LDAP_SCOPE_SUBTREE );
 
                        send_search_reference( sop, rs );
 
@@ -1259,9 +1254,9 @@ id2entry_retry:
                                                } else {
                                                        struct berval cookie;
                                                        slap_compose_sync_cookie( sop, &cookie,
-                                                                               search_context_csn,
-                                                                               sop->o_sync_state.sid,
-                                                                               sop->o_sync_state.rid );
+                                                               search_context_csn,
+                                                               sop->o_sync_state.sid,
+                                                               sop->o_sync_state.rid );
                                                        rs->sr_err = slap_build_sync_state_ctrl( sop,
                                                                rs, e, entry_sync_state, ctrls,
                                                                num_ctrls++, 1, &cookie );
@@ -1269,17 +1264,16 @@ id2entry_retry:
                                                        rs->sr_attrs = attrs;
                                                        rs->sr_ctrls = ctrls;
                                                        result = send_search_entry( sop, rs );
-                                                       if ( cookie.bv_val )
-                                                               ch_free( cookie.bv_val );       
+                                                       if ( cookie.bv_val ) ch_free( cookie.bv_val );  
                                                        sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
-                                                                        sop->o_tmpmemctx );
+                                                                sop->o_tmpmemctx );
                                                        sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
                                                        ctrls[num_ctrls] = NULL;
                                                        rs->sr_ctrls = NULL;
                                                }
                                        } else if ( ps_type == LDAP_PSEARCH_BY_PREMODIFY ) {
                                                struct psid_entry* psid_e;
-                                               psid_e = (struct psid_entry *) ch_calloc (1,
+                                               psid_e = (struct psid_entry *) ch_calloc(1,
                                                        sizeof(struct psid_entry));
                                                psid_e->ps_op = sop;
                                                LDAP_LIST_INSERT_HEAD( &op->o_pm_list,
@@ -1298,7 +1292,6 @@ id2entry_retry:
                                        }
                                } else {
                                        if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
-
                                                if ( rc_sync == LDAP_COMPARE_TRUE ) { /* ADD */
                                                        rs->sr_err = slap_build_sync_state_ctrl( sop,
                                                                rs, e, entry_sync_state, ctrls,
@@ -1308,29 +1301,32 @@ id2entry_retry:
                                                        rs->sr_attrs = sop->oq_search.rs_attrs;
                                                        result = send_search_entry( sop, rs );
                                                        sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
-                                                                        sop->o_tmpmemctx );
+                                                                sop->o_tmpmemctx );
                                                        sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
                                                        ctrls[num_ctrls] = NULL;
                                                        rs->sr_ctrls = NULL;
                                                } else { /* PRESENT */
                                                        if ( sync_send_present_mode ) {
                                                                result = slap_build_syncUUID_set( sop,
-                                                                                                       &syncUUID_set, e );
+                                                                       &syncUUID_set, e );
                                                                if ( result <= 0 ) {
                                                                        result = -1;    
                                                                } else {
                                                                        syncUUID_set_cnt++;
-                                                                       if ( syncUUID_set_cnt == SLAP_SYNCUUID_SET_SIZE ) {
+                                                                       if ( syncUUID_set_cnt ==
+                                                                               SLAP_SYNCUUID_SET_SIZE )
+                                                                       {
                                                                                rs->sr_err = LDAP_SUCCESS;
                                                                                rs->sr_rspoid = LDAP_SYNC_INFO;
                                                                                rs->sr_ctrls = NULL;
                                                                                result = slap_send_syncinfo( sop, rs,
-                                                                                               LDAP_TAG_SYNC_ID_SET,
-                                                                                               NULL, 0, syncUUID_set, 0 );
-                                                                               if ( result != LDAP_SUCCESS )
+                                                                                       LDAP_TAG_SYNC_ID_SET,
+                                                                                       NULL, 0, syncUUID_set, 0 );
+                                                                               if ( result != LDAP_SUCCESS ) {
                                                                                        result = -1;
+                                                                               }
                                                                                ber_bvarray_free_x( syncUUID_set,
-                                                                                                               sop->o_tmpmemctx );
+                                                                                       sop->o_tmpmemctx );
                                                                                syncUUID_set = NULL;
                                                                                syncUUID_set_cnt = 0;
                                                                        }
@@ -1394,7 +1390,7 @@ loop_continue:
                rs->sr_rspoid = LDAP_SYNC_INFO;
                rs->sr_ctrls = NULL;
                slap_send_syncinfo( sop, rs, LDAP_TAG_SYNC_ID_SET,
-                                                       NULL, 0, syncUUID_set, 0 );
+                       NULL, 0, syncUUID_set, 0 );
                ber_bvarray_free_x( syncUUID_set, sop->o_tmpmemctx );
                syncUUID_set_cnt = 0;
        }
@@ -1404,10 +1400,8 @@ nochange:
                if ( sop->o_sync_mode & SLAP_SYNC_REFRESH ) {
                        if ( sop->o_sync_mode & SLAP_SYNC_PERSIST ) {
                                struct berval cookie;
-                               slap_compose_sync_cookie( sop, &cookie,
-                                                                                 search_context_csn,
-                                                                                 sop->o_sync_state.sid,
-                                                                                 sop->o_sync_state.rid );
+                               slap_compose_sync_cookie( sop, &cookie, search_context_csn,
+                                       sop->o_sync_state.sid, sop->o_sync_state.rid );
 
                                if ( sync_send_present_mode ) {
                                        rs->sr_err = LDAP_SUCCESS;
@@ -1419,9 +1413,12 @@ nochange:
                                        if ( !no_sync_state_change ) {
                                                int slog_found = 0;
                                                ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock );
-                                               LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list, o_ps_link ) {
+                                               LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list,
+                                                       o_ps_link )
+                                               {
                                                        if ( ps_list->o_sync_slog_size > 0 ) {
-                                                               if ( ps_list->o_sync_state.sid == sop->o_sync_state.sid ) {
+                                                               if ( ps_list->o_sync_state.sid ==
+                                                                       sop->o_sync_state.sid ) {
                                                                        slog_found = 1;
                                                                        break;
                                                                }
@@ -1449,10 +1446,8 @@ nochange:
                        } else {
                                /* refreshOnly mode */
                                struct berval cookie;
-                               slap_compose_sync_cookie( sop, &cookie,
-                                                                                 search_context_csn,
-                                                                                 sop->o_sync_state.sid,
-                                                                                 sop->o_sync_state.rid );
+                               slap_compose_sync_cookie( sop, &cookie, search_context_csn,
+                                       sop->o_sync_state.sid, sop->o_sync_state.rid );
 
                                if ( sync_send_present_mode ) {
                                        slap_build_sync_done_ctrl( sop, rs, ctrls,
@@ -1462,7 +1457,8 @@ nochange:
                                                int slog_found = 0;
                                                ldap_pvt_thread_rdwr_rlock( &bdb->bi_pslist_rwlock );
                                                LDAP_LIST_FOREACH( ps_list, &bdb->bi_psearch_list,
-                                                               o_ps_link ) {
+                                                       o_ps_link )
+                                               {
                                                        if ( ps_list->o_sync_slog_size > 0 ) {
                                                                if ( ps_list->o_sync_state.sid ==
                                                                                sop->o_sync_state.sid ) {
@@ -1483,16 +1479,17 @@ nochange:
 
                                rs->sr_ctrls = ctrls;
                                rs->sr_ref = rs->sr_v2ref;
-                               rs->sr_err = (rs->sr_v2ref == NULL) ? LDAP_SUCCESS : LDAP_REFERRAL;
+                               rs->sr_err = (rs->sr_v2ref == NULL)
+                                       ? LDAP_SUCCESS : LDAP_REFERRAL;
                                rs->sr_rspoid = NULL;
                                send_ldap_result( sop, rs );
                                if ( ctrls[num_ctrls-1]->ldctl_value.bv_val != NULL ) {
-                                       sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val, sop->o_tmpmemctx );
+                                       sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val,
+                                               sop->o_tmpmemctx );
                                }
                                sl_free( ctrls[--num_ctrls], sop->o_tmpmemctx );
                                ctrls[num_ctrls] = NULL;
-                               if ( cookie.bv_val )
-                                       ch_free( cookie.bv_val );       
+                               if ( cookie.bv_val ) ch_free( cookie.bv_val );  
                        }
                } else {
                        rs->sr_ctrls = NULL;
@@ -1508,10 +1505,10 @@ nochange:
 done:
        if( !IS_PSEARCH && e != NULL ) {
                /* free reader lock */
-               bdb_cache_return_entry_r ( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
+               bdb_cache_return_entry_r( bdb->bi_dbenv, &bdb->bi_cache, e, &lock );
        }
 
-       LOCK_ID_FREE (bdb->bi_dbenv, locker );
+       LOCK_ID_FREEbdb->bi_dbenv, locker );
 
        ber_bvfree( search_context_csn );
 
@@ -1550,8 +1547,7 @@ static int base_candidate(
 static int oc_filter(
        Filter *f,
        int cur,
-       int *max
-)
+       int *max )
 {
        int rc = 0;
 
@@ -1559,7 +1555,7 @@ static int oc_filter(
 
        if( cur > *max ) *max = cur;
 
-       switch(f->f_choice) {
+       switch( f->f_choice ) {
        case LDAP_FILTER_PRESENT:
                if (f->f_desc == slap_schema.si_ad_objectClass) {
                        rc = 1;
@@ -1569,7 +1565,7 @@ static int oc_filter(
        case LDAP_FILTER_AND:
        case LDAP_FILTER_OR:
                cur++;
-               for (f=f->f_and; f; f=f->f_next) {
+               for ( f=f->f_and; f; f=f->f_next ) {
                        (void) oc_filter(f, cur, max);
                }
                break;
@@ -1676,7 +1672,7 @@ static int search_candidates(
        /* Dummy; we compute scope separately now */
        nf.f_choice = SLAPD_FILTER_COMPUTED;
        nf.f_result = LDAP_SUCCESS;
-       nf.f_next = xf.f_or == op->oq_search.rs_filter
+       nf.f_next = ( xf.f_or == op->oq_search.rs_filter )
                ? op->oq_search.rs_filter : &xf ;
        /* Filter depth increased again, adding dummy clause */
        depth++;
@@ -1763,7 +1759,7 @@ send_pagerequest_response(
                lastid, rs->sr_nentries, NULL );
 #else
        Debug(LDAP_DEBUG_ARGS, "send_pagerequest_response: lastid: (0x%08lx) "
-                       "nentries: (0x%081x)\n", lastid, rs->sr_nentries, NULL );
+               "nentries: (0x%081x)\n", lastid, rs->sr_nentries, NULL );
 #endif
 
        ctrl.ldctl_value.bv_val = NULL;