From 19a4cbeb29fbf1052416728310f062281bceccb4 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 06 Oct 2006 17:01:56 +0000
Subject: [PATCH] Update the password validator API in the following ways:

---
 opends/src/server/org/opends/server/core/PasswordPolicyState.java |   22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/opends/src/server/org/opends/server/core/PasswordPolicyState.java b/opends/src/server/org/opends/server/core/PasswordPolicyState.java
index 4307311..c30c17f 100644
--- a/opends/src/server/org/opends/server/core/PasswordPolicyState.java
+++ b/opends/src/server/org/opends/server/core/PasswordPolicyState.java
@@ -36,6 +36,7 @@
 import java.util.LinkedHashSet;
 import java.util.LinkedList;
 import java.util.List;
+import java.util.Set;
 
 import org.opends.server.api.AccountStatusNotificationHandler;
 import org.opends.server.api.PasswordGenerator;
@@ -3758,17 +3759,22 @@
    * Indicates whether the provided password appears to be acceptable according
    * to the password validators.
    *
-   * @param  operation      The operation that provided the password.
-   * @param  userEntry      The user entry in which the password is used.
-   * @param  password       The password to be validated.
-   * @param  invalidReason  A buffer that may be used to hold the invalid reason
-   *                        if the password is rejected.
+   * @param  operation         The operation that provided the password.
+   * @param  userEntry         The user entry in which the password is used.
+   * @param  newPassword       The password to be validated.
+   * @param  currentPasswords  The set of clear-text current passwords for the
+   *                           user (this may be a subset if not all of them are
+   *                           available in the clear, or empty if none of them
+   *                           are available in the clear).
+   * @param  invalidReason     A buffer that may be used to hold the invalid
+   *                           reason if the password is rejected.
    *
    * @return  <CODE>true</CODE> if the password is acceptable for use, or
    *          <CODE>false</CODE> if it is not.
    */
   public boolean passwordIsAcceptable(Operation operation, Entry userEntry,
-                                      ByteString password,
+                                      ByteString newPassword,
+                                      Set<ByteString> currentPasswords,
                                       StringBuilder invalidReason)
   {
     assert debugEnter(CLASS_NAME, "passwordIsAcceptable",
@@ -3780,8 +3786,8 @@
       PasswordValidator validator =
            passwordPolicy.getPasswordValidators().get(validatorDN);
 
-      if (! validator.passwordIsValid(password, operation, userEntry,
-                                      invalidReason))
+      if (! validator.passwordIsAcceptable(newPassword, currentPasswords,
+                                           operation, userEntry, invalidReason))
       {
         if (debug)
         {

--
Gitblit v1.10.0