From cebf0995415f15b7fa2f1428a76d033fd1d4be83 Mon Sep 17 00:00:00 2001 From: bapt Date: Wed, 9 Dec 2015 21:38:26 +0000 Subject: 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 --- 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 d9602e9..5b422fe 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; -- cgit v1.1