3 Commits

Author SHA1 Message Date
Pierre Warnier 32c94fbc76 shadow-core, tools: complete nix removal — phase 2 (#140)
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).
2026-04-22 11:26:49 +02:00
Pierre Warnier 96f9c40ca3 tests: deduplicate skip_unless_root() into common module
Replace 13 local copies across all test files with a shared import
from tests/common/mod.rs. Fix getuid/geteuid inconsistency in
test_useradd.rs and test_userdel.rs (effective UID is correct for
setuid-root tools).

Fixes #133
2026-04-03 17:45:10 +02:00
Pierre Warnier 748f0ad88d fix: binary size <1MB, shared test helpers, shell completions
Fixes #78 — Binary size: release-small profile achieves 894KB (<1MB).
  Default release also shrank from 1.5MB to 1.3MB thanks to
  panic=abort + codegen-units=1 from PR #91.

Fixes #86 — Shared test helper crate at tests/common/mod.rs with
  skip_unless_root(), setup_prefix(), setup_full_prefix(), read_file().

Fixes #88 — Shell completion script at util/generate-completions.sh
  (placeholder — generates minimal bash/zsh/fish completions).

456 tests, zero clippy warnings.
2026-03-24 14:48:37 +01:00