From 643d3853acb1a01af47a6d76e374e3ac34098246 Mon Sep 17 00:00:00 2001
From: david_page <david_page@localhost>
Date: Wed, 21 Feb 2007 16:29:51 +0000
Subject: [PATCH] The PasswordPolicyState public interface includes "getters" for PasswordPolicy attributes that simply forward the request to the corresponding PasswordPolicy getter. Remove these methods from the PasswordPolicyState interface and replace any calls with a direct invocation on the PasswordPolicy object reference held by the PasswordPolicyState object (via PasswordPolicyState.getPolicy()).

---
 opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java b/opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java
index 000f9b9..bff4ed7 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java
@@ -592,7 +592,7 @@
       // make sure that's OK.
       if (oldPassword == null)
       {
-        if (selfChange && pwPolicyState.requireCurrentPassword())
+        if (selfChange && pwPolicyState.getPolicy().requireCurrentPassword())
         {
           operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
 
@@ -637,7 +637,8 @@
 
       // If it is a self password change and we don't allow that, then reject
       // the request.
-      if (selfChange && (! pwPolicyState.allowUserPasswordChanges()))
+      if (selfChange &&
+           (! pwPolicyState.getPolicy().allowUserPasswordChanges()))
       {
         if (pwPolicyRequested)
         {
@@ -670,7 +671,7 @@
 
       // If we require secure password changes and the connection isn't secure,
       // then reject the request.
-      if (pwPolicyState.requireSecurePasswordChanges() &&
+      if (pwPolicyState.getPolicy().requireSecurePasswordChanges() &&
           (! operation.getClientConnection().isSecure()))
       {
         if (oldPassword == null)
@@ -728,7 +729,7 @@
       // If the user's password is expired and it's a self-change request, then
       // see if that's OK.
       if ((selfChange && pwPolicyState.isPasswordExpired() &&
-          (! pwPolicyState.allowExpiredPasswordChanges())))
+          (! pwPolicyState.getPolicy().allowExpiredPasswordChanges())))
       {
         if (pwPolicyRequested)
         {
@@ -825,7 +826,7 @@
           // by an internal operation or during synchronization, so we don't
           // need to check for those cases.
           isPreEncoded = true;
-          if (! pwPolicyState.allowPreEncodedPasswords())
+          if (! pwPolicyState.getPolicy().allowPreEncodedPasswords())
           {
             if (oldPassword == null)
             {
@@ -847,7 +848,8 @@
         }
         else
         {
-          if (selfChange || (! pwPolicyState.skipValidationForAdministrators()))
+          if (selfChange ||
+               (! pwPolicyState.getPolicy().skipValidationForAdministrators()))
           {
             HashSet<ByteString> clearPasswords;
             if (oldPassword == null)
@@ -950,7 +952,7 @@
       // If the current password was provided, then remove all matching values
       // from the user's entry and replace them with the new password.
       // Otherwise replace all password values.
-      AttributeType attrType = pwPolicyState.getPasswordAttribute();
+      AttributeType attrType = pwPolicyState.getPolicy().getPasswordAttribute();
       List<Modification> modList = new ArrayList<Modification>();
       if (oldPassword != null)
       {
@@ -959,7 +961,7 @@
              pwPolicyState.getPasswordValues();
         LinkedHashSet<AttributeValue> deleteValues =
              new LinkedHashSet<AttributeValue>(existingValues.size());
-        if (pwPolicyState.usesAuthPasswordSyntax())
+        if (pwPolicyState.getPolicy().usesAuthPasswordSyntax())
         {
           for (AttributeValue v : existingValues)
           {
@@ -1006,7 +1008,7 @@
                    UserPasswordSyntax.decodeUserPassword(v.getStringValue());
               PasswordStorageScheme scheme =
                    DirectoryServer.getPasswordStorageScheme(
-                        toLowerCase(components[0].toString()));
+                        toLowerCase(components[0]));
               if (scheme == null)
               {
                 // The password is encoded using an unknown scheme.  Remove it
@@ -1078,7 +1080,8 @@
       }
       else
       {
-        pwPolicyState.setMustChangePassword(pwPolicyState.forceChangeOnReset());
+        pwPolicyState.setMustChangePassword(
+             pwPolicyState.getPolicy().forceChangeOnReset());
       }
 
 
@@ -1121,7 +1124,7 @@
         ModifyOperation modifyOperation =
              internalConnection.processModify(userDN, modList);
         ResultCode resultCode = modifyOperation.getResultCode();
-        if (resultCode != resultCode.SUCCESS)
+        if (resultCode != ResultCode.SUCCESS)
         {
           operation.setResultCode(resultCode);
           operation.setErrorMessage(modifyOperation.getErrorMessage());

--
Gitblit v1.10.0