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

mmarie
21.14.2007 b5d7e1e6e21c8443047e4298ccc813592c7fa842
[2773] add operation into a non existing naming context returns wrong error code
- Fix return code for add operation on a non existing backend (32 instead of -1 currently)
2 files modified
25 ■■■■■ changed files
opends/src/messages/messages/core.properties 3 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/AddOperationBasis.java 22 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/core.properties
@@ -1761,3 +1761,6 @@
MILD_ERR_CRYPTOMGR_DECRYPT_UNKNOWN_PROLOGUE_VERSION_696=CryptoManager failed to \
 decrypt the supplied data because the version "%d" in the data prologue is \
 unknown
MILD_ERR_ADD_ENTRY_UNKNOWN_SUFFIX_697=The provided entry %s cannot be added \
 because is not defined as one of the suffixes within the Directory Server
opends/src/server/org/opends/server/core/AddOperationBasis.java
@@ -1043,22 +1043,26 @@
      if (DirectoryServer.isNamingContext(entryDN))
      {
        // This is fine.  This entry is one of the configured suffixes.
        return;
      }
      else if (entryDN.isNullDN())
      if (entryDN.isNullDN())
      {
        // This is not fine.  The root DSE cannot be added.
        setResultCode(ResultCode.UNWILLING_TO_PERFORM);
        appendErrorMessage(ERR_ADD_CANNOT_ADD_ROOT_DSE.get());
        return;
      }
      else
      {
        // The entry doesn't have a parent but isn't a suffix.  This is not
        // allowed.
        setResultCode(ResultCode.NO_SUCH_OBJECT);
        appendErrorMessage(ERR_ADD_ENTRY_NOT_SUFFIX.get(
                String.valueOf(entryDN)));
      }
      // The entry doesn't have a parent but isn't a suffix.  This is not
      // allowed.
      setResultCode(ResultCode.NO_SUCH_OBJECT);
      appendErrorMessage(ERR_ADD_ENTRY_NOT_SUFFIX.get(
        String.valueOf(entryDN)));
      return;
    }
    // The suffix does not exist
    setResultCode(ResultCode.NO_SUCH_OBJECT);
    appendErrorMessage(ERR_ADD_ENTRY_UNKNOWN_SUFFIX.get(
      String.valueOf(entryDN)));
  }