gnutls: backport Homebrew/homebrew#41071 for expired certs

This commit is contained in:
Dominyk Tiller 2015-07-01 23:26:56 +01:00
parent 57871da8cd
commit bf52e39df9

View file

@ -48,8 +48,8 @@ class Gnutls < Formula
system "make", "install"
# certtool shadows the OS X certtool utility
mv bin+"certtool", bin+"gnutls-certtool"
mv man1+"certtool.1", man1+"gnutls-certtool.1"
mv bin/"certtool", bin/"gnutls-certtool"
mv man1/"certtool.1", man1/"gnutls-certtool.1"
end
def post_install
@ -58,9 +58,23 @@ class Gnutls < Formula
/System/Library/Keychains/SystemRootCertificates.keychain
]
certs_list = `security find-certificate -a -p #{keychains.join(" ")}`
certs = certs_list.scan(
/-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----/m
)
valid_certs = certs.select do |cert|
IO.popen("openssl x509 -inform pem -checkend 0 -noout", "w") do |openssl_io|
openssl_io.write(cert)
openssl_io.close_write
end
$?.success?
end
openssldir = etc/"openssl"
openssldir.mkpath
(openssldir/"cert.pem").atomic_write `security find-certificate -a -p #{keychains.join(" ")}`
(openssldir/"cert.pem").atomic_write(valid_certs.join("\n"))
end
test do