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

neil_a_wilson
23.14.2007 c5f739d0a79784332c08824bab6fb55586a8a37a
Fix a problem in the LDIF backend in which references to subordinate entries
were not properly updated for modify DN operations.
1 files modified
28 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/backends/LDIFBackend.java 28 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/backends/LDIFBackend.java
@@ -863,14 +863,36 @@
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS, m);
      }
      DN parentDN = newDN.getParentDNInSuffix();
      if (! entryMap.containsKey(parentDN))
      DN newParentDN = newDN.getParentDNInSuffix();
      if (! entryMap.containsKey(newParentDN))
      {
        Message m = ERR_LDIF_BACKEND_MODDN_NEW_PARENT_DOESNT_EXIST.get(
                         String.valueOf(parentDN));
                         String.valueOf(newParentDN));
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT, m);
      }
      // Remove the entry from the list of children for the old parent and
      // add the new entry DN to the set of children for the new parent.
      DN oldParentDN = currentDN.getParentDNInSuffix();
      HashSet<DN> parentChildDNs = childDNs.get(oldParentDN);
      if (parentChildDNs != null)
      {
        parentChildDNs.remove(currentDN);
        if (parentChildDNs.isEmpty() &&
            (modifyDNOperation.getNewSuperior() != null))
        {
          childDNs.remove(oldParentDN);
        }
      }
      parentChildDNs = childDNs.get(newParentDN);
      if (parentChildDNs == null)
      {
        parentChildDNs = new HashSet<DN>();
        childDNs.put(newParentDN, parentChildDNs);
      }
      parentChildDNs.add(newDN);
      // If the entry has children, then we'll need to work on the whole
      // subtree.  Otherwise, just work on the target entry.