-
Notifications
You must be signed in to change notification settings - Fork 6.2k
8349546: Linux support for Kerberos "nativeccache" functionality #28075
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nrhall
wants to merge
12
commits into
openjdk:master
Choose a base branch
from
nrhall:nrhall-add-support-for-linux-krb5-native
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
c0204db
Add support for native Kerberos credential acquisition on Linux
nrhall 2e6cd02
Fix permissions on build.sh
nrhall 307c3f2
Tidy up comments/docs
nrhall 5106d31
eliminate build.sh in favour of jtreg primitives
nrhall 33407d4
more comment fixes
nrhall 1a28cee
Add specific MacOS jtreg compiler flags to fix deprecation warnings
nrhall 5cad1e4
Add missing .h file to PR
nrhall bc904b0
Fixes to ensure that the jtreg test is not built or executed if krb5 …
nrhall 3ea9793
Attend to @erikj79's code review comments
nrhall d58d417
Minor variable/function name and comment clean-ups
nrhall 47968fe
Minor doc/comment clean-ups
nrhall 8c8288a
Address second set of @erikj79's build comments
nrhall File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,187 @@ | ||
| # | ||
| # Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. | ||
| # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| # | ||
| # This code is free software; you can redistribute it and/or modify it | ||
| # under the terms of the GNU General Public License version 2 only, as | ||
| # published by the Free Software Foundation. Oracle designates this | ||
| # particular file as subject to the "Classpath" exception as provided | ||
| # by Oracle in the LICENSE file that accompanied this code. | ||
| # | ||
| # This code is distributed in the hope that it will be useful, but WITHOUT | ||
| # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| # version 2 for more details (a copy is included in the LICENSE file that | ||
| # accompanied this code). | ||
| # | ||
| # You should have received a copy of the GNU General Public License version | ||
| # 2 along with this work; if not, write to the Free Software Foundation, | ||
| # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| # | ||
| # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| # or visit www.oracle.com if you need additional information or have any | ||
| # questions. | ||
| # | ||
|
|
||
| ################################################################################ | ||
| # Setup krb5 (Kerberos 5) | ||
| ################################################################################ | ||
| AC_DEFUN_ONCE([LIB_SETUP_KRB5], | ||
| [ | ||
| AC_ARG_WITH(krb5, [AS_HELP_STRING([--with-krb5], | ||
| [specify prefix directory for the krb5 package on Linux, or use "yes/no/auto" (default=auto)])]) | ||
| AC_ARG_WITH(krb5-include, [AS_HELP_STRING([--with-krb5-include], | ||
| [specify directory for the krb5 include files on Linux])]) | ||
| AC_ARG_WITH(krb5-lib, [AS_HELP_STRING([--with-krb5-lib], | ||
| [specify directory for the krb5 library on Linux])]) | ||
|
|
||
| KRB5_CFLAGS= | ||
| KRB5_LIBS= | ||
| ENABLE_LIBKRB5_LINUX=false | ||
|
|
||
| if test "x$OPENJDK_TARGET_OS" != "xlinux" && test "x${with_krb5}" = "xyes"; then | ||
| AC_MSG_ERROR([krb5 support is only available on Linux]) | ||
| elif test "x${with_krb5}" = "xno"; then | ||
| AC_MSG_CHECKING([for krb5]) | ||
| AC_MSG_RESULT([disabled]) | ||
| else | ||
| KRB5_FOUND=no | ||
|
|
||
| if test "x${with_krb5}" != "x" && test "x${with_krb5}" != "xyes" && test "x${with_krb5}" != "xauto"; then | ||
| # if a path was provided, use it | ||
| if test "x${with_krb5}" != "x"; then | ||
| AC_MSG_CHECKING([for krb5]) | ||
| KRB5_LIBS="-L${with_krb5}/lib -lkrb5 -lcom_err" | ||
| KRB5_CFLAGS="-I${with_krb5}/include" | ||
| KRB5_FOUND=yes | ||
| AC_MSG_RESULT([${with_krb5}]) | ||
| fi | ||
| fi | ||
|
|
||
| if test "x${with_krb5_include}" != "x"; then | ||
| AC_MSG_CHECKING([for krb5 includes]) | ||
| KRB5_CFLAGS="-I${with_krb5_include}" | ||
| KRB5_FOUND=yes | ||
| AC_MSG_RESULT([${with_krb5_include}]) | ||
| fi | ||
|
|
||
| if test "x${with_krb5_lib}" != "x"; then | ||
| AC_MSG_CHECKING([for krb5 libs]) | ||
| KRB5_LIBS="-L${with_krb5_lib} -lkrb5 -lcom_err" | ||
| KRB5_FOUND=yes | ||
| AC_MSG_RESULT([${with_krb5_lib}]) | ||
| fi | ||
|
|
||
| if test "x$KRB5_FOUND" = "xno"; then | ||
| if test "x$SYSROOT" != "x"; then | ||
| AC_MSG_CHECKING([for krb5 ($SYSROOT)]) | ||
| # Cross-compilation with SYSROOT - look at known locations in SYSROOT. | ||
| KRB5_LIB_PATH="" | ||
| COM_ERR_LIB_PATH="" | ||
|
|
||
| # Look for libkrb5/libcom_err | ||
| if test -f "$SYSROOT/usr/lib64/libkrb5.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then | ||
| KRB5_LIB_PATH="$SYSROOT/usr/lib64" | ||
| elif test -f "$SYSROOT/usr/lib/libkrb5.so"; then | ||
| KRB5_LIB_PATH="$SYSROOT/usr/lib" | ||
| elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libkrb5.so"; then | ||
| KRB5_LIB_PATH="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI" | ||
| elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libkrb5.so"; then | ||
| KRB5_LIB_PATH="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI" | ||
| fi | ||
|
|
||
| if test -f "$KRB5_LIB_PATH/libcom_err.so"; then | ||
| COM_ERR_LIB_PATH="$KRB5_LIB_PATH" | ||
| elif test -f "$SYSROOT/usr/lib64/libcom_err.so" && test "x$OPENJDK_TARGET_CPU_BITS" = x64; then | ||
| COM_ERR_LIB_PATH="$SYSROOT/usr/lib64" | ||
| elif test -f "$SYSROOT/usr/lib/libcom_err.so"; then | ||
| COM_ERR_LIB_PATH="$SYSROOT/usr/lib" | ||
| elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libcom_err.so"; then | ||
| COM_ERR_LIB_PATH="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI" | ||
| elif test -f "$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI/libcom_err.so"; then | ||
| COM_ERR_LIB_PATH="$SYSROOT/usr/lib/$OPENJDK_TARGET_CPU_AUTOCONF-$OPENJDK_TARGET_OS-$OPENJDK_TARGET_ABI" | ||
| fi | ||
|
|
||
| # Check for matching include files | ||
| KRB5_INCLUDE_PATH="" | ||
| COM_ERR_INCLUDE_PATH="" | ||
|
|
||
| if test -f "$SYSROOT/usr/include/krb5/krb5.h"; then | ||
| KRB5_INCLUDE_PATH="$SYSROOT/usr/include" | ||
| fi | ||
|
|
||
| if test -f "$SYSROOT/usr/include/com_err.h"; then | ||
| COM_ERR_INCLUDE_PATH="$SYSROOT/usr/include" | ||
| fi | ||
|
|
||
| # Check everything was found and merge paths | ||
| if test "x$KRB5_LIB_PATH" != "x" && test "x$COM_ERR_LIB_PATH" != "x" && \ | ||
| test "x$KRB5_INCLUDE_PATH" != "x" && test "x$COM_ERR_INCLUDE_PATH" != "x"; then | ||
| KRB5_LIBS="-L$KRB5_LIB_PATH -lkrb5" | ||
| if test "x$COM_ERR_LIB_PATH" != "x" && test "x$COM_ERR_LIB_PATH" != "x$KRB5_LIB_PATH"; then | ||
| KRB5_LIBS="$KRB5_LIBS -L$COM_ERR_LIB_PATH" | ||
| fi | ||
| KRB5_LIBS="$KRB5_LIBS -lcom_err" | ||
|
|
||
| KRB5_CFLAGS="-I$KRB5_INCLUDE_PATH" | ||
| if test "x$COM_ERR_INCLUDE_PATH" != "x" && test "x$COM_ERR_INCLUDE_PATH" != "x$KRB5_INCLUDE_PATH"; then | ||
| KRB5_CFLAGS="$KRB5_CFLAGS -I$COM_ERR_INCLUDE_PATH" | ||
| fi | ||
|
|
||
| KRB5_FOUND=yes | ||
| fi | ||
| AC_MSG_RESULT([$KRB5_FOUND]) | ||
| else | ||
| if test "x$PKG_CONFIG" != "x" ; then | ||
| PKG_CHECK_MODULES(KRB5, krb5, [KRB5_FOUND=yes], [KRB5_FOUND=no]) | ||
| if test "x$KRB5_FOUND" = "xyes" ; then | ||
| AC_MSG_CHECKING([for krb5]) | ||
| AC_MSG_RESULT([yes (using pkg-config)]) | ||
| fi | ||
| fi | ||
|
|
||
| if test "x$KRB5_FOUND" = "xno"; then | ||
| UTIL_LOOKUP_PROGS(KRB5CONF, krb5-config) | ||
| if test "x$KRB5CONF" != "x"; then | ||
| AC_MSG_CHECKING([for krb5 using krb5-config]) | ||
| KRB5_CFLAGS="`$KRB5CONF --cflags`" | ||
| KRB5_LIBS="`$KRB5CONF --libs`" | ||
| KRB5_FOUND=yes | ||
| AC_MSG_RESULT([$KRB5_FOUND]) | ||
| fi | ||
| fi | ||
| fi | ||
| fi | ||
|
|
||
| # No sysconfig/pkg-config/krb5-config, so auto-detect | ||
| if test "x$KRB5_FOUND" = "xno"; then | ||
| AC_CHECK_HEADERS([krb5.h], [ | ||
| AC_CHECK_HEADERS([com_err.h], [ | ||
| AC_CHECK_LIB([krb5], [krb5_init_context], [ | ||
| KRB5_CFLAGS="" | ||
| KRB5_LIBS="-lkrb5" | ||
| AC_CHECK_LIB([com_err], [com_err], [ | ||
| KRB5_LIBS="$KRB5_LIBS -lcom_err" | ||
| ]) | ||
| KRB5_FOUND=yes | ||
| ]) | ||
| ]) | ||
| ]) | ||
| fi | ||
|
|
||
| if test "x$KRB5_FOUND" = "xno"; then | ||
| if test "x${with_krb5}" = "xyes"; then | ||
| AC_MSG_ERROR([krb5 was required but could not be found]) | ||
| fi | ||
| KRB5_CFLAGS= | ||
| KRB5_LIBS= | ||
| ENABLE_LIBKRB5_LINUX=false | ||
| else | ||
| ENABLE_LIBKRB5_LINUX=true | ||
| fi | ||
| fi | ||
|
|
||
| AC_SUBST(KRB5_CFLAGS) | ||
| AC_SUBST(KRB5_LIBS) | ||
| AC_SUBST(ENABLE_LIBKRB5_LINUX) | ||
| ]) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.