Blob Blame History Raw
From e6aa17c2d3aa33d164d215b7b4491b31deda73f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 16 Sep 2011 10:33:54 +0200
Subject: [PATCH] Redirect to ca-certificates bundle

This patch replaces Mozilla-CA certificate bundle with bundle
delivered by ca-certificates RPM package used as single source of
Mozilla certificate bundle.

See <https://bugzilla.redhat.com/show_bug.cgi?id=738383> for more
details.
---
 MANIFEST          |    1 -
 Makefile.PL       |    8 ++++++++
 lib/Mozilla/CA.pm |    8 +-------
 t/locate-file.t   |    2 +-
 4 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/MANIFEST b/MANIFEST
index a6f0a9c..096dd68 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,5 +1,4 @@
 lib/Mozilla/CA.pm
-lib/Mozilla/CA/cacert.pem
 Makefile.PL
 MANIFEST			This list of files
 README
diff --git a/Makefile.PL b/Makefile.PL
index 2b10474..57f2f07 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -40,3 +40,11 @@ BEGIN {
         ExtUtils::MakeMaker::WriteMakefile(%arg);
     };
 }
+
+package MY;
+sub MY::libscan {
+    my $name = shift->SUPER::libscan(@_);
+    # Remove private certificate bundle
+    if ($name =~ /cacert.pem\z/) { $name = '' };
+    return $name;
+}
diff --git a/lib/Mozilla/CA.pm b/lib/Mozilla/CA.pm
index 71e4b8b..71ada3a 100644
--- a/lib/Mozilla/CA.pm
+++ b/lib/Mozilla/CA.pm
@@ -5,14 +5,8 @@ package Mozilla::CA;
 
-use Cwd ();
 use File::Spec ();
-use File::Basename qw(dirname);
 
 sub SSL_ca_file {
-    my $file = File::Spec->catfile(dirname(__FILE__), "CA", "cacert.pem");
-    if (!File::Spec->file_name_is_absolute($file)) {
-	$file = File::Spec->catfile(Cwd::cwd(), $file);
-    }
-    return $file;
+    return File::Spec->catfile('/etc/pki/tls/certs/ca-bundle.crt');
 }
 
 1;
diff --git a/t/locate-file.t b/t/locate-file.t
index a9acb34..b936059 100644
--- a/t/locate-file.t
+++ b/t/locate-file.t
@@ -11,7 +11,7 @@ print "# $ca_file\n";
 ok($ca_file);
 ok(open(my $fh, "<", $ca_file));
 while (<$fh>) {
-    if (/\*\* BEGIN LICENSE BLOCK \*\*/) {
+    if (/-----BEGIN CERTIFICATE-----/) {
 	ok(1);
 	last;
     }
-- 
1.7.6.2