diff --git a/pkgs/development/libraries/openssl/1.0.1j.nix b/pkgs/development/libraries/openssl/1.0.1j.nix index 29656f7ef888..541561b0b702 100644 --- a/pkgs/development/libraries/openssl/1.0.1j.nix +++ b/pkgs/development/libraries/openssl/1.0.1j.nix @@ -18,7 +18,7 @@ let # hardcoding something like /etc/ssl/cert.pem is impure and # cannot be overriden per-process. For security, the # environment variable is ignored for setuid binaries. - ./cert-file.patch + ./cert-file-1.0.1j.patch # Remove the compilation time from the library ./no-date-in-library.patch ] diff --git a/pkgs/development/libraries/openssl/cert-file-1.0.1j.patch b/pkgs/development/libraries/openssl/cert-file-1.0.1j.patch new file mode 100644 index 000000000000..26b51c0295e0 --- /dev/null +++ b/pkgs/development/libraries/openssl/cert-file-1.0.1j.patch @@ -0,0 +1,41 @@ +diff -ru -x '*~' openssl-1.0.0e-orig/crypto/x509/x509_def.c openssl-1.0.0e/crypto/x509/x509_def.c +--- openssl-1.0.0e-orig/crypto/x509/x509_def.c 1999-09-11 19:54:11.000000000 +0200 ++++ openssl-1.0.0e/crypto/x509/x509_def.c 2011-09-12 18:30:59.386501609 +0200 +@@ -57,6 +57,10 @@ + */ + + #include ++#include ++#include ++#include ++#include + #include "cryptlib.h" + #include + #include +@@ -71,7 +75,25 @@ + { return(X509_CERT_DIR); } + + const char *X509_get_default_cert_file(void) +- { return(X509_CERT_FILE); } ++ { ++ static char buf[PATH_MAX] = X509_CERT_FILE; ++ static int init = 0; ++ if (!init) { ++ init = 1; ++ char * s = getenv("OPENSSL_X509_CERT_FILE"); ++ if (s) { ++#ifndef OPENSSL_SYS_WINDOWS ++ if (getuid() == geteuid()) { ++#endif ++ strncpy(buf, s, sizeof(buf)); ++ buf[sizeof(buf) - 1] = 0; ++#ifndef OPENSSL_SYS_WINDOWS ++ } ++#endif ++ } ++ } ++ return buf; ++ } + + const char *X509_get_default_cert_dir_env(void) + { return(X509_CERT_DIR_EVP); }