From 4ddd07f6c673afa7d5f0dcaa6c708ec2c0c364ff Mon Sep 17 00:00:00 2001
From: ludovicp <ludovicp@localhost>
Date: Mon, 07 Jun 2010 09:07:09 +0000
Subject: [PATCH] Fix for issue #4556 - Make sure the skipValidationForAdministrators password policy flag applies identically for the ldap modify and password modify extended ops. Also tidy some comments and line length issues, failing the precommit target.
---
opendj-sdk/opends/src/server/org/opends/server/extensions/PasswordModifyExtendedOperation.java | 28 ++++++++++++++++------------
opendj-sdk/opends/src/server/org/opends/server/types/Entry.java | 18 +++++++++++-------
opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java | 2 +-
3 files changed, 28 insertions(+), 20 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 1692800..3cf059f 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
@@ -22,7 +22,7 @@
* CDDL HEADER END
*
*
- * Copyright 2006-2009 Sun Microsystems, Inc.
+ * Copyright 2006-2010 Sun Microsystems, Inc.
*/
package org.opends.server.extensions;
import org.opends.messages.Message;
@@ -946,21 +946,25 @@
{
if (pwPolicyState.isPasswordInHistory(newPassword))
{
- if (oldPassword == null)
+ if (selfChange || (! pwPolicyState.getPolicy().
+ skipValidationForAdministrators()))
{
- operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
+ if (oldPassword == null)
+ {
+ operation.setResultCode(ResultCode.UNWILLING_TO_PERFORM);
- operation.appendErrorMessage(
- ERR_EXTOP_PASSMOD_PW_IN_HISTORY.get());
- }
- else
- {
- operation.setResultCode(ResultCode.INVALID_CREDENTIALS);
+ operation.appendErrorMessage(
+ ERR_EXTOP_PASSMOD_PW_IN_HISTORY.get());
+ }
+ else
+ {
+ operation.setResultCode(ResultCode.INVALID_CREDENTIALS);
- operation.appendAdditionalLogMessage(
- ERR_EXTOP_PASSMOD_PW_IN_HISTORY.get());
+ operation.appendAdditionalLogMessage(
+ ERR_EXTOP_PASSMOD_PW_IN_HISTORY.get());
+ }
+ return;
}
- return;
}
else
{
diff --git a/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java b/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
index 14e1b4f..228572c 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/types/Entry.java
@@ -1781,17 +1781,21 @@
* checking will be performed.
*
* @param mod The modification to apply to this entry.
- * @param relaxConstraints indicates if the modification constraints are
- * relaxed to match the ones of a set (add existing
- * value and delete absent value do not fail)
- *
- * @throws DirectoryException If a problem occurs while attempting
- * to apply the modification. Note
+ * @param relaxConstraints indicates if the modification
+ * constraints are relaxed to match
+ * the ones of a set (add existing
+ * value and delete absent value do not
+ * fail)
+ *
+ * @throws DirectoryException If a problem occurs while
+ * attempting to apply the
+ * modification. Note
* that even if a problem occurs, then
* the entry may have been altered in
* some way.
*/
- public void applyModification(Modification mod, boolean relaxConstraints)
+ public void applyModification(Modification mod,
+ boolean relaxConstraints)
throws DirectoryException
{
Attribute a = mod.getAttribute();
diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
index 75f5e0d..fc6c8db 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/ServerConstants.java
@@ -2276,7 +2276,7 @@
/**
- * The OID for the Permissive Modify control, defined and used by MSAD
+ * The OID for the Permissive Modify control, defined and used by MSAD.
*/
public static final String OID_PERMISSIVE_MODIFY_CONTROL =
"1.2.840.113556.1.4.1413";
--
Gitblit v1.10.0