Repository navigation
Conversation
useradd(8) and usermod(8) document -1 for --inactive and --expiredate, and the value handling already maps it to an empty field, but clap rejected -1 as an unknown argument. chage already allows hyphen values for these options.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
| } | ||
|
|
||
| #[test] | ||
| fn test_negative_one_inactive_and_expiredate() { |
There was a problem hiding this comment.
could you please also add a test in tests/by-util/test_usermod.rs checking that -e -1 / -f -1 blank the shadow fields? thanks
There was a problem hiding this comment.
Added test_negative_one_blanks_inactive_and_expiredate in 9de8fb5: it starts from a shadow line with inactive 30 and expire 19782, runs usermod -e -1 -f -1, and checks both fields come out empty. It fails on main.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
|
Thanks for your PR |
Fixes #338
-f -1and-e -1are documented in useradd(8) and usermod(8), and the value handling already turns-1into an empty field, but clap rejected-1as an unknown argument. The four arguments now setallow_hyphen_values, aschagedoes for the same options.Tests: parse tests for
-f -1 -e -1in useradd and usermod (fail before, pass after).cargo test --workspacerun as root in an Ubuntu 26.04 container: 941 passed (939 on main, plus the two new).cargo fmt --checkandcargo clippy --workspace --all-targets -- -D warningsare clean; thepamconfigurations were not run locally. Against GNU shadow 4.17.4 in the same container,useradd -f -1,useradd -e -1,usermod -f -1andusermod -e -1now give the same files and exit codes.AI tools assisted with this contribution.