From f4a2a132798712b8a14c7da08ae97d62bdf7494e Mon Sep 17 00:00:00 2001 From: bapt Date: Wed, 9 Dec 2015 21:38:26 +0000 Subject: [PATCH] MFC: r291658 pw_checkname since the beginning is too strict on GECOS field, relax it a bit so gecos can be used to store multibytes data. This was unseen before FreeBSD 10.2 as this validation function was motly unused since FreeBSD 10.2 the usage of this function has been generalized to improve Reported by: des git-svn-id: svn://svn.freebsd.org/base/stable/10@292026 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/pw/pw_user.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.sbin/pw/pw_user.c b/usr.sbin/pw/pw_user.c index d9602e953..5b422fe27 100644 --- a/usr.sbin/pw/pw_user.c +++ b/usr.sbin/pw/pw_user.c @@ -640,7 +640,8 @@ pw_checkname(char *name, int gecos) } if (!reject) { while (*ch) { - if (strchr(badchars, *ch) != NULL || *ch < ' ' || + if (strchr(badchars, *ch) != NULL || + (!gecos && *ch < ' ') || *ch == 127) { reject = 1; break; -- 2.45.0