mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
BDB_ALIASES and BDB_SUBENTRIES cleanup
This commit is contained in:
parent
ffebea4a8b
commit
b57c11f4bd
@ -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;
|
||||
|
@ -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
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
LDAP_BEGIN_DECL
|
||||
|
||||
#define BDB_FILTER_INDICES 1
|
||||
#define BDB_IDL_MULTI 1
|
||||
/* #define BDB_HIER 1 */
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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 ) {
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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) );
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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,18 +623,10 @@ static int search_candidates(
|
||||
sf.f_next = scopef.f_next;
|
||||
scopef.f_next = &sf;
|
||||
}
|
||||
|
||||
#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
|
||||
|
||||
rc = bdb_filter_candidates( be, &f, ids, tmp );
|
||||
|
||||
Debug(LDAP_DEBUG_TRACE,
|
||||
"bdb_search_candidates: id=%ld first=%ld last=%ld\n",
|
||||
(long) ids[0],
|
||||
|
Loading…
Reference in New Issue
Block a user