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

boli
23.56.2006 fde13021769c54352c2c692f7140e3ef3fbcd51b
Fixed several bugs:

An extensible LDAP filter with dn attribute but without attribute name and
matching rule causes IndexOutOfBounds exception in LDAPFilter.decode method.

To reproduce the error, decode filter string "(:dn:=John Doe)"

Fix for issue 708.

Constructing a LDAPFilter object from a SearchFilter objects with NOT components
results in an incomplete LDAPFilter object. The LDAPFilter will be complete
except for the NOT components. This results in a NullPointerException exception
when calling methods that assume a LDAPFilter component will not be NULL (ie.
toString).

Fix for issue 709.

When encoding LDAPFilter objects to ASN1Element objects, extensible components
are encoded as or components. The matching rule ID is also included twice in the
encoding with the wrong ASN1 type of matching rule attribute.

Fix for issue 710.
2 files modified
11 ■■■■■ changed files
opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java 9 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/FilterType.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/protocols/ldap/LDAPFilter.java
@@ -191,7 +191,7 @@
      case NOT:
        notComponent = new LDAPFilter(filter.getNotComponent());
        notComponent      = null;
        filterComponents  = null;
        attributeType     = null;
        assertionValue    = null;
        subInitialElement = null;
@@ -1643,8 +1643,11 @@
      {
        dnAttributes = true;
        if((startPos+4) < (equalPos-1))
        {
        matchingRuleID = filterString.substring(startPos+4, equalPos-1);
      }
      }
      else
      {
        matchingRuleID = filterString.substring(startPos+1, equalPos-1);
@@ -2242,14 +2245,14 @@
        elements = new ArrayList<ASN1Element>(4);
        if (matchingRuleID != null)
        {
          elements.add(new ASN1OctetString(TYPE_MATCHING_RULE_TYPE,
          elements.add(new ASN1OctetString(TYPE_MATCHING_RULE_ID,
                                           matchingRuleID));
        }
        if (attributeType != null)
        {
          elements.add(new ASN1OctetString(TYPE_MATCHING_RULE_TYPE,
                                           matchingRuleID));
                                           attributeType));
        }
        assertionValue.setType(TYPE_MATCHING_RULE_VALUE);
opends/src/server/org/opends/server/types/FilterType.java
@@ -105,7 +105,7 @@
  /**
   * The filter type for extensible matching filters.
   */
  EXTENSIBLE_MATCH(TYPE_FILTER_OR);
  EXTENSIBLE_MATCH(TYPE_FILTER_EXTENSIBLE_MATCH);