-
-#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 */
-