]> git.sur5r.net Git - openldap/commitdiff
Sync with HEAD
authorKurt Zeilenga <kurt@openldap.org>
Thu, 18 Mar 2004 01:56:29 +0000 (01:56 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 18 Mar 2004 01:56:29 +0000 (01:56 +0000)
31 files changed:
servers/slapd/Makefile.in
servers/slapd/back-bdb/dn2id.c
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/search.c
servers/slapd/back-dnssrv/search.c
servers/slapd/back-ldap/config.c
servers/slapd/back-ldap/search.c
servers/slapd/back-ldbm/filterindex.c
servers/slapd/back-ldbm/search.c
servers/slapd/back-monitor/Makefile.in
servers/slapd/back-monitor/back-monitor.h
servers/slapd/back-monitor/database.c
servers/slapd/back-monitor/init.c
servers/slapd/back-monitor/overlay.c [new file with mode: 0644]
servers/slapd/back-monitor/proto-back-monitor.h
servers/slapd/back-monitor/search.c
servers/slapd/back-passwd/search.c
servers/slapd/back-perl/search.c
servers/slapd/back-sql/search.c
servers/slapd/backend.c
servers/slapd/backglue.c
servers/slapd/backover.c
servers/slapd/config.c
servers/slapd/main.c
servers/slapd/overlays/pcache.c
servers/slapd/sessionlog.c
servers/slapd/slapcommon.c
servers/slapd/slapcommon.h
servers/slapd/slapi/slapi_ops.c
servers/slapd/slapi/slapi_utils.c
servers/slapd/syncrepl.c

index c044775b3a281950ba6b3a7d0113b4df80c14af2..33691a4778f4e46a0b72312e3722370a76a152b9 100644 (file)
@@ -13,7 +13,7 @@
 ## top-level directory of the distribution or, alternatively, at
 ## <http://www.OpenLDAP.org/license.html>.
 
-SLAPTOOLS=slapadd slapcat slapindex slappasswd
+SLAPTOOLS=slapadd slapcat slapdn slapindex slappasswd slaptest
 PROGRAMS=slapd $(SLAPTOOLS)
 XPROGRAMS=sslapd libbackends.a .backend liboverlays.a
 XSRCS=version.c
@@ -35,8 +35,10 @@ SRCS = main.c globals.c config.c daemon.c \
                oidm.c starttls.c index.c sets.c referral.c root_dse.c \
                sasl.c module.c mra.c mods.c sl_malloc.c limits.c \
                backglue.c operational.c matchedValues.c cancel.c syncrepl.c \
-               slapadd.c slapcat.c slapcommon.c slapindex.c slappasswd.c \
-               backover.c ctxcsn.c ldapsync.c sessionlog.c $(@PLAT@_SRCS)
+               backover.c ctxcsn.c ldapsync.c sessionlog.c \
+               slapadd.c slapcat.c slapcommon.c slapdn.c slapindex.c \
+               slappasswd.c slaptest.c \
+               $(@PLAT@_SRCS)
 
 OBJS   = main.o globals.o config.o daemon.o \
                connection.o search.o filter.o add.o cr.o \
@@ -50,8 +52,10 @@ OBJS = main.o globals.o config.o daemon.o \
                oidm.o starttls.o index.o sets.o referral.o root_dse.o \
                sasl.o module.o mra.o mods.o sl_malloc.o limits.o \
                backglue.o operational.o matchedValues.o cancel.o syncrepl.o \
-               slapadd.o slapcat.o slapcommon.o slapindex.o slappasswd.o \
-               backover.o ctxcsn.o ldapsync.o sessionlog.o $(@PLAT@_OBJS)
+               backover.o ctxcsn.o ldapsync.o sessionlog.o \
+               slapadd.o slapcat.o slapcommon.o slapdn.o slapindex.o \
+               slappasswd.o slaptest.o \
+               $(@PLAT@_OBJS)
 
 LDAP_INCDIR= ../../include -I$(srcdir)/slapi
 LDAP_LIBDIR= ../../libraries
index 26746dc8149f20de7fa5aecd325c79ea3dcfd950..19dc5d30742217996c6bd2bf2334446d67aa0746 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 47e5728fbd817cfd4bb2eb36043ee6dbfb011463..2dbb326e324c1ee5c63aa7233eefce292a47fa6d 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 b63b953e59dc48ed31245d82cdd05661759aa80e..97da998b23738305878c64e7bafafba8263c3035 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)
@@ -851,7 +847,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 */
@@ -973,6 +969,11 @@ id2entry_retry:
                        if ( ei->bei_parent->bei_id == base.e_id ) scopeok = 1;
                        break;
 
+#ifdef LDAP_SCOPE_CHILDREN
+               case LDAP_SCOPE_CHILDREN:
+                       if ( id == base.e_id ) break;
+                       /* Fall-thru */
+#endif
                case LDAP_SCOPE_SUBTREE: {
                        EntryInfo *tmp;
                        for (tmp = BEI(e); tmp->bei_parent;
@@ -1002,12 +1003,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 );
@@ -1044,11 +1043,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 );
 
@@ -1179,27 +1176,27 @@ 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 );
                                                        if ( rs->sr_err != LDAP_SUCCESS ) goto done;
                                                        rs->sr_attrs = attrs;
                                                        rs->sr_ctrls = ctrls;
+                                                       rs->sr_flags = 0;
                                                        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,
@@ -1218,7 +1215,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,
@@ -1226,31 +1222,35 @@ id2entry_retry:
                                                        if ( rs->sr_err != LDAP_SUCCESS ) goto done;
                                                        rs->sr_ctrls = ctrls;
                                                        rs->sr_attrs = sop->oq_search.rs_attrs;
+                                                       rs->sr_flags = 0;
                                                        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;
                                                                        }
@@ -1262,6 +1262,7 @@ id2entry_retry:
                                        } else {
                                                rs->sr_attrs = sop->oq_search.rs_attrs;
                                                rs->sr_ctrls = NULL;
+                                               rs->sr_flags = 0;
                                                result = send_search_entry( sop, rs );
                                        }
                                }
@@ -1314,7 +1315,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;
        }
@@ -1324,10 +1325,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;
@@ -1339,9 +1338,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;
                                                                }
@@ -1369,10 +1371,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,
@@ -1382,7 +1382,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 ) {
@@ -1403,16 +1404,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;
@@ -1428,10 +1430,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 );
 
@@ -1470,8 +1472,7 @@ static int base_candidate(
 static int oc_filter(
        Filter *f,
        int cur,
-       int *max
-)
+       int *max )
 {
        int rc = 0;
 
@@ -1479,7 +1480,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;
@@ -1489,7 +1490,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;
@@ -1596,7 +1597,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++;
@@ -1683,7 +1684,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;
index 999bfe0a61c3b0239ee25c6d7faffb27263535da..09954e13b323faa40a68041f0135e52e58d56b06 100644 (file)
@@ -221,6 +221,7 @@ dnssrv_back_search(
                if( rc == LDAP_COMPARE_TRUE ) {
                        rs->sr_entry = e;
                        rs->sr_attrs = op->oq_search.rs_attrs;
+                       rs->sr_flags = REP_ENTRY_MODIFIABLE;
                        send_search_entry( op, rs );
                        rs->sr_entry = NULL;
                        rs->sr_attrs = NULL;
index 5baef7722d7a1b77bbeb7730d1fb2929af90f900..32da6f9f3de7ee56e82fe39d3f2bc529f923ceed 100644 (file)
@@ -70,15 +70,62 @@ ldap_back_db_config(
 
        /* URI of server to query (preferred over "server" directive) */
        } else if ( strcasecmp( argv[0], "uri" ) == 0 ) {
+               LDAPURLDesc     *lud, tmplud;
+
                if (argc != 2) {
-                       fprintf( stderr,
-       "%s: line %d: missing address in \"uri <address>\" line\n",
-                           fname, lineno );
+                       fprintf( stderr, "%s: line %d: "
+                               "missing uri "
+                               "in \"uri <uri>\" line\n",
+                               fname, lineno );
                        return( 1 );
                }
-               if (li->url != NULL)
-                       ch_free(li->url);
-               li->url = ch_strdup(argv[1]);
+               if ( li->url != NULL ) {
+                       ch_free( li->url );
+               }
+
+               if ( ldap_url_parse( argv[ 1 ], &lud ) != LDAP_URL_SUCCESS ) {
+                       fprintf( stderr, "%s: line %d: "
+                               "unable to parse uri \"%s\" "
+                               "in \"uri <uri>\" line\n",
+                               fname, lineno, argv[ 1 ] );
+                       return 1;
+               }
+
+               if ( ( lud->lud_dn != NULL && lud->lud_dn[0] != '\0' )
+                               || lud->lud_attrs != NULL
+                               || lud->lud_filter != NULL
+                               || lud->lud_exts != NULL )
+               {
+                       fprintf( stderr, "%s: line %d: "
+                               "warning, only protocol, "
+                               "host and port allowed "
+                               "in \"uri <uri>\" line\n",
+                               fname, lineno );
+               }
+
+#if 0
+               tmplud = *lud;
+               tmplud.lud_dn = NULL;
+               tmplud.lud_attrs = NULL;
+               tmplud.lud_filter = NULL;
+               if ( !ldap_is_ldapi_url( argv[ 1 ] ) ) {
+                       tmplud.lud_exts = NULL;
+                       tmplud.lud_crit_exts = 0;
+               }
+               
+               li->url = ldap_url_desc2str( &tmplud );
+               if ( li->url == NULL ) {
+                       fprintf( stderr, "%s: line %d: "
+                               "unable to rebuild uri \"%s\" "
+                               "in \"uri <uri>\" line\n",
+                               fname, lineno, argv[ 1 ] );
+                       return 1;
+               }
+#else
+               li->url = ch_strdup( argv[ 1 ] );
+#endif
+
+               ldap_free_urldesc( lud );
 
        /* name to use for ldap_back_group */
        } else if ( strcasecmp( argv[0], "binddn" ) == 0 ) {
index 986e4c5c7064ba6ad32493945458a76de22a939f..6cf7697fdafc54bb1bcfbcfc0c8376e0797f407a 100644 (file)
@@ -187,6 +187,7 @@ fail:;
                                                LDAP_BUILD_ENTRY_PRIVATE)) == LDAP_SUCCESS ) {
                                rs->sr_entry = &ent;
                                rs->sr_attrs = op->ors_attrs;
+                               rs->sr_flags = 0;
                                abort = send_search_entry( op, rs );
                                while (ent.e_attrs) {
                                        Attribute *a;
index 72028a92179964fe055e41a36c61f9adaedc60be..1b5d86b1cc4587c1d5df48acc003797ab1cd50ff 100644 (file)
@@ -45,6 +45,7 @@ filter_candidates(
     Filter     *f
 )
 {
+       char *sub = "SUBTREE";
        ID_BLOCK        *result;
 
 #ifdef NEW_LOGGING
@@ -88,12 +89,17 @@ filter_candidates(
                }
                break;
 
+#ifdef SLAPD_FILTER_DN_CHILDREN
+       case SLAPD_FILTER_DN_CHILDREN:
+               sub = "CHILDREN";
+#endif
        case SLAPD_FILTER_DN_SUBTREE:
 #ifdef NEW_LOGGING
                LDAP_LOG( FILTER, DETAIL1, 
-                          "filter_candidates:  DN SUBTREE (%s)\n", f->f_dn, 0, 0 );
+                  "filter_candidates:  DN %s (%s)\n", sub, f->f_dn, 0 );
 #else
-               Debug( LDAP_DEBUG_FILTER, "\tDN SUBTREE\n", 0, 0, 0 );
+               Debug( LDAP_DEBUG_FILTER,
+                       "\tDN %s\n", sub, 0, 0 );
 #endif
 
                /* an error is treated as an empty list */
index 44925228df57df9eb3bdad930e45e87b3caf7470..acebe63641c2d0c826fe6a18b98bacfb8e951288 100644 (file)
@@ -347,6 +347,14 @@ searchit:
                        {
                                scopeok = dnIsSuffix( &e->e_nname, &realbase );
 
+#ifdef LDAP_SCOPE_SUBORDINATE
+                       } else if ( !scopeok
+                               && op->ors_scope == LDAP_SCOPE_SUBORDINATE )
+                       {
+                               scopeok = !dn_match( &e->e_nname, &realbase )
+                                       && dnIsSuffix( &e->e_nname, &realbase );
+#endif
+
                        } else {
                                scopeok = 1;
                        }
@@ -403,6 +411,14 @@ searchit:
                        {
                                scopeok = dnIsSuffix( &e->e_nname, &realbase );
 
+#ifdef LDAP_SCOPE_SUBORDINATE
+                       } else if ( !scopeok &&
+                               op->ors_scope == LDAP_SCOPE_SUBORDINATE )
+                       {
+                               scopeok = !dn_match( &e->e_nname, &realbase )
+                                       && dnIsSuffix( &e->e_nname, &realbase );
+#endif
+
                        } else {
                                scopeok = 1;
                        }
@@ -418,6 +434,7 @@ searchit:
                                }
 
                                if (e) {
+                                       rs->sr_flags = 0;
                                        result = send_search_entry( op, rs );
 
                                        switch (result) {
index 76d9453ae8e19671ebe10cec1be3360e92dd3a86..8d96a5640733880ba28027be771ec2005323275b 100644 (file)
@@ -17,12 +17,12 @@ SRCS = init.c search.c compare.c modify.c bind.c \
        operational.c \
        cache.c entry.c \
        backend.c database.c thread.c conn.c rww.c log.c \
-       operation.c sent.c listener.c time.c
+       operation.c sent.c listener.c time.c overlay.c
 OBJS = init.lo search.lo compare.lo modify.lo bind.lo \
        operational.lo \
        cache.lo entry.lo \
        backend.lo database.lo thread.lo conn.lo rww.lo log.lo \
-       operation.lo sent.lo listener.lo time.lo
+       operation.lo sent.lo listener.lo time.lo overlay.lo
 
 LDAP_INCDIR= ../../../include
 LDAP_LIBDIR= ../../../libraries
index 5659bc5a5307d1fe19c14536ab7275007db3acd7..cddd899abc4ec5b9ebc7aa0713e959d72cc61896 100644 (file)
@@ -94,6 +94,7 @@ struct monitorinfo {
        AttributeDescription *mi_ad_monitorConnectionLocalAddress;
        AttributeDescription *mi_ad_monitorConnectionPeerAddress;
        AttributeDescription *mi_ad_monitorTimestamp;
+       AttributeDescription *mi_ad_monitorOverlay;
 
        /*
         * Generic description attribute
@@ -101,95 +102,106 @@ struct monitorinfo {
        AttributeDescription *mi_ad_description;
        AttributeDescription *mi_ad_seeAlso;
        AttributeDescription *mi_ad_l;
+       AttributeDescription *mi_ad_labeledURI;
 };
 
 /*
  * DNs
  */
+
+#define SLAPD_MONITOR_AT               "cn"
+
 #define        SLAPD_MONITOR_LISTENER          0
 #define SLAPD_MONITOR_LISTENER_NAME    "Listeners"
 #define SLAPD_MONITOR_LISTENER_RDN     \
-       "cn=" SLAPD_MONITOR_LISTENER_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LISTENER_NAME
 #define SLAPD_MONITOR_LISTENER_DN      \
        SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_DATABASE         1
 #define SLAPD_MONITOR_DATABASE_NAME    "Databases"
 #define SLAPD_MONITOR_DATABASE_RDN     \
-       "cn=" SLAPD_MONITOR_DATABASE_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_DATABASE_NAME
 #define SLAPD_MONITOR_DATABASE_DN      \
        SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_BACKEND          2
 #define SLAPD_MONITOR_BACKEND_NAME     "Backends"
 #define SLAPD_MONITOR_BACKEND_RDN      \
-       "cn=" SLAPD_MONITOR_BACKEND_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_BACKEND_NAME
 #define SLAPD_MONITOR_BACKEND_DN       \
        SLAPD_MONITOR_BACKEND_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_THREAD           3
 #define SLAPD_MONITOR_THREAD_NAME      "Threads"
 #define SLAPD_MONITOR_THREAD_RDN       \
-       "cn=" SLAPD_MONITOR_THREAD_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_THREAD_NAME
 #define SLAPD_MONITOR_THREAD_DN        \
        SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_SASL             4
 #define SLAPD_MONITOR_SASL_NAME                "SASL"
 #define SLAPD_MONITOR_SASL_RDN \
-       "cn=" SLAPD_MONITOR_SASL_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SASL_NAME
 #define SLAPD_MONITOR_SASL_DN  \
        SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_TLS              5
 #define SLAPD_MONITOR_TLS_NAME         "TLS"
 #define SLAPD_MONITOR_TLS_RDN  \
-       "cn=" SLAPD_MONITOR_TLS_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TLS_NAME
 #define SLAPD_MONITOR_TLS_DN   \
        SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_CONN             6
 #define SLAPD_MONITOR_CONN_NAME                "Connections"
 #define SLAPD_MONITOR_CONN_RDN \
-       "cn=" SLAPD_MONITOR_CONN_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_CONN_NAME
 #define SLAPD_MONITOR_CONN_DN  \
        SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_RWW              7
 #define SLAPD_MONITOR_RWW_NAME "Waiters"
 #define SLAPD_MONITOR_RWW_RDN  \
-       "cn=" SLAPD_MONITOR_RWW_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_RWW_NAME
 #define SLAPD_MONITOR_RWW_DN   \
        SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_LOG              8
 #define SLAPD_MONITOR_LOG_NAME         "Log"
 #define SLAPD_MONITOR_LOG_RDN  \
-       "cn=" SLAPD_MONITOR_LOG_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LOG_NAME
 #define SLAPD_MONITOR_LOG_DN   \
        SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_OPS              9
 #define SLAPD_MONITOR_OPS_NAME         "Operations"
 #define SLAPD_MONITOR_OPS_RDN  \
-       "cn=" SLAPD_MONITOR_OPS_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OPS_NAME
 #define SLAPD_MONITOR_OPS_DN   \
        SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_SENT             10
 #define SLAPD_MONITOR_SENT_NAME                "Statistics"
 #define SLAPD_MONITOR_SENT_RDN \
-       "cn=" SLAPD_MONITOR_SENT_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SENT_NAME
 #define SLAPD_MONITOR_SENT_DN  \
        SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_TIME             11
 #define SLAPD_MONITOR_TIME_NAME                "Time"
 #define SLAPD_MONITOR_TIME_RDN  \
-       "cn=" SLAPD_MONITOR_TIME_NAME
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TIME_NAME
 #define SLAPD_MONITOR_TIME_DN   \
        SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
 
+#define SLAPD_MONITOR_OVERLAY          12
+#define SLAPD_MONITOR_OVERLAY_NAME             "Overlay"
+#define SLAPD_MONITOR_OVERLAY_RDN  \
+       SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OVERLAY_NAME
+#define SLAPD_MONITOR_OVERLAY_DN   \
+       SLAPD_MONITOR_OVERLAY_RDN "," SLAPD_MONITOR_DN
+
 struct monitorsubsys {
        int             mss_type;
        char            *mss_name;
index 896b44b60a1f968840a43ceb3056506d3ad589cc..3442106bb0fea7641e209ac9a0cdf2c881f40d5d 100644 (file)
 static int monitor_back_add_plugin( Backend *be, Entry *e );
 #endif /* defined(LDAP_SLAPI) */
 
+#if defined(SLAPD_LDAP) 
+#include "../back-ldap/back-ldap.h"
+#endif /* defined(SLAPD_LDAP) */
+
 int
 monitor_subsys_database_init(
        BackendDB       *be
@@ -132,6 +136,47 @@ monitor_subsys_database_init(
                                        be->be_suffix, be->be_nsuffix );
                }
 
+               if ( oi != NULL ) {
+                       slap_overinst *on = oi->oi_list;
+
+                       for ( ; on; on = on->on_next ) {
+                               struct berval           bv;
+                               slap_overinst           *on2;
+                               
+                               bv.bv_val = on->on_bi.bi_type;
+                               bv.bv_len = strlen( bv.bv_val );
+                               attr_merge_normalize_one( e, mi->mi_ad_monitorOverlay,
+                                               &bv, NULL );
+
+                               for ( on2 = overlay_next( NULL ), j = 0; on2; on2 = overlay_next( on2 ), j++ ) {
+                                       if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
+                                               break;
+                                       }
+                               }
+                               assert( on2 );
+
+                               snprintf( buf, sizeof( buf ), 
+                                       "cn=Overlay %d,%s", 
+                                       j, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_dn.bv_val );
+                               bv.bv_val = buf;
+                               bv.bv_len = strlen( buf );
+                               attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
+                                               &bv, NULL );
+                       }
+               }
+
+#if defined(SLAPD_LDAP) 
+               if ( strcmp( be->bd_info->bi_type, "ldap" ) == 0 ) {
+                       struct ldapinfo         *li = (struct ldapinfo *)be->be_private;
+                       struct berval           bv;
+
+                       bv.bv_val = li->url;
+                       bv.bv_len = strlen( bv.bv_val );
+                       attr_merge_normalize_one( e, mi->mi_ad_labeledURI,
+                                       &bv, NULL );
+               }
+#endif /* defined(SLAPD_LDAP) */
+
                for ( j = nBackendInfo; j--; ) {
                        if ( backendInfo[ j ].bi_type == be->bd_info->bi_type ) {
                                struct berval           bv;
index 54292418f0295997911e14d826e96fa230d18459..f8d2815066bb7da236466ab790ae4c7043346f71 100644 (file)
@@ -136,6 +136,14 @@ struct monitorsubsys monitor_subsys[] = {
                monitor_subsys_time_update,
                NULL,   /* create */
                NULL,   /* modify */
+               }, { 
+               SLAPD_MONITOR_OVERLAY, SLAPD_MONITOR_OVERLAY_NAME,
+               BER_BVNULL, BER_BVNULL, BER_BVNULL,
+               MONITOR_F_PERSISTENT_CH,
+               monitor_subsys_overlay_init,
+               NULL,   /* update */
+               NULL,   /* create */
+               NULL,   /* modify */
        }, { -1, NULL }
 };
 
@@ -321,8 +329,10 @@ monitor_back_db_open(
                                "$ postalCode "
 #endif
                                "$ seeAlso "
+                               "$ labeledURI "
                                "$ monitoredInfo "
                                "$ managedInfo "
+                               "$ monitorOverlay "
                        ") )", SLAP_OC_OPERATIONAL|SLAP_OC_HIDE,
                        offsetof(struct monitorinfo, mi_oc_monitor) },
                { "monitorServer", "( 1.3.6.1.4.1.4203.666.3.7 "
@@ -440,10 +450,18 @@ monitor_back_db_open(
                        "NO-USER-MODIFICATION "
                        "USAGE directoryOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
                        offsetof(struct monitorinfo, mi_ad_monitorTimestamp) },
+               { "monitorOverlay", "( 1.3.6.1.4.1.4203.666.1.27 "
+                       "NAME 'monitorOverlay' "
+                       "DESC 'name of overlays defined for a give database' "
+                       "SUP monitoredInfo "
+                       "NO-USER-MODIFICATION "
+                       "USAGE directoryOperation )", SLAP_AT_HIDE,
+                       offsetof(struct monitorinfo, mi_ad_monitorOverlay) },
 #ifdef INTEGRATE_CORE_SCHEMA
                { NULL, NULL, 0, -1 },  /* description */
                { NULL, NULL, 0, -1 },  /* seeAlso */
                { NULL, NULL, 0, -1 },  /* l */
+               { NULL, NULL, 0, -1 },  /* labeledURI */
 #endif /* INTEGRATE_CORE_SCHEMA */
                { NULL, NULL, 0, -1 }
        }, mat_core[] = {
@@ -464,6 +482,12 @@ monitor_back_db_open(
                        "DESC 'RFC2256: locality which this object resides in' "
                        "SUP name )", 0,
                        offsetof(struct monitorinfo, mi_ad_l) },
+               { "labeledURI", "( 1.3.6.1.4.1.250.1.57 "
+                       "NAME 'labeledURI' "
+                       "DESC 'RFC2079: Uniform Resource Identifier with optional label' "
+                       "EQUALITY caseExactMatch "
+                       "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )", 0,
+                       offsetof(struct monitorinfo, mi_ad_labeledURI) },
                { NULL, NULL, 0, -1 }
        };
        
diff --git a/servers/slapd/back-monitor/overlay.c b/servers/slapd/back-monitor/overlay.c
new file mode 100644 (file)
index 0000000..22b704f
--- /dev/null
@@ -0,0 +1,176 @@
+/* overlay.c - deals with overlay subsystem */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Portions Copyright 2001-2003 Pierangelo Masarati.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Pierangelo Masarati for inclusion
+ * in OpenLDAP Software.
+ */
+
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-monitor.h"
+
+/*
+ * initializes overlay subentries
+ */
+int
+monitor_subsys_overlay_init(
+       BackendDB       *be
+)
+{
+       struct monitorinfo      *mi;
+       Entry                   *e, *e_overlay, *e_tmp;
+       int                     i;
+       struct monitorentrypriv *mp;
+       slap_overinst           *on;
+
+       mi = ( struct monitorinfo * )be->be_private;
+
+       if ( monitor_cache_get( mi, 
+                               &monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn, 
+                               &e_overlay ) ) {
+#ifdef NEW_LOGGING
+               LDAP_LOG( OPERATION, CRIT,
+                       "monitor_subsys_overlay_init: "
+                       "unable to get entry '%s'\n",
+                       monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0, 0 );
+#else
+               Debug( LDAP_DEBUG_ANY,
+                       "monitor_subsys_overlay_init: "
+                       "unable to get entry '%s'\n%s%s",
+                       monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 
+                       "", "" );
+#endif
+               return( -1 );
+       }
+
+       e_tmp = NULL;
+       for ( on = overlay_next( NULL ), i = 0; on ; on = overlay_next( on ), i++ ) {
+               char            buf[ BACKMONITOR_BUFSIZE ];
+               struct berval   bv;
+               int             j;
+
+               snprintf( buf, sizeof( buf ),
+                               "dn: cn=Overlay %d,%s\n"
+                               "objectClass: %s\n"
+                               "structuralObjectClass: %s\n"
+                               "cn: Overlay %d\n"
+                               "createTimestamp: %s\n"
+                               "modifyTimestamp: %s\n",
+                               i,
+                               monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_dn.bv_val,
+                               mi->mi_oc_monitoredObject->soc_cname.bv_val,
+                               mi->mi_oc_monitoredObject->soc_cname.bv_val,
+                               i,
+                               mi->mi_startTime.bv_val,
+                               mi->mi_startTime.bv_val );
+               
+               e = str2entry( buf );
+               if ( e == NULL ) {
+#ifdef NEW_LOGGING
+                       LDAP_LOG( OPERATION, CRIT,
+                               "monitor_subsys_overlay_init: "
+                               "unable to create entry 'cn=Overlay %d,%s'\n",
+                               i, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0 );
+#else
+                       Debug( LDAP_DEBUG_ANY,
+                               "monitor_subsys_overlay_init: "
+                               "unable to create entry 'cn=Overlay %d,%s'\n%s",
+                               i, 
+                               monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val,
+                               "" );
+#endif
+                       return( -1 );
+               }
+               
+               bv.bv_val = on->on_bi.bi_type;
+               bv.bv_len = strlen( bv.bv_val );
+
+               attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
+                               &bv, NULL );
+               attr_merge_normalize_one( e_overlay, mi->mi_ad_monitoredInfo,
+                               &bv, NULL );
+
+               for ( j = 0; j < nBackendDB; j++ ) {
+                       BackendDB       *be = &backendDB[j];
+                       char            buf[ SLAP_LDAPDN_MAXLEN ];
+                       struct berval   dn;
+                       slap_overinst   *on2;
+
+                       if ( strcmp( be->bd_info->bi_type, "over" ) != 0 ) {
+                               continue;
+                       }
+
+                       on2 = ((slap_overinfo *)be->bd_info)->oi_list;
+                       for ( ; on2; on2 = on2->on_next ) {
+                               if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
+                                       break;
+                               }
+                       }
+
+                       if ( on2 == NULL ) {
+                               continue;
+                       }
+
+                       snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
+                                       j, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val );
+                       dn.bv_val = buf;
+                       dn.bv_len = strlen( buf );
+
+                       attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
+                                       &dn, NULL );
+               }
+               
+               mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
+               e->e_private = ( void * )mp;
+               mp->mp_next = e_tmp;
+               mp->mp_children = NULL;
+               mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OVERLAY];
+               mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_flags
+                       | MONITOR_F_SUB;
+
+               if ( monitor_cache_add( mi, e ) ) {
+#ifdef NEW_LOGGING
+                       LDAP_LOG( OPERATION, CRIT,
+                               "monitor_subsys_overlay_init: "
+                               "unable to add entry 'cn=Overlay %d,%s'\n",
+                               i, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0 );
+#else
+                       Debug( LDAP_DEBUG_ANY,
+                               "monitor_subsys_overlay_init: "
+                               "unable to add entry 'cn=Overlay %d,%s'\n%s",
+                               i,
+                               monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val,
+                               "" );
+#endif
+                       return( -1 );
+               }
+
+               e_tmp = e;
+       }
+       
+       mp = ( struct monitorentrypriv * )e_overlay->e_private;
+       mp->mp_children = e_tmp;
+
+       monitor_cache_release( mi, e_overlay );
+
+       return( 0 );
+}
+
index 6253c71e0d495c0b3d72682f921d5fff61a6bf61..9b5980174bab47f264e6d2487a533978da240e7f 100644 (file)
@@ -74,6 +74,11 @@ int monitor_subsys_log_modify LDAP_P(( Operation *op, Entry *e ));
 int monitor_subsys_ops_init LDAP_P(( BackendDB *be ));
 int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
 
+/*
+ * overlay
+ */
+int monitor_subsys_overlay_init LDAP_P(( BackendDB *be ));
+
 /*
  * sent
  */
index 46fa3457118ed1ecdd6ddf5c49e9930514ed0a7f..e2d7ef63cc3847af8acc952c6e4eec068c1bf8d6 100644 (file)
@@ -92,6 +92,7 @@ monitor_send_children(
                rc = test_filter( op, e, op->oq_search.rs_filter );
                if ( rc == LDAP_COMPARE_TRUE ) {
                        rs->sr_entry = e;
+                       rs->sr_flags = 0;
                        send_search_entry( op, rs );
                        rs->sr_entry = NULL;
                }
@@ -155,6 +156,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
                rc = test_filter( op, e, op->oq_search.rs_filter );
                if ( rc == LDAP_COMPARE_TRUE ) {
                        rs->sr_entry = e;
+                       rs->sr_flags = 0;
                        send_search_entry( op, rs );
                        rs->sr_entry = NULL;
                }
@@ -175,6 +177,7 @@ monitor_back_search( Operation *op, SlapReply *rs )
                rc = test_filter( op, e, op->oq_search.rs_filter );
                if ( rc == LDAP_COMPARE_TRUE ) {
                        rs->sr_entry = e;
+                       rs->sr_flags = 0;
                        send_search_entry( op, rs );
                        rs->sr_entry = NULL;
                }
index 1932583d17a1c5d2e0a2c7785159b9bd36ea331d..3e3560e5690cdfac656f42349045e20883edb0cb 100644 (file)
@@ -131,6 +131,7 @@ passwd_back_search(
                        if ( test_filter( op, e, op->ors_filter ) == LDAP_COMPARE_TRUE ) {
                                rs->sr_entry = e;
                                rs->sr_attrs = op->ors_attrs;
+                               rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                send_search_entry( op, rs );
                        }
                }
@@ -174,6 +175,7 @@ passwd_back_search(
 
                                        rs->sr_entry = e;
                                        rs->sr_attrs = op->ors_attrs;
+                                       rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                        send_search_entry( op, rs );
                                }
 
@@ -233,6 +235,7 @@ passwd_back_search(
                if ( test_filter( op, e, op->ors_filter ) == LDAP_COMPARE_TRUE ) {
                        rs->sr_entry = e;
                        rs->sr_attrs = op->ors_attrs;
+                       rs->sr_flags = REP_ENTRY_MODIFIABLE;
                        send_search_entry( op, rs );
                }
 
index 21b9a12fd94ec39f7cd756f8aa854218fed2ec6f..4e1264e5cbf16978f3f81863bf347d698b91288e 100644 (file)
@@ -100,6 +100,7 @@ perl_back_search(
                                        if (send_entry) {
                                                rs->sr_entry = e;
                                                rs->sr_attrs = op->ors_attrs;
+                                               rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                                send_search_entry( op, rs );
                                        }
 
index efbdcd9877b047f004fb94d4c4fcd284663c575c..0eca1f703b2ede7ea8b620089a84692f1b867765 100644 (file)
@@ -1339,6 +1339,7 @@ backsql_search( Operation *op, SlapReply *rs )
                        {
                                rs->sr_attrs = op->ors_attrs;
                                rs->sr_entry = entry;
+                               rs->sr_flags = REP_ENTRY_MODIFIABLE;
                                sres = send_search_entry( op, rs );
                                rs->sr_entry = NULL;
                                rs->sr_attrs = NULL;
index d34d89ee77560d8f3c35f95f8c6d25587fe75932..21dd29003f1f37591a5de3e4625c14d8d5b9a9cf 100644 (file)
@@ -81,6 +81,9 @@
 #if defined(SLAPD_PERL) && !defined(SLAPD_PERL_DYNAMIC)
 #include "back-perl/external.h"
 #endif
+#if defined(SLAPD_RELAY) && !defined(SLAPD_RELAY_DYNAMIC)
+#include "back-relay/external.h"
+#endif
 #if defined(SLAPD_SHELL) && !defined(SLAPD_SHELL_DYNAMIC)
 #include "back-shell/external.h"
 #endif
@@ -125,6 +128,9 @@ static BackendInfo binfo[] = {
 #if defined(SLAPD_PERL) && !defined(SLAPD_PERL_DYNAMIC)
        {"perl",        perl_back_initialize},
 #endif
+#if defined(SLAPD_RELAY) && !defined(SLAPD_RELAY_DYNAMIC)
+       {"relay",       relay_back_initialize},
+#endif
 #if defined(SLAPD_SHELL) && !defined(SLAPD_SHELL_DYNAMIC)
        {"shell",       shell_back_initialize},
 #endif
@@ -1283,6 +1289,14 @@ backend_group(
                                                case LDAP_SCOPE_SUBTREE:
                                                        if ( !dnIsSuffix( op_ndn, &nbase )) goto loopit;
                                                        break;
+#ifdef LDAP_SCOPE_SUBORDINATE
+                                               case LDAP_SCOPE_SUBORDINATE:
+                                                       if ( dn_match( &nbase, op_ndn ) &&
+                                                               !dnIsSuffix(op_ndn, &nbase ))
+                                                       {
+                                                               goto loopit;
+                                                       }
+#endif
                                                }
                                                filter = str2filter_x( op, ludp->lud_filter );
                                                if ( filter ) {
index 38d36b79a3d62781da8a6362cbd3e9e773f4b898..d76154743a18e1dbfa8a37b76b7beb23d3774a20 100644 (file)
@@ -281,6 +281,9 @@ glue_back_search ( Operation *op, SlapReply *rs )
 
        case LDAP_SCOPE_ONELEVEL:
        case LDAP_SCOPE_SUBTREE:
+#ifdef LDAP_SCOPE_SUBORDINATE
+       case LDAP_SCOPE_SUBORDINATE: /* FIXME */
+#endif
                op->o_callback = &cb;
                rs->sr_err = gs.err = LDAP_UNWILLING_TO_PERFORM;
                scope0 = op->ors_scope;
index 21ced8051a2ebf60a195974c20b2a8ad5e54e5c8..fed40f1cfd0c90c20d5a88f65cb638c0622f73c7 100644 (file)
@@ -130,7 +130,7 @@ over_db_destroy(
 static int
 over_back_response ( Operation *op, SlapReply *rs )
 {
-       slap_overinfo *oi = (slap_overinfo *) op->o_bd->bd_info;
+       slap_overinfo *oi = op->o_callback->sc_private;
        slap_overinst *on = oi->oi_list;
        int rc = SLAP_CB_CONTINUE;
        BackendDB *be = op->o_bd, db = *op->o_bd;
@@ -167,6 +167,7 @@ over_op_func(
 
        op->o_bd = &db;
        cb.sc_next = op->o_callback;
+       cb.sc_private = oi;
        op->o_callback = &cb;
 
        for (; on; on=on->on_next ) {
@@ -267,15 +268,27 @@ overlay_register(
        return 0;
 }
 
+slap_overinst *
+overlay_next(
+       slap_overinst *on
+)
+{
+       if ( on == NULL ) {
+               return overlays;
+       }
+
+       return on->on_next;
+}
+
 static const char overtype[] = "over";
 
 /* add an overlay to a particular backend. */
 int
 overlay_config( BackendDB *be, const char *ov )
 {
-       slap_overinst *on, *on2, *prev;
-       slap_overinfo *oi;
-       BackendInfo *bi;
+       slap_overinst *on = NULL, *on2 = NULL, *prev = NULL;
+       slap_overinfo *oi = NULL;
+       BackendInfo *bi = NULL;
 
        for ( on = overlays; on; on=on->on_next ) {
                if (!strcmp( ov, on->on_bi.bi_type ) )
@@ -316,13 +329,15 @@ overlay_config( BackendDB *be, const char *ov )
                bi->bi_extended = over_op_extended;
 
                be->bd_info = bi;
+
+       } else {
+               oi = (slap_overinfo *) be->bd_info;
        }
 
 #if 0
        /* Walk to the end of the list of overlays, add the new
         * one onto the end
         */
-       oi = (slap_overinfo *) be->bd_info;
        for ( prev=NULL, on2 = oi->oi_list; on2; prev=on2, on2=on2->on_next );
        on2 = ch_calloc( 1, sizeof(slap_overinst) );
        if ( !prev ) {
index 5e4bf1b80c589418a588de40d4819c069979de00..aa75227507ce88da72c57c6cd3eca6cf2f242d99 100644 (file)
@@ -96,15 +96,15 @@ int use_reverse_lookup = 0;
 int slapi_plugins_used = 0;
 #endif
 
-static char    *fp_getline(FILE *fp, int *lineno);
-static void    fp_getline_init(int *lineno);
-static int     fp_parse_line(int lineno, char *line);
+static char *fp_getline(FILE *fp, int *lineno);
+static void fp_getline_init(int *lineno);
+static int fp_parse_line(int lineno, char *line);
 
 static char    *strtok_quote(char *line, char *sep);
-static int      load_ucdata(char *path);
+static int load_ucdata(char *path);
 
-static int     add_syncrepl LDAP_P(( Backend *, char **, int ));
-static int      parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
+static int add_syncrepl LDAP_P(( Backend *, char **, int ));
+static int parse_syncrepl_line LDAP_P(( char **, int, syncinfo_t *));
 
 int
 read_config( const char *fname, int depth )
@@ -2855,10 +2855,10 @@ add_syncrepl(
                if ( si->si_rid == si_entry->si_rid ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG( CONFIG, ERR,
-                                       "add_syncrepl: duplicaetd replica id\n", 0, 0,0 );
+                               "add_syncrepl: duplicated replica id\n", 0, 0,0 );
 #else
                        Debug( LDAP_DEBUG_ANY,
-                                       "add_syncrepl: duplicated replica id\n",0, 0, 0 );
+                               "add_syncrepl: duplicated replica id\n",0, 0, 0 );
 #endif
                        duplicated_replica_id = 1;
                        break;
@@ -3100,6 +3100,12 @@ parse_syncrepl_line(
                                si->si_scope = LDAP_SCOPE_BASE;
                        } else if ( !strncasecmp( val, "one", sizeof( "one" ) - 1 )) {
                                si->si_scope = LDAP_SCOPE_ONELEVEL;
+#ifdef LDAP_SCOPE_SUBORDINATE
+                       } else if ( !strcasecmp( val, "subordinate" ) ||
+                               !strcasecmp( val, "children" ))
+                       {
+                               si->si_scope = LDAP_SCOPE_SUBORDINATE;
+#endif
                        } else if ( !strncasecmp( val, "sub", sizeof( "sub" ) - 1 )) {
                                si->si_scope = LDAP_SCOPE_SUBTREE;
                        } else {
index 497d40868161bcc3f2b7b8cf6e82aa1e442d6c65..a0cd1380dbff630f260137c6e0e088eac12f9545 100644 (file)
@@ -65,7 +65,7 @@ static struct sockaddr_in     bind_addr;
 #endif
 
 typedef int (MainFunc) LDAP_P(( int argc, char *argv[] ));
-extern MainFunc slapadd, slapcat, slapindex, slappasswd;
+extern MainFunc slapadd, slapcat, slapdn, slapindex, slappasswd, slaptest;
 
 static struct {
        char *name;
@@ -73,8 +73,10 @@ static struct {
 } tools[] = {
        {"slapadd", slapadd},
        {"slapcat", slapcat},
+       {"slapdn", slapdn},
        {"slapindex", slapindex},
        {"slappasswd", slappasswd},
+       {"slaptest", slaptest},
        {NULL, NULL}
 };
 
@@ -116,7 +118,9 @@ static int   cnvt_str2int( char *, STRDISP_P, int );
 
 #endif /* LOG_LOCAL4 */
 
-static int check_config = 0;
+#define CHECK_NONE     0x00
+#define CHECK_CONFIG   0x01
+static int check = CHECK_NONE;
 static int version = 0;
 
 static void
@@ -127,7 +131,7 @@ usage( char *name )
        fprintf( stderr,
                "\t-4\t\tIPv4 only\n"
                "\t-6\t\tIPv6 only\n"
-               "\t-T (a|c|i|p)\tRun in Tool mode\n"
+               "\t-T {acdipt}\tRun in Tool mode\n"
                "\t-c cookie\tSync cookie of consumer\n"
                "\t-d level\tDebug level" "\n"
                "\t-f filename\tConfiguration file\n"
@@ -143,7 +147,6 @@ usage( char *name )
                "\t-r directory\tSandbox directory to chroot to\n"
 #endif
                "\t-s level\tSyslog level\n"
-               "\t-t\t\tCheck configuration file and exit\n"
 #if defined(HAVE_SETUID) && defined(HAVE_SETGID)
                "\t-u user\t\tUser (id or name) to run as\n"
                "\t-V\t\tprint version info (-VV only)\n"
@@ -266,7 +269,7 @@ int main( int argc, char **argv )
 #endif
 
        while ( (i = getopt( argc, argv,
-                            "c:d:f:h:s:n:t:T:V"
+                            "c:d:f:h:s:n:tT:V"
 #if LDAP_PF_INET6
                                "46"
 #endif
@@ -370,8 +373,12 @@ int main( int argc, char **argv )
                        break;
 
                case 't':
-                       check_config++;
+                       /* deprecated; use slaptest instead */
+                       fprintf( stderr, "option -t deprecated; "
+                               "use slaptest command instead\n" );
+                       check |= CHECK_CONFIG;
                        break;
+
                case 'V':
                        version++;
                        break;
@@ -431,7 +438,7 @@ int main( int argc, char **argv )
        Debug( LDAP_DEBUG_ANY, "%s", Versionstr, 0, 0 );
 #endif
 
-       if( !check_config && slapd_daemon_init( urls ) != 0 ) {
+       if( check == CHECK_NONE && slapd_daemon_init( urls ) != 0 ) {
                rc = 1;
                SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 16 );
                goto stop;
@@ -532,17 +539,21 @@ int main( int argc, char **argv )
                rc = 1;
                SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 19 );
 
-               if ( check_config ) {
+               if ( check & CHECK_CONFIG ) {
                        fprintf( stderr, "config check failed\n" );
                }
 
                goto destroy;
        }
 
-       if ( check_config ) {
-               rc = 0;
+       if ( check & CHECK_CONFIG ) {
                fprintf( stderr, "config check succeeded\n" );
-               goto destroy;
+
+               check &= ~CHECK_CONFIG;
+               if ( check == CHECK_NONE ) {
+                       rc = 0;
+                       goto destroy;
+               }
        }
 
        if ( glue_sub_init( ) != 0 ) {
index add41d81a172eb22550f62ff1bfc59e207c4e939..8b2d6a7dadd792d85f23485105d253078d674875 100644 (file)
@@ -803,8 +803,9 @@ static void cache_replacement(query_manager* qm, struct berval *result)
 }
 
 struct query_info {
-       struct berval*          uuid;
-       int                     deleted;
+       struct query_info *next;
+       struct berval xdn;
+       int del;
 };
 
 static int
@@ -813,18 +814,11 @@ remove_func (
        SlapReply       *rs
 )
 {
-       struct query_info       *info = op->o_callback->sc_private;
-       int                     count = 0;
-       Modifications           mod;
-       struct berval vals[2];
+       Attribute *attr;
+       struct query_info *qi;
+       int count = 0;
 
-       Attribute               *attr;
-       Operation               op_tmp = *op;
-
-       SlapReply               sreply = {REP_RESULT};
-
-       if (rs->sr_type == REP_RESULT)
-               return 0;
+       if ( rs->sr_type != REP_SEARCH ) return 0;
 
        for (attr = rs->sr_entry->e_attrs; attr!= NULL; attr = attr->a_next) {
                if (attr->a_desc == ad_queryid) {
@@ -833,51 +827,12 @@ remove_func (
                        break;
                }
        }
-
-       if (count == 0) {
-               return 0;
-       }
-       if (count == 1) {
-#ifdef NEW_LOGGING
-               LDAP_LOG( BACK_META, DETAIL1,
-                               "DELETING ENTRY TEMPLATE=%s\n",
-                               attr->a_vals[0].bv_val, 0, 0 );
-#else
-               Debug( LDAP_DEBUG_ANY, "DELETING ENTRY TEMPLATE=%s\n",
-                               attr->a_vals[0].bv_val, 0, 0 );
-#endif
-
-               op_tmp.o_req_dn = rs->sr_entry->e_name;
-               op_tmp.o_req_ndn = rs->sr_entry->e_nname;
-
-               if (op->o_bd->be_delete(&op_tmp, rs) == LDAP_SUCCESS) {
-                       info->deleted++;
-               }
-               return 0;
-       }
-
-       vals[0] = *info->uuid;
-       vals[1].bv_val = NULL;
-       vals[1].bv_len = 0;
-       mod.sml_op = LDAP_MOD_DELETE;
-       mod.sml_desc = ad_queryid;
-       mod.sml_type = ad_queryid->ad_cname;
-       mod.sml_bvalues = vals;
-       mod.sml_next = NULL;
-#ifdef NEW_LOGGING
-       LDAP_LOG( BACK_META, DETAIL1,
-                       "REMOVING TEMP ATTR : TEMPLATE=%s\n",
-                       attr->a_vals[0].bv_val, 0, 0 );
-#else
-       Debug( LDAP_DEBUG_ANY, "REMOVING TEMP ATTR : TEMPLATE=%s\n",
-                       attr->a_vals[0].bv_val, 0, 0 );
-#endif
-
-       op_tmp.o_req_dn = rs->sr_entry->e_name;
-       op_tmp.o_req_ndn = rs->sr_entry->e_nname;
-       op_tmp.orm_modlist = &mod;
-
-       op->o_bd->be_modify( &op_tmp, &sreply );
+       if ( count == 0 ) return 0;
+       qi = op->o_tmpalloc( sizeof( struct query_info ), op->o_tmpmemctx );
+       qi->next = op->o_callback->sc_private;
+       op->o_callback->sc_private = qi;
+       ber_dupbv_x( &qi->xdn, &rs->sr_entry->e_nname, op->o_tmpmemctx );
+       qi->del = ( count == 1 );
 
        return 0;
 }
@@ -888,21 +843,21 @@ remove_query_data (
        SlapReply       *rs,
        struct berval* query_uuid)
 {
-       struct query_info       info;
+       struct query_info       *qi, *qnext;
        char                    filter_str[64];
+       AttributeAssertion      ava;
        Filter                  filter = {LDAP_FILTER_EQUALITY};
        SlapReply               sreply = {REP_RESULT};
        slap_callback cb = { NULL, remove_func, NULL, NULL };
+       int deleted = 0;
 
        sreply.sr_entry = NULL;
        sreply.sr_nentries = 0;
        op->ors_filterstr.bv_len = snprintf(filter_str, sizeof(filter_str),
                "(%s=%s)", ad_queryid->ad_cname.bv_val, query_uuid->bv_val);
+       filter.f_ava = &ava;
        filter.f_av_desc = ad_queryid;
        filter.f_av_value = *query_uuid;
-       info.uuid = query_uuid;
-       info.deleted = 0;
-       cb.sc_private = &info;
 
        op->o_tag = LDAP_REQ_SEARCH;
        op->o_protocol = LDAP_VERSION3;
@@ -924,7 +879,57 @@ remove_query_data (
 
        op->o_bd->be_search( op, &sreply );
 
-       return info.deleted;
+       for ( qi=cb.sc_private; qi; qi=qnext ) {
+               qnext = qi->next;
+
+               op->o_req_dn = qi->xdn;
+               op->o_req_ndn = qi->xdn;
+
+               if ( qi->del) {
+#ifdef NEW_LOGGING
+                       LDAP_LOG( BACK_META, DETAIL1,
+                               "DELETING ENTRY TEMPLATE=%s\n",
+                               query_uuid->bv_val, 0, 0 );
+#else
+                       Debug( LDAP_DEBUG_ANY, "DELETING ENTRY TEMPLATE=%s\n",
+                               query_uuid->bv_val, 0, 0 );
+#endif
+
+                       op->o_tag = LDAP_REQ_DELETE;
+
+                       if (op->o_bd->be_delete(op, &sreply) == LDAP_SUCCESS) {
+                               deleted++;
+                       }
+               } else {
+                       Modifications mod;
+                       struct berval vals[2];
+
+                       vals[0] = *query_uuid;
+                       vals[1].bv_val = NULL;
+                       vals[1].bv_len = 0;
+                       mod.sml_op = LDAP_MOD_DELETE;
+                       mod.sml_desc = ad_queryid;
+                       mod.sml_type = ad_queryid->ad_cname;
+                       mod.sml_bvalues = vals;
+                       mod.sml_next = NULL;
+#ifdef NEW_LOGGING
+                       LDAP_LOG( BACK_META, DETAIL1,
+                               "REMOVING TEMP ATTR : TEMPLATE=%s\n",
+                               query_uuid->bv_val, 0, 0 );
+#else
+                       Debug( LDAP_DEBUG_ANY,
+                               "REMOVING TEMP ATTR : TEMPLATE=%s\n",
+                               query_uuid->bv_val, 0, 0 );
+#endif
+
+                       op->orm_modlist = &mod;
+
+                       op->o_bd->be_modify( op, &sreply );
+               }
+               op->o_tmpfree( qi->xdn.bv_val, op->o_tmpmemctx );
+               op->o_tmpfree( qi, op->o_tmpmemctx );
+       }
+       return deleted;
 }
 
 static int
@@ -1516,19 +1521,18 @@ consistency_check(
        cache_manager *cm = on->on_bi.bi_private;
        query_manager *qm = cm->qm;
        Operation op = {0};
+       Connection conn = {0};
 
        SlapReply rs = {REP_RESULT};
        CachedQuery* query, *query_prev;
        int i, return_val, pause = 1;
        QueryTemplate* templ;
 
+       connection_fake_init( &conn, &op, ctx );
+
        op.o_bd = &cm->db;
        op.o_dn = cm->db.be_rootdn;
        op.o_ndn = cm->db.be_rootndn;
-       op.o_threadctx = ctx;
-
-       op.o_tmpmemctx = sl_mem_create( SLMALLOC_SLAB_SIZE, ctx );
-       op.o_tmpmfuncs = &sl_mfuncs;
 
        cm->cc_arg = arg;
 
index 5d8308a07d28a7b5468209ac5aea8fab52d85734..148f703360b271806df422c2752431d4346c2384 100644 (file)
@@ -87,6 +87,7 @@ slap_send_session_log(
                        rs->sr_entry = &e;
                        rs->sr_attrs = uuid_attr;
                        rs->sr_ctrls = ctrls;
+                       rs->sr_flags = 0;
                        result = send_search_entry( op, rs );
                        sl_free( ctrls[num_ctrls-1]->ldctl_value.bv_val, op->o_tmpmemctx );
                        sl_free( ctrls[--num_ctrls], op->o_tmpmemctx );
index 9db0214ef047bf8b7274032f6de7e07d78cc1675..996536b4f87b1bc7518be4d5bcff539316018cc3 100644 (file)
@@ -49,24 +49,29 @@ usage( int tool, const char *progname )
 {
        char *options = NULL;
        fprintf( stderr,
-               "usage: %s [-v] [-c] [-d debuglevel] [-f configfile]\n"
-                       "\t[-n databasenumber | -b suffix]", progname );
+               "usage: %s [-v] [-c] [-d debuglevel] [-f configfile]\n",
+               progname );
 
        switch( tool ) {
        case SLAPADD:
-               options = "\n\t[-l ldiffile] [-u] [-p [-w] | -r [-i syncreplidlist] [-w]]\n";
+               options = "\t[-n databasenumber | -b suffix]\n"
+                       "\t[-l ldiffile] [-u] [-p [-w] | -r [-i syncreplidlist] [-w]]\n";
                break;
 
        case SLAPCAT:
-               options = "\t[-l ldiffile] [-m] [-k]\n";
+               options = "\t[-n databasenumber | -b suffix] [-l ldiffile] [-m] [-k]\n";
+               break;
+
+       case SLAPDN:
+               options = "\tDN [...]\n";
                break;
 
        case SLAPINDEX:
-               options = "\n";
+               options = "\t[-n databasenumber | -b suffix]\n";
                break;
        }
 
-       if( options != NULL ) {
+       if ( options != NULL ) {
                fputs( options, stderr );
        }
        exit( EXIT_FAILURE );
@@ -110,16 +115,21 @@ slap_tool_init(
                options = "b:cd:f:i:l:n:prtuvWw";
                break;
 
-       case SLAPINDEX:
-               options = "b:cd:f:n:v";
-               mode |= SLAP_TOOL_READMAIN;
-               break;
-
        case SLAPCAT:
                options = "b:cd:f:kl:mn:s:v";
                mode |= SLAP_TOOL_READMAIN | SLAP_TOOL_READONLY;
                break;
 
+       case SLAPDN:
+       case SLAPTEST:
+               options = "d:f:v";
+               break;
+
+       case SLAPINDEX:
+               options = "b:cd:f:n:v";
+               mode |= SLAP_TOOL_READMAIN;
+               break;
+
        default:
                fprintf( stderr, "%s: unknown tool mode (%d)\n",
                         progname, tool );
@@ -223,16 +233,38 @@ slap_tool_init(
                }
        }
 
-       if ( ( argc != optind ) || (dbnum >= 0 && base.bv_val != NULL ) ) {
-               usage( tool, progname );
-       }
+       switch ( tool ) {
+       case SLAPADD:
+       case SLAPCAT:
+       case SLAPINDEX:
+               if ( ( argc != optind ) || (dbnum >= 0 && base.bv_val != NULL ) ) {
+                       usage( tool, progname );
+               }
+
+               if ( replica_promotion && replica_demotion ) {
+                       usage( tool, progname );
+
+               } else if ( !replica_promotion && !replica_demotion ) {
+                       if ( update_ctxcsn != SLAP_TOOL_CTXCSN_KEEP ) {
+                               usage( tool, progname );
+                       }
+               }
+               break;
 
-       if ( replica_promotion && replica_demotion ) {
-               usage( tool, progname );
-       } else if ( !replica_promotion && !replica_demotion ) {
-               if ( update_ctxcsn != SLAP_TOOL_CTXCSN_KEEP ) {
+       case SLAPDN:
+               if ( argc == optind ) {
                        usage( tool, progname );
                }
+               break;
+
+       case SLAPTEST:
+               if ( argc != optind ) {
+                       usage( tool, progname );
+               }
+               break;
+
+       default:
+               break;
        }
 
        if ( ldiffile == NULL ) {
@@ -279,9 +311,19 @@ slap_tool_init(
 
        ldap_syslog = 0;
 
-       if ( !nbackends ) {
-               fprintf( stderr, "No databases found in config file\n" );
-               exit( EXIT_FAILURE );
+       switch ( tool ) {
+       case SLAPADD:
+       case SLAPCAT:
+       case SLAPINDEX:
+               if ( !nbackends ) {
+                       fprintf( stderr, "No databases found "
+                                       "in config file\n" );
+                       exit( EXIT_FAILURE );
+               }
+               break;
+
+       default:
+               break;
        }
 
        rc = glue_sub_init();
@@ -298,6 +340,15 @@ slap_tool_init(
                exit( EXIT_FAILURE );
        }
 
+       switch ( tool ) {
+       case SLAPDN:
+       case SLAPTEST:
+               return;
+
+       default:
+               break;
+       }
+
        if( subtree ) {
                struct berval val;
                val.bv_val = subtree;
index fdeb68a1a461b7ade2e57e96e4a2358d81046e7f..12a1b57ffd3e88e631216da0e0179495d2a3f577 100644 (file)
 enum slaptool {
        SLAPADD=1,      /* LDIF -> database tool */
        SLAPCAT,        /* database -> LDIF tool */
+       SLAPDN,         /* DN check w/ syntax tool */
        SLAPINDEX,      /* database index tool */
-       SLAPPASSWD      /* password generation tool */
+       SLAPPASSWD,     /* password generation tool */
+       SLAPTEST,       /* slapd.conf test tool */
+       SLAPLAST
 };
 
 #define SLAP_TOOL_CTXCSN_KEEP  0
index fb25fe082bf7108418005945a92b39adcf6ad1a4..db3ecb7d2e63bf1e81046306c48c9805c4dfbb36 100644 (file)
@@ -1174,6 +1174,7 @@ slapi_search_internal(
                                rs.sr_type = REP_SEARCH;
                                rs.sr_err = LDAP_SUCCESS;
                                rs.sr_attrs = an;
+                               rs.sr_flags = REP_ENTRY_MODIFIABLE;
 
                                send_search_entry( op, &rs );
                        }
index 9a1fc49b32e0b3459d411ff5bd07777a18827f61..3944a4c81c5ca748163847e5dcb7e0db075fcb37 100644 (file)
@@ -1573,6 +1573,7 @@ slapi_send_ldap_search_entry(
        rs.sr_attrs = an;
        rs.sr_entry = e;
        rs.sr_v2ref = NULL;
+       rs.sr_flags = 0;
 
        if ( slapi_pblock_get( pb, SLAPI_OPERATION, (void *)&pOp ) != 0 ) {
                return LDAP_OTHER;
index ea3da5f929513ec5e2990d86f6fd69234fc3e842..cb0a461adc4c00126cde391ee670cdeafcdf9b6e 100644 (file)
@@ -165,8 +165,6 @@ ldap_sync_search(
        return rc;
 }
 
-static const Listener dummy_list = { {0, ""}, {0, ""} };
-
 static int
 do_syncrep1(
        Operation *op,
@@ -809,25 +807,12 @@ do_syncrepl(
                return NULL;
        }
 
-       conn.c_connid = -1;
-       conn.c_send_ldap_result = slap_send_ldap_result;
-       conn.c_send_search_entry = slap_send_search_entry;
-       conn.c_send_search_reference = slap_send_search_reference;
-       conn.c_listener = (Listener *)&dummy_list;
-       conn.c_peer_name = slap_empty_bv;
-
-       /* set memory context */
-       op.o_tmpmemctx = sl_mem_create( SLMALLOC_SLAB_SIZE, ctx );
-       op.o_tmpmfuncs = &sl_mfuncs;
+       connection_fake_init( &conn, &op, ctx );
 
        op.o_dn = si->si_updatedn;
        op.o_ndn = si->si_updatedn;
-       op.o_time = slap_get_time();
-       op.o_threadctx = ctx;
        op.o_managedsait = 1;
        op.o_bd = si->si_be;
-       op.o_conn = &conn;
-       op.o_connid = op.o_conn->c_connid;
 
        op.o_sync_state.ctxcsn = NULL;
        op.o_sync_state.sid = -1;
@@ -854,7 +839,7 @@ do_syncrepl(
                         */
                        if ( rc == LDAP_SUCCESS ) {
                                if ( first ) {
-                                       rc = connection_client_setup( s, (Listener *)&dummy_list, do_syncrepl,
+                                       rc = connection_client_setup( s, do_syncrepl,
                                                arg );
                                } else {
                                        connection_client_enable( s );