49 |
49 |
50 private static final String NAME = "SunNativeGSS"; |
50 private static final String NAME = "SunNativeGSS"; |
51 private static final String INFO = "Sun Native GSS provider"; |
51 private static final String INFO = "Sun Native GSS provider"; |
52 private static final String MF_CLASS = |
52 private static final String MF_CLASS = |
53 "sun.security.jgss.wrapper.NativeGSSFactory"; |
53 "sun.security.jgss.wrapper.NativeGSSFactory"; |
54 private static final String LIB_PROP = "sun.security.jgss.lib"; |
|
55 private static final String DEBUG_PROP = "sun.security.nativegss.debug"; |
|
56 private static final HashMap<String, String> MECH_MAP; |
54 private static final HashMap<String, String> MECH_MAP; |
57 static final Provider INSTANCE; |
55 static final Provider INSTANCE; |
58 static boolean DEBUG; |
56 static boolean DEBUG; |
59 static void debug(String message) { |
57 static void debug(String message) { |
60 if (DEBUG) { |
58 if (DEBUG) { |
68 static { |
66 static { |
69 MECH_MAP = |
67 MECH_MAP = |
70 AccessController.doPrivileged( |
68 AccessController.doPrivileged( |
71 new PrivilegedAction<HashMap<String, String>>() { |
69 new PrivilegedAction<HashMap<String, String>>() { |
72 public HashMap<String, String> run() { |
70 public HashMap<String, String> run() { |
73 DEBUG = Boolean.parseBoolean |
71 DEBUG = Boolean.parseBoolean( |
74 (System.getProperty(DEBUG_PROP)); |
72 System.getProperty("sun.security.nativegss.debug")); |
75 try { |
73 try { |
76 System.loadLibrary("j2gss"); |
74 System.loadLibrary("j2gss"); |
77 } catch (Error err) { |
75 } catch (Error err) { |
78 debug("No j2gss library found!"); |
76 debug("No j2gss library found!"); |
79 if (DEBUG) err.printStackTrace(); |
77 if (DEBUG) err.printStackTrace(); |
80 return null; |
78 return null; |
81 } |
79 } |
82 String[] gssLibs = new String[0]; |
80 String[] gssLibs = new String[0]; |
83 String defaultLib = System.getProperty(LIB_PROP); |
81 String defaultLib |
|
82 = System.getProperty("sun.security.jgss.lib"); |
84 if (defaultLib == null || defaultLib.trim().equals("")) { |
83 if (defaultLib == null || defaultLib.trim().equals("")) { |
85 String osname = System.getProperty("os.name"); |
84 String osname = System.getProperty("os.name"); |
86 if (osname.startsWith("SunOS")) { |
85 if (osname.startsWith("SunOS")) { |
87 gssLibs = new String[]{ "libgss.so" }; |
86 gssLibs = new String[]{ "libgss.so" }; |
88 } else if (osname.startsWith("Linux")) { |
87 } else if (osname.startsWith("Linux")) { |