diff --git a/Cargo.toml b/Cargo.toml index 991da45..5da897d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -59,6 +59,11 @@ name = "net_without_namespaces" path = "tests/net_without_namespaces.rs" harness = false +[[test]] +name = "consistent_id_mappings" +path = "tests/consistent_id_mappings.rs" +harness = false + [target.'cfg(target_os = "linux")'.dependencies] seccompiler = "0.2.0" landlock = "0.2.0" diff --git a/tests/consistent_id_mappings.rs b/tests/consistent_id_mappings.rs new file mode 100644 index 0000000..ee45fd6 --- /dev/null +++ b/tests/consistent_id_mappings.rs @@ -0,0 +1,16 @@ +use birdcage::{Birdcage, Sandbox}; + +fn main() { + let uid = unsafe { libc::getuid() }; + let gid = unsafe { libc::getgid() }; + let euid = unsafe { libc::geteuid() }; + let egid = unsafe { libc::getegid() }; + + let birdcage = Birdcage::new().unwrap(); + birdcage.lock().unwrap(); + + assert_eq!(uid, unsafe { libc::getuid() }); + assert_eq!(gid, unsafe { libc::getgid() }); + assert_eq!(euid, unsafe { libc::geteuid() }); + assert_eq!(egid, unsafe { libc::getegid() }); +}