aboutsummaryrefslogtreecommitdiffstats
path: root/community/nodejs-current/use-system-ca-certs.patch
diff options
context:
space:
mode:
authorJakub Jirutka <jakub@jirutka.cz>2016-11-27 13:23:57 +0100
committerJakub Jirutka <jakub@jirutka.cz>2016-11-27 14:10:03 +0100
commit308944d90df71c773c958a1c5ff4ebdb240526a3 (patch)
tree88f1668824f4f80c5d21c31e954d9f847144c1d9 /community/nodejs-current/use-system-ca-certs.patch
parent7d73d222fd7122c6881d333ea7d07fc500596495 (diff)
downloadaports-308944d90df71c773c958a1c5ff4ebdb240526a3.tar.bz2
aports-308944d90df71c773c958a1c5ff4ebdb240526a3.tar.xz
main/nodejs: rename to nodejs-current and move to community
Odd-numbered versions, like this one (v7), are supported by upstream only for 9 months. When a new odd-numbered major release is cut, the previous even-numbered major version transitions to the Long Term Support plan (LTS). Packages in Alpine stable must be supported for 2 years, so we should keep only LTS version in the stable. Therefore this package is renamed to nodejs-current and moved to the community repository. The nodejs-lts package is going to be renamed to nodejs. See https://github.com/nodejs/LTS#lts-schedule
Diffstat (limited to 'community/nodejs-current/use-system-ca-certs.patch')
-rw-r--r--community/nodejs-current/use-system-ca-certs.patch63
1 files changed, 63 insertions, 0 deletions
diff --git a/community/nodejs-current/use-system-ca-certs.patch b/community/nodejs-current/use-system-ca-certs.patch
new file mode 100644
index 0000000000..6e46c74b40
--- /dev/null
+++ b/community/nodejs-current/use-system-ca-certs.patch
@@ -0,0 +1,63 @@
+From: Jakub Jirutka <jakub@jirutka.cz>
+Date: Sat, 26 Nov 2016 21:18:00 +0200
+Subject: Use system-provided CA certificates instead of bundled ones
+
+--- a/src/node_crypto.cc
++++ b/src/node_crypto.cc
+@@ -116,8 +116,8 @@
+
+ static Mutex* mutexes;
+
+-const char* const root_certs[] = {
+-#include "node_root_certs.h" // NOLINT(build/include_order)
++const char* root_certs[] = {
++ NULL
+ };
+
+ X509_STORE* root_cert_store;
+@@ -688,25 +688,33 @@
+
+
+ static X509_STORE* NewRootCertStore() {
++ X509_STORE* store = X509_STORE_new();
++
+ if (!root_certs_vector) {
+ root_certs_vector = new std::vector<X509*>;
+
+- for (size_t i = 0; i < arraysize(root_certs); i++) {
+- BIO* bp = NodeBIO::NewFixed(root_certs[i], strlen(root_certs[i]));
+- X509 *x509 = PEM_read_bio_X509(bp, nullptr, CryptoPemCallback, nullptr);
+- BIO_free(bp);
+-
+- if (x509 == nullptr) {
+- // Parse errors from the built-in roots are fatal.
+- ABORT();
+- return nullptr;
+- }
++ BIO* bio = BIO_new(BIO_s_file());
++ if (bio == nullptr) {
++ abort();
++ return nullptr;
++ }
++
++ if (BIO_read_filename(bio, "/etc/ssl/certs/ca-certificates.crt") == 1) {
++ STACK_OF(X509_INFO)* certs = PEM_X509_INFO_read_bio(bio, nullptr, nullptr, nullptr);
+
+- root_certs_vector->push_back(x509);
++ for (int i = 0; i < sk_X509_INFO_num(certs); i++) {
++ X509* cert = sk_X509_INFO_value(certs, i)->x509;
++
++ if (cert) {
++ X509_up_ref(cert);
++ root_certs_vector->push_back(cert);
++ }
++ }
++ sk_X509_INFO_pop_free(certs, X509_INFO_free);
+ }
++ BIO_free_all(bio);
+ }
+
+- X509_STORE* store = X509_STORE_new();
+ for (auto& cert : *root_certs_vector) {
+ X509_up_ref(cert);
+ X509_STORE_add_cert(store, cert);