@@ -50,7 +50,7 @@ pub fn deinit(cb: *Bundle, gpa: Allocator) void {
50
50
cb .* = undefined ;
51
51
}
52
52
53
- pub const RescanError = RescanLinuxError || RescanMacError || RescanWindowsError ;
53
+ pub const RescanError = RescanLinuxError || RescanMacError || RescanBSDError || RescanWindowsError ;
54
54
55
55
/// Clears the set of certificates and then scans the host operating system
56
56
/// file system standard locations for certificates.
@@ -60,18 +60,20 @@ pub fn rescan(cb: *Bundle, gpa: Allocator) RescanError!void {
60
60
switch (builtin .os .tag ) {
61
61
.linux = > return rescanLinux (cb , gpa ),
62
62
.macos = > return rescanMac (cb , gpa ),
63
- .openbsd = > return rescanOpenBSD (cb , gpa ),
63
+ .freebsd , .openbsd = > return rescanBSD (cb , gpa , "/etc/ssl/cert.pem" ),
64
+ .netbsd = > return rescanBSD (cb , gpa , "/etc/openssl/certs/ca-certificates.crt" ),
65
+ .dragonfly = > return rescanBSD (cb , gpa , "/usr/local/etc/ssl/cert.pem" ),
64
66
.windows = > return rescanWindows (cb , gpa ),
65
67
else = > {},
66
68
}
67
69
}
68
70
69
- pub const rescanMac = @import ("Bundle/macos.zig" ).rescanMac ;
70
- pub const RescanMacError = @import ("Bundle/macos.zig" ).RescanMacError ;
71
+ const rescanMac = @import ("Bundle/macos.zig" ).rescanMac ;
72
+ const RescanMacError = @import ("Bundle/macos.zig" ).RescanMacError ;
71
73
72
- pub const RescanLinuxError = AddCertsFromFilePathError || AddCertsFromDirPathError ;
74
+ const RescanLinuxError = AddCertsFromFilePathError || AddCertsFromDirPathError ;
73
75
74
- pub fn rescanLinux (cb : * Bundle , gpa : Allocator ) RescanLinuxError ! void {
76
+ fn rescanLinux (cb : * Bundle , gpa : Allocator ) RescanLinuxError ! void {
75
77
// Possible certificate files; stop after finding one.
76
78
const cert_file_paths = [_ ][]const u8 {
77
79
"/etc/ssl/certs/ca-certificates.crt" , // Debian/Ubuntu/Gentoo etc.
@@ -113,22 +115,18 @@ pub fn rescanLinux(cb: *Bundle, gpa: Allocator) RescanLinuxError!void {
113
115
cb .bytes .shrinkAndFree (gpa , cb .bytes .items .len );
114
116
}
115
117
116
- pub const RescanOpenBSDError = AddCertsFromFilePathError ;
117
-
118
- pub fn rescanOpenBSD (cb : * Bundle , gpa : Allocator ) RescanOpenBSDError ! void {
119
- const cert_file_path = "/etc/ssl/cert.pem" ;
118
+ const RescanBSDError = AddCertsFromFilePathError ;
120
119
120
+ fn rescanBSD (cb : * Bundle , gpa : Allocator , cert_file_path : []const u8 ) RescanBSDError ! void {
121
121
cb .bytes .clearRetainingCapacity ();
122
122
cb .map .clearRetainingCapacity ();
123
-
124
- addCertsFromFilePathAbsolute (cb , gpa , cert_file_path ) catch | err | return err ;
125
-
123
+ try addCertsFromFilePathAbsolute (cb , gpa , cert_file_path );
126
124
cb .bytes .shrinkAndFree (gpa , cb .bytes .items .len );
127
125
}
128
126
129
- pub const RescanWindowsError = Allocator .Error || ParseCertError || std .os .UnexpectedError || error {FileNotFound };
127
+ const RescanWindowsError = Allocator .Error || ParseCertError || std .os .UnexpectedError || error {FileNotFound };
130
128
131
- pub fn rescanWindows (cb : * Bundle , gpa : Allocator ) RescanWindowsError ! void {
129
+ fn rescanWindows (cb : * Bundle , gpa : Allocator ) RescanWindowsError ! void {
132
130
cb .bytes .clearRetainingCapacity ();
133
131
cb .map .clearRetainingCapacity ();
134
132
0 commit comments