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

jvergara
22.05.2009 945594c9fa9d3b3698cd308d21ea7deaa98bd006
Do a best effort and try to retrieve the canonical path of the instance and install paths when they are calculated.  This is harmless and avoids having relative paths ('../.' and '/.') in the data in cn=monitor.
1 files modified
26 ■■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java 26 ●●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/extensions/ConfigFileHandler.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Copyright 2006-2008 Sun Microsystems, Inc.
 *      Copyright 2006-2009 Sun Microsystems, Inc.
 */
package org.opends.server.extensions;
@@ -690,8 +690,20 @@
        if ((configDirFile != null) &&
            configDirFile.getName().equals(CONFIG_DIR_NAME))
        {
          /*
           * Do a best effort to avoid having a relative representation (for
           * instance to avoid having ../../../).
           */
          try
          {
            serverRoot = configDirFile.getParentFile().getCanonicalPath();
          }
          catch (IOException ioe)
          {
            // Best effort
          serverRoot = configDirFile.getParentFile().getAbsolutePath();
        }
        }
        if (serverRoot == null)
        {
@@ -739,8 +751,20 @@
    }
    else
    {
      /*
       * Do a best effort to avoid having a relative representation (for
       * instance to avoid having ../../../).
       */
      try
      {
        instanceRoot = instanceFile.getCanonicalPath();
      }
      catch (IOException ioe)
      {
        // Best effort
      instanceRoot = instanceFile.getAbsolutePath();
    }
    }