Skip to content

Commit 5ed691c

Browse files
Merge pull request #156 from klemensn/openbsd
Support OpenBSD
2 parents 9127108 + cc2219e commit 5ed691c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ readme = "README.md"
1313

1414
[features]
1515
default = ["platform-all"]
16-
platform-all = ["platform-linux", "platform-freebsd", "platform-macos", "platform-ios", "platform-windows"]
16+
platform-all = ["platform-linux", "platform-freebsd", "platform-openbsd", "platform-macos", "platform-ios", "platform-windows"]
1717
platform-linux = ["linux-secret-service", "linux-keyutils"]
1818
platform-freebsd = ["linux-secret-service"]
19+
platform-openbsd = ["linux-secret-service"]
1920
platform-macos = ["security-framework"]
2021
platform-ios = ["security-framework"]
2122
platform-windows = ["winapi", "byteorder"]
@@ -44,6 +45,9 @@ linux-keyutils = { version = "0.2", features = ["std"], optional = true }
4445
[target.'cfg(target_os = "freebsd")'.dependencies]
4546
secret-service = { version = "3", optional = true }
4647

48+
[target.'cfg(target_os = "openbsd")'.dependencies]
49+
secret-service = { version = "3", optional = true }
50+
4751
[target.'cfg(target_os = "windows")'.dependencies]
4852
byteorder = { version = "1.2", optional = true }
4953
winapi = { version = "0.3", features = ["wincred", "winerror", "errhandlingapi", "minwindef"], optional = true }

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,10 @@ Linux (secret-service and kernel keyutils),
8686
iOS (keychain), macOS (keychain), and
8787
Windows (credential manager).
8888

89-
It also builds on FreeBSD (secret-service),
89+
It also builds on FreeBSD and OpenBSD (secret-service),
9090
and probably works there,
9191
but since neither the maintainers nor GitHub do
92-
building and testing on FreeBSD, we can't be sure.
92+
building and testing on BSDs, we can't be sure.
9393

9494
The default features of this crate are set up
9595
to build all the available platform support.
@@ -117,7 +117,7 @@ PLEASE NOTE: As of version 2.2, turning off the default
117117
feature set will turn off platform support on *all* platforms,
118118
not just on Linux (as was the case before). While this
119119
behavior is a breaking change on Mac, Windows,
120-
and FreeBSD, the behavior on those platforms before was
120+
FreeBSD and OpenBSD, the behavior on those platforms before was
121121
unintended and undefined (suppressing default features did nothing),
122122
so this is considered a bug fix rather than
123123
a semver-breaking change that requires a major version bump.

src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ A top-level introduction to the library's usage, as well as a small code sample,
88
may be found in [the library's entry on crates.io](https://crates.io/crates/keyring).
99
Currently supported platforms are
1010
Linux,
11+
FreeBSD,
12+
OpenBSD,
1113
Windows,
1214
macOS, and iOS.
1315
@@ -147,6 +149,13 @@ use crate::secret_service as default;
147149
#[cfg(all(target_os = "freebsd", not(feature = "secret-service")))]
148150
use mock as default;
149151

152+
#[cfg(all(target_os = "openbsd", feature = "secret-service"))]
153+
pub mod secret_service;
154+
#[cfg(all(target_os = "openbsd", feature = "secret-service"))]
155+
use crate::secret_service as default;
156+
#[cfg(all(target_os = "openbsd", not(feature = "secret-service")))]
157+
use mock as default;
158+
150159
#[cfg(all(target_os = "macos", feature = "platform-macos"))]
151160
pub mod macos;
152161
#[cfg(all(target_os = "macos", feature = "platform-macos"))]
@@ -171,6 +180,7 @@ use mock as default;
171180
#[cfg(not(any(
172181
target_os = "linux",
173182
target_os = "freebsd",
183+
target_os = "openbsd",
174184
target_os = "macos",
175185
target_os = "ios",
176186
target_os = "windows",

0 commit comments

Comments
 (0)