From 1596ccfcb23b1f5865560d9cb8e7ac79c3b30ddc Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:34 +0000
Subject: [PATCH] OPENDJ-2661 Fix checks for attribute types with passwords
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java | 15 +++++++++++++--
1 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
index d1f39d7..e6c39c5 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/util/Utilities.java
@@ -119,8 +119,10 @@
import org.opends.server.schema.SomeSchemaElement;
import org.opends.server.types.OpenDsException;
import org.opends.server.types.Schema;
+import org.opends.server.util.SchemaUtils;
import org.opends.server.util.ServerConstants;
import org.opends.server.util.StaticUtils;
+import org.opends.server.util.SchemaUtils.PasswordType;
/**
* A static class that provides miscellaneous functions.
@@ -134,7 +136,6 @@
private static final String HTML_SPACE = " ";
private static final String[] attrsToObfuscate = { ServerConstants.ATTR_USER_PASSWORD };
- private static final String[] passwordSyntaxOIDs = { SchemaConstants.SYNTAX_USER_PASSWORD_OID };
private static final String[] binarySyntaxOIDs = {
SchemaConstants.SYNTAX_BINARY_OID,
SchemaConstants.SYNTAX_JPEG_OID,
@@ -2126,7 +2127,17 @@
*/
public static boolean hasPasswordSyntax(String attrName, Schema schema)
{
- return hasAnySyntax(attrName, schema, passwordSyntaxOIDs);
+ if (schema != null)
+ {
+ attrName = Utilities.getAttributeNameWithoutOptions(attrName).toLowerCase();
+ if (schema.hasAttributeType(attrName))
+ {
+ AttributeType attr = schema.getAttributeType(attrName);
+ PasswordType passwordType = SchemaUtils.checkPasswordType(attr);
+ return passwordType.equals(PasswordType.USER_PASSWORD);
+ }
+ }
+ return false;
}
private static boolean hasAnySyntax(String attrName, Schema schema, String[] oids)
--
Gitblit v1.10.0