From: Iker Pedrosa Date: Tue, 2 Jun 2026 13:18:31 +0000 (+0200) Subject: passwd: add UPN validation support X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;ds=inline;p=thirdparty%2Fshadow.git 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: 326889ca (2024-10-22; "Fix coverity unbound buffer issues") Closes: Reported-by: @nooreldeenmansour Signed-off-by: Iker Pedrosa Reviewed-by: Alejandro Colomar --- diff --git a/src/passwd.c b/src/passwd.c index b2cac80b0..351252e0b 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -993,7 +993,7 @@ main(int argc, char **argv) } myname = xstrdup (pw->pw_name); if (optind < argc) { - if (!is_valid_user_name (argv[optind])) { + if (!is_valid_user_name (argv[optind]) && !is_valid_upn (argv[optind])) { fprintf (stderr, _("%s: Provided user name is not a valid name\n"), Prog); fail_exit (E_NOPERM, process_selinux); }