| 613 | } |
| 614 | |
| 615 | fn newroot() -> Result<cap_std_ext::cap_tempfile::TempDir> { |
| 616 | let root = cap_std_ext::cap_tempfile::tempdir(cap_std::ambient_authority())?; |
| 617 | root.create_dir("etc")?; |
| 618 | root.write("etc/passwd", b"")?; |
| 619 | root.write("etc/group", b"")?; |
| 620 | root.create_dir_all(SYSUSERSD)?; |
| 621 | root.atomic_replace_with( |
| 622 | Utf8Path::new(SYSUSERSD).join("setup.conf"), |
| 623 | |w| -> std::io::Result<()> { |
| 624 | w.write_all(SYSUSERS_REF.as_bytes())?; |
| 625 | w.write_all(SYSGROUPS_REF.as_bytes())?; |
| 626 | Ok(()) |
| 627 | }, |
| 628 | )?; |
| 629 | Ok(root) |
| 630 | } |
| 631 | |
| 632 | #[test] |
| 633 | fn test_missing() -> Result<()> { |