Skip to content

Commit 9828ff5

Browse files
authored
Add native access JVM flag for Bouncy Castle FIPS on newer Java releases (#645)
1 parent 6c53e87 commit 9828ff5

2 files changed

Lines changed: 18 additions & 0 deletions

File tree

opendj-server-legacy/resource/bin/_script-util.bat

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,13 @@ set SET_ENVIRONMENT_VARS_DONE=true
173173
"%OPENDJ_JAVA_BIN%" --add-opens java.base/jdk.internal.loader=ALL-UNNAMED --version > NUL 2>&1
174174
set RESULT_CODE=%errorlevel%
175175
if %RESULT_CODE% == 0 set OPENDJ_JAVA_ARGS=%OPENDJ_JAVA_ARGS% --add-opens java.base/jdk.internal.loader=ALL-UNNAMED
176+
"%OPENDJ_JAVA_BIN%" --enable-native-access=ALL-UNNAMED --version > NUL 2>&1
177+
set RESULT_CODE=%errorlevel%
178+
if NOT %RESULT_CODE% == 0 goto skipNativeAccessArg
179+
echo %OPENDJ_JAVA_ARGS% | findstr /C:"--enable-native-access=ALL-UNNAMED" > NUL 2>&1
180+
if %errorlevel% == 0 goto skipNativeAccessArg
181+
set OPENDJ_JAVA_ARGS=%OPENDJ_JAVA_ARGS% --enable-native-access=ALL-UNNAMED
182+
:skipNativeAccessArg
176183
goto scriptBegin
177184

178185
:setTempDir

opendj-server-legacy/resource/bin/_script-util.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,17 @@ set_environment_vars() {
254254
then
255255
export OPENDJ_JAVA_ARGS="$OPENDJ_JAVA_ARGS --add-exports java.base/sun.security.x509=ALL-UNNAMED --add-exports java.base/sun.security.tools.keytool=ALL-UNNAMED --add-opens java.base/jdk.internal.loader=ALL-UNNAMED"
256256
fi
257+
258+
"${OPENDJ_JAVA_BIN}" --enable-native-access=ALL-UNNAMED --version > /dev/null 2>&1
259+
RESULT_CODE=${?}
260+
if test ${RESULT_CODE} -eq 0
261+
then
262+
case " ${OPENDJ_JAVA_ARGS} " in
263+
*" --enable-native-access=ALL-UNNAMED "*) ;;
264+
*) OPENDJ_JAVA_ARGS="${OPENDJ_JAVA_ARGS} --enable-native-access=ALL-UNNAMED" ;;
265+
esac
266+
export OPENDJ_JAVA_ARGS
267+
fi
257268
}
258269

259270
# Configure the appropriate CLASSPATH for server, using Opend DJ logger.

0 commit comments

Comments
 (0)