]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/mr.c
Fallout from ITS#4986 - remove unused param of select_backend()
[openldap] / servers / slapd / mr.c
index 32165263fb475015a3e94d21cbc5030e6ce99524..8a49f4f6c5751b987f37c9c21fec7c4c28dc9563 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2006 The OpenLDAP Foundation.
+ * Copyright 1998-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -30,9 +30,9 @@ struct mindexrec {
 };
 
 static Avlnode *mr_index = NULL;
-static LDAP_SLIST_HEAD(MRList, slap_matching_rule) mr_list
+static LDAP_SLIST_HEAD(MRList, MatchingRule) mr_list
        = LDAP_SLIST_HEAD_INITIALIZER(&mr_list);
-static LDAP_SLIST_HEAD(MRUList, slap_matching_rule_use) mru_list
+static LDAP_SLIST_HEAD(MRUList, MatchingRuleUse) mru_list
        = LDAP_SLIST_HEAD_INITIALIZER(&mru_list);
 
 static int
@@ -169,6 +169,7 @@ mr_add(
                for( i=0; def->mrd_compat_syntaxes[i]; i++ ) {
                        compat_syn[i] = syn_find( def->mrd_compat_syntaxes[i] );
                        if( compat_syn[i] == NULL ) {
+                               ch_free( compat_syn );
                                return SLAP_SCHERR_SYN_NOT_FOUND;
                        }
                }
@@ -198,10 +199,12 @@ mr_add(
                        smr->smr_syntax = syn;
                } else {
                        *err = smr->smr_syntax_oid;
+                       ch_free( smr );
                        return SLAP_SCHERR_SYN_NOT_FOUND;
                }
        } else {
                *err = "";
+               ch_free( smr );
                return SLAP_SCHERR_MR_INCOMPLETE;
        }
        code = mr_insert(smr,err);
@@ -393,13 +396,16 @@ matching_rule_use_init( void )
        return( 0 );
 }
 
-int mr_usable_with_at(
-       MatchingRule *mr,
-       AttributeType *at )
+int
+mr_usable_with_at(
+       MatchingRule    *mr,
+       AttributeType   *at )
 {
-       if( mr->smr_usage & SLAP_MR_EXT && ( 
+       if ( ( mr->smr_usage & SLAP_MR_EXT ) && (
                mr->smr_syntax == at->sat_syntax ||
-               mr == at->sat_equality || mr == at->sat_approx ) )
+               mr == at->sat_equality ||
+               mr == at->sat_approx ||
+               syn_is_sup( at->sat_syntax, mr->smr_syntax ) ) )
        {
                return 1;
        }