summaryrefslogtreecommitdiff
path: root/external
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-01-17 11:13:43 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-01-17 12:56:29 +0100
commita3ca9b88b4b38c008efa868844ba7a3105b4bcca (patch)
treebb5ac956ca469f07235fb4405b5bb9ee77df0018 /external
parent14ad64270e4fbca3c24da6f55f260b1fb229556a (diff)
tdf#127619: external/nss: Load smime3 lib with a path on macOS
A plain dlopen("libsmime3.dylib",...) would search (among other places) DYLD_FALLBACK_LIBRARY_PATH, which when unset defaults to a set of paths including /usr/local/lib (so would erroneously find Homebrew's /usr/local/lib/libsmime3.dylib instead of LO's LibreOffice.app/Contents/Frameworks/libsmime3.dylib next to the calling LibreOffice.app/Contents/Frameworks/libnspr4.dylib). At least macOS 10.15.2 supports a "@loader_path/" prefix in dlopen, to find the requested library next to the calling code, so use that as a quick fix. (Should that turn out to be problematic, there is PORT_LoadLibraryFromOrigin in workdir/UnpackedTarball/nss/nss/lib/util/secload.c that might be useful in a more elaborate fix.) Change-Id: I8688606017a4b32a2dd55740f67b8fdb36fc5435 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86966 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'external')
-rw-r--r--external/nss/UnpackedTarball_nss.mk1
-rw-r--r--external/nss/macos-dlopen.patch.025
2 files changed, 26 insertions, 0 deletions
diff --git a/external/nss/UnpackedTarball_nss.mk b/external/nss/UnpackedTarball_nss.mk
index 3079216b674e..0e174879a702 100644
--- a/external/nss/UnpackedTarball_nss.mk
+++ b/external/nss/UnpackedTarball_nss.mk
@@ -33,6 +33,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,nss,\
$(if $(filter ANDROID,$(OS)), \
external/nss/nss-android.patch.1) \
external/nss/nss.bzmozilla1238154.patch \
+ external/nss/macos-dlopen.patch.0 \
))
ifeq ($(COM_IS_CLANG),TRUE)
diff --git a/external/nss/macos-dlopen.patch.0 b/external/nss/macos-dlopen.patch.0
new file mode 100644
index 000000000000..8c484e4c6841
--- /dev/null
+++ b/external/nss/macos-dlopen.patch.0
@@ -0,0 +1,25 @@
+--- nspr/pr/src/linking/prlink.c
++++ nspr/pr/src/linking/prlink.c
+@@ -793,7 +793,7 @@
+ /* ensure the file exists if it contains a slash character i.e. path */
+ /* DARWIN's dlopen ignores the provided path and checks for the */
+ /* plain filename in DYLD_LIBRARY_PATH */
+- if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL ||
++ if (strchr(name, PR_DIRECTORY_SEPARATOR) == NULL || strncmp(name, "@loader_path/", 13) == 0 ||
+ PR_Access(name, PR_ACCESS_EXISTS) == PR_SUCCESS) {
+ h = dlopen(name, dl_flags);
+ }
+--- nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
++++ nss/lib/libpkix/pkix_pl_nss/module/pkix_pl_httpcertstore.c
+@@ -224,7 +224,11 @@
+ static PRStatus PR_CALLBACK pkix_getDecodeFunction(void)
+ {
+ pkix_decodeFunc.smimeLib =
++#if defined DARWIN
++ PR_LoadLibrary("@loader_path/" SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
++#else
+ PR_LoadLibrary(SHLIB_PREFIX"smime3."SHLIB_SUFFIX);
++#endif
+ if (pkix_decodeFunc.smimeLib == NULL) {
+ return PR_FAILURE;
+ }