These programs don't add new users. Because they handle existing users,
they should handle them with whatever names they already have, including
bad names.
A recent commit that added some username syntax validation blindly
removed support for bad names in these programs. Fix that regression.
Fixes: 326889ca81bb (2024-10-22; "Fix coverity unbound buffer issues")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
* name, or the name getlogin() returns.
*/
if (optind < argc) {
- if (!is_valid_user_name(argv[optind], false)) {
+ if (!is_valid_user_name(argv[optind], true)) {
fprintf (stderr, _("%s: Provided user name is not a valid name\n"), Prog);
fail_exit (E_NOPERM, process_selinux);
}
* name, or the name getlogin() returns.
*/
if (optind < argc) {
- if (!is_valid_user_name(argv[optind], false)) {
+ if (!is_valid_user_name(argv[optind], true)) {
fprintf (stderr, _("%s: Provided user name is not a valid name\n"), Prog);
fail_exit (1, process_selinux);
}
}
myname = xstrdup (pw->pw_name);
if (optind < argc) {
- if (!is_valid_user_name(argv[optind], false) && !is_valid_upn(argv[optind], false)) {
+ if (!is_valid_user_name(argv[optind], true) && !is_valid_upn(argv[optind], true)) {
fprintf (stderr, _("%s: Provided user name is not a valid name\n"), Prog);
fail_exit (E_NOPERM, process_selinux);
}