commit a949dda7efd1f6c8b7d04ed4d8380248c5b20c00
parent 8defb7539802dd914644908d2444cfbaab88764a
Author: Zack Newman <zack@philomathiclife.com>
Date: Wed, 21 Aug 2024 22:04:16 -0600
update priv_sep
Diffstat:
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/priv_sep.rs b/src/priv_sep.rs
@@ -3,7 +3,7 @@ use core::convert::Infallible;
#[cfg(all(feature = "priv_sep", target_os = "openbsd"))]
pub use priv_sep::UnveilErr;
#[cfg(all(feature = "priv_sep", target_os = "openbsd"))]
-use priv_sep::{Permissions, Promise, Promises};
+use priv_sep::{Permission, Permissions, Promise, Promises};
#[cfg(all(feature = "priv_sep", target_os = "openbsd"))]
use std::io::Error;
use std::path::Path;
@@ -18,7 +18,7 @@ pub struct Zst;
/// are passed.
#[cfg(all(feature = "priv_sep", target_os = "openbsd"))]
#[inline]
-pub fn pledge_init() -> Result<Promises<7>, Error> {
+pub fn pledge_init() -> Result<Promises, Error> {
let promises = Promises::new([
Promise::Cpath,
Promise::Flock,
@@ -43,9 +43,8 @@ pub const fn pledge_init() -> Result<Zst, Infallible> {
/// Removes `Promise::Unveil`.
#[cfg(all(feature = "priv_sep", target_os = "openbsd"))]
#[inline]
-pub fn pledge_away_unveil(promises: &mut Promises<7>) -> Result<(), Error> {
- promises.remove(Promise::Unveil);
- promises.pledge()
+pub fn pledge_away_unveil(promises: &mut Promises) -> Result<(), Error> {
+ promises.remove_then_pledge(Promise::Unveil)
}
/// No-op that always returns `Ok`.
#[allow(clippy::unnecessary_wraps)]
@@ -72,7 +71,7 @@ pub fn unveil_read<P: AsRef<Path>>(_: P) -> Result<(), Infallible> {
#[inline]
pub fn unveil_create_read_write<P: AsRef<Path>>(path: P) -> Result<(), UnveilErr> {
let mut perms = Permissions::ALL;
- perms.execute = false;
+ perms.disable(Permission::Execute);
perms.unveil(path)
}
/// No-op that always returns `Ok`.