Bug 648730 - Fix(again) Kerberos/GSSAPI authentication on OpenBSD r=khuey
authorLandry Breuil <landry@openbsd.org>
Thu, 06 Mar 2014 20:11:24 +0100
changeset 189553 7fc49d96e84ad7cc4bfa4ec2d12615884adf4307
parent 189552 8799ec066a38422333507f0be2ab6c6595593f99
child 189554 969220ac8459bb6820e88e75e37cf525e06f5708
push id3503
push userraliiev@mozilla.com
push dateMon, 28 Apr 2014 18:51:11 +0000
treeherdermozilla-beta@c95ac01e332e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskhuey
bugs648730
milestone30.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 648730 - Fix(again) Kerberos/GSSAPI authentication on OpenBSD r=khuey
extensions/auth/nsAuthGSSAPI.cpp
--- a/extensions/auth/nsAuthGSSAPI.cpp
+++ b/extensions/auth/nsAuthGSSAPI.cpp
@@ -117,29 +117,52 @@ gssInit()
     }
     else {
 #ifdef XP_WIN
         char *libName = PR_GetLibraryName(nullptr, "gssapi32");
         if (libName) {
             lib = PR_LoadLibrary("gssapi32");
             PR_FreeLibraryName(libName);
         }
+#elif defined(__OpenBSD__)
+        /* OpenBSD doesn't register inter-library dependencies in basesystem
+         * libs therefor we need to load all the libraries gssapi depends on,
+         * in the correct order and with LD_GLOBAL for GSSAPI auth to work
+         * fine.
+         */
+
+        const char *const verLibNames[] = {
+            "libasn1.so",
+            "libcrypto.so",
+            "libroken.so",
+            "libheimbase.so",
+            "libcom_err.so",
+            "libkrb5.so",
+            "libgssapi.so"
+        };
+
+        PRLibSpec libSpec;
+        for (size_t i = 0; i < ArrayLength(verLibNames); ++i) {
+            libSpec.type = PR_LibSpec_Pathname;
+            libSpec.value.pathname = verLibNames[i];
+            lib = PR_LoadLibraryWithFlags(libSpec, PR_LD_GLOBAL);
+        };
+
 #else
         
         const char *const libNames[] = {
             "gss",
             "gssapi_krb5",
             "gssapi"
         };
         
         const char *const verLibNames[] = {
             "libgssapi_krb5.so.2", /* MIT - FC, Suse10, Debian */
             "libgssapi.so.4",      /* Heimdal - Suse10, MDK */
-            "libgssapi.so.1",      /* Heimdal - Suse9, CITI - FC, MDK, Suse10*/
-            "libgssapi.so"         /* OpenBSD */
+            "libgssapi.so.1"       /* Heimdal - Suse9, CITI - FC, MDK, Suse10*/
         };
 
         for (size_t i = 0; i < ArrayLength(verLibNames) && !lib; ++i) {
             lib = PR_LoadLibrary(verLibNames[i]);
  
             /* The CITI libgssapi library calls exit() during
              * initialization if it's not correctly configured. Try to
              * ensure that we never use this library for our GSSAPI