Skip to content

Commit fb03241

Browse files
committed
fix: Don't load Mozilla::CA if ssl-keystore is set to system-ssl-ca on MacOSX
1 parent 937df0e commit fb03241

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/GLPI/Agent/HTTP/Client.pm

+7-3
Original file line numberDiff line numberDiff line change
@@ -589,6 +589,7 @@ sub _KeyChain_or_KeyStore_Export {
589589
);
590590

591591
my @certs = ();
592+
my $loadMozillaCA = 1;
592593

593594
File::Temp->require();
594595
if ($EVAL_ERROR) {
@@ -606,8 +607,11 @@ sub _KeyChain_or_KeyStore_Export {
606607
my $command = "security find-certificate -a -p";
607608

608609
# Support --ssl-keystore=system-ssl-ca option on MacOSX
609-
$command .= " /System/Library/Keychains/SystemRootCertificates.keychain"
610-
if $self->{ssl_keystore} && $self->{ssl_keystore} =~ /^system-ssl-ca$/i;
610+
if ($self->{ssl_keystore} && $self->{ssl_keystore} =~ /^system-ssl-ca$/i) {
611+
$command .= " /System/Library/Keychains/SystemRootCertificates.keychain";
612+
# In that case, we don't need to load Mozilla::CA
613+
$loadMozillaCA = 0;
614+
}
611615

612616
getAllLines(
613617
command => "$command > '$file'",
@@ -698,7 +702,7 @@ sub _KeyChain_or_KeyStore_Export {
698702
}
699703

700704
# Always include default CA file from Mozilla::CA
701-
if (Mozilla::CA->require()) {
705+
if ($loadMozillaCA && $Mozilla::CA->require()) {
702706
my $cacert = Mozilla::CA::SSL_ca_file();
703707
push @certs, IO::Socket::SSL::Utils::PEM_file2certs($cacert)
704708
if -e $cacert;

0 commit comments

Comments
 (0)