Author: dab
Date: Fri Mar  9 14:45:47 2018
New Revision: 330695
URL: https://svnweb.freebsd.org/changeset/base/330695

Log:
  MFC r330245:
  
  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:   jscha...@netmeister.org, Dave Cottlehuber <d...@freebsd.org>
  Reported by:    jscha...@netmeister.org, Dave Cottlehuber <d...@freebsd.org>
  Sponsored by:   Dell EMC

Modified:
  stable/10/usr.sbin/pw/pw_user.c
  stable/10/usr.sbin/pw/tests/pw_useradd_test.sh
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/pw/pw_user.c
==============================================================================
--- stable/10/usr.sbin/pw/pw_user.c     Fri Mar  9 14:45:17 2018        
(r330694)
+++ stable/10/usr.sbin/pw/pw_user.c     Fri Mar  9 14:45:47 2018        
(r330695)
@@ -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: stable/10/usr.sbin/pw/tests/pw_useradd_test.sh
==============================================================================
--- stable/10/usr.sbin/pw/tests/pw_useradd_test.sh      Fri Mar  9 14:45:17 
2018        (r330694)
+++ stable/10/usr.sbin/pw/tests/pw_useradd_test.sh      Fri Mar  9 14:45:47 
2018        (r330695)
@@ -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,u...@example.com'
+       atf_check -s exit:0 -o match:'^test:.*:Test 
User,work!,123,u...@example.com:' \
+               grep '^test:.*:Test User,work!,123,u...@example.com:' 
$HOME/master.passwd
 }
 
 # Test add user with comments and option -N
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to