/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2000-2004 The OpenLDAP Foundation.
+ * Copyright 2000-2005 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#include "back-bdb.h"
#include "idl.h"
+#ifdef LDAP_COMP_MATCH
+#include <component.h>
+#endif
static int presence_candidates(
Operation *op,
ID *ids,
ID *tmp,
ID *stack);
+
+static int
+comp_candidates (
+ Operation *op,
+ MatchingRuleAssertion *mra,
+ ComponentFilter *f,
+ ID *ids,
+ ID *tmp,
+ ID *stack);
+
+static int
+ava_comp_candidates (
+ Operation *op,
+ AttributeAssertion *ava,
+ AttributeAliasing *aa,
+ ID *ids,
+ ID *tmp,
+ ID *stack);
#endif
int
ID *stack )
{
int rc = 0;
+#ifdef LDAP_COMP_MATCH
+ AttributeAliasing *aa;
+#endif
Debug( LDAP_DEBUG_FILTER, "=> bdb_filter_candidates\n", 0, 0, 0 );
switch ( f->f_choice ) {
case LDAP_FILTER_EQUALITY:
Debug( LDAP_DEBUG_FILTER, "\tEQUALITY\n", 0, 0, 0 );
- rc = equality_candidates( op, f->f_ava, ids, tmp );
+#ifdef LDAP_COMP_MATCH
+ if ( is_aliased_attribute && ( aa = is_aliased_attribute ( f->f_ava->aa_desc ) ) ) {
+ rc = ava_comp_candidates ( op, f->f_ava, aa, ids, tmp, stack );
+ }
+ else
+#endif
+ {
+ rc = equality_candidates( op, f->f_ava, ids, tmp );
+ }
break;
case LDAP_FILTER_APPROX:
ID *tmp,
ID *save )
{
- struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
int rc = 0;
ComponentFilter *f;
return( rc );
}
+static int
+ava_comp_candidates (
+ Operation *op,
+ AttributeAssertion *ava,
+ AttributeAliasing *aa,
+ ID *ids,
+ ID *tmp,
+ ID *stack )
+{
+ MatchingRuleAssertion mra;
+
+ mra.ma_rule = ava->aa_desc->ad_type->sat_equality;
+ if ( !mra.ma_rule ) {
+ struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
+ BDB_IDL_ALL( bdb, ids );
+ return 0;
+ }
+ mra.ma_desc = aa->aa_aliased_ad;
+ mra.ma_rule = ava->aa_desc->ad_type->sat_equality;
+
+ return comp_candidates ( op, &mra, ava->aa_cf, ids, tmp, stack );
+}
+
static int
comp_candidates (
Operation *op,
* Currently Only Component Indexing for componentFilterMatch is supported
* Indexing for an extensible filter is not supported yet
*/
- if ( !mra->ma_cf )
+ if ( !mra->ma_cf ) {
+ struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
+ BDB_IDL_ALL( bdb, ids );
return 0;
+ }
+
return comp_candidates ( op, mra, mra->ma_cf, ids, tmp, stack);
}
#endif
ID *tmp,
ID *save )
{
- struct bdb_info *bdb = (struct bdb_info *) op->o_bd->be_private;
int rc = 0;
Filter *f;