From owner-svn-src-head@freebsd.org Thu Mar 1 17:47:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B786F3F194; Thu, 1 Mar 2018 17:47:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4EE0472189; Thu, 1 Mar 2018 17:47:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 45ADA427C; Thu, 1 Mar 2018 17:47:29 +0000 (UTC) (envelope-from dab@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w21HlTJH099004; Thu, 1 Mar 2018 17:47:29 GMT (envelope-from dab@FreeBSD.org) Received: (from dab@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w21HlSmM099002; Thu, 1 Mar 2018 17:47:28 GMT (envelope-from dab@FreeBSD.org) Message-Id: <201803011747.w21HlSmM099002@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dab set sender to dab@FreeBSD.org using -f From: David Bright Date: Thu, 1 Mar 2018 17:47:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r330245 - in head/usr.sbin/pw: . tests X-SVN-Group: head X-SVN-Commit-Author: dab X-SVN-Commit-Paths: in head/usr.sbin/pw: . tests X-SVN-Commit-Revision: 330245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Mar 2018 17:47:29 -0000 Author: dab Date: Thu Mar 1 17:47:28 2018 New Revision: 330245 URL: https://svnweb.freebsd.org/changeset/base/330245 Log: 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 Reported by: jschauma@netmeister.org, Dave Cottlehuber Reviewed by: delphij (secteam), vangyzen MFC after: 1 week Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D14519 Modified: head/usr.sbin/pw/pw_user.c head/usr.sbin/pw/tests/pw_useradd_test.sh Modified: head/usr.sbin/pw/pw_user.c ============================================================================== --- head/usr.sbin/pw/pw_user.c Thu Mar 1 17:31:36 2018 (r330244) +++ head/usr.sbin/pw/pw_user.c Thu Mar 1 17:47:28 2018 (r330245) @@ -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. */ Modified: head/usr.sbin/pw/tests/pw_useradd_test.sh ============================================================================== --- head/usr.sbin/pw/tests/pw_useradd_test.sh Thu Mar 1 17:31:36 2018 (r330244) +++ head/usr.sbin/pw/tests/pw_useradd_test.sh Thu Mar 1 17:47:28 2018 (r330245) @@ -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