]> git.pld-linux.org Git - packages/nodejs.git/blob - nodejs-use-system-certs.patch
builds with uv 1.6.0
[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: need some feedback before submitting the matter upstream
4 Author: Jérémy Lal <kapouer@melix.org>
5 Last-Update: 2014-03-02
6
7 Modified 2014-05-02 by T.C. Hollingsworth <tchollingsworth@gmail.com> with the correct path for Fedora
8 Modified 2014-08-11 by Elan Ruusamäe <glen@delfi.ee> with the correct path for PLD
9 Modified 2015-10-17 by Elan Ruusamäe <glen@delfi.ee> updated for node 4.2.1-LTS
10 --- node-v4.2.1/src/node_crypto.cc      2015-10-17 15:14:47.248709690 +0300
11 +++ node-v4.2.1/src/node_crypto.cc      2015-10-17 15:21:21.109176336 +0300
12 @@ -127,7 +127,6 @@
13  static uv_mutex_t* locks;
14  
15  const char* const root_certs[] = {
16 -#include "node_root_certs.h"  // NOLINT(build/include_order)
17  };
18  
19  X509_STORE* root_cert_store;
20 @@ -706,32 +705,17 @@
21    CHECK_EQ(sc->ca_store_, nullptr);
22  
23    if (!root_cert_store) {
24 -    root_cert_store = X509_STORE_new();
25 -
26 -    for (size_t i = 0; i < ARRAY_SIZE(root_certs); i++) {
27 -      BIO* bp = NodeBIO::New();
28 -
29 -      if (!BIO_write(bp, root_certs[i], strlen(root_certs[i]))) {
30 -        BIO_free_all(bp);
31 -        return;
32 -      }
33 -
34 -      X509 *x509 = PEM_read_bio_X509(bp, nullptr, CryptoPemCallback, nullptr);
35 -
36 -      if (x509 == nullptr) {
37 -        BIO_free_all(bp);
38 -        return;
39 -      }
40 -
41 -      X509_STORE_add_cert(root_cert_store, x509);
42 -
43 -      BIO_free_all(bp);
44 -      X509_free(x509);
45 +    if (SSL_CTX_load_verify_locations(sc->ctx_, "/etc/certs/ca-certificates.crt", NULL) == 1) {
46 +      root_cert_store = SSL_CTX_get_cert_store(sc->ctx_);
47 +    } else {
48 +      // empty store
49 +      root_cert_store = X509_STORE_new();
50      }
51 +  } else {
52 +    SSL_CTX_set_cert_store(sc->ctx_, root_cert_store);
53    }
54  
55    sc->ca_store_ = root_cert_store;
56 -  SSL_CTX_set_cert_store(sc->ctx_, sc->ca_store_);
57  }
This page took 0.802883 seconds and 3 git commands to generate.