Files
oech3 21ac3d4437 shadow-core: use getrandom from rustix (#165)
to replace unsafe libc::getrandom

Co-authored-by: oech3 <>
2026-05-24 14:09:12 +02:00

242 lines
7.3 KiB
TOML

# spell-checker:ignore uutils
[package]
name = "shadow-rs"
version = "0.2.0"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
authors.workspace = true
repository.workspace = true
homepage.workspace = true
description = "Memory-safe Rust reimplementation of Linux shadow-utils"
readme = "README.md"
keywords = ["shadow-utils", "uutils", "shadow", "passwd", "linux"]
categories = ["command-line-utilities"]
[workspace]
members = [
"src/shadow-core",
"src/uu/passwd",
"src/uu/pwck",
"src/uu/useradd",
"src/uu/userdel",
"src/uu/usermod",
"src/uu/groupadd",
"src/uu/groupdel",
"src/uu/groupmod",
"src/uu/grpck",
"src/uu/chfn",
"src/uu/chsh",
"src/uu/newgrp",
"src/uu/chpasswd",
"src/uu/chage",
]
[workspace.package]
version = "0.2.0"
edition = "2024"
rust-version = "1.94.0"
license = "MIT"
authors = ["shadow-rs contributors"]
repository = "https://github.com/uutils/shadow-rs"
homepage = "https://github.com/uutils/shadow-rs"
keywords = ["shadow-utils", "uutils", "shadow", "passwd", "linux"]
categories = ["command-line-utilities"]
[workspace.dependencies]
# Internal crates
shadow-core = { path = "src/shadow-core" }
# CLI
clap = { version = "4", features = ["derive", "wrap_help"] }
clap_complete = "4"
# uutils integration
uucore = "0.8"
# Error handling
thiserror = "2"
# Unix/Linux
rustix = { version = "1", features = ["fs", "param", "process", "rand", "termios"] }
libc = "0.2"
# Security
zeroize = "1"
subtle = "2"
landlock = "0.4"
# Testing
proptest = "1"
tempfile = "3"
[dependencies]
clap = { workspace = true }
clap_complete = { workspace = true, optional = true }
shadow-core = { path = "src/shadow-core" }
rustix = { workspace = true }
# Tool crates (optional, enabled by features)
passwd = { optional = true, version = "0.2.0", package = "uu_passwd", path = "src/uu/passwd" }
pwck = { optional = true, version = "0.2.0", package = "uu_pwck", path = "src/uu/pwck" }
useradd = { optional = true, version = "0.2.0", package = "uu_useradd", path = "src/uu/useradd" }
userdel = { optional = true, version = "0.2.0", package = "uu_userdel", path = "src/uu/userdel" }
usermod = { optional = true, version = "0.2.0", package = "uu_usermod", path = "src/uu/usermod" }
chpasswd = { optional = true, version = "0.2.0", package = "uu_chpasswd", path = "src/uu/chpasswd" }
chage = { optional = true, version = "0.2.0", package = "uu_chage", path = "src/uu/chage" }
groupadd = { optional = true, version = "0.2.0", package = "uu_groupadd", path = "src/uu/groupadd" }
groupdel = { optional = true, version = "0.2.0", package = "uu_groupdel", path = "src/uu/groupdel" }
groupmod = { optional = true, version = "0.2.0", package = "uu_groupmod", path = "src/uu/groupmod" }
grpck = { optional = true, version = "0.2.0", package = "uu_grpck", path = "src/uu/grpck" }
chfn = { optional = true, version = "0.2.0", package = "uu_chfn", path = "src/uu/chfn" }
chsh = { optional = true, version = "0.2.0", package = "uu_chsh", path = "src/uu/chsh" }
newgrp = { optional = true, version = "0.2.0", package = "uu_newgrp", path = "src/uu/newgrp" }
[features]
default = ["passwd", "pwck", "useradd", "userdel", "usermod", "chpasswd", "chage",
"groupadd", "groupdel", "groupmod", "grpck", "chfn", "chsh", "newgrp"]
# Individual tools
feat_passwd = ["passwd"]
feat_pwck = ["pwck"]
feat_useradd = ["useradd"]
feat_userdel = ["userdel"]
feat_usermod = ["usermod"]
feat_chpasswd = ["chpasswd"]
feat_chage = ["chage"]
feat_groupadd = ["groupadd"]
feat_groupdel = ["groupdel"]
feat_groupmod = ["groupmod"]
feat_grpck = ["grpck"]
feat_chfn = ["chfn"]
feat_chsh = ["chsh"]
feat_newgrp = ["newgrp"]
# Grouped features
feat_phase1 = ["feat_passwd", "feat_pwck"]
feat_phase2 = ["feat_useradd", "feat_userdel", "feat_usermod", "feat_chpasswd", "feat_chage"]
feat_phase3 = ["feat_groupadd", "feat_groupdel", "feat_groupmod", "feat_grpck", "feat_chfn", "feat_chsh", "feat_newgrp"]
feat_common = ["feat_phase1", "feat_phase2"]
feat_common_core = ["feat_phase1", "feat_phase2", "feat_phase3"]
# PAM authentication (requires libpam-dev)
pam = ["passwd/pam"]
# Shell completions generator
completions = ["dep:clap_complete"]
[[bin]]
name = "shadow-rs"
path = "src/bin/shadow-rs.rs"
[[bin]]
name = "shadow-rs-completions"
path = "src/bin/completions.rs"
required-features = ["completions"]
[[test]]
name = "test_chage"
path = "tests/by-util/test_chage.rs"
[[test]]
name = "test_chpasswd"
path = "tests/by-util/test_chpasswd.rs"
[[test]]
name = "test_passwd"
path = "tests/by-util/test_passwd.rs"
[[test]]
name = "test_chfn"
path = "tests/by-util/test_chfn.rs"
[[test]]
name = "test_chsh"
path = "tests/by-util/test_chsh.rs"
[[test]]
name = "test_newgrp"
path = "tests/by-util/test_newgrp.rs"
[[test]]
name = "test_groupdel"
path = "tests/by-util/test_groupdel.rs"
[[test]]
name = "test_groupmod"
path = "tests/by-util/test_groupmod.rs"
[[test]]
name = "test_useradd"
path = "tests/by-util/test_useradd.rs"
[[test]]
name = "test_userdel"
path = "tests/by-util/test_userdel.rs"
[[test]]
name = "test_pwck"
path = "tests/by-util/test_pwck.rs"
[[test]]
name = "test_grpck"
path = "tests/by-util/test_grpck.rs"
[[test]]
name = "test_usermod"
path = "tests/by-util/test_usermod.rs"
[[test]]
name = "test_groupadd"
path = "tests/by-util/test_groupadd.rs"
[dev-dependencies]
chage = { version = "0.2.0", package = "uu_chage", path = "src/uu/chage" }
chfn = { version = "0.2.0", package = "uu_chfn", path = "src/uu/chfn" }
chpasswd = { version = "0.2.0", package = "uu_chpasswd", path = "src/uu/chpasswd" }
chsh = { version = "0.2.0", package = "uu_chsh", path = "src/uu/chsh" }
groupadd = { version = "0.2.0", package = "uu_groupadd", path = "src/uu/groupadd" }
groupdel = { version = "0.2.0", package = "uu_groupdel", path = "src/uu/groupdel" }
groupmod = { version = "0.2.0", package = "uu_groupmod", path = "src/uu/groupmod" }
newgrp = { version = "0.2.0", package = "uu_newgrp", path = "src/uu/newgrp" }
passwd = { version = "0.2.0", package = "uu_passwd", path = "src/uu/passwd" }
useradd = { version = "0.2.0", package = "uu_useradd", path = "src/uu/useradd" }
userdel = { version = "0.2.0", package = "uu_userdel", path = "src/uu/userdel" }
usermod = { version = "0.2.0", package = "uu_usermod", path = "src/uu/usermod" }
pwck = { version = "0.2.0", package = "uu_pwck", path = "src/uu/pwck" }
grpck = { version = "0.2.0", package = "uu_grpck", path = "src/uu/grpck" }
shadow-core = { path = "src/shadow-core", features = ["shadow"] }
rustix = { workspace = true }
tempfile = { workspace = true }
[profile.release]
lto = true
strip = true
panic = "abort"
codegen-units = 1
[profile.release-small]
inherits = "release"
opt-level = "z"
[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(fuzzing)'] }
unsafe_code = "deny"
dead_code = "deny"
[workspace.lints.clippy]
all = { level = "deny" }
pedantic = { level = "warn" }
cargo = { level = "warn", priority = -1 }
# Allowed pedantic/cargo lints that don't add value for this project:
multiple_crate_versions = { level = "allow", priority = 1 }
missing_panics_doc = { level = "allow", priority = 1 }
missing_errors_doc = { level = "allow", priority = 1 }
must_use_candidate = { level = "allow", priority = 1 }
module_name_repetitions = { level = "allow", priority = 1 }
cargo_common_metadata = { level = "allow", priority = 1 }
[lints]
workspace = true