2020-06-29 01:09:27 +00:00
|
|
|
diff --git nss/cmd/shlibsign/shlibsign.c nss/cmd/shlibsign/shlibsign.c
|
|
|
|
index ad8f3b84e..74676d039 100644
|
|
|
|
--- nss/cmd/shlibsign/shlibsign.c
|
|
|
|
+++ nss/cmd/shlibsign/shlibsign.c
|
|
|
|
@@ -875,6 +875,8 @@ main(int argc, char **argv)
|
2017-01-24 13:49:14 +00:00
|
|
|
goto cleanup;
|
|
|
|
}
|
2014-01-22 09:46:29 +00:00
|
|
|
lib = PR_LoadLibrary(libname);
|
|
|
|
+ if (!lib)
|
2014-04-22 12:54:36 +00:00
|
|
|
+ lib = PR_LoadLibrary(NIX_NSS_LIBDIR"libsoftokn3.so");
|
2014-01-22 09:46:29 +00:00
|
|
|
assert(lib != NULL);
|
2017-01-24 13:49:14 +00:00
|
|
|
if (!lib) {
|
|
|
|
PR_fprintf(PR_STDERR, "loading softokn3 failed");
|
2020-06-29 01:09:27 +00:00
|
|
|
diff --git nss/lib/pk11wrap/pk11load.c nss/lib/pk11wrap/pk11load.c
|
|
|
|
index 9e7a0a546..a0a23a1a4 100644
|
|
|
|
--- nss/lib/pk11wrap/pk11load.c
|
|
|
|
+++ nss/lib/pk11wrap/pk11load.c
|
|
|
|
@@ -466,6 +466,15 @@ secmod_LoadPKCS11Module(SECMODModule *mod, SECMODModule **oldModule)
|
2017-01-24 13:49:14 +00:00
|
|
|
* unload the library if anything goes wrong from here on out...
|
|
|
|
*/
|
|
|
|
library = PR_LoadLibrary(mod->dllName);
|
2020-06-29 01:09:27 +00:00
|
|
|
+#ifndef NSS_STATIC_SOFTOKEN
|
2017-01-24 13:49:14 +00:00
|
|
|
+ if ((library == NULL) &&
|
|
|
|
+ !rindex(mod->dllName, PR_GetDirectorySeparator())) {
|
2014-01-22 09:46:29 +00:00
|
|
|
+ library = PORT_LoadLibraryFromOrigin(my_shlib_name,
|
2017-01-24 13:49:14 +00:00
|
|
|
+ (PRFuncPtr) &softoken_LoadDSO,
|
|
|
|
+ mod->dllName);
|
|
|
|
+ }
|
2020-06-29 01:09:27 +00:00
|
|
|
+#endif
|
2014-01-22 09:46:29 +00:00
|
|
|
+
|
2017-01-24 13:49:14 +00:00
|
|
|
mod->library = (void *)library;
|
2014-01-22 09:46:29 +00:00
|
|
|
|
2017-01-24 13:49:14 +00:00
|
|
|
if (library == NULL) {
|
2020-06-29 01:09:27 +00:00
|
|
|
diff --git nss/lib/util/secload.c nss/lib/util/secload.c
|
|
|
|
index 12efd2f75..8b74478f6 100644
|
|
|
|
--- nss/lib/util/secload.c
|
|
|
|
+++ nss/lib/util/secload.c
|
|
|
|
@@ -70,9 +70,14 @@ loader_LoadLibInReferenceDir(const char* referencePath, const char* name)
|
2014-01-22 09:46:29 +00:00
|
|
|
|
|
|
|
/* Remove the trailing filename from referencePath and add the new one */
|
|
|
|
c = strrchr(referencePath, PR_GetDirectorySeparator());
|
|
|
|
+ if (!c) { /* referencePath doesn't contain a / means that dladdr gave us argv[0]
|
2014-04-22 12:54:36 +00:00
|
|
|
+ * and program was called from $PATH. Hack to get libs from NIX_NSS_LIBDIR */
|
|
|
|
+ referencePath = NIX_NSS_LIBDIR;
|
2015-12-16 15:18:42 +00:00
|
|
|
+ c = (char*) &referencePath[sizeof(NIX_NSS_LIBDIR) - 1]; /* last / */
|
2014-01-22 09:46:29 +00:00
|
|
|
+ }
|
|
|
|
if (c) {
|
|
|
|
size_t referencePathSize = 1 + c - referencePath;
|
2016-11-15 15:33:41 +00:00
|
|
|
- fullName = (char*)PORT_Alloc(strlen(name) + referencePathSize + 1);
|
2014-01-22 09:46:29 +00:00
|
|
|
+ fullName = (char*) PORT_Alloc(strlen(name) + referencePathSize + 5);
|
|
|
|
if (fullName) {
|
|
|
|
memcpy(fullName, referencePath, referencePathSize);
|
2016-11-15 15:33:41 +00:00
|
|
|
strcpy(fullName + referencePathSize, name);
|
2020-06-29 01:09:27 +00:00
|
|
|
@@ -82,6 +87,11 @@ loader_LoadLibInReferenceDir(const char* referencePath, const char* name)
|
2014-01-22 09:46:29 +00:00
|
|
|
#endif
|
|
|
|
libSpec.type = PR_LibSpec_Pathname;
|
|
|
|
libSpec.value.pathname = fullName;
|
|
|
|
+ if ((referencePathSize >= 4) &&
|
|
|
|
+ (strncmp(fullName + referencePathSize - 4, "bin", 3) == 0)) {
|
|
|
|
+ memcpy(fullName + referencePathSize -4, "lib", 3);
|
|
|
|
+ }
|
2014-04-22 12:54:36 +00:00
|
|
|
+ strcpy(fullName + referencePathSize, name);
|
2014-01-22 09:46:29 +00:00
|
|
|
dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL
|
|
|
|
#ifdef PR_LD_ALT_SEARCH_PATH
|
2016-11-15 15:33:41 +00:00
|
|
|
/* allow library's dependencies to be found in the same directory
|
2020-06-29 01:09:27 +00:00
|
|
|
@@ -89,6 +99,10 @@ loader_LoadLibInReferenceDir(const char* referencePath, const char* name)
|
2016-11-15 15:33:41 +00:00
|
|
|
| PR_LD_ALT_SEARCH_PATH
|
2014-01-22 09:46:29 +00:00
|
|
|
#endif
|
|
|
|
);
|
|
|
|
+ if (! dlh) {
|
|
|
|
+ strcpy(fullName + referencePathSize, name);
|
|
|
|
+ dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL);
|
|
|
|
+ }
|
|
|
|
PORT_Free(fullName);
|
|
|
|
}
|
|
|
|
}
|