Skip to content

Commit 0428dee

Browse files
ikerexxealejandro-colomar
authored andcommitted
passwd: add UPN validation support
Add User Principal Name (UPN) validation to allow passwd command to accept usernames in user@domain.com format. Currently, passwd will accept both traditional usernames and UPN format. Fixes: 326889c (2024-10-22; "Fix coverity unbound buffer issues") Closes: <#1626> Reported-by: @nooreldeenmansour Signed-off-by: Iker Pedrosa <ipedrosa@redhat.com>
1 parent 01d0488 commit 0428dee

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/passwd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ main(int argc, char **argv)
993993
}
994994
myname = xstrdup (pw->pw_name);
995995
if (optind < argc) {
996-
if (!is_valid_user_name (argv[optind])) {
996+
if (!is_valid_user_name (argv[optind]) && !is_valid_upn (argv[optind])) {
997997
fprintf (stderr, _("%s: Provided user name is not a valid name\n"), Prog);
998998
fail_exit (E_NOPERM, process_selinux);
999999
}

0 commit comments

Comments
 (0)