diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2003-05-13 01:12:32 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2003-05-13 01:12:32 +0000 |
commit | 7e7c3f540a76a3c9c1fa74dc7fbd2e3450ca3bee (patch) | |
tree | 8171929e2da2da658b0acd03d0e0295b3ebe1ee5 | |
parent | 67c0a9f0ad329667c04c4ec3c4911f4e830e33de (diff) |
Don't allow usernames to begin with a dash since pwd_mkdb(8)
will reject such a name; from Brian Poole
-rw-r--r-- | usr.sbin/user/user.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/user/user.c b/usr.sbin/user/user.c index 45cc0d95484..6d441041abc 100644 --- a/usr.sbin/user/user.c +++ b/usr.sbin/user/user.c @@ -1,4 +1,4 @@ -/* $OpenBSD: user.c,v 1.41 2003/04/03 16:03:06 millert Exp $ */ +/* $OpenBSD: user.c,v 1.42 2003/05/13 01:12:31 millert Exp $ */ /* $NetBSD: user.c,v 1.45 2001/08/17 08:29:00 joda Exp $ */ /* @@ -551,6 +551,10 @@ valid_login(char *login) { char *cp; + /* The first character cannot be a hyphen */ + if (*login == '-') + return 0; + for (cp = login ; *cp ; cp++) { /* We allow '$' as the last character for samba */ if (!isalnum(*cp) && *cp != '.' && *cp != '_' && *cp != '-' && |