summaryrefslogtreecommitdiffstats
path: root/usr.sbin/adduser
diff options
context:
space:
mode:
authorfjoe <fjoe@FreeBSD.org>2003-01-23 20:07:40 +0000
committerfjoe <fjoe@FreeBSD.org>2003-01-23 20:07:40 +0000
commit9efcd9e534db8cc5f82315e826022a56a166d757 (patch)
tree4064e4869e98f9ff9e7a34ef260ca803859ee0de /usr.sbin/adduser
parent95a61b2a6f40d7c7fd7a9c2f8187be87f06784c4 (diff)
downloadFreeBSD-src-9efcd9e534db8cc5f82315e826022a56a166d757.zip
FreeBSD-src-9efcd9e534db8cc5f82315e826022a56a166d757.tar.gz
- restore an ability to write log of added users (default to
/var/log/adduser, disabled if empty or adduserlog="no") - do not ask for password in configure mode - print $passwdtype instead of password in configure mode - add DATECMD, GREPCMD (not overridable but with full path)
Diffstat (limited to 'usr.sbin/adduser')
-rw-r--r--usr.sbin/adduser/adduser.sh16
1 files changed, 13 insertions, 3 deletions
diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh
index 0a92133..6c14251 100644
--- a/usr.sbin/adduser/adduser.sh
+++ b/usr.sbin/adduser/adduser.sh
@@ -145,7 +145,7 @@ fullpath_from_shell() {
save_config() {
echo "# Configuration file for adduser(8)." > ${ADDUSERCONF}
echo "# NOTE: only *some* variables are saved." >> ${ADDUSERCONF}
- echo "# Last Modified on `date`." >> ${ADDUSERCONF}
+ echo "# Last Modified on `${DATECMD}`." >> ${ADDUSERCONF}
echo '' >> ${ADDUSERCONF}
echo "defaultclass=$uclass" >> ${ADDUSERCONF}
echo "defaultgroups=$ugroups" >> ${ADDUSERCONF}
@@ -155,6 +155,7 @@ save_config() {
echo "udotdir=$udotdir" >> ${ADDUSERCONF}
echo "msgfile=$msgfile" >> ${ADDUSERCONF}
echo "disableflag=$disableflag" >> ${ADDUSERCONF}
+ echo "adduserlog=$adduserlog" >> ${ADDUSERCONF}
}
# add_user
@@ -238,6 +239,9 @@ add_user() {
fi
fi
+ _log=${adduserlog:-no}
+ [ x"$_log" = x"no" ] || (echo "$(${DATECMD} +'%Y/%m/%d %T') $(${PWCMD} 2>/dev/null usershow -n $username)" >> $_log)
+
_line=
_owner=
_perms=
@@ -328,7 +332,7 @@ get_shell() {
ushell="$defaultshell"
# Make sure the current value of the shell is a valid one
- _shellchk="grep '^$ushell$' ${ETCSHELLS} > /dev/null 2>&1"
+ _shellchk="${GREPCMD} '^$ushell$' ${ETCSHELLS} > /dev/null 2>&1"
eval $_shellchk || {
err "Invalid shell ($ushell). Using default shell ${defaultshell}."
ushell="$defaultshell"
@@ -601,6 +605,7 @@ input_interactive() {
;;
esac
passwdtype="yes"
+ [ -n "$configrun" ] && break
trap 'stty echo; exit' 0 1 2 3 15
stty -echo
echo -n "Enter password: "
@@ -677,7 +682,8 @@ input_interactive() {
_pass='<random>'
;;
esac
- printf "%-10s : %s\n" "Password" "$_pass"
+ [ -z "$configflag" ] && printf "%-10s : %s\n" "Password" "$_pass"
+ [ -n "$configflag" ] && printf "%-10s : %s\n" "Pass Type" "$passwdtype"
[ -z "$configflag" ] && printf "%-10s : %s\n" "Full Name" "$ugecos"
[ -z "$configflag" ] && printf "%-10s : %s\n" "Uid" "$uuid"
printf "%-10s : %s\n" "Class" "$uclass"
@@ -709,9 +715,12 @@ input_interactive() {
THISCMD=`/usr/bin/basename $0`
DEFAULTSHELL=/bin/sh
ADDUSERCONF="${ADDUSERCONF:-/etc/adduser.conf}"
+ADDUSERLOG="${ADDUSERLOG:-/var/log/adduser}"
PWCMD="${PWCMD:-/usr/sbin/pw}"
MAILCMD="${MAILCMD:-mail}"
ETCSHELLS="${ETCSHELLS:-/etc/shells}"
+GREPCMD="/usr/bin/grep"
+DATECMD="/bin/date"
# Set default values
#
@@ -737,6 +746,7 @@ configflag=
fflag=
infile=
disableflag=
+adduserlog="${ADDUSERLOG}"
readconfig="yes"
homeprefix="/home"
randompass=
OpenPOWER on IntegriCloud