]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs-use-system-certs.patch
ea34b0be933ac16ac8d15cc72569b9cc39b85a7c
[packages/nodejs.git] / nodejs-use-system-certs.patch
1 Description: do not bundle CA certificates, openssl on Debian have them
2  As a consequence, nodejs must depend on ca-certificates.
3 Forwarded: https://github.com/nodejs/node/issues/3159
4 Author: Jérémy Lal <kapouer@melix.org>
5 Modified 2014-08-11 by Elan Ruusamäe <glen@delfi.ee> with the correct path for PLD
6 Modified 2015-10-17 by Elan Ruusamäe <glen@delfi.ee> updated for node 4.2.1-LTS
7 --- nodejs-4.5.0/src/node_crypto.cc.orig        2016-08-16 17:09:50.000000000 +0200
8 +++ nodejs-4.5.0/src/node_crypto.cc     2016-09-09 23:40:11.959456422 +0200
9 @@ -117,7 +117,6 @@
10  static uv_mutex_t* locks;
11  
12  const char* const root_certs[] = {
13 -#include "node_root_certs.h"  // NOLINT(build/include_order)
14  };
15  
16  X509_STORE* root_cert_store;
17 @@ -754,29 +753,18 @@
18    CHECK_EQ(sc->ca_store_, nullptr);
19  
20    if (!root_cert_store) {
21 -    root_cert_store = X509_STORE_new();
22 -
23 -    for (size_t i = 0; i < arraysize(root_certs); i++) {
24 -      BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));
25 -      if (bp == nullptr) {
26 -        return;
27 -      }
28 -
29 -      X509 *x509 = PEM_read_bio_X509(bp, nullptr, CryptoPemCallback, nullptr);
30 -      if (x509 == nullptr) {
31 -        BIO_free_all(bp);
32 -        return;
33 -      }
34 -
35 -      X509_STORE_add_cert(root_cert_store, x509);
36 -
37 -      BIO_free_all(bp);
38 -      X509_free(x509);
39 +    if (SSL_CTX_load_verify_locations(sc->ctx_, "/etc/certs/ca-certificates.crt", NULL) == 1) {
40 +      root_cert_store = SSL_CTX_get_cert_store(sc->ctx_);
41 +    } else {
42 +      // new empty store
43 +      root_cert_store = X509_STORE_new();
44      }
45 +  } else {
46 +    SSL_CTX_set_cert_store(sc->ctx_, root_cert_store);
47    }
48  
49 +
50    sc->ca_store_ = root_cert_store;
51 -  SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
52  }
53  
54  
This page took 0.046792 seconds and 2 git commands to generate.