Chris Ridd wrote:
<....>

RFC 2252 and X.501 say that attributes can only have a single supertype. I'm
not sure why our Schema class allows for multiple - maybe to cope with
multiple names for a single supertype?

There's no reason why couldn't define a subtype with different matching
rules - if you don't define a matching rule then you should inherit the
supertype's matching rule (which might inherit from the supertype's
supertype etc etc).

Cheers,

Chris


Thanks for the info, the next snippet takes care of walking the hierarchy, maybe it could be an extension to Net::LDAP::Schema ;-) How should I deal with comparisons (le/ge) when there's no ordering match specified ? E.g. CN has only equality and substrings defined through Name and Name has no superior.

And in the same fashion, what to do with approx matches as 2252 does not specify a declaration of approx filters ?

Cheers,

Hans
<snippet>
# given the attribute and a matchtype (e.g. equality) this will return the name of the rule to apply

sub matchingruleforattribute{
 my $schema = shift;
 my $attr = shift;
 my $matchtype = shift;

 my $attrtype = $schema->attribute( $attr );
 if (exists $attrtype->{$matchtype}){
   return $attrtype->{$matchtype} ;
 }
 elsif (exists $attrtype->{'sup'}){
# the assumption ( backed by RFC 2252 and X.501 ) is that all superiors result in the same ruleset return matchingruleforattribute( $schema, $attrtype->{'sup'}[0], $matchtype);
 }
 return undef;
}
</snippet>

Reply via email to