1 /*
2 * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
65
66 static {
67 MECH_MAP =
68 AccessController.doPrivileged(
69 new PrivilegedAction<>() {
70 public HashMap<String, String> run() {
71 DEBUG = Boolean.parseBoolean(
72 System.getProperty("sun.security.nativegss.debug"));
73 try {
74 System.loadLibrary("j2gss");
75 } catch (Error err) {
76 debug("No j2gss library found!");
77 if (DEBUG) err.printStackTrace();
78 return null;
79 }
80 String[] gssLibs;
81 String defaultLib
82 = System.getProperty("sun.security.jgss.lib");
83 if (defaultLib == null || defaultLib.trim().equals("")) {
84 String osname = System.getProperty("os.name");
85 if (osname.startsWith("SunOS")) {
86 gssLibs = new String[]{ "libgss.so" };
87 } else if (osname.startsWith("Linux")) {
88 gssLibs = new String[]{
89 "libgssapi.so",
90 "libgssapi_krb5.so",
91 "libgssapi_krb5.so.2",
92 };
93 } else if (osname.contains("OS X")) {
94 gssLibs = new String[]{
95 "libgssapi_krb5.dylib",
96 "/usr/lib/sasl2/libgssapiv2.2.so",
97 };
98 } else if (osname.contains("Windows")) {
99 // Full path needed, DLL is in jre/bin
100 gssLibs = new String[]{ System.getProperty("java.home")
101 + "\\bin\\sspi_bridge.dll" };
102 } else {
103 gssLibs = new String[0];
104 }
105 } else {
106 gssLibs = new String[]{ defaultLib };
107 }
|
1 /*
2 * Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
65
66 static {
67 MECH_MAP =
68 AccessController.doPrivileged(
69 new PrivilegedAction<>() {
70 public HashMap<String, String> run() {
71 DEBUG = Boolean.parseBoolean(
72 System.getProperty("sun.security.nativegss.debug"));
73 try {
74 System.loadLibrary("j2gss");
75 } catch (Error err) {
76 debug("No j2gss library found!");
77 if (DEBUG) err.printStackTrace();
78 return null;
79 }
80 String[] gssLibs;
81 String defaultLib
82 = System.getProperty("sun.security.jgss.lib");
83 if (defaultLib == null || defaultLib.trim().equals("")) {
84 String osname = System.getProperty("os.name");
85 if (osname.startsWith("Linux")) {
86 gssLibs = new String[]{
87 "libgssapi.so",
88 "libgssapi_krb5.so",
89 "libgssapi_krb5.so.2",
90 };
91 } else if (osname.contains("OS X")) {
92 gssLibs = new String[]{
93 "libgssapi_krb5.dylib",
94 "/usr/lib/sasl2/libgssapiv2.2.so",
95 };
96 } else if (osname.contains("Windows")) {
97 // Full path needed, DLL is in jre/bin
98 gssLibs = new String[]{ System.getProperty("java.home")
99 + "\\bin\\sspi_bridge.dll" };
100 } else {
101 gssLibs = new String[0];
102 }
103 } else {
104 gssLibs = new String[]{ defaultLib };
105 }
|