mirror of
https://github.com/uutils/shadow.git
synced 2026-06-10 16:14:57 -07:00
32c94fbc76
Fully remove nix as a direct dependency of the shadow-rs workspace. New module shadow_core::process provides process-wide POSIX wrappers via libc for setuid/setgid/initgroups/execv/sigprocmask. These MUST use libc (not rustix) because rustix intentionally provides only per-thread versions, which are incorrect for setuid-root tools. Migrations: - hardening.rs: setrlimit → rustix::process, sigprocmask → process module, User::from_uid → /etc/passwd parser lookup - pam.rs: nix::sys::termios → rustix::termios - passwd.rs: full migration (seteuid, setuid, getuid, User lookup) - newgrp.rs: full migration (termios, User lookup, setgid, initgroups, execv) - chpasswd/chage/chfn/chsh: setuid → shadow_core::process - lock.rs tests: fcntl_getfd → rustix::io libc stays for: PAM FFI, crypt(3) FFI, process-wide POSIX wrappers. nix remains only as a transitive dep of uucore (upstream).
16 lines
504 B
Rust
16 lines
504 B
Rust
// This file is part of the shadow-rs package.
|
|
//
|
|
// For the full copyright and license information, please view the LICENSE
|
|
// file that was distributed with this source code.
|
|
|
|
//! Shared test helpers for shadow-rs integration tests.
|
|
//!
|
|
//! Import with `#[path = "../common/mod.rs"] mod common;` in test files.
|
|
|
|
/// Skip the test when not running as root (euid != 0).
|
|
///
|
|
/// Returns `true` if the test should be skipped.
|
|
pub fn skip_unless_root() -> bool {
|
|
!rustix::process::geteuid().is_root()
|
|
}
|