summary refs log tree commit diff
path: root/pkgs/development/libraries/nss
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2014-01-22 10:46:29 +0100
committerDomen Kožar <domen@dev.si>2014-01-22 10:46:37 +0100
commit5b982bd090c4926cc8132f5e494190547dce42eb (patch)
treefd39f66e67f80d83172ae98a58305e661f8a6acc /pkgs/development/libraries/nss
parentfc1ae3f6b5e66ecd1b9b988063560709c2a82479 (diff)
downloadnixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.tar
nixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.tar.gz
nixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.tar.bz2
nixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.tar.lz
nixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.tar.xz
nixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.tar.zst
nixpkgs-5b982bd090c4926cc8132f5e494190547dce42eb.zip
nss: patch http location moved, let's keep it in filesystem
Diffstat (limited to 'pkgs/development/libraries/nss')
-rw-r--r--pkgs/development/libraries/nss/85_security_load.patch80
-rw-r--r--pkgs/development/libraries/nss/default.nix9
2 files changed, 82 insertions, 7 deletions
diff --git a/pkgs/development/libraries/nss/85_security_load.patch b/pkgs/development/libraries/nss/85_security_load.patch
new file mode 100644
index 00000000000..4268231380c
--- /dev/null
+++ b/pkgs/development/libraries/nss/85_security_load.patch
@@ -0,0 +1,80 @@
+## 85_security_load.patch by Mike Hommey <glandium@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Load modules from $ORIGIN/nss.
+
+Index: nss/nss/cmd/shlibsign/shlibsign.c
+===================================================================
+--- nss.orig/nss/cmd/shlibsign/shlibsign.c	2013-08-05 14:40:31.041657554 +0900
++++ nss/nss/cmd/shlibsign/shlibsign.c	2013-08-05 14:40:31.033657739 +0900
+@@ -851,6 +851,8 @@
+     libname = PR_GetLibraryName(NULL, "softokn3");
+     assert(libname != NULL);
+     lib = PR_LoadLibrary(libname);
++    if (!lib)
++        lib = PR_LoadLibrary("/usr/lib/nss/libsoftokn3.so");
+     assert(lib != NULL);
+     PR_FreeLibraryName(libname);
+ 
+Index: nss/nss/lib/pk11wrap/pk11load.c
+===================================================================
+--- nss.orig/nss/lib/pk11wrap/pk11load.c	2013-08-05 14:40:31.041657554 +0900
++++ nss/nss/lib/pk11wrap/pk11load.c	2013-08-05 14:40:31.033657739 +0900
+@@ -406,6 +406,13 @@
+ 	 * unload the library if anything goes wrong from here on out...
+ 	 */
+ 	library = PR_LoadLibrary(mod->dllName);
++	if ((library == NULL) &&
++	    !rindex(mod->dllName, PR_GetDirectorySeparator())) {
++            library = PORT_LoadLibraryFromOrigin(my_shlib_name,
++                                      (PRFuncPtr) &softoken_LoadDSO,
++                                      mod->dllName);
++	}
++
+ 	mod->library = (void *)library;
+ 
+ 	if (library == NULL) {
+Index: nss/nss/lib/util/secload.c
+===================================================================
+--- nss.orig/nss/lib/util/secload.c	2013-08-05 14:40:31.041657554 +0900
++++ nss/nss/lib/util/secload.c	2013-08-05 14:40:31.033657739 +0900
+@@ -69,9 +69,14 @@
+ 
+     /* 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]
++               * and program was called from $PATH. Hack to get libs from /usr/lib */
++        referencePath = "/usr/lib/";
++        c = &referencePath[8]; /* last / */
++    }
+     if (c) {
+         size_t referencePathSize = 1 + c - referencePath;
+-        fullName = (char*) PORT_Alloc(strlen(name) + referencePathSize + 1);
++        fullName = (char*) PORT_Alloc(strlen(name) + referencePathSize + 5);
+         if (fullName) {
+             memcpy(fullName, referencePath, referencePathSize);
+             strcpy(fullName + referencePathSize, name); 
+@@ -81,6 +86,12 @@
+ #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);
++            }
++            strcpy(fullName + referencePathSize, "nss/");
++            strcpy(fullName + referencePathSize + 4, name);
+             dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL
+ #ifdef PR_LD_ALT_SEARCH_PATH
+             /* allow library's dependencies to be found in the same directory
+@@ -88,6 +99,10 @@
+                                           | PR_LD_ALT_SEARCH_PATH 
+ #endif
+                                           );
++            if (! dlh) {
++                strcpy(fullName + referencePathSize, name);
++                dlh = PR_LoadLibraryWithFlags(libSpec, PR_LD_NOW | PR_LD_LOCAL);
++            }
+             PORT_Free(fullName);
+         }
+     }
diff --git a/pkgs/development/libraries/nss/default.nix b/pkgs/development/libraries/nss/default.nix
index 64c07d9cb2e..b352064cee5 100644
--- a/pkgs/development/libraries/nss/default.nix
+++ b/pkgs/development/libraries/nss/default.nix
@@ -9,12 +9,6 @@ let
     sha256 = "1k1m8lsgqwxx251943hks1dd13hz1adpqqb0hxwn011by5vmi201";
   };
 
-  secLoadPatch = fetchurl {
-    name = "security_load.patch";
-    urls = http://patch-tracker.debian.org/patch/series/dl/nss/2:3.15.3.1-1/85_security_load.patch;
-    sha256 = "041c6v4cxwsy14qr5m9qs0gkv3w24g632cwpz27kacxpa886r1ds";
-  };
-
 in stdenv.mkDerivation rec {
   name = "nss-${version}";
   version = "3.15.3.1";
@@ -32,7 +26,8 @@ in stdenv.mkDerivation rec {
 
   patches =
     [ ./nss-3.15-gentoo-fixups.patch
-      secLoadPatch
+      # from http://patch-tracker.debian.org/patch/series/dl/nss/2:3.15.4-1/85_security_load.patch
+      ./85_security_load.patch
       ./nix_secload_fixup.patch
     ];