Repository navigation
useradd: exit 19 for an invalid user name - #341
Conversation
useradd(8) lists exit 19 for an invalid user or group name; useradd exited 3.
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.
| Self::UsernameInUse(_) => 9, | ||
| Self::CannotUpdateGroup(_) => 10, | ||
| Self::CannotCreateHome(_) => 12, | ||
| Self::BadName(_) => 19, |
There was a problem hiding this comment.
could you please add a BAD_NAME: i32 = 19 to exit_codes and to test_error_codes, like the others?
There was a problem hiding this comment.
Done in 5038265, BAD_NAME: i32 = 19 is in exit_codes and checked in test_error_codes.
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 #340
A name rejected by
validate_usernamenow maps to a newUseraddError::BadName, exit 19, as listed in useradd(8). Other tools keep their codes: groupadd(8) has no 19 and GNU groupadd exits 3 there too.Tests:
test_invalid_name_exits_19(root-only, like the other--roottests) checksbad:nameand1234exit 19 and leave passwd unchanged; it fails before (exit 3) and passes after.cargo test --workspaceas root in an Ubuntu 26.04 container: 940 passed (939 on main, plus the new one). fmt and clippy clean;pamconfigurations not run locally. Against GNU shadow 4.17.4 in the same container, the exit codes now match forbad:name,1234,-r 'x y'.AI tools assisted with this contribution.