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

boli
11.24.2006 6e8ad1087a49ce957fc8312e43463f8deeb5177b
Added checks to see if file permissions can be set on the platform before setting file permissions on the directory containing the database files. No errors are produced if there are no way to set the file permissions (ie. Windows and Java < 6.0).

Fix for issue 1005
1 files modified
28 ■■■■■ changed files
opends/src/server/org/opends/server/backends/jeb/RootContainer.java 28 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/backends/jeb/RootContainer.java
@@ -146,20 +146,23 @@
                    EnvironmentConfig envConfig) throws DatabaseException
  {
    // Get the backend database backendDirectory permissions and apply
    try
    if(FilePermission.canSetPermissions())
    {
      if(!FilePermission.setPermissions(backendDirectory, backendPermission))
      try
      {
        throw new Exception();
        if(!FilePermission.setPermissions(backendDirectory, backendPermission))
        {
          throw new Exception();
        }
      }
    }
    catch(Exception e)
    {
      // Log an warning that the permissions were not set.
      int msgID = MSGID_JEB_SET_PERMISSIONS_FAILED;
      String message = getMessage(msgID, backendDirectory.getPath());
      logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING,
               message, msgID);
      catch(Exception e)
      {
        // Log an warning that the permissions were not set.
        int msgID = MSGID_JEB_SET_PERMISSIONS_FAILED;
        String message = getMessage(msgID, backendDirectory.getPath());
        logError(ErrorLogCategory.BACKEND, ErrorLogSeverity.SEVERE_WARNING,
                 message, msgID);
      }
    }
    // Open the database environment
@@ -559,7 +562,8 @@
    FilePermission oldPermission = config.getBackendPermission();
    FilePermission newPermission = newConfig.getBackendPermission();
    if(!FilePermission.toUNIXMode(oldPermission).equals(
    if(FilePermission.canSetPermissions() &&
        !FilePermission.toUNIXMode(oldPermission).equals(
        FilePermission.toUNIXMode(newPermission)))
    {
      try