mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-14 10:09:48 +00:00
Check if the new user already exists right after entering the
username instead of watching the final call to pw(8) fail.
This commit is contained in:
parent
6455de0029
commit
a80d527f45
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=167917
@ -346,13 +346,19 @@ get_user() {
|
||||
_input="`echo "$fileline" | cut -f1 -d:`"
|
||||
fi
|
||||
|
||||
# There *must* be a username. If this is an interactive
|
||||
# session give the user an opportunity to retry.
|
||||
# There *must* be a username, and it must not exist. If
|
||||
# this is an interactive session give the user an
|
||||
# opportunity to retry.
|
||||
#
|
||||
if [ -z "$_input" ]; then
|
||||
err "You must enter a username!"
|
||||
[ -z "$fflag" ] && continue
|
||||
fi
|
||||
${PWCMD} usershow $_input > /dev/null 2>&1
|
||||
if [ "$?" -eq 0 ]; then
|
||||
err "User exists!"
|
||||
[ -z "$fflag" ] && continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
username="$_input"
|
||||
|
Loading…
Reference in New Issue
Block a user