upstream: github.com/mirage/ca-certs
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(lint): resolve lint issues in ca-certs

+32 -36
+32 -36
lib/ca_certs.ml
··· 83 83 Log.warn (fun m -> m "Ignored %u trust anchors." err_count); 84 84 Ok (X509.Certificate.encode_pem_multiple cert_list) 85 85 86 + let macos_trust_anchors () = 87 + macos_keychain_locations 88 + |> List.map (fun path -> 89 + let cmd = 90 + Bos.Cmd.(v "security" % "find-certificate" % "-a" % "-p" % path) 91 + in 92 + Bos.OS.Cmd.(run_out cmd |> out_string |> success)) 93 + |> List.fold_left 94 + (fun acc cert -> 95 + match (cert, acc) with 96 + | Ok cert, Ok acc -> Ok (cert ^ "\n" ^ acc) 97 + | Ok cert, Error (`Msg msg) -> 98 + Log.warn (fun m -> 99 + m "ignoring error %s (got another set of certificates)" msg); 100 + Ok cert 101 + | Error e, Ok "" -> Error e 102 + | Error (`Msg msg), Ok x -> 103 + Log.warn (fun m -> 104 + m 105 + "ignoring error %s (already have another set of \ 106 + certificates)" 107 + msg); 108 + Ok x 109 + | Error e, Error (`Msg msg) -> 110 + Log.warn (fun m -> m "ignoring error %s (got another error)" msg); 111 + Error e) 112 + (Ok "") 113 + |> Result.map_error (function `Msg msg -> 114 + `Msg 115 + ("ca-certs: no trust anchor file found on macOS: " ^ msg ^ ".\n" ^ issue)) 116 + 86 117 let system_trust_anchors () = 87 118 if Sys.win32 then windows_trust_anchors () 88 119 else ··· 103 134 | "FreeBSD" -> detect_one freebsd_location 104 135 | "OpenBSD" -> detect_one openbsd_location 105 136 | "Linux" -> detect_list linux_locations 106 - | "Darwin" -> 107 - macos_keychain_locations 108 - |> List.map (fun path -> 109 - let cmd = 110 - Bos.Cmd.( 111 - v "security" % "find-certificate" % "-a" % "-p" % path) 112 - in 113 - Bos.OS.Cmd.(run_out cmd |> out_string |> success)) 114 - |> List.fold_left 115 - (fun acc cert -> 116 - match (cert, acc) with 117 - | Ok cert, Ok acc -> Ok (cert ^ "\n" ^ acc) 118 - | Ok cert, Error (`Msg msg) -> 119 - Log.warn (fun m -> 120 - m 121 - "ignoring error %s (got another set of \ 122 - certificates)" 123 - msg); 124 - Ok cert 125 - | Error e, Ok "" -> Error e 126 - | Error (`Msg msg), Ok x -> 127 - Log.warn (fun m -> 128 - m 129 - "ignoring error %s (already have another set of \ 130 - certificates)" 131 - msg); 132 - Ok x 133 - | Error e, Error (`Msg msg) -> 134 - Log.warn (fun m -> 135 - m "ignoring error %s (got another error)" msg); 136 - Error e) 137 - (Ok "") 138 - |> Result.map_error (function `Msg msg -> 139 - `Msg 140 - ("ca-certs: no trust anchor file found on macOS: " ^ msg 141 - ^ ".\n" ^ issue)) 137 + | "Darwin" -> macos_trust_anchors () 142 138 | s -> Error (`Msg ("ca-certs: unknown system " ^ s ^ ".\n" ^ issue))) 143 139 144 140 let extra_trust_anchors () =