]> git.sur5r.net Git - openldap/commitdiff
BDB_ALIASES and BDB_SUBENTRIES cleanup
authorKurt Zeilenga <kurt@openldap.org>
Tue, 29 Jan 2002 04:53:47 +0000 (04:53 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 29 Jan 2002 04:53:47 +0000 (04:53 +0000)
13 files changed:
servers/slapd/back-bdb/add.c
servers/slapd/back-bdb/attribute.c
servers/slapd/back-bdb/back-bdb.h
servers/slapd/back-bdb/bind.c
servers/slapd/back-bdb/config.c
servers/slapd/back-bdb/delete.c
servers/slapd/back-bdb/filterindex.c
servers/slapd/back-bdb/group.c
servers/slapd/back-bdb/init.c
servers/slapd/back-bdb/modify.c
servers/slapd/back-bdb/modrdn.c
servers/slapd/back-bdb/passwd.c
servers/slapd/back-bdb/search.c

index 961aa0a8ed7479102ff91108cf64feb545e81942..7da553e59fcb6fabbb2db333875c9a9430ca0124 100644 (file)
@@ -30,7 +30,9 @@ bdb_add(
        AttributeDescription *children = slap_schema.si_ad_children;
        DB_TXN          *ltid = NULL;
        struct bdb_op_info opinfo;
+#ifdef BDB_SUBENTRIES
        int subentry;
+#endif
 #if 0
        u_int32_t       lockid;
        DB_LOCK         lock;
@@ -47,7 +49,9 @@ bdb_add(
                goto return_results;
        }
 
+#ifdef BDB_SUBENTRIES
        subentry = is_entry_subentry( e );
+#endif
 
        /*
         * acquire an ID outside of the operation transaction
@@ -186,6 +190,7 @@ retry:      /* transaction retry */
                        goto return_results;;
                }
 
+#ifdef BDB_SUBENTRIES
                if ( is_entry_subentry( p ) ) {
                        /* parent is a subentry, don't allow add */
                        Debug( LDAP_DEBUG_TRACE, "bdb_add: parent is subentry\n",
@@ -194,7 +199,8 @@ retry:      /* transaction retry */
                        text = "parent is a subentry";
                        goto return_results;;
                }
-
+#endif
+#ifdef BDB_ALIASES
                if ( is_entry_alias( p ) ) {
                        /* parent is an alias, don't allow add */
                        Debug( LDAP_DEBUG_TRACE, "bdb_add: parent is alias\n",
@@ -203,6 +209,7 @@ retry:      /* transaction retry */
                        text = "parent is an alias";
                        goto return_results;;
                }
+#endif
 
                if ( is_entry_referral( p ) ) {
                        /* parent is a referral, don't allow add */
@@ -221,10 +228,12 @@ retry:    /* transaction retry */
                        goto done;
                }
 
+#ifdef BDB_SUBENTRIES
                if ( subentry ) {
                        /* FIXME: */
                        /* parent must be an administrative point of the required kind */
                }
+#endif
 
                /* free parent and reader lock */
                bdb_cache_return_entry_r( &bdb->bi_cache, p );
@@ -269,6 +278,7 @@ retry:      /* transaction retry */
                        }
                }
 
+#ifdef BDB_SUBENTRIES
                if( subentry ) {
                        Debug( LDAP_DEBUG_TRACE,
                                "bdb_add: no parent, cannot add subentry\n",
@@ -277,6 +287,7 @@ retry:      /* transaction retry */
                        text = "no parent, cannot add subentry";
                        goto return_results;;
                }
+#endif
 #if 0
                if ( ltid ) {
                        DBT obj;
index 298c6f5fdc6a89ad293c4b77bb4cbdc668e822a6..71f1147cf96164ccfda85e19203755b4be679c17 100644 (file)
@@ -114,6 +114,7 @@ bdb_attribute(
 #endif
        }
 
+#ifdef BDB_ALIASES
        /* find attribute values */
        if( is_entry_alias( e ) ) {
 #ifdef NEW_LOGGING
@@ -126,6 +127,7 @@ bdb_attribute(
                rc = LDAP_ALIAS_PROBLEM;
                goto return_results;
        }
+#endif
 
        if( is_entry_referral( e ) ) {
 #ifdef NEW_LOGGING
index 08ad730aa2abca31d99e8d215915696767b961e1..e0d6cd7842a4557a1b6a4bf078afeb35ab8576a4 100644 (file)
@@ -15,7 +15,6 @@
 
 LDAP_BEGIN_DECL
 
-#define BDB_FILTER_INDICES 1
 #define BDB_IDL_MULTI          1
 /* #define BDB_HIER            1 */
 
index 1c682e4b4b89485b5babb678c34cc1e863b4e824..2dbb5ad8f5dfaa05d5aa03cd3bb2b075342933aa 100644 (file)
@@ -109,7 +109,20 @@ bdb_bind(
        ber_dupbv( edn, &e->e_name );
 
        /* check for deleted */
+#ifdef BDB_SUBENTRIES
+       if ( is_entry_subentry( e ) ) {
+               /* entry is an subentry, don't allow bind */
+               Debug( LDAP_DEBUG_TRACE, "entry is alias\n", 0,
+                       0, 0 );
+
+               send_ldap_result( conn, op, rc = LDAP_INVALID_CREDENTIALS,
+                       NULL, NULL, NULL, NULL );
+
+               goto done;
+       }
+#endif
 
+#ifdef BDB_ALIASES
        if ( is_entry_alias( e ) ) {
                /* entry is an alias, don't allow bind */
                Debug( LDAP_DEBUG_TRACE, "entry is alias\n", 0,
@@ -120,6 +133,7 @@ bdb_bind(
 
                goto done;
        }
+#endif
 
        if ( is_entry_referral( e ) ) {
                /* entry is a referral, don't allow bind */
index b1a6d6d5dd19fe5209b8dad57766b86997345bb6..bd74e95e8c32f39f3bb19f0b8faa22ab72cba048 100644 (file)
@@ -121,7 +121,6 @@ bdb_db_config(
                }
                bdb->bi_dbenv_mode = strtol( argv[1], NULL, 0 );
 
-#if BDB_FILTER_INDICES
        /* attribute to index */
        } else if ( strcasecmp( argv[0], "index" ) == 0 ) {
                int rc;
@@ -139,7 +138,6 @@ bdb_db_config(
                rc = bdb_attr_index_config( bdb, fname, lineno, argc - 1, &argv[1] );
 
                if( rc != LDAP_SUCCESS ) return 1;
-#endif
 
        /* size of the cache in entries */
          } else if ( strcasecmp( argv[0], "cachesize" ) == 0 ) {
index f09b2963b1623e20724f264275d16388e3fd3758..24d4f2ecb49404d0431762a5a994c1c11d030a4b 100644 (file)
@@ -233,8 +233,7 @@ retry:      /* transaction retry */
        }
 
        if ( !manageDSAit && is_entry_referral( e ) ) {
-               /* parent is a referral, don't allow add */
-               /* parent is an alias, don't allow add */
+               /* entry is a referral, don't allow delete */
                BerVarray refs = get_entry_referrals( be,
                        conn, op, e );
 
index 995b9e96cbe7f33710faec8fea8af35a6909a78c..9e5caa29ab137328e85babcfb6ff263fb1a4c7ba 100644 (file)
@@ -13,8 +13,6 @@
 #include "back-bdb.h"
 #include "idl.h"
 
-#ifdef BDB_FILTER_INDICES
-
 static int presence_candidates(
        Backend *be,
        AttributeDescription *desc,
@@ -563,4 +561,3 @@ substring_candidates(
        return( 0 );
 }
 
-#endif
index b754c31f14cfe128940b0fc8cab44c795a14b2d3..e5c3bc8a97385c9846318c3afafff569f9415a86 100644 (file)
@@ -123,6 +123,7 @@ bdb_group(
         */
        rc = 1;
 
+#ifdef BDB_ALIASES
        if( is_entry_alias( e ) ) {
 #ifdef NEW_LOGGING
                LDAP_LOG(( "backend", LDAP_LEVEL_INFO,
@@ -133,6 +134,7 @@ bdb_group(
 #endif
                goto return_results;
        }
+#endif
 
        if( is_entry_referral( e ) ) {
 #ifdef NEW_LOGGING
index b51ca852b96c42046b71ae6bacff2d02d8941b9b..a7f3ad0f01286e5fa8741ed66e8430374b01a3a0 100644 (file)
@@ -65,9 +65,14 @@ bdb_db_init( BackendDB *be )
                0, 0, 0 );
 
        /* indicate system schema supported */
-       be->be_flags |= SLAP_BFLAG_ALIASES
-               | SLAP_BFLAG_REFERRALS
-               | SLAP_BFLAG_SUBENTRIES;
+       be->be_flags |=
+#ifdef BDB_SUBENTRIES
+               SLAP_BFLAG_SUBENTRIES |
+#endif
+#ifdef BDB_ALIASES
+               SLAP_BFLAG_ALIASES |
+#endif
+               SLAP_BFLAG_REFERRALS;
 
        /* allocate backend-database-specific stuff */
        bdb = (struct bdb_info *) ch_calloc( 1, sizeof(struct bdb_info) );
index 6194c20e2bda14cf419cdc3ea2b995cfe20b76c5..d9dc92be05fa68243b50bd9e242ee071cb11f05c 100644 (file)
@@ -281,8 +281,7 @@ retry:      /* transaction retry */
        }
 
        if ( !manageDSAit && is_entry_referral( e ) ) {
-               /* parent is a referral, don't allow add */
-               /* parent is an alias, don't allow add */
+               /* entry is a referral, don't allow modify */
                BerVarray refs = get_entry_referrals( be,
                        conn, op, e );
 
index 73c7d212520cc21f5fdc27a49247530a66fc723b..29888ae7d0b11792a7e183aea72ece1c7f76c19c 100644 (file)
@@ -324,6 +324,7 @@ retry:      /* transaction retry */
                                goto return_results;
                        }
 
+#ifdef BDB_ALIASES
                        if ( is_entry_alias( np ) ) {
                                /* parent is an alias, don't allow add */
                                Debug( LDAP_DEBUG_TRACE, "bdb_modrdn: entry is alias\n",
@@ -332,6 +333,7 @@ retry:      /* transaction retry */
                                rc = LDAP_ALIAS_PROBLEM;
                                goto return_results;
                        }
+#endif
 
                        if ( is_entry_referral( np ) ) {
                                /* parent is a referral, don't allow add */
index 003f85691adcd749074bc8e1d3c9bcd8f10fa8fa..38cee4b7c6153126c4c30234c0671befd1b11aa2 100644 (file)
@@ -142,18 +142,27 @@ retry:    /* transaction retry */
                goto done;
        }
 
+#ifdef BDB_SUBENTRIES
+       if( is_entry_subentries( e ) ) {
+               /* entry is an alias, don't allow operation */
+               *text = "authorization entry is subentry";
+               rc = LDAP_OTHER;
+               goto done;
+       }
+#endif
+#ifdef BDB_ALIASES
        if( is_entry_alias( e ) ) {
                /* entry is an alias, don't allow operation */
                *text = "authorization entry is alias";
                rc = LDAP_ALIAS_PROBLEM;
                goto done;
        }
-
+#endif
 
        if( is_entry_referral( e ) ) {
                /* entry is an referral, don't allow operation */
                *text = "authorization entry is referral";
-               rc = LDAP_OPERATIONS_ERROR;
+               rc = LDAP_OTHER;
                goto done;
        }
 
index 6b3447ef5ce4d15f109a1d5a4dc21fe779da42e4..34197d090b9f921cd8b33dfae5cb49bbc909fe27 100644 (file)
@@ -315,22 +315,26 @@ bdb_search(
                        goto loop_continue;
                }
 
+#ifdef BDB_SUBENTRIES
                if ( is_entry_subentry( e ) ) {
                        if( scope != LDAP_SCOPE_BASE ) {
                                if(!get_subentries_visibility( op )) {
                                        /* only subentries are visible */
                                        goto loop_continue;
                                }
+
                        } else if ( get_subentries( op ) &&
                                !get_subentries_visibility( op ))
                        {
                                /* only subentries are visible */
                                goto loop_continue;
                        }
+
                } else if ( get_subentries_visibility( op )) {
                        /* only subentries are visible */
                        goto loop_continue;
                }
+#endif
 
 #ifdef BDB_ALIASES
                if ( deref & LDAP_DEREF_SEARCHING && is_entry_alias( e ) ) {
@@ -545,15 +549,18 @@ static int search_candidates(
        ID      *ids )
 {
        int rc;
-       Filter          f, scopef, sf, rf, xf;
+       Filter          f, scopef, rf, xf;
        ID              tmp[BDB_IDL_UM_SIZE];
        AttributeAssertion aa_ref;
+#ifdef BDB_SUBENTRIES
+       Filter  sf;
        AttributeAssertion aa_subentry;
-       struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+#endif
 #ifdef BDB_ALIASES
        Filter  af;
        AttributeAssertion aa_alias;
 #endif
+       struct bdb_info *bdb = (struct bdb_info *) be->be_private;
 
        /*
         * This routine takes as input a filter (user-filter)
@@ -606,6 +613,7 @@ static int search_candidates(
        scopef.f_dn = &e->e_nname;
        scopef.f_next = xf.f_or == filter ? filter : &xf ;
 
+#ifdef BDB_SUBENTRIES
        if( get_subentries_visibility( op ) ) {
                struct berval bv_subentry = { sizeof("SUBENTRY")-1, "SUBENTRY" };
                sf.f_choice = LDAP_FILTER_EQUALITY;
@@ -615,17 +623,9 @@ static int search_candidates(
                sf.f_next = scopef.f_next;
                scopef.f_next = &sf;
        }
+#endif
 
-#ifdef BDB_FILTER_INDICES
        rc = bdb_filter_candidates( be, &f, ids, tmp );
-#else
-       /* FIXME: Original code:
-       BDB_IDL_ID( bdb, ids, e->e_id );
-       * this is a hack to make "" base work; when bdb_filter_candidates
-       * is used this should not be needed any more */
-       BDB_IDL_ID( bdb, ids, (e->e_id == NOID ? 1 : e->e_id) );
-       rc = 0;
-#endif
 
        Debug(LDAP_DEBUG_TRACE,
                "bdb_search_candidates: id=%ld first=%ld last=%ld\n",