Skip to content

Commit 1e93e73

Browse files
committed
Merge remote-tracking branch 'upstream/split' into feat-ohos
2 parents 14f33f0 + 6be675d commit 1e93e73

File tree

1 file changed

+45
-29
lines changed

1 file changed

+45
-29
lines changed

src/lib.rs

Lines changed: 45 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -167,42 +167,58 @@ const CERTIFICATE_DIRS: &[&str] = &["/var/ssl/certs"];
167167
)))]
168168
const CERTIFICATE_DIRS: &[&str] = &["/etc/ssl/certs"];
169169

170-
// cert.pem looks to be an openssl 1.0.1 thing, while
171-
// certs/ca-certificates.crt appears to be a 0.9.8 thing
170+
#[cfg(target_os = "linux")]
172171
const CERTIFICATE_FILE_NAMES: &[&str] = &[
173172
"/etc/ssl/certs/ca-certificates.crt", // Debian, Ubuntu, Gentoo, Joyent SmartOS, etc.
174-
#[cfg(target_os = "linux")]
175173
"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem", // CentOS, RHEL 7 (should come before RHEL 6)
176-
#[cfg(target_os = "linux")]
177-
"/etc/pki/tls/certs/ca-bundle.crt", // Fedora, RHEL 6
178-
#[cfg(target_os = "linux")]
179-
"/etc/ssl/ca-bundle.pem", // OpenSUSE
180-
#[cfg(target_os = "linux")]
181-
"/etc/pki/tls/cacert.pem", // OpenELEC (a media center Linux distro)
182-
#[cfg(any(target_os = "linux", target_os = "openbsd"))]
183-
"/etc/ssl/cert.pem", // Alpine Linux, OpenBSD
184-
#[cfg(target_os = "freebsd")]
185-
"/usr/local/etc/ssl/cert.pem", // FreeBSD
186-
#[cfg(target_os = "dragonfly")]
187-
"/usr/local/share/certs/ca-root-nss.crt", // DragonFly
188-
#[cfg(target_os = "netbsd")]
189-
"/etc/openssl/certs/ca-certificates.crt", // NetBSD
190-
#[cfg(target_os = "solaris")]
191-
"/etc/certs/ca-certificates.crt", // Solaris 11.2+
192-
#[cfg(target_os = "illumos")]
193-
"/etc/ssl/cacert.pem", // OmniOS, https://github.com/rustls/openssl-probe/pull/22
194-
#[cfg(target_os = "illumos")]
195-
"/etc/certs/ca-certificates.crt", // OpenIndiana, https://github.com/rustls/openssl-probe/pull/22
196-
#[cfg(target_os = "android")]
197-
"/data/data/com.termux/files/usr/etc/tls/cert.pem", // Termux on Android, https://github.com/rustls/openssl-probe/pull/2
198-
#[cfg(target_os = "haiku")]
199-
"/boot/system/data/ssl/CARootCertificates.pem", // Haiku, https://github.com/rustls/openssl-probe/pull/4
200-
#[cfg(target_os = "linux")]
174+
"/etc/pki/tls/certs/ca-bundle.crt", // Fedora, RHEL 6
175+
"/etc/ssl/ca-bundle.pem", // OpenSUSE
176+
"/etc/pki/tls/cacert.pem", // OpenELEC (a media center Linux distro)
177+
"/etc/ssl/cert.pem", // Alpine Linux
201178
"/opt/etc/ssl/certs/ca-certificates.crt", // Entware, https://github.com/rustls/openssl-probe/pull/21
202-
#[cfg(target_os = "linux")]
203179
"/etc/ssl/certs/cacert.pem", // OpenHarmony, https://developer.huawei.com/consumer/cn/doc/harmonyos-faqs/faqs-network-41
204180
];
205181

182+
#[cfg(target_os = "freebsd")]
183+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/usr/local/etc/ssl/cert.pem"];
184+
185+
#[cfg(target_os = "dragonfly")]
186+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/usr/local/share/certs/ca-root-nss.crt"];
187+
188+
#[cfg(target_os = "netbsd")]
189+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/etc/openssl/certs/ca-certificates.crt"];
190+
191+
#[cfg(target_os = "openbsd")]
192+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/etc/ssl/cert.pem"];
193+
194+
#[cfg(target_os = "solaris")] // Solaris 11.2+
195+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/etc/certs/ca-certificates.crt"];
196+
197+
#[cfg(target_os = "illumos")]
198+
const CERTIFICATE_FILE_NAMES: &[&str] = &[
199+
"/etc/ssl/cacert.pem", // OmniOS, https://github.com/rustls/openssl-probe/pull/22
200+
"/etc/certs/ca-certificates.crt", // OpenIndiana, https://github.com/rustls/openssl-probe/pull/22
201+
];
202+
203+
#[cfg(target_os = "android")] // Termux on Android, https://github.com/rustls/openssl-probe/pull/2
204+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/data/data/com.termux/files/usr/etc/tls/cert.pem"];
205+
206+
#[cfg(target_os = "haiku")] // https://github.com/rustls/openssl-probe/pull/4
207+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/boot/system/data/ssl/CARootCertificates.pem"];
208+
209+
#[cfg(not(any(
210+
target_os = "linux",
211+
target_os = "freebsd",
212+
target_os = "dragonfly",
213+
target_os = "netbsd",
214+
target_os = "openbsd",
215+
target_os = "solaris",
216+
target_os = "illumos",
217+
target_os = "android",
218+
target_os = "haiku",
219+
)))]
220+
const CERTIFICATE_FILE_NAMES: &[&str] = &["/etc/ssl/certs/ca-certificates.crt"];
221+
206222
/// The OpenSSL environment variable to configure what certificate file to use.
207223
pub const ENV_CERT_FILE: &'static str = "SSL_CERT_FILE";
208224

0 commit comments

Comments
 (0)