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

jvergara
24.02.2008 76873cf7ce1d9160d018688cbe806ad7e67bbd1d
There was a flag day when the new security framework was added in build 1.0.0 build 6.  The following changes address the issue.  The main thing that has been updated are the changes at the end of VersionCompatibilityIssue.  The problem is that the code relied only on the fact that a flag day was known (we register the flag days).  However it can happen (as it is the case) that a flag day is registered in the code way after the changes occurred.  So when we registered a flag day, systematically we could not upgrade from previous builds.

For instance: a flag day corresponding to build 6 is registered now (candidate build 11). Without these modifications this would prevent to upgrade from build 7 or build 8 to the current build. That is why the new code actually checks the revision corresponding to the flag day and the revision of the new build. If the new build is newer than the revision of the flag day then we consider that there is no problem and we continue with the upgrade.



4 files modified
69 ■■■■ changed files
opends/src/messages/messages/version.properties 8 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java 4 ●●●● patch | view | raw | blame | history
opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java 4 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/util/VersionCompatibilityIssue.java 53 ●●●●● patch | view | raw | blame | history
opends/src/messages/messages/version.properties
@@ -20,7 +20,7 @@
#
# CDDL HEADER END
#
#      Portions Copyright 2006-2007 Sun Microsystems, Inc.
#      Portions Copyright 2006-2008 Sun Microsystems, Inc.
@@ -84,4 +84,8 @@
 because the default password storage scheme and deprecated password storage \
 scheme references in the password policy have been converted from names to \
 DNs, and it is not possible to revert from the DN back to the scheme name
INFO_3294_UPGRADE_9=This upgrade introduces a new security framework that is \
 not backwards compatible.  Upgrade is not possible.
INFO_3294_REVERSION_10=The revision 3294 introduces a new security framework.  \
 Revert is not possible.
opends/src/quicksetup/org/opends/quicksetup/BuildInformation.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
 */
package org.opends.quicksetup;
@@ -291,7 +291,7 @@
        try {
          ids.add(Integer.parseInt(s));
        } catch (NumberFormatException nfe) {
          LOG.log(Level.INFO, "invalid upgrade incompatability ID " + s);
          LOG.log(Level.INFO, "invalid upgrade incompatibility ID " + s);
        }
      }
    }
opends/src/quicksetup/org/opends/quicksetup/upgrader/VersionIssueNotifier.java
@@ -22,7 +22,7 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.quicksetup.upgrader;
@@ -150,7 +150,7 @@
    List<VersionCompatibilityIssue> compatibilityIssues;
    Set<Integer> excludeIds = current.getIncompatibilityEventIds();
    if (excludeIds != null) {
      compatibilityIssues = getEvents(excludeIds);
      compatibilityIssues = getEvents(excludeIds, current, neu);
    } else {
      // This method is only used as a fallback for pre 1.0.0 servers which
      // do not advertise incompatible version events.
opends/src/server/org/opends/server/util/VersionCompatibilityIssue.java
@@ -22,11 +22,12 @@
 * CDDL HEADER END
 *
 *
 *      Portions Copyright 2007 Sun Microsystems, Inc.
 *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
 */
package org.opends.server.util;
import org.opends.messages.Message;
import org.opends.quicksetup.BuildInformation;
import static org.opends.messages.VersionMessages.*;
@@ -216,6 +217,18 @@
   * or more versions of the OpenDS codebase.
   */
  public enum Cause {
    /**
     * Incompatible changes in the cryptomanager and specially in the way
     * replication works.  These changes were committed on several revisions
     * and the flagday that has been chosen corresponds to revision 3294
     * (opends 1.0.0 build 6 of 16/10/2007)
     */
    REPLICATION_SECURITY_CHANGE_1(
            5, // Unique ID.  See javadoc for more information.
            INFO_3294_UPGRADE.get(),
            INFO_3294_REVERSION.get(),
            Effect.REVERSION_NOT_POSSIBLE,
            Effect.UPGRADE_NOT_POSSIBLE),
    /**
     * Incompatible property name change committed on 09/05/2007
@@ -424,6 +437,9 @@
  //***************************************************
  static {
    //
    register(Cause.REPLICATION_SECURITY_CHANGE_1,
        new BuildVersion(1, 0, 0, 3294));
    register(Cause.PROPERTY_CHANGE_1, new BuildVersion(1, 0, 0, 3053));
    register(Cause.DB_FORMAT_CHANGE_2, new BuildVersion(0, 9, 0, 2049));
    register(Cause.DB_FORMAT_CHANGE_1, new BuildVersion(0, 1, 0, 1582));
@@ -456,19 +472,50 @@
   *
   * @param excludeIds collection of IDs representing issues
   *        that will not be returned in the list
   * @param current build version
   * @param neu build version
   *
   * @return list of issues sorted by build version in which
   *         they appear
   */
  static public List<VersionCompatibilityIssue> getEvents(
          Collection<Integer> excludeIds)
          Collection<Integer> excludeIds, BuildInformation current,
          BuildInformation neu)
  {
    if (excludeIds == null) excludeIds = Collections.emptySet();
    List<VersionCompatibilityIssue> issueList =
            new ArrayList<VersionCompatibilityIssue>();
    for (VersionCompatibilityIssue evt : VERSION_COMPATIBILITY_ISSUES) {
      if (!excludeIds.contains(evt.getCause().getId())) {
        issueList.add(evt);
        boolean isUpgrade = neu.compareTo(current) >= 0;
        BuildVersion newVersion = new BuildVersion(neu.getMajorVersion(),
            neu.getMinorVersion(), neu.getPointVersion(),
            neu.getRevisionNumber());
        BuildVersion currentVersion = new BuildVersion(
            current.getMajorVersion(), current.getMinorVersion(),
            current.getPointVersion(), current.getRevisionNumber());
        if (isUpgrade)
        {
          // If the currentVersion is newer than the issue described, then there
          // is no problem.  This can occur for instance when we discovered a
          // flag day too late (and we added the flag day description to the
          // code way after the revision).
          if (currentVersion.compareTo(evt.getVersion()) < 0)
          {
            issueList.add(evt);
          }
        }
        else
        {
          // If the newVersion in the reversion is newer than the issue
          // described, then there is no problem.  This can occur for instance
          // when we discovered a flag day too late (and we added the flag day
          // description to the code way after the revision).
          if (currentVersion.compareTo(evt.getVersion()) < 0)
          {
            issueList.add(evt);
          }
        }
      }
    }
    Collections.sort(issueList, VERSION_COMPARATOR);