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

dugan
27.09.2007 17a5226af72b812144cdcabd97462610799ecab1
Fix inconsistent Format Checking for ACI targattrfilter.

Issue 1473.
2 files modified
23 ■■■■■ changed files
opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java 19 ●●●● patch | view | raw | blame | history
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/TargAttrFiltersTestCase.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/authorization/dseecompat/TargAttrFilters.java
@@ -63,6 +63,13 @@
     */
    private static final String ADD_OR_DEL_KEYWORD_GROUP = "(add|del)";
    /*
     * Regular expression used to check for valid expression separator.
     */
    private static final
    String secondOpSeparator="\\)" +  ZERO_OR_MORE_WHITESPACE + ",";
    /**
     * Regular expression used to match the second operation of the filter list.
     * If the first was "add" this must be "del", if the first was "del" this
@@ -181,12 +188,20 @@
          String message = getMessage(msgID, expression);
          throw new AciException(msgID, message);
        } else if (filterLists.length == 1) {
          //This check catches the case where there might not be a
          //',' character between the first filter list and the second.
          //Check if the there is something like ") , deel=". A bad token
          //that the regular expression didn't pick up.
          String [] filterList2=subExpression.split(secondOpSeparator);
          if(filterList2.length == 2) {
              int msgID = MSGID_ACI_SYNTAX_INVALID_TARGATTRFILTERS_EXPRESSION;
              String message = getMessage(msgID, expression);
              throw new AciException(msgID, message);
          }
          String sOp="del";
          if(getMask(firstOp) == TARGATTRFILTERS_DELETE)
            sOp="add";
          String rg= sOp + "=";
          //This check catches the case where there might not be a
          //',' character between the first filter list and the second.
          if(subExpression.indexOf(rg) != -1) {
            int msgID = MSGID_ACI_SYNTAX_INVALID_TARGATTRFILTERS_EXPRESSION;
            String message = getMessage(msgID, expression);
opends/tests/unit-tests-testng/src/server/org/opends/server/authorization/dseecompat/TargAttrFiltersTestCase.java
@@ -49,6 +49,8 @@
    return new Object[][] {
            {"add=st:(st=*),del=st:(st=*)"},
            {"add=st:(st=*) && cn:(cn=c*), del=st:(st=*) && sn:(sn=s*)"},
            {"add=st:(st=*)"},
            {"del=st:(st=*)"},
    };
  }
@@ -56,6 +58,8 @@
  @DataProvider(name = "invalidStatements")
  public Object[][] invalids() {
    return new Object[][] {
            {"add=st:(st=*),deeeel =st:(st=*)"},
            {"add=st:(st=*),foo =st:(st=*)"},
            {"add=st:(st=*),,,del=st:(st=*)"},
            {"add=st:(st=*),dellll =st:(st=*)"},
            {"add=st:(st=*)del=st:(st=*)"},