CR-1688 Fix OPENDJ-905 X-SCHEMA-FILE should not allow directory path separators
| | |
| | | X.509 Certificate because it contains invalid DER encodings |
| | | MILD_ERR_ATTR_SYNTAX_COUNTRY_NO_VALID_ISO_CODE_333=The provided value "%s" \ |
| | | is not a valid ISO 3166 country code |
| | | SEVERE_ERR_ATTR_SYNTAX_ILLEGAL_X_SCHEMA_FILE_334=The provided value "%s" is \ |
| | | not safe for X-SCHEMA-FILE |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message); |
| | | } |
| | | |
| | | CommonSchemaElements.checkSafeProperties(extraProperties); |
| | | |
| | | return new AttributeType(value.toString(), primaryName, typeNames, oid, |
| | | description, superiorType, syntax, |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2011-2012 ForgeRock AS |
| | | * Portions Copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | |
| | |
| | | import org.opends.server.config.ConfigException; |
| | | import org.opends.server.types.ByteSequence; |
| | | import org.opends.server.types.ByteString; |
| | | import org.opends.server.types.CommonSchemaElements; |
| | | import org.opends.server.types.DirectoryException; |
| | | |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | |
| | | // Schema backend. |
| | | syntax = new LDAPSyntaxDescriptionSyntax(); |
| | | } |
| | | |
| | | CommonSchemaElements.checkSafeProperties(extraProperties); |
| | | |
| | | //Since we reached here it means everything is OK. |
| | | return new LDAPSyntaxDescription(valueStr,syntax, |
| | | description,extraProperties); |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions Copyright 2012 ForgeRock AS |
| | | * Portions Copyright 2012-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.schema; |
| | | import org.opends.messages.Message; |
| | |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import org.opends.server.types.*; |
| | | |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import org.opends.messages.MessageBuilder; |
| | | import static org.opends.server.schema.SchemaConstants.*; |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | CommonSchemaElements.checkSafeProperties(extraProperties); |
| | | |
| | | return new ObjectClass(value.toString(), primaryName, names, oid, |
| | | description, superiorClasses, requiredAttributes, |
| | |
| | | * |
| | | * |
| | | * Copyright 2006-2009 Sun Microsystems, Inc. |
| | | * Portions Copyright 2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.types; |
| | | |
| | | import org.opends.messages.Message; |
| | | import static org.opends.messages.SchemaMessages.*; |
| | | import static org.opends.server.util.ServerConstants.*; |
| | | import static org.opends.server.util.StaticUtils.toLowerCase; |
| | | import static org.opends.server.util.Validator.*; |
| | |
| | | |
| | | |
| | | /** |
| | | * Check if the extra schema properties contain safe filenames. |
| | | * |
| | | * @param extraProperties |
| | | * The schema properties to check. |
| | | * |
| | | * @throws DirectoryException |
| | | * If a provided value was unsafe. |
| | | */ |
| | | public static void checkSafeProperties(Map <String,List<String>> |
| | | extraProperties) |
| | | throws DirectoryException |
| | | { |
| | | // Check that X-SCHEMA-FILE doesn't contain unsafe characters |
| | | List<String> filenames = extraProperties.get(SCHEMA_PROPERTY_FILENAME); |
| | | if (filenames != null && !filenames.isEmpty()) { |
| | | String filename = filenames.get(0); |
| | | if (filename.indexOf('/') != -1 || filename.indexOf('\\') != -1) |
| | | { |
| | | Message message = ERR_ATTR_SYNTAX_ILLEGAL_X_SCHEMA_FILE.get(filename); |
| | | throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, |
| | | message); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * Retrieves the primary name for this schema definition. |
| | | * |
| | | * @return The primary name for this schema definition, or |
| | |
| | | " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'test' " + |
| | | " X-SCHEMA-FILE '33-test.ldif' X-NAME )", |
| | | false}, // X-NAME is invalid extension (no value) |
| | | |
| | | {"(1.2.8.5 NAME 'testType' DESC 'full type' EQUALITY caseIgnoreMatch " + |
| | | " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'test' " + |
| | | " X-SCHEMA-FILE '../config.ldif' )", |
| | | false}, // X-SCHEMA-FILE is unsafe |
| | | {"(1.2.8.5 NAME 'testType' DESC 'full type' EQUALITY caseIgnoreMatch " + |
| | | " SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 X-ORIGIN 'test' " + |
| | | " X-SCHEMA-FILE '..\\config.ldif' )", |
| | | false}, // X-SCHEMA-FILE is unsafe |
| | | }; |
| | | } |
| | | |