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;
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;
/*
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;
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
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 ) {
&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
backsql_attrlist_add( bsi, NULL );
}
goto done;
-#endif /* SLAP_X_FILTER_HASSUBORDINATES || SLAP_X_MRA_MATCH_DNATTRS */
} else {
at = backsql_ad2at( bsi->oc, ad );
*/
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 ) {
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
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 ) {
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 */
-
}
}
-#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( ava->aa_desc == slap_schema.si_ad_hasSubordinates
&& be && be->be_has_subordinates ) {
int hasSubordinates;
return LDAP_COMPARE_FALSE;
}
-#endif /* SLAP_X_FILTER_HASSUBORDINATES */
return( LDAP_COMPARE_FALSE );
}
a = attrs_find( e->e_attrs, desc );
-#ifdef SLAP_X_FILTER_HASSUBORDINATES
if ( a == NULL && desc == slap_schema.si_ad_hasSubordinates ) {
/*
return LDAP_COMPARE_FALSE;
}
-#endif /* SLAP_X_FILTER_HASSUBORDINATES */
return a != NULL ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE;
}
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
* (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
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));
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;