diff options
-rw-r--r-- | Cargo.lock | 10 | ||||
-rw-r--r-- | wpa-psk-cli/CHANGELOG.md | 4 | ||||
-rw-r--r-- | wpa-psk-cli/Cargo.toml | 3 | ||||
-rw-r--r-- | wpa-psk-cli/src/bin/wpa-psk.rs | 3 |
4 files changed, 20 insertions, 0 deletions
@@ -265,6 +265,15 @@ dependencies = [ ] [[package]] +name = "pledge" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "252599417b7d9a43b7fdc63dd790b0848666a8910b2ebe1a25118309c3c981e5" +dependencies = [ + "libc", +] + +[[package]] name = "predicates" version = "2.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -556,5 +565,6 @@ version = "0.1.2" dependencies = [ "assert_cmd", "clap", + "pledge", "wpa-psk", ] diff --git a/wpa-psk-cli/CHANGELOG.md b/wpa-psk-cli/CHANGELOG.md index 081ed45..be28c03 100644 --- a/wpa-psk-cli/CHANGELOG.md +++ b/wpa-psk-cli/CHANGELOG.md @@ -10,6 +10,10 @@ The format is based on [Keep A Changelog][] and this project adheres to ## Unreleased +### Changed + +- Call pledge(2) on OpenBSD. + ## [0.1.2] - 2022-02-16 ### Changed diff --git a/wpa-psk-cli/Cargo.toml b/wpa-psk-cli/Cargo.toml index 07ebdd1..52a0a1e 100644 --- a/wpa-psk-cli/Cargo.toml +++ b/wpa-psk-cli/Cargo.toml @@ -15,5 +15,8 @@ publish = true clap = { version = "4.1.8", features = ["derive", "wrap_help"] } wpa-psk = { path = "../wpa-psk", version = "0.2.1" } +[target.'cfg(target_os = "openbsd")'.dependencies] +pledge = "0.4.2" + [dev-dependencies] assert_cmd = "2.0.8" diff --git a/wpa-psk-cli/src/bin/wpa-psk.rs b/wpa-psk-cli/src/bin/wpa-psk.rs index ddcec0d..3a4ca6b 100644 --- a/wpa-psk-cli/src/bin/wpa-psk.rs +++ b/wpa-psk-cli/src/bin/wpa-psk.rs @@ -34,6 +34,9 @@ fn main() { } fn run() -> Result<(), Box<dyn std::error::Error>> { + #[cfg(target_os = "openbsd")] + pledge::pledge![Stdio, Stdio]?; + let args = Args::try_parse()?; let psk = if args.force { wpa_psk_unchecked(args.ssid.as_bytes(), args.passphrase.as_bytes()) |