From 74b6b13c3355a8f76dad71fc1f138c50f9be1805 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Tue, 20 Sep 2016 13:57:04 +0000
Subject: [PATCH] Fix for OPENDJ-3279. Rename misnamed function and make sure we don't increment the failure counts when the account is already locked.

---
 opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
index 8f08780..b08dc8b 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/workflowelement/localbackend/LocalBackendBindOperation.java
@@ -473,8 +473,7 @@
 
         if (policy.getLockoutFailureCount() > 0)
         {
-          generateAccountStatusNotificationForLockedBindAccount(userEntry,
-              pwPolicyState);
+          updateFailureCount(userEntry, pwPolicyState);
         }
       }
     }
@@ -684,8 +683,7 @@
         if (saslHandler.isPasswordBased(saslMechanism)
             && pwPolicyState.getAuthenticationPolicy().getLockoutFailureCount() > 0)
         {
-          generateAccountStatusNotificationForLockedBindAccount(
-              saslAuthUserEntry, pwPolicyState);
+          updateFailureCount(saslAuthUserEntry, pwPolicyState);
         }
       }
     }
@@ -693,9 +691,13 @@
     return true;
   }
 
-  private void generateAccountStatusNotificationForLockedBindAccount(
-      Entry userEntry, PasswordPolicyState pwPolicyState)
+  private void updateFailureCount(Entry userEntry, PasswordPolicyState pwPolicyState)
   {
+    if (pwPolicyState.lockedDueToFailures())
+    {
+      // Account is already locked, nothing to do
+      return;
+    }
     pwPolicyState.updateAuthFailureTimes();
     if (pwPolicyState.lockedDueToFailures())
     {

--
Gitblit v1.10.0