summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2015-12-02 22:35:25 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2015-12-02 22:35:25 +0000
commit3fad668210aeec37d615b35f1814e65454c5c27c (patch)
tree991fc3545884fb05b2e1ce2f54786cfbd19e03ec
parent589645e2892df41b0acc5fed5073098a2bfab6a7 (diff)
downloadpw-darwin-3fad668210aeec37d615b35f1814e65454c5c27c.tar.gz
pw-darwin-3fad668210aeec37d615b35f1814e65454c5c27c.tar.zst
pw-darwin-3fad668210aeec37d615b35f1814e65454c5c27c.zip
pw_checkname since the beginning if 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 validation. Reported by: des MFC after: 1 week
-rw-r--r--pw/pw_user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/pw/pw_user.c b/pw/pw_user.c
index 61c2440..30a2749 100644
--- a/pw/pw_user.c
+++ b/pw/pw_user.c
@@ -642,7 +642,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;