@@ -71,15 +71,16 @@ pub fn probe() -> ProbeResult {
7171
7272 for certs_dir in candidate_cert_dirs ( ) {
7373 if result. cert_dir . is_none ( ) {
74- let cert_dir = certs_dir . join ( "certs" ) ;
74+ let cert_dir = PathBuf :: from ( certs_dir ) ;
7575 if cert_dir. exists ( ) {
7676 result. cert_dir = Some ( cert_dir) ;
7777 }
7878 }
79- if result. cert_file . is_some ( ) && result . cert_dir . is_some ( ) {
79+ if result. cert_dir . is_some ( ) {
8080 break ;
8181 }
8282 }
83+
8384 result
8485}
8586
@@ -121,27 +122,41 @@ impl ProbeResult {
121122}
122123
123124// see http://gagravarr.org/writing/openssl-certs/others.shtml
125+ // Go's related definitions can be found here:
126+ // https://github.com/golang/go/tree/master/src/crypto/x509
127+ // Look at `root_*.go` files for platform-specific files and directories.
128+
129+ #[ cfg( target_os = "linux" ) ]
130+ const CERTIFICATE_DIRS : & [ & str ] = & [
131+ "/etc/ssl/certs" , // SLES 10, SLES 11
132+ "/etc/pki/tls/certs" , // Fedora, RHEL
133+ ] ;
134+
135+ #[ cfg( target_os = "freebsd" ) ]
124136const CERTIFICATE_DIRS : & [ & str ] = & [
125- "/var/ssl" ,
126- "/usr/share/ssl" ,
127- "/usr/local/ssl" ,
128- "/usr/local/openssl" ,
129- "/usr/local/etc/openssl" , // MacPorts, https://github.com/rustls/openssl-probe/pull/15
130- "/usr/local/share" ,
131- "/usr/lib/ssl" ,
132- "/usr/ssl" ,
133- "/etc/openssl" ,
134- "/etc/pki/ca-trust/extracted/pem" ,
135- "/etc/pki/tls" ,
136- "/etc/ssl" ,
137- "/etc/certs" ,
138- "/opt/etc/ssl" , // Entware
139- #[ cfg( target_os = "android" ) ]
140- "/data/data/com.termux/files/usr/etc/tls" ,
141- #[ cfg( target_os = "haiku" ) ]
142- "/boot/system/data/ssl" ,
137+ "/etc/ssl/certs" , // FreeBSD 12.2+,
138+ "/usr/local/share/certs" , // FreeBSD
143139] ;
144140
141+ #[ cfg( any( target_os = "illumos" , target_os = "solaris" ) ) ]
142+ const CERTIFICATE_DIRS : & [ & str ] = & [ "/etc/certs/CA" ] ;
143+
144+ #[ cfg( target_os = "netbsd" ) ]
145+ const CERTIFICATE_DIRS : & [ & str ] = & [ "/etc/openssl/certs" ] ;
146+
147+ #[ cfg( target_os = "aix" ) ]
148+ const CERTIFICATE_DIRS : & [ & str ] = & [ "/var/ssl/certs" ] ;
149+
150+ #[ cfg( not( any(
151+ target_os = "linux" ,
152+ target_os = "freebsd" ,
153+ target_os = "illumos" ,
154+ target_os = "solaris" ,
155+ target_os = "netbsd" ,
156+ target_os = "aix"
157+ ) ) ) ]
158+ const CERTIFICATE_DIRS : & [ & str ] = & [ "/etc/ssl/certs" ] ;
159+
145160#[ cfg( target_os = "linux" ) ]
146161const CERTIFICATE_FILE_NAMES : & [ & str ] = & [
147162 "/etc/ssl/certs/ca-certificates.crt" , // Debian, Ubuntu, Gentoo, Joyent SmartOS, etc.
0 commit comments