diff options
author | David Bright <dab@FreeBSD.org> | 2018-03-01 17:47:28 +0000 |
---|---|---|
committer | David Bright <dab@FreeBSD.org> | 2018-03-01 17:47:28 +0000 |
commit | 5d9f253bb5e0cfe6848f6ceb730fe13e9494b460 (patch) | |
tree | e780953225c029576bb7ae83475d55dd7ef6e19d /pw | |
parent | 4a5fb0541d35a9ac13f2aba28e7bb600c240bafc (diff) | |
download | pw-darwin-5d9f253bb5e0cfe6848f6ceb730fe13e9494b460.tar.gz pw-darwin-5d9f253bb5e0cfe6848f6ceb730fe13e9494b460.tar.zst pw-darwin-5d9f253bb5e0cfe6848f6ceb730fe13e9494b460.zip |
Allow the "@" and "!" characters in passwd file GECOS fields.
Two PRs (152084 & 210187) request allowing the "@" and/or "!"
characters in the passwd file GECOS field. The man page for pw does
not mention that those characters are disallowed, Linux supports those
characters in this field, and the "@" character in particular would be
useful for storing email addresses in that field.
PR: 152084, 210187
Submitted by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reported by: jschauma@netmeister.org, Dave Cottlehuber <dch@freebsd.org>
Reviewed by: delphij (secteam), vangyzen
MFC after: 1 week
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14519
Diffstat (limited to 'pw')
-rw-r--r-- | pw/pw_user.c | 2 | ||||
-rwxr-xr-x | pw/tests/pw_useradd_test.sh | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c index 62a1613..148239e 100644 --- a/pw/pw_user.c +++ b/pw/pw_user.c @@ -632,7 +632,7 @@ pw_checkname(char *name, int gecos) reject = 0; if (gecos) { /* See if the name is valid as a gecos (comment) field. */ - badchars = ":!@"; + badchars = ":"; showtype = "gecos field"; } else { /* See if the name is valid as a userid or group. */ diff --git a/pw/tests/pw_useradd_test.sh b/pw/tests/pw_useradd_test.sh index 1a1c7d3..3a88967 100755 --- a/pw/tests/pw_useradd_test.sh +++ b/pw/tests/pw_useradd_test.sh @@ -27,9 +27,9 @@ atf_test_case user_add_comments user_add_comments_body() { populate_etc_skel - atf_check -s exit:0 ${PW} useradd test -c "Test User,work,123,456" - atf_check -s exit:0 -o match:"^test:.*:Test User,work,123,456:" \ - grep "^test:.*:Test User,work,123,456:" $HOME/master.passwd + atf_check -s exit:0 ${PW} useradd test -c 'Test User,work!,123,user@example.com' + atf_check -s exit:0 -o match:'^test:.*:Test User,work!,123,user@example.com:' \ + grep '^test:.*:Test User,work!,123,user@example.com:' $HOME/master.passwd } # Test add user with comments and option -N |