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

neil_a_wilson
18.26.2007 ef7053f846ffa665daa20dad0d3615267692da0a
Fix a bug in SearchFilter.equals() in which substring filter components are
only compared by their assertion values and the attribute type isn't taken into
account (so the filters "(cn=*bowen*)" and "(sn=*bowen*)" would be considered
equal when they shouldn't be).

OpenDS Issue Number: 1245
2 files modified
10 ■■■■■ changed files
opends/src/server/org/opends/server/types/SearchFilter.java 7 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/types/SearchFilterTests.java 3 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/types/SearchFilter.java
@@ -3595,6 +3595,11 @@
        return (attributeType.equals(f.attributeType) &&
                assertionValue.equals(f.assertionValue));
      case SUBSTRING:
        if (! attributeType.equals(f.attributeType))
        {
          return false;
        }
        if (subInitialElement == null)
        {
          if (f.subInitialElement != null)
@@ -3734,7 +3739,7 @@
      case EQUALITY:
        return (attributeType.hashCode() + assertionValue.hashCode());
      case SUBSTRING:
        hashCode = 0;
        hashCode = attributeType.hashCode();
        if (subInitialElement != null)
        {
opends/tests/unit-tests-testng/src/server/org/opends/server/types/SearchFilterTests.java
@@ -1097,6 +1097,9 @@
          {"(|(sn=Smith)(sn<=Aus))", "(|(sn=Smith)(sn>=Aus))", false, false},
          // Test cases for issue #1245
          {"(cn=*bowen*)", "(cn=*bowen*)", true, true},
          {"(cn=*bowen*)", "(sn=*bowen*)", false, false}
  };