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

matthew_swift
19.26.2009 a2b075f791cc543fe6fdba378225512f798f2071
Fix broken ldapSubentry filter detection and re-enable translateRubEntryTest.
2 files modified
69 ■■■■ changed files
opends/src/server/org/opends/server/core/SearchOperationBasis.java 67 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/SearchOperationBasis.java
@@ -1464,43 +1464,44 @@
   */
  private void checkFilterForLDAPSubEntry(SearchFilter filter, int depth)
  {
    // Paranoid check to avoid recursion deep enough to provoke
    // the stack overflow. This should never happen because if
    // a given filter is too nested SearchFilter exception gets
    // raised long before this method is invoked.
    if (depth >= MAX_NESTED_FILTER_DEPTH)
    {
      if (debugEnabled())
      {
        TRACER.debugError("Exceeded maximum filter depth");
      }
      return;
    }
    switch (filter.getFilterType())
    {
      case EQUALITY:
      case AND:
      case OR:
        for (SearchFilter f : filter.getFilterComponents())
    case EQUALITY:
      if (filter.getAttributeType().isObjectClassType())
      {
        AttributeValue v = filter.getAssertionValue();
        if (toLowerCase(v.getValue().toString()).equals("ldapsubentry"))
        {
          if (f.getFilterType() == FilterType.EQUALITY)
          {
            if (f.getAttributeType().isObjectClassType())
            {
              AttributeValue v = f.getAssertionValue();
              if (toLowerCase(v.getValue().toString(
                  )).equals("ldapsubentry"))
              {
                setReturnLDAPSubentries(true);
                return;
              }
            }
          }
          else
          {
            // Paranoid check to avoid recursion deep enough to provoke
            // the stack overflow. This should never happen because if
            // a given filter is too nested SearchFilter exception gets
            // raised long before this method is invoked.
            if (depth >= MAX_NESTED_FILTER_DEPTH)
            {
              if (debugEnabled())
              {
                TRACER.debugError("Exceeded maximum filter depth");
              }
              return;
            }
            checkFilterForLDAPSubEntry(f, depth + 1);
          }
          setReturnLDAPSubentries(true);
        }
      }
      break;
    case AND:
    case OR:
      for (SearchFilter f : filter.getFilterComponents())
      {
        checkFilterForLDAPSubEntry(f, depth + 1);
        if (isReturnLDAPSubentries())
        {
          // No point in continuing.
          break;
        }
      }
      break;
    }
  }
}
opends/tests/unit-tests-testng/src/server/org/opends/server/replication/plugin/PersistentServerStateTest.java
@@ -119,7 +119,7 @@
   * @throws  Exception  If an unexpected problem occurs.
   */
  @SuppressWarnings("unchecked")
  @Test(enabled = false)
  @Test
  public void translateRuvEntryTest()
         throws Exception
  {