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

Jean-Noël Rouvignac
02.47.2016 cdbc97a66ca18d9f74b58c3fbca253f17d4dcd55
opendj-server-legacy/src/main/java/org/opends/server/crypto/CryptoManagerSync.java
@@ -35,6 +35,7 @@
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -45,6 +46,7 @@
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.ResultCode;
import org.forgerock.opendj.ldap.SearchScope;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.admin.ads.ADSContext;
import org.opends.server.api.Backend;
import org.opends.server.api.BackendInitializationListener;
@@ -60,7 +62,6 @@
import org.opends.server.protocols.internal.SearchRequest;
import org.opends.server.protocols.ldap.LDAPControl;
import org.opends.server.types.Attribute;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.Control;
import org.opends.server.types.CryptoManagerException;
import org.opends.server.types.DN;
@@ -399,18 +400,8 @@
    ocMap.put(ocInstanceKey, OC_CRYPTO_INSTANCE_KEY);
    Map<AttributeType, List<Attribute>> userAttrs = new HashMap<>();
    List<Attribute> attrList;
    attrList = srcEntry.getAttribute(attrAlias);
    if (!attrList.isEmpty())
    {
      userAttrs.put(attrAlias, attrList);
    }
    attrList = srcEntry.getAttribute(attrCert);
    if (!attrList.isEmpty())
    {
      userAttrs.put(attrCert, attrList);
    }
    putAttributeTypeIfExist(userAttrs, srcEntry, attrAlias);
    putAttributeTypeIfExist(userAttrs, srcEntry, attrCert);
    Entry addEntry = new Entry(dstDN, ocMap, userAttrs, null);
    AddOperation addOperation = getRootConnection().processAdd(addEntry);
@@ -420,6 +411,16 @@
    }
  }
  private void putAttributeTypeIfExist(Map<AttributeType, List<Attribute>> userAttrs, Entry srcEntry,
      AttributeType attrType)
  {
    List<Attribute> attrList = srcEntry.getAttribute(attrType);
    if (!attrList.isEmpty())
    {
      userAttrs.put(attrType, new ArrayList<>(attrList));
    }
  }
  @Override
  public PostResponse doPostResponse(PostResponseAddOperation op)
  {