src/share/classes/sun/security/jgss/wrapper/SunNativeProvider.java

Print this page
rev 6670 : 8010192: Enable native JGSS provider on Mac


  73                             (System.getProperty(DEBUG_PROP));
  74                         try {
  75                             System.loadLibrary("j2gss");
  76                         } catch (Error err) {
  77                             debug("No j2gss library found!");
  78                             if (DEBUG) err.printStackTrace();
  79                             return null;
  80                         }
  81                         String gssLibs[] = new String[0];
  82                         String defaultLib = System.getProperty(LIB_PROP);
  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                             }
  94                         } else {
  95                             gssLibs = new String[]{ defaultLib };
  96                         }
  97                         for (String libName: gssLibs) {
  98                             if (GSSLibStub.init(libName)) {
  99                                 debug("Loaded GSS library: " + libName);
 100                                 Oid[] mechs = GSSLibStub.indicateMechs();
 101                                 HashMap<String, String> map =
 102                                             new HashMap<String, String>();
 103                                 for (int i = 0; i < mechs.length; i++) {
 104                                     debug("Native MF for " + mechs[i]);
 105                                     map.put("GssApiMechanism." + mechs[i],
 106                                             MF_CLASS);
 107                                 }
 108                                 return map;
 109                             }
 110                         }
 111                         return null;
 112                     }


  73                             (System.getProperty(DEBUG_PROP));
  74                         try {
  75                             System.loadLibrary("j2gss");
  76                         } catch (Error err) {
  77                             debug("No j2gss library found!");
  78                             if (DEBUG) err.printStackTrace();
  79                             return null;
  80                         }
  81                         String gssLibs[] = new String[0];
  82                         String defaultLib = System.getProperty(LIB_PROP);
  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                             }
  99                         } else {
 100                             gssLibs = new String[]{ defaultLib };
 101                         }
 102                         for (String libName: gssLibs) {
 103                             if (GSSLibStub.init(libName)) {
 104                                 debug("Loaded GSS library: " + libName);
 105                                 Oid[] mechs = GSSLibStub.indicateMechs();
 106                                 HashMap<String, String> map =
 107                                             new HashMap<String, String>();
 108                                 for (int i = 0; i < mechs.length; i++) {
 109                                     debug("Native MF for " + mechs[i]);
 110                                     map.put("GssApiMechanism." + mechs[i],
 111                                             MF_CLASS);
 112                                 }
 113                                 return map;
 114                             }
 115                         }
 116                         return null;
 117                     }