From 2c7b8d6d8c0c177e8089272140dae66b87852ff7 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 17 Jul 2007 21:59:32 +0000
Subject: [PATCH] Implement support for password history functionality.  The password history can be maintained either based on the number of previous passwords to remember (e.g., a user cannot re-use any of his/her last five passwords), or the length of time the previous passwords have been retained (e.g., a user cannot re-use any password he/she has had within the last 365 days), or both.

---
 opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
index 2012bee..f440150 100644
--- a/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
+++ b/opends/src/server/org/opends/server/workflowelement/localbackend/LocalBackendWorkflowElement.java
@@ -1869,6 +1869,33 @@
               }
             }
           }
+
+
+          // If we should check the password history, then do so now.
+          if (pwPolicyState.maintainHistory())
+          {
+            List<AttributeValue> newPasswords = localOp.getNewPasswords();
+            if (newPasswords != null)
+            {
+              for (AttributeValue v : newPasswords)
+              {
+                if (pwPolicyState.isPasswordInHistory(v.getValue()))
+                {
+                  if (selfChange || (! pwPolicyState.getPolicy().
+                                            skipValidationForAdministrators()))
+                  {
+                    localOp.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
+
+                    int msgID = MSGID_MODIFY_PW_IN_HISTORY;
+                    localOp.appendErrorMessage(getMessage(msgID));
+                    break modifyProcessing;
+                  }
+                }
+              }
+
+              pwPolicyState.updatePasswordHistory();
+            }
+          }
         }
 
 

--
Gitblit v1.10.0