free_comp_filter( ComponentFilter* f );
static int
-test_comp_filter( Syntax *syn, ComponentSyntaxInfo *a, struct berval *bv,
- ComponentFilter *f );
+test_comp_filter( Syntax *syn, ComponentSyntaxInfo *a, ComponentFilter *f );
int
componentCertificateValidate(
struct berval *value,
void *assertedValue )
{
- struct berval* bv;
- Attribute *a = (Attribute*)value;
+ ComponentSyntaxInfo *csi_attr = (ComponentSyntaxInfo*)value;
MatchingRuleAssertion * ma = (MatchingRuleAssertion*)assertedValue;
- void* assert_nm;
int num_attr, rc, i;
if ( !mr || !ma->ma_cf )
if ( !attr_converter || !nibble_mem_allocator )
return LDAP_INAPPROPRIATE_MATCHING;
- /* Check if decoded component trees are already linked */
- num_attr = 0;
- if ( !a->a_comp_data ) {
- for ( ; a->a_vals[num_attr].bv_val != NULL; num_attr++ );
- if ( num_attr <= 0 )/* no attribute value */
- return LDAP_INAPPROPRIATE_MATCHING;
- num_attr++;
- /* following malloced will be freed by comp_tree_free () */
- a->a_comp_data = malloc( sizeof( ComponentData ) + sizeof( ComponentSyntaxInfo* )*num_attr );
- if ( !a->a_comp_data )
- return LDAP_NO_MEMORY;
- a->a_comp_data->cd_tree = (ComponentSyntaxInfo**)((char*)a->a_comp_data + sizeof(ComponentData));
- a->a_comp_data->cd_tree[ num_attr - 1] = (ComponentSyntaxInfo*)NULL;
- a->a_comp_data->cd_mem_op = nibble_mem_allocator ( 1024*16, 1024 );
- }
-
- for ( bv = a->a_vals, i = 0 ; bv->bv_val != NULL; bv++, i++ ) {
- /* decodes current attribute into components */
- if ( num_attr != 0 ) {
- a->a_comp_data->cd_tree[i] = attr_converter (a, syntax, bv);
- }
- /* decoding error */
- if ( !a->a_comp_data->cd_tree[i] )
- return LDAP_OPERATIONS_ERROR;
- rc = test_comp_filter( syntax, a->a_comp_data->cd_tree[i], bv, ma->ma_cf );
+ rc = test_comp_filter( syntax, csi_attr, ma->ma_cf );
- if ( rc == LDAP_COMPARE_TRUE ) {
- *matchp = 0;
- return LDAP_SUCCESS;
- }
- else if ( rc == LDAP_COMPARE_FALSE ) {
- continue;
- }
- else {
- return LDAP_INAPPROPRIATE_MATCHING;
- }
+ if ( rc == LDAP_COMPARE_TRUE ) {
+ *matchp = 0;
+ return LDAP_SUCCESS;
+ }
+ else if ( rc == LDAP_COMPARE_FALSE ) {
+ *matchp = 1;
+ return LDAP_SUCCESS;
+ }
+ else {
+ return LDAP_INAPPROPRIATE_MATCHING;
}
- *matchp = 1;
- return LDAP_SUCCESS;
-
}
int
test_comp_filter_and(
Syntax *syn,
ComponentSyntaxInfo *a,
- struct berval *bv,
ComponentFilter *flist )
{
ComponentFilter *f;
int rtn = LDAP_COMPARE_TRUE;
for ( f = flist ; f != NULL; f = f->cf_next ) {
- int rc = test_comp_filter( syn, a, bv, f );
+ int rc = test_comp_filter( syn, a, f );
if ( rc == LDAP_COMPARE_FALSE ) {
rtn = rc;
break;
test_comp_filter_or(
Syntax *syn,
ComponentSyntaxInfo *a,
- struct berval *bv,
ComponentFilter *flist )
{
ComponentFilter *f;
int rtn = LDAP_COMPARE_TRUE;
for ( f = flist ; f != NULL; f = f->cf_next ) {
- int rc = test_comp_filter( syn, a, bv, f );
+ int rc = test_comp_filter( syn, a, f );
if ( rc == LDAP_COMPARE_TRUE ) {
rtn = rc;
break;
test_comp_filter_item(
Syntax *syn,
ComponentSyntaxInfo *csi_attr,
- struct berval *bv,
ComponentAssertion *ca )
{
int rc, len;
if ( strcmp(ca->ca_ma_rule->smr_mrule.mr_oid,
OID_COMP_FILTER_MATCH ) == 0 && ca->ca_cf ) {
/* componentFilterMatch inside of componentFilterMatch */
- rc = test_comp_filter( syn, csi_attr, bv, ca->ca_cf );
+ rc = test_comp_filter( syn, csi_attr, ca->ca_cf );
return rc;
}
test_comp_filter(
Syntax *syn,
ComponentSyntaxInfo *a,
- struct berval *bv,
ComponentFilter *f )
{
int rc;
rc = f->cf_result;
break;
case LDAP_COMP_FILTER_AND:
- rc = test_comp_filter_and( syn, a, bv, f->cf_and );
+ rc = test_comp_filter_and( syn, a, f->cf_and );
break;
case LDAP_COMP_FILTER_OR:
- rc = test_comp_filter_or( syn, a, bv, f->cf_or );
+ rc = test_comp_filter_or( syn, a, f->cf_or );
break;
case LDAP_COMP_FILTER_NOT:
- rc = test_comp_filter( syn, a, bv, f->cf_not );
+ rc = test_comp_filter( syn, a, f->cf_not );
switch ( rc ) {
case LDAP_COMPARE_TRUE:
}
break;
case LDAP_COMP_FILTER_ITEM:
- rc = test_comp_filter_item( syn, a, bv, f->cf_ca );
+ rc = test_comp_filter_item( syn, a, f->cf_ca );
break;
default:
rc = LDAP_PROTOCOL_ERROR;