git: cc3c8d7ead2e - main - lang/rust: Add files/patch-vendor_openssl-probe_src_lib.rs

From: Mikael Urankar <mikael_at_FreeBSD.org>
Date: Tue, 11 Nov 2025 12:03:39 UTC
The branch main has been updated by mikael:

URL: https://cgit.FreeBSD.org/ports/commit/?id=cc3c8d7ead2ee2a5eb0bbf0f113523c1508356e5

commit cc3c8d7ead2ee2a5eb0bbf0f113523c1508356e5
Author:     Mikael Urankar <mikael@FreeBSD.org>
AuthorDate: 2025-11-11 12:01:21 +0000
Commit:     Mikael Urankar <mikael@FreeBSD.org>
CommitDate: 2025-11-11 12:03:36 +0000

    lang/rust: Add files/patch-vendor_openssl-probe_src_lib.rs
    
    Reported by:    Gunther Nikl
    Fixes:          a01365ba22179d5ceabec53c65586012b75b4dab
---
 .../files/patch-vendor_openssl-probe_src_lib.rs    | 50 ++++++++++++++++++++++
 1 file changed, 50 insertions(+)

diff --git a/lang/rust/files/patch-vendor_openssl-probe_src_lib.rs b/lang/rust/files/patch-vendor_openssl-probe_src_lib.rs
new file mode 100644
index 000000000000..064018790d0f
--- /dev/null
+++ b/lang/rust/files/patch-vendor_openssl-probe_src_lib.rs
@@ -0,0 +1,50 @@
+--- vendor/openssl-probe-0.1.6/src/lib.rs
++++ vendor/openssl-probe-0.1.6/src/lib.rs
+@@ -26,6 +26,7 @@ pub fn find_certs_dirs() -> Vec<PathBuf> {
+ /// found.
+ ///
+ /// This will only search known system locations.
++#[cfg(not(target_os = "freebsd"))]
+ pub fn candidate_cert_dirs() -> impl Iterator<Item = &'static Path> {
+     // see http://gagravarr.org/writing/openssl-certs/others.shtml
+     [
+@@ -52,6 +53,19 @@ pub fn candidate_cert_dirs() -> impl Iterator<Item = &'static Path> {
+     .map(Path::new)
+     .filter(|p| p.exists())
+ }
++#[cfg(target_os = "freebsd")]
++pub fn candidate_cert_dirs() -> impl Iterator<Item = &'static Path> {
++    // see manpage of certctl(8): https://man.freebsd.org/cgi/man.cgi?query=certctl&sektion=8
++    // see security/openssl* ports
++    [
++        "/etc/ssl",
++        "/usr/local/etc/ssl",
++        "/usr/local/openssl",
++    ]
++    .iter()
++    .map(Path::new)
++    .filter(|p| p.exists())
++}
+ 
+ /// Deprecated as this isn't sound, use [`init_openssl_env_vars`] instead.
+ #[doc(hidden)]
+@@ -169,6 +183,7 @@ pub fn probe() -> ProbeResult {
+     for certs_dir in candidate_cert_dirs() {
+         // cert.pem looks to be an openssl 1.0.1 thing, while
+         // certs/ca-certificates.crt appears to be a 0.9.8 thing
++        #[cfg(not(target_os = "freebsd"))]
+         let cert_filenames = [
+             "cert.pem",
+             "certs.pem",
+@@ -181,6 +196,11 @@ pub fn probe() -> ProbeResult {
+             "CARootCertificates.pem",
+             "tls-ca-bundle.pem",
+         ];
++        #[cfg(target_os = "freebsd")]
++        let cert_filenames = [
++            "cert.pem",
++            "ca-root-nss.crt",
++        ];
+         if result.cert_file.is_none() {
+             result.cert_file = cert_filenames
+                 .iter()