remove #ifdef SLAP_FILTER_HASSUBORDINATES

This commit is contained in:
Pierangelo Masarati 2002-11-10 19:48:36 +00:00
parent a9c902a7ca
commit 76bf91f553
10 changed files with 1 additions and 122 deletions

View File

@ -33,9 +33,7 @@ extern BI_chk_referrals bdb_referrals;
extern BI_operational bdb_operational;
#ifdef SLAP_X_FILTER_HASSUBORDINATES
extern BI_has_subordinates bdb_hasSubordinates;
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
/* tools.c */
extern BI_tool_entry_open bdb_tool_entry_open;

View File

@ -615,9 +615,7 @@ bdb_initialize(
bi->bi_chk_referrals = bdb_referrals;
bi->bi_operational = bdb_operational;
#ifdef SLAP_X_FILTER_HASSUBORDINATES
bi->bi_has_subordinates = bdb_hasSubordinates;
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
bi->bi_entry_release_rw = bdb_entry_release;
/*

View File

@ -43,9 +43,7 @@ extern BI_acl_attribute ldbm_back_attribute;
extern BI_operational ldbm_back_operational;
#ifdef SLAP_X_FILTER_HASSUBORDINATES
extern BI_has_subordinates ldbm_back_hasSubordinates;
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
/* hooks for slap tools */
extern BI_tool_entry_open ldbm_tool_entry_open;

View File

@ -71,9 +71,7 @@ ldbm_back_initialize(
bi->bi_acl_attribute = ldbm_back_attribute;
bi->bi_chk_referrals = ldbm_back_referrals;
bi->bi_operational = ldbm_back_operational;
#ifdef SLAP_X_FILTER_HASSUBORDINATES
bi->bi_has_subordinates = ldbm_back_hasSubordinates;
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
/*
* hooks for slap tools

View File

@ -70,10 +70,7 @@ backsql_operational(
if ( ( opattrs || ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) )
#ifdef SLAP_X_FILTER_HASSUBORDINATES
&& attr_find( e->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
) {
&& attr_find( e->e_attrs, slap_schema.si_ad_hasSubordinates ) == NULL ) {
rc = backsql_get_db_conn( be, conn, &dbh );
if ( rc != LDAP_SUCCESS ) {

View File

@ -386,7 +386,6 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f )
&bsi->oc->oc->soc_cname,
'\'' );
#if defined(SLAP_X_FILTER_HASSUBORDINATES) || defined(SLAP_X_MRA_MATCH_DNATTRS)
} else if ( ad == slap_schema.si_ad_hasSubordinates || ad == NULL ) {
/*
* FIXME: this is not robust; e.g. a filter
@ -416,7 +415,6 @@ backsql_process_filter( backsql_srch_info *bsi, Filter *f )
backsql_attrlist_add( bsi, NULL );
}
goto done;
#endif /* SLAP_X_FILTER_HASSUBORDINATES || SLAP_X_MRA_MATCH_DNATTRS */
} else {
at = backsql_ad2at( bsi->oc, ad );
@ -1145,10 +1143,8 @@ backsql_search(
*/
for ( eid = srch_info.id_list; eid != NULL;
eid = backsql_free_entryID( eid, 1 ) ) {
#ifdef SLAP_X_FILTER_HASSUBORDINATES
Attribute *hasSubordinate = NULL,
*a = NULL;
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
/* check for abandon */
if ( op->o_abandon ) {
@ -1186,7 +1182,6 @@ backsql_search(
continue;
}
#ifdef SLAP_X_FILTER_HASSUBORDINATES
/*
* We use this flag since we need to parse the filter
* anyway; we should have used the frontend API function
@ -1224,18 +1219,15 @@ backsql_search(
continue;
}
}
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
if ( test_filter( be, conn, op, entry, filter )
== LDAP_COMPARE_TRUE ) {
#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( hasSubordinate && !( srch_info.bsi_flags & BSQL_SF_ALL_OPER )
&& !ad_inlist( slap_schema.si_ad_hasSubordinates, attrs ) ) {
a->a_next = NULL;
attr_free( hasSubordinate );
hasSubordinate = NULL;
}
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
#if 0 /* noop is masked SLAP_CTRL_UPDATE */
if ( op->o_noop ) {

View File

@ -1531,92 +1531,3 @@ return_error:
return( LDAP_SUCCESS );
}
#ifdef SLAP_X_FILTER_HASSUBORDINATES
static int filter_has_subordinates_list(
Filter *filter );
/*
* FIXME: we could detect the need to filter
* for hasSubordinates when parsing the filter ...
*/
static int
filter_has_subordinates_list(
Filter *fl )
{
Filter *f;
for ( f = fl; f != NULL; f = f->f_next ) {
int rc;
rc = filter_has_subordinates( f );
if ( rc ) {
return rc;
}
}
return 0;
}
int
filter_has_subordinates(
Filter *f )
{
AttributeDescription *ad = NULL;
switch ( f->f_choice ) {
case LDAP_FILTER_PRESENT:
ad = f->f_desc;
break;
case LDAP_FILTER_EQUALITY:
case LDAP_FILTER_APPROX:
case LDAP_FILTER_GE:
case LDAP_FILTER_LE:
ad = f->f_ava->aa_desc;
break;
case LDAP_FILTER_SUBSTRINGS:
ad = f->f_sub_desc;
break;
case LDAP_FILTER_EXT:
/* could be null; however here it is harmless */
ad = f->f_mra->ma_desc;
break;
case LDAP_FILTER_NOT:
return filter_has_subordinates( f->f_not );
case LDAP_FILTER_AND:
return filter_has_subordinates_list( f->f_and );
case LDAP_FILTER_OR:
return filter_has_subordinates_list( f->f_or );
case SLAPD_FILTER_COMPUTED:
/*
* something wrong?
*/
return 0;
default:
/*
* this means a new type of filter has been implemented,
* which is not handled yet in this function; we should
* issue a developer's warning, e.g. an assertion
*/
assert( 0 );
return -1;
}
if ( ad == slap_schema.si_ad_hasSubordinates ) {
return 1;
}
return 0;
}
#endif /* SLAP_X_FILTER_HASSUBORDINATES */

View File

@ -460,7 +460,6 @@ test_ava_filter(
}
}
#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( ava->aa_desc == slap_schema.si_ad_hasSubordinates
&& be && be->be_has_subordinates ) {
int hasSubordinates;
@ -493,7 +492,6 @@ test_ava_filter(
return LDAP_COMPARE_FALSE;
}
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
return( LDAP_COMPARE_FALSE );
}
@ -517,7 +515,6 @@ test_presence_filter(
a = attrs_find( e->e_attrs, desc );
#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( a == NULL && desc == slap_schema.si_ad_hasSubordinates ) {
/*
@ -532,7 +529,6 @@ test_presence_filter(
return LDAP_COMPARE_FALSE;
}
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
return a != NULL ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
}

View File

@ -483,9 +483,7 @@ LDAP_SLAPD_F (int) get_vrFilter LDAP_P(( Connection *conn, BerElement *ber,
LDAP_SLAPD_F (void) vrFilter_free LDAP_P(( ValuesReturnFilter *f ));
LDAP_SLAPD_F (void) vrFilter2bv LDAP_P(( ValuesReturnFilter *f, struct berval *fstr ));
#ifdef SLAP_X_FILTER_HASSUBORDINATES
LDAP_SLAPD_F (int) filter_has_subordinates LDAP_P(( Filter *filter ));
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
/*
* filterentry.c

View File

@ -1213,11 +1213,8 @@ struct slap_backend_db {
* (in previous use there was a flaw with back-bdb and back-ldbm; now it
* is fixed).
*/
#define SLAP_X_FILTER_HASSUBORDINATES
#ifdef SLAP_X_FILTER_HASSUBORDINATES
#define be_has_subordinates bd_info->bi_has_subordinates
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
#define be_controls bd_info->bi_controls
@ -1418,11 +1415,9 @@ typedef int (BI_operational) LDAP_P((Backend *bd,
struct slap_conn *c, struct slap_op *o,
Entry *e, AttributeName *attrs, int opattrs, Attribute **a ));
#ifdef SLAP_X_FILTER_HASSUBORDINATES
typedef int (BI_has_subordinates) LDAP_P((Backend *bd,
struct slap_conn *c, struct slap_op *o,
Entry *e, int *has_subordinates ));
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
typedef int (BI_connection_init) LDAP_P((BackendDB *bd,
struct slap_conn *c));
@ -1517,9 +1512,7 @@ struct slap_backend_info {
BI_acl_attribute *bi_acl_attribute;
BI_operational *bi_operational;
#ifdef SLAP_X_FILTER_HASSUBORDINATES
BI_has_subordinates *bi_has_subordinates;
#endif /* SLAP_X_FILTER_HASSUBORDINATES */
BI_connection_init *bi_connection_init;
BI_connection_destroy *bi_connection_destroy;