From: Pierangelo Masarati Date: Sun, 10 Nov 2002 19:48:36 +0000 (+0000) Subject: remove #ifdef SLAP_FILTER_HASSUBORDINATES X-Git-Tag: NO_SLAP_OP_BLOCKS~808 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=76bf91f553d9630e633f6bb92fe5a093da9e2e6d;p=openldap remove #ifdef SLAP_FILTER_HASSUBORDINATES --- diff --git a/servers/slapd/back-bdb/external.h b/servers/slapd/back-bdb/external.h index 9e595ef9ff..6ecb0e0b13 100644 --- a/servers/slapd/back-bdb/external.h +++ b/servers/slapd/back-bdb/external.h @@ -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; diff --git a/servers/slapd/back-bdb/init.c b/servers/slapd/back-bdb/init.c index aa956d2b1e..e8646d3896 100644 --- a/servers/slapd/back-bdb/init.c +++ b/servers/slapd/back-bdb/init.c @@ -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; /* diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h index 93b40b1dd4..e68286dd85 100644 --- a/servers/slapd/back-ldbm/external.h +++ b/servers/slapd/back-ldbm/external.h @@ -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; diff --git a/servers/slapd/back-ldbm/init.c b/servers/slapd/back-ldbm/init.c index 327b0b79a9..949abfa870 100644 --- a/servers/slapd/back-ldbm/init.c +++ b/servers/slapd/back-ldbm/init.c @@ -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 diff --git a/servers/slapd/back-sql/other.c b/servers/slapd/back-sql/other.c index b2638960f4..f0d863e605 100644 --- a/servers/slapd/back-sql/other.c +++ b/servers/slapd/back-sql/other.c @@ -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 ) { diff --git a/servers/slapd/back-sql/search.c b/servers/slapd/back-sql/search.c index 77428ea18c..411468e6af 100644 --- a/servers/slapd/back-sql/search.c +++ b/servers/slapd/back-sql/search.c @@ -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 ) { diff --git a/servers/slapd/filter.c b/servers/slapd/filter.c index 4582be62bb..7a4a207677 100644 --- a/servers/slapd/filter.c +++ b/servers/slapd/filter.c @@ -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 */ - diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index eee672a9b9..3cf1d88f22 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -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; } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 441007c0bb..bb574abeec 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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 diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 9fa03c3816..71213fbe8f 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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;