mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Ludovic Poitou
02.37.2013 b40081ea28c38f045bdab225936a5f5ffedcc6f9
Fix for OPENDJ-1228, Concatenated schema may contain more than valid schema, possibly leading to further issues.
Make sure we only consider *.ldif files when handling schemas under config/schema
2 files modified
15 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java 2 ●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/types/Schema.java 13 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/core/SchemaConfigManager.java
@@ -161,7 +161,7 @@
  /**
   * Filter implementation that accepts only ldif files.
   */
  private static class SchemaFileFilter implements FilenameFilter
  public static class SchemaFileFilter implements FilenameFilter
  {
    /**
     * {@inheritDoc}
opendj-sdk/opends/src/server/org/opends/server/types/Schema.java
@@ -29,12 +29,7 @@
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
@@ -3576,7 +3571,9 @@
    TreeSet<File> schemaFiles = new TreeSet<File>();
    String schemaDirectory =
      SchemaConfigManager.getSchemaDirectoryPath();
    for (File f : new File(schemaDirectory).listFiles())
    final FilenameFilter filter = new SchemaConfigManager.SchemaFileFilter();
    for (File f : new File(schemaDirectory).listFiles(filter))
    {
      if (f.isFile())
      {
@@ -3621,7 +3618,7 @@
      // Iterate through each line in the list.  Find the colon and
      // get the attribute name at the beginning.  If it's someting
      // get the attribute name at the beginning.  If it's something
      // that we don't recognize, then skip it.  Otherwise, add the
      // X-SCHEMA-FILE extension and add it to the appropriate schema
      // element list.