Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion opendj-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
information: "Portions Copyright [year] [name of copyright owner]".

Copyright 2011-2016 ForgeRock AS.
Portions Copyright 2018-2022 Wren Security.
Portions Copyright 2018-2026 Wren Security.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand All @@ -39,6 +39,12 @@
<artifactId>i18n-core</artifactId>
</dependency>

<dependency>
<groupId>org.wrensecurity.commons.guava</groupId>
<artifactId>wrensec-guava-io</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,22 @@
*
* Copyright 2010 Sun Microsystems, Inc.
* Portions copyright 2011-2016 ForgeRock AS.
* Portions copyright 2022 Wren Security.
* Portions copyright 2022-2026 Wren Security.
*/
package org.forgerock.opendj.ldap;

import static org.fest.assertions.Assertions.assertThat;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.util.Arrays;

import com.google.common.io.BaseEncoding;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import static org.fest.assertions.Assertions.*;
import org.wrensecurity.guava.common.io.BaseEncoding;

/**
* This class defines a set of tests for the ByteString class.
Expand Down
2 changes: 1 addition & 1 deletion opendj-doc-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<version>3.15.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion opendj-dsml-servlet/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
</dependency>
</dependency>

<!-- Servlet API -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ public Void answer(InvocationOnMock invocation) throws Throwable {
} else {
context.disconnect();
}
waitForCondition(context::isClosed);
assertThat(context.isClosed()).isTrue();
}
// Block until remote close is signalled.
Expand Down
2 changes: 1 addition & 1 deletion opendj-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<version>3.15.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Portions Copyright 2013-2016 ForgeRock AS.
* Portions Copyright 2022 Wren Security
* Portions Copyright 2022-2026 Wren Security
*/
package org.opends.server.tools.upgrade;

Expand Down Expand Up @@ -547,6 +547,8 @@ public final class Upgrade
register("4.0.0", moveSubordinateBaseDnToGlobalConfiguration());
register("4.0.0", removeTools("ldif-diff", "make-ldif", "dsjavaproperties"));

register("5.0.4", removeMatchingJarFiles("forgerock-guava-*.jar"));

/* All upgrades will refresh the server configuration schema and generate a new upgrade folder. */
registerLast(
copySchemaFile("02-config.ldif"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,82 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Portions Copyright 2013-2016 ForgeRock AS.
* Portions Copyright 2022 Wren Security
* Portions Copyright 2022-2026 Wren Security
*/
package org.opends.server.tools.upgrade;

import static org.opends.server.util.SchemaUtils.addSchemaFileToElementDefinitionIfAbsent;

import static java.nio.charset.StandardCharsets.*;
import static java.nio.file.StandardOpenOption.*;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.nio.file.StandardOpenOption.APPEND;
import static javax.security.auth.callback.ConfirmationCallback.NO;
import static javax.security.auth.callback.ConfirmationCallback.YES;
import static javax.security.auth.callback.TextOutputCallback.*;
import static javax.security.auth.callback.TextOutputCallback.INFORMATION;
import static org.forgerock.util.Utils.joinAsString;
import static org.opends.messages.ToolMessages.*;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_ADDATTRIBUTE_FAILS;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_ADDOBJECTCLASS_FAILS;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_ADD_CONFIG_FILE_FAILS;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_CONFIG_ERROR_UPGRADE_FOLDER;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_COPYSCHEMA_FAILS;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_CORRUPTED_TEMPLATE;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_PERFORMING_POST_TASKS_FAIL;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_ALL_REBUILD_INDEX_DECLINED;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_CHANGE_DONE_IN_SPECIFIC_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_NO_CHANGE_DONE_IN_SPECIFIC_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_NO_INDEX_TO_REBUILD_FOR_BACKEND;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_REBUILD_ALL;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_REBUILD_INDEXES_DECLINED;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_REBUILD_INDEX_ARGUMENTS;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_REBUILD_INDEX_ENDS;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_REBUILD_INDEX_STARTS;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_ADD_CONFIG_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_ADD_SUBORDINATE_BASE_DN_TO_GLOBAL_CONFIG;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_CANNOT_READ_SCHEMA_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_CANNOT_WRITE_TO_CONCATENATED_SCHEMA_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_DELETE_CHANGELOG_SUMMARY;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_DELETE_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_DELETE_SUBORDINATE_BASE_DN_FROM_ROOT_DSE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_CHANGELOG_DESCRIPTION;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_CONFIG_READ_FAIL;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_CANCELLED;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_DESCRIPTION;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_ENV_UNREADABLE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_NO_JE_LIB;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_SUMMARY_1;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_SUMMARY_5;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_MIGRATE_JE_UGLY_DN;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_NEEDS_USER_CONFIRM;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_REFRESH_UPGRADE_DIRECTORY;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_REMOVE_OLD_JARS;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_REPLACE_SCHEMA_FILE;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_SUMMARY_RESTORE_CSV_DELIMITER_CHAR;
import static org.opends.messages.ToolMessages.INFO_UPGRADE_TASK_UNABLE_TO_REMOVE_OLD_JARS;
import static org.opends.server.tools.upgrade.FileManager.copyRecursively;
import static org.opends.server.tools.upgrade.UpgradeUtils.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.server.tools.upgrade.UpgradeUtils.batDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.binDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.concatenatedSchemaFile;
import static org.opends.server.tools.upgrade.UpgradeUtils.configDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.configFile;
import static org.opends.server.tools.upgrade.UpgradeUtils.configSchemaDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.deleteFileIfExists;
import static org.opends.server.tools.upgrade.UpgradeUtils.getInstancePath;
import static org.opends.server.tools.upgrade.UpgradeUtils.libDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.searchConfigFile;
import static org.opends.server.tools.upgrade.UpgradeUtils.templateConfigDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.templateConfigSchemaDirectory;
import static org.opends.server.tools.upgrade.UpgradeUtils.updateConfigFile;
import static org.opends.server.tools.upgrade.UpgradeUtils.updateConfigUpgradeSchemaFile;
import static org.opends.server.tools.upgrade.UpgradeUtils.updateSchemaFile;
import static org.opends.server.tools.upgrade.UpgradeUtils.deleteMatchingFiles;
import static org.opends.server.util.SchemaUtils.addSchemaFileToElementDefinitionIfAbsent;
import static org.opends.server.util.StaticUtils.isClassAvailable;
import static org.opends.server.util.StaticUtils.stackTraceToSingleLineString;

import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ReturnCode;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.Transaction;
import com.sleepycat.je.TransactionConfig;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;
Expand All @@ -45,9 +104,7 @@
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import javax.security.auth.callback.TextOutputCallback;

import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.Attribute;
Expand All @@ -72,14 +129,6 @@
import org.opends.server.util.ChangeOperationType;
import org.opends.server.util.StaticUtils;

import com.forgerock.opendj.cli.ClientException;
import com.forgerock.opendj.cli.ReturnCode;
import com.sleepycat.je.DatabaseException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.EnvironmentConfig;
import com.sleepycat.je.Transaction;
import com.sleepycat.je.TransactionConfig;

/** Factory methods for create new upgrade tasks. */
final class UpgradeTasks
{
Expand Down Expand Up @@ -1416,6 +1465,22 @@ public void perform(final UpgradeContext context) throws ClientException {
};
}

static UpgradeTask removeMatchingJarFiles(final String... patterns)
{
return new AbstractUpgradeTask() {
@Override
public void perform(UpgradeContext context) throws ClientException {
try {
for (String pattern : patterns) {
deleteMatchingFiles(libDirectory.toPath(), pattern);
}
} catch (IOException e) {
throw new ClientException(ReturnCode.ERROR_UNEXPECTED, LocalizableMessage.raw(e.getMessage()));
}
}
};
}

/** Prevent instantiation. */
private UpgradeTasks()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,38 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Portions Copyright 2013-2016 ForgeRock AS.
* Portions Copyright 2026 Wren Security
*/
package org.opends.server.tools.upgrade;

import static org.forgerock.opendj.ldap.schema.CoreSchema.getCaseExactMatchingRule;
import static org.forgerock.opendj.ldap.schema.CoreSchema.getDirectoryStringSyntax;
import static org.forgerock.opendj.ldap.schema.SchemaOptions.DEFAULT_MATCHING_RULE_OID;
import static org.forgerock.opendj.ldap.schema.SchemaOptions.DEFAULT_SYNTAX_OID;
import static org.opends.messages.ConfigMessages.INFO_CONFIG_FILE_HEADER;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_CORRUPTED_TEMPLATE;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_READING_CONF_FILE;
import static org.opends.messages.ToolMessages.ERR_UPGRADE_UNKNOWN_OC_ATT;
import static org.opends.server.tools.upgrade.FileManager.deleteRecursively;
import static org.opends.server.tools.upgrade.FileManager.rename;
import static org.opends.server.tools.upgrade.Installation.CONFIG_PATH_RELATIVE;
import static org.opends.server.tools.upgrade.Installation.CURRENT_CONFIG_FILE_NAME;
import static org.opends.server.tools.upgrade.Installation.INSTANCE_LOCATION_PATH;
import static org.opends.server.tools.upgrade.Installation.INSTANCE_LOCATION_PATH_RELATIVE;
import static org.opends.server.tools.upgrade.Installation.LIB_RELATIVE_PATH;
import static org.opends.server.tools.upgrade.Installation.LOCKS_PATH_RELATIVE;
import static org.opends.server.tools.upgrade.Installation.OPENDJ_BOOTSTRAP_JAR_RELATIVE_PATH;
import static org.opends.server.tools.upgrade.Installation.SCHEMA_PATH_RELATIVE;
import static org.opends.server.tools.upgrade.Installation.SVC_SCRIPT_FILE_NAME;
import static org.opends.server.tools.upgrade.Installation.TEMPLATE_RELATIVE_PATH;
import static org.opends.server.tools.upgrade.Installation.UNIX_BINARIES_PATH_RELATIVE;
import static org.opends.server.tools.upgrade.Installation.UPGRADE_PATH;
import static org.opends.server.tools.upgrade.Installation.WINDOWS_BINARIES_PATH_RELATIVE;
import static org.opends.server.util.ChangeOperationType.ADD;
import static org.opends.server.util.ChangeOperationType.DELETE;
import static org.opends.server.util.ChangeOperationType.MODIFY;
import static org.opends.server.util.ServerConstants.SCHEMA_CONCAT_FILE_NAME;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
Expand All @@ -23,11 +52,17 @@
import java.io.FileReader;
import java.io.FilenameFilter;
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
import org.forgerock.opendj.ldap.Assertion;
Expand Down Expand Up @@ -58,15 +93,6 @@
import org.opends.server.util.ChangeOperationType;
import org.opends.server.util.SchemaUtils;

import static org.forgerock.opendj.ldap.schema.CoreSchema.*;
import static org.forgerock.opendj.ldap.schema.SchemaOptions.*;
import static org.opends.messages.ConfigMessages.*;
import static org.opends.messages.ToolMessages.*;
import static org.opends.server.tools.upgrade.FileManager.*;
import static org.opends.server.tools.upgrade.Installation.*;
import static org.opends.server.util.ChangeOperationType.*;
import static org.opends.server.util.ServerConstants.*;

/** Common utility methods needed by the upgrade. */
final class UpgradeUtils
{
Expand Down Expand Up @@ -754,6 +780,23 @@ static void deleteFileIfExists(final File f)
}
}

static void deleteMatchingFiles(Path base, String pattern) throws IOException {
PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern);
Files.walkFileTree(base, new SimpleFileVisitor<Path>() {
@Override
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
return dir.equals(base) ? FileVisitResult.CONTINUE : FileVisitResult.SKIP_SUBTREE;
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
if (matcher.matches(file.getFileName()) && attrs.isRegularFile()) {
Files.delete(file);
}
return FileVisitResult.CONTINUE;
}
});
}

/** Prevent instantiation. */
private UpgradeUtils()
{
Expand Down
20 changes: 10 additions & 10 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
information: "Portions Copyright [year] [name of copyright owner]".

Copyright 2011-2016 ForgeRock AS.
Portions Copyright 2017-2025 Wren Security.
Portions Copyright 2017-2026 Wren Security.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
Expand Down Expand Up @@ -102,7 +102,7 @@
<freemarker.version>2.3.24-incubating</freemarker.version>
<grizzly-framework.version>2.3.28</grizzly-framework.version>
<metrics-core.version>3.1.2</metrics-core.version>
<wrensec-commons.version>22.3.0</wrensec-commons.version>
<wrensec-commons.version>22.6.2</wrensec-commons.version>

<!-- OSGi bundles properties -->
<opendj.osgi.import.additional />
Expand All @@ -124,13 +124,13 @@
<version>1.0-1</version>
</dependency>

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.7</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.7</version>
<type>pom</type>
<scope>import</scope>
</dependency>

<dependency>
<groupId>io.dropwizard.metrics</groupId>
Expand Down Expand Up @@ -348,7 +348,7 @@
<?m2e ignore?>
<groupId>org.wrensecurity.commons</groupId>
<artifactId>doc-maven-plugin</artifactId>
<version>22.4.0</version>
<version>${wrensec-commons.version}</version>
<configuration>
<projectName>Wren:DS</projectName>
<projectVersion>${project.version}</projectVersion>
Expand Down