8010192: Enable native JGSS provider on Mac
authorweijun
Tue, 07 May 2013 12:30:36 +0800
changeset 17435 ec797e955dca
parent 17434 4a04d7127e80
child 17436 79483ba40c55
8010192: Enable native JGSS provider on Mac Reviewed-by: valeriep
jdk/make/sun/security/Makefile
jdk/makefiles/CompileNativeLibraries.gmk
jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java
jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java
jdk/src/share/native/sun/security/jgss/wrapper/gssapi.h
jdk/test/sun/security/krb5/runNameEquals.sh
--- a/jdk/make/sun/security/Makefile	Mon May 06 21:24:37 2013 -0700
+++ b/jdk/make/sun/security/Makefile	Tue May 07 12:30:36 2013 +0800
@@ -38,12 +38,10 @@
 SUBDIRS_MAKEFLAGS += JAVAC_WARNINGS_FATAL=true
 include $(BUILDDIR)/common/Defs.gmk
 
-# build sun/security/jgss/wrapper on non-windows non-macosx platforms
+# build sun/security/jgss/wrapper on non-windows platforms
 JGSS_WRAPPER =
 ifneq ($(PLATFORM), windows)
-    ifneq ($(PLATFORM), macosx)
-    	JGSS_WRAPPER = jgss/wrapper
-    endif
+  JGSS_WRAPPER = jgss/wrapper
 endif
 
 # Build PKCS#11 on all platforms
--- a/jdk/makefiles/CompileNativeLibraries.gmk	Mon May 06 21:24:37 2013 -0700
+++ b/jdk/makefiles/CompileNativeLibraries.gmk	Tue May 07 12:30:36 2013 +0800
@@ -2545,7 +2545,6 @@
 ##########################################################################################
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
-ifneq ($(OPENJDK_TARGET_OS), macosx)
 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS,\
 		LIBRARY:=j2gss,\
                 OUTPUT_DIR:=$(INSTALL_LIBRARIES_HERE),\
@@ -2565,7 +2564,6 @@
 
 BUILD_LIBRARIES += $(BUILD_LIBJ2GSS)
 endif
-endif
 
 ##########################################################################################
 
--- a/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java	Mon May 06 21:24:37 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/GSSManagerImpl.java	Tue May 07 12:30:36 2013 +0800
@@ -48,6 +48,7 @@
                     public Boolean run() {
                             String osname = System.getProperty("os.name");
                             if (osname.startsWith("SunOS") ||
+                                osname.contains("OS X") ||
                                 osname.startsWith("Linux")) {
                                 return new Boolean(System.getProperty
                                     (USE_NATIVE_PROP));
--- a/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Mon May 06 21:24:37 2013 -0700
+++ b/jdk/src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java	Tue May 07 12:30:36 2013 +0800
@@ -90,6 +90,11 @@
                                     "libgssapi_krb5.so",
                                     "libgssapi_krb5.so.2",
                                 };
+                            } else if (osname.contains("OS X")) {
+                                gssLibs = new String[]{
+                                    "libgssapi_krb5.dylib",
+                                    "/usr/lib/sasl2/libgssapiv2.2.so",
+                               };
                             }
                         } else {
                             gssLibs = new String[]{ defaultLib };
--- a/jdk/src/share/native/sun/security/jgss/wrapper/gssapi.h	Mon May 06 21:24:37 2013 -0700
+++ b/jdk/src/share/native/sun/security/jgss/wrapper/gssapi.h	Tue May 07 12:30:36 2013 +0800
@@ -32,10 +32,21 @@
 #ifndef _GSSAPI_H_
 #define _GSSAPI_H_
 
+#if defined(__MACH__) && defined(__APPLE__)
+#       include <TargetConditionals.h>
+#       if TARGET_RT_MAC_CFM
+#               error "Use KfM 4.0 SDK headers for CFM compilation."
+#       endif
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif /* __cplusplus */
 
+#if TARGET_OS_MAC
+#    pragma pack(push,2)
+#endif
+
 /*
  * First, include stddef.h to get size_t defined.
  */
@@ -671,6 +682,10 @@
         gss_name_t *            /* output_name */
 );
 
+#if TARGET_OS_MAC
+#    pragma pack(pop)
+#endif
+
 #ifdef __cplusplus
 }
 #endif
--- a/jdk/test/sun/security/krb5/runNameEquals.sh	Mon May 06 21:24:37 2013 -0700
+++ b/jdk/test/sun/security/krb5/runNameEquals.sh	Tue May 07 12:30:36 2013 +0800
@@ -52,15 +52,11 @@
 # set platform-dependent variables
 OS=`uname -s`
 case "$OS" in
-  SunOS | Linux )
+  SunOS | Linux | Darwin )
     PATHSEP=":"
     FILESEP="/"
     NATIVE=true
     ;;
-  Darwin )
-    PATHSEP=":"
-    FILESEP="/"
-    ;;
   CYGWIN* )
     PATHSEP=";"
     FILESEP="/"