mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
13.18.2011 75591684d7efbc0aef005308f9539708ef3aca2a
Fix OPENDJ-385: Unable to perform object identifier equality matches using object classes which are not defined in the schema
2 files modified
40 ■■■■■ changed files
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java 37 ●●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java 3 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierEqualityMatchingRuleImpl.java
@@ -45,40 +45,6 @@
final class ObjectIdentifierEqualityMatchingRuleImpl extends
    AbstractMatchingRuleImpl
{
  static class OIDAssertion implements Assertion
  {
    private final String oid;
    OIDAssertion(final String oid)
    {
      this.oid = oid;
    }
    public ConditionResult matches(final ByteSequence attributeValue)
    {
      final String attrStr = attributeValue.toString();
      // We should have normalized all values to OIDs. If not, we know
      // the descriptor form is not valid in the schema.
      if (attrStr.length() == 0 || !StaticUtils.isDigit(attrStr.charAt(0)))
      {
        return ConditionResult.UNDEFINED;
      }
      if (oid.length() == 0 || !StaticUtils.isDigit(oid.charAt(0)))
      {
        return ConditionResult.UNDEFINED;
      }
      return attrStr.equals(oid) ? ConditionResult.TRUE : ConditionResult.FALSE;
    }
  }
  static String resolveNames(final Schema schema, final String oid)
  {
    if (!StaticUtils.isDigit(oid.charAt(0)))
@@ -164,8 +130,7 @@
    final SubstringReader reader = new SubstringReader(definition);
    final String normalized = resolveNames(schema, SchemaUtils.readOID(reader,
        schema.allowMalformedNamesAndOptions()));
    return new OIDAssertion(normalized);
    return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
  }
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/schema/ObjectIdentifierFirstComponentEqualityMatchingRuleImpl.java
@@ -62,8 +62,7 @@
    final String normalized = ObjectIdentifierEqualityMatchingRuleImpl
        .resolveNames(schema, SchemaUtils.readOID(reader,
            schema.allowMalformedNamesAndOptions()));
    return new ObjectIdentifierEqualityMatchingRuleImpl.OIDAssertion(normalized);
    return new DefaultEqualityAssertion(ByteString.valueOf(normalized));
  }