summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2009-05-08 14:32:53 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2009-05-08 14:32:53 +0000
commit832c9ffc454d1b62b470f6603c5be47719ddb2da (patch)
tree83abe3d5d943e3b9684402a0cd4ed50f770e4e1e
parent149b9f61116a86e8a3817ab17faa604b761eef6d (diff)
improve user_setup by only accepting good usernames; idea from alexander
hall. also improve the 2nd question designed for people not paying attention; ok todd
-rw-r--r--distrib/miniroot/install.sub21
1 files changed, 13 insertions, 8 deletions
diff --git a/distrib/miniroot/install.sub b/distrib/miniroot/install.sub
index f3cfe303645..ca7d7e31396 100644
--- a/distrib/miniroot/install.sub
+++ b/distrib/miniroot/install.sub
@@ -1,4 +1,4 @@
-# $OpenBSD: install.sub,v 1.538 2009/05/08 05:47:38 deraadt Exp $
+# $OpenBSD: install.sub,v 1.539 2009/05/08 14:32:52 deraadt Exp $
# $NetBSD: install.sub,v 1.5.2.8 1996/09/02 23:25:02 pk Exp $
#
# Copyright (c) 1997-2009 Todd Miller, Theo de Raadt, Ken Westerback
@@ -282,15 +282,20 @@ askpassword() {
}
user_setup() {
- ask "Setup a user? (enter a lower-case loginname, or 'no')" no
- case $resp in
- n|no) return ;;
- y|yes) ask "No really, what is the lower-case loginname, or 'no'?"
+ local _q="Setup a user? (enter a lower-case loginname, or 'no')"
+
+ while :; do
+ ask "$_q" no
case $resp in
n|no) return ;;
- esac ;;
- esac
-
+ y|yes) _q="No really, what is the lower-case loginname, or 'no'?"
+ continue ;;
+ root|daemon|operator|bin|smmsp|popa3d) ;;
+ sshd|uucp|www|named|proxy|nobody|ftp) ;;
+ [a-z]*([a-z0-9])) break ;;
+ esac
+ echo "$resp is not a useable loginname."
+ done
user=$resp
ask "Full user name for $user?" $user
username=$resp