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

ludovicp
31.22.2010 e8bb810e49f1e41ac21071c6d4da19066362ca88
Do preliminary acceptance checked for password policy subentries within the PwP import plugin.
2 files modified
26 ■■■■■ changed files
opends/src/server/org/opends/server/core/PasswordPolicyConfigManager.java 2 ●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java 24 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/core/PasswordPolicyConfigManager.java
@@ -410,7 +410,7 @@
   *         while creating a password policy from
   *         given subentry.
   */
  private void checkSubentryAcceptable(Entry entry)
  public static void checkSubentryAcceptable(Entry entry)
          throws DirectoryException
  {
    SubEntry subentry = new SubEntry(entry);
opends/src/server/org/opends/server/plugins/PasswordPolicyImportPlugin.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2010 Sun Microsystems, Inc.
 */
package org.opends.server.plugins;
@@ -57,6 +57,7 @@
import org.opends.server.config.ConfigException;
import org.opends.server.core.DirectoryServer;
import org.opends.server.core.PasswordPolicy;
import org.opends.server.core.PasswordPolicyConfigManager;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.schema.AuthPasswordSyntax;
import org.opends.server.schema.UserPasswordSyntax;
@@ -325,6 +326,27 @@
  public final PluginResult.ImportLDIF
               doLDIFImport(LDIFImportConfig importConfig, Entry entry)
  {
    // Check if this entry is a password policy subentry
    // and if so evaluate whether or not its acceptable.
    if ((entry.isSubentry() || entry.isLDAPSubentry()) &&
            entry.isPasswordPolicySubentry())
    {
      try
      {
        PasswordPolicyConfigManager.checkSubentryAcceptable(entry);
      }
      catch (DirectoryException de)
      {
        if (debugEnabled())
        {
          TRACER.debugCaught(DebugLogLevel.ERROR, de);
        }
        return PluginResult.ImportLDIF.stopEntryProcessing(
                de.getMessageObject());
      }
    }
    // See if the entry explicitly states the password policy that it should
    // use.  If so, then only use it to perform the encoding.
    List<Attribute> attrList = entry.getAttribute(customPolicyAttribute);