Commit 30fbf95d authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

allow to register further syntax/mr compatibility

parent a57a24da
......@@ -145,6 +145,67 @@ mr_insert(
return 0;
}
int
mr_make_syntax_compat_with_mr(
Syntax *syn,
MatchingRule *mr )
{
int n = 0;
assert( syn != NULL );
assert( mr != NULL );
if ( mr->smr_compat_syntaxes ) {
/* count esisting */
for ( n = 0;
mr->smr_compat_syntaxes[ n ];
n++ )
{
if ( mr->smr_compat_syntaxes[ n ] == syn ) {
/* already compatible; mmmmh... */
return 1;
}
}
}
mr->smr_compat_syntaxes = ch_realloc(
mr->smr_compat_syntaxes,
sizeof( Syntax * )*(n + 2) );
mr->smr_compat_syntaxes[ n ] = syn;
mr->smr_compat_syntaxes[ n + 1 ] = NULL;
return 0;
}
int
mr_make_syntax_compat_with_mrs(
const char *syntax,
char *const *mrs )
{
int r, rc = 0;
Syntax *syn;
assert( syntax != NULL );
assert( mrs != NULL );
syn = syn_find( syntax );
if ( syn == NULL ) {
return -1;
}
for ( r = 0; mrs[ r ] != NULL; r++ ) {
MatchingRule *mr = mr_find( mrs[ r ] );
if ( mr == NULL ) {
/* matchingRule not found -- ignore by now */
continue;
}
rc += mr_make_syntax_compat_with_mr( syn, mr );
}
return rc;
}
int
mr_add(
LDAPMatchingRule *mr,
......@@ -316,7 +377,8 @@ matching_rule_use_init( void )
LDAP_SLIST_FOREACH( mr, &mr_list, smr_next ) {
AttributeType *at;
MatchingRuleUse mru_storage, *mru = &mru_storage;
MatchingRuleUse mru_storage = { 0 },
*mru = &mru_storage;
char **applies_oids = NULL;
......@@ -341,8 +403,6 @@ matching_rule_use_init( void )
continue;
}
memset( mru, 0, sizeof( MatchingRuleUse ) );
/*
* Note: we're using the same values of the corresponding
* MatchingRule structure; maybe we'd copy them ...
......
......@@ -1238,11 +1238,17 @@ LDAP_SLAPD_F (int) register_matching_rule LDAP_P((
LDAP_SLAPD_F (void) mru_destroy LDAP_P(( void ));
LDAP_SLAPD_F (int) matching_rule_use_init LDAP_P(( void ));
LDAP_SLAPD_F (int) mr_schema_info( Entry *e );
LDAP_SLAPD_F (int) mru_schema_info( Entry *e );
LDAP_SLAPD_F (int) mr_schema_info LDAP_P(( Entry *e ));
LDAP_SLAPD_F (int) mru_schema_info LDAP_P(( Entry *e ));
LDAP_SLAPD_F (int) mr_usable_with_at( MatchingRule *mr,
AttributeType *at );
LDAP_SLAPD_F (int) mr_usable_with_at LDAP_P(( MatchingRule *mr,
AttributeType *at ));
LDAP_SLAPD_F (int) mr_make_syntax_compat_with_mr LDAP_P((
Syntax *syn,
MatchingRule *mr ));
LDAP_SLAPD_F (int) mr_make_syntax_compat_with_mrs LDAP_P((
const char *syntax,
char *const *mrs ));
/*
* mra.c
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment