From 86115f857f2a72cc6ee2e6cc8b630cae0437da59 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Fri, 09 Sep 2016 09:45:24 +0000
Subject: [PATCH] OPENDJ-3089 OPENDJ-1237 Add missing options to CoreSchemaProvider and CoreSchemaConfiguration.xml
---
opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java | 10 ++--
opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java | 3 +
opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/CoreSchemaConfiguration.xml | 84 ++++++++++++++++++++++++++++++++++++++++++
opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java | 3 +
4 files changed, 94 insertions(+), 6 deletions(-)
diff --git a/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/CoreSchemaConfiguration.xml b/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/CoreSchemaConfiguration.xml
index 764e1fd..442f3f3 100644
--- a/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/CoreSchemaConfiguration.xml
+++ b/opendj-maven-plugin/src/main/resources/config/xml/org/forgerock/opendj/server/config/CoreSchemaConfiguration.xml
@@ -176,4 +176,88 @@
</ldap:attribute>
</adm:profile>
</adm:property>
+ <adm:property name="strict-format-jpeg-photos" advanced="true">
+ <adm:synopsis>
+ Indicates whether to require JPEG values to strictly
+ comply with the standard definition for this syntax.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>false</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-strict-format-jpeg-photos</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="strict-format-certificates" advanced="true">
+ <adm:synopsis>
+ Indicates whether X.509 Certificate values are required to
+ strictly comply with the standard definition for this syntax.
+ </adm:synopsis>
+ <adm:description>
+ When set to false, certificates will not be validated and, as a result
+ any sequence of bytes will be acceptable.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>true</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-strict-format-certificates</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="strict-format-telephone-numbers" advanced="true">
+ <adm:synopsis>
+ Indicates whether to require telephone number values to strictly
+ comply with the standard definition for this syntax.
+ </adm:synopsis>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>false</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-strict-format-telephone-numbers</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
+ <adm:property name="allow-attribute-types-with-no-sup-or-syntax" advanced="true">
+ <adm:synopsis>
+ Indicates whether the schema should allow attribute type definitions
+ that do not declare a superior attribute type or syntax
+ </adm:synopsis>
+ <adm:description>
+ When set to true, invalid attribute type definitions will
+ use the default syntax.
+ </adm:description>
+ <adm:default-behavior>
+ <adm:defined>
+ <adm:value>true</adm:value>
+ </adm:defined>
+ </adm:default-behavior>
+ <adm:syntax>
+ <adm:boolean />
+ </adm:syntax>
+ <adm:profile name="ldap">
+ <ldap:attribute>
+ <ldap:name>ds-cfg-allow-attribute-types-with-no-sup-or-syntax</ldap:name>
+ </ldap:attribute>
+ </adm:profile>
+ </adm:property>
</adm:managed-object>
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java b/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java
index 836870c..8243768 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/CoreConfigManager.java
@@ -23,6 +23,7 @@
import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.ResultCode;
+import org.forgerock.opendj.ldap.schema.SchemaOptions;
import org.forgerock.opendj.config.server.ConfigurationChangeListener;
import org.forgerock.opendj.server.config.meta.GlobalCfgDefn;
import org.forgerock.opendj.server.config.meta.GlobalCfgDefn.DisabledPrivilege;
@@ -142,7 +143,7 @@
commonAudit.setTrustTransactionIds(globalConfig.isTrustTransactionIds());
}
- // Update the "new" schema with configuration changes if necessary
+ // Update the schema with configuration changes if necessary
try
{
final boolean allowMalformedNames = globalConfig.isAllowAttributeNameExceptions();
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
index 4deb6f3..06d9e4c 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/core/DirectoryServer.java
@@ -3365,7 +3365,10 @@
*
* @return <CODE>true</CODE> if the server should use a more flexible
* syntax for attribute names, or <CODE>false</CODE> if not.
+ * @deprecated The schema option SchemaOptions.ALLOW_MALFORMED_NAMES_AND_OPTIONS from the
+ * schema should be used instead
*/
+ @Deprecated
public static boolean allowAttributeNameExceptions()
{
return directoryServer.allowAttributeNameExceptions;
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java b/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java
index f12d59f..9c39848 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/schema/CoreSchemaProvider.java
@@ -67,11 +67,11 @@
.setOption(ALLOW_ZERO_LENGTH_DIRECTORY_STRINGS, configuration.isAllowZeroLengthValuesDirectoryString())
.setOption(STRICT_FORMAT_FOR_COUNTRY_STRINGS, configuration.isStrictFormatCountryString())
.setOption(STRIP_UPPER_BOUND_FOR_ATTRIBUTE_TYPE,
- configuration.isStripSyntaxMinUpperBoundAttributeTypeDescription());
- // TODO : add the missing methods in schema builder for those properties
- // schemaBuilder.allowMalformedJPEGPhotos(configuration.)
- // schemaBuilder.allowMalformedNamesAndOptions(configuration.)
- // ...
+ configuration.isStripSyntaxMinUpperBoundAttributeTypeDescription())
+ .setOption(ALLOW_MALFORMED_JPEG_PHOTOS, !configuration.isStrictFormatJPEGPhotos())
+ .setOption(ALLOW_MALFORMED_CERTIFICATES, !configuration.isStrictFormatCertificates())
+ .setOption(ALLOW_NON_STANDARD_TELEPHONE_NUMBERS, !configuration.isStrictFormatTelephoneNumbers())
+ .setOption(ALLOW_ATTRIBUTE_TYPES_WITH_NO_SUP_OR_SYNTAX, configuration.isAllowAttributeTypesWithNoSupOrSyntax());
for (final String oid : configuration.getDisabledMatchingRule())
{
--
Gitblit v1.10.0