summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adduser/adduser.sh10
1 files changed, 8 insertions, 2 deletions
diff --git a/adduser/adduser.sh b/adduser/adduser.sh
index 735d178..7097caf 100644
--- a/adduser/adduser.sh
+++ b/adduser/adduser.sh
@@ -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"