[Midnightbsd-cvs] src: usr.sbin/adduser: Bug fixes, $MidnightBSD$ Delete the .pop file

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Mon Apr 28 00:13:27 EDT 2008


Log Message:
-----------
Bug fixes, $MidnightBSD$

Delete the .pop file properly in rmuser

Modified Files:
--------------
    src/usr.sbin/adduser:
        Makefile (r1.1.1.1 -> r1.2)
        adduser.8 (r1.1.1.1 -> r1.2)
        adduser.conf.5 (r1.1.1.1 -> r1.2)
        adduser.sh (r1.2 -> r1.3)
        rmuser.8 (r1.1.1.1 -> r1.2)
        rmuser.sh (r1.1.1.1 -> r1.2)

-------------- next part --------------
Index: adduser.conf.5
===================================================================
RCS file: /home/cvs/src/usr.sbin/adduser/adduser.conf.5,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.sbin/adduser/adduser.conf.5 -L usr.sbin/adduser/adduser.conf.5 -u -r1.1.1.1 -r1.2
--- usr.sbin/adduser/adduser.conf.5
+++ usr.sbin/adduser/adduser.conf.5
@@ -23,9 +23,10 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/usr.sbin/adduser/adduser.conf.5,v 1.4 2004/06/13 18:03:39 ru Exp $
+.\" $MidnightBSD$
+.\" $FreeBSD: src/usr.sbin/adduser/adduser.conf.5,v 1.6 2007/04/12 08:39:13 ceri Exp $
 .\"
-.Dd March 30, 2004
+.Dd April 12, 2007
 .Dt ADDUSER.CONF 5
 .Os
 .Sh NAME
@@ -34,6 +35,15 @@
 .Xr adduser 8
 configuration file
 .Sh DESCRIPTION
+The 
+.Pa /etc/adduser.conf
+file is automatically generated by the
+.Xr adduser 8
+utility when invoked with the
+.Fl C
+command-line option.
+It is not meant to be edited by hand.
+.Pp
 The
 .Pa /etc/adduser.conf
 file is used to pre-set certain configuration options for
@@ -161,7 +171,7 @@
 .It Va ugecos
 The default information to be held in the GECOS field of
 .Pa /etc/master.passwd .
-.It Va uuid
+.It Va uidstart
 The default user ID setting.
 This must be a number above 1000 and fewer than 65534.
 .El
@@ -199,6 +209,14 @@
 .Nm
 manual page first appeared in
 .Fx 5.3 .
+.Sh BUGS
+The internal variables documented here may change without notice.
+Do not rely on them.
+To modify this file invoke
+.Xr adduser 8
+with the
+.Fl C
+option instead.
 .Sh AUTHORS
 This manual page was written by
 .An Tom Rhodes Aq trhodes at FreeBSD.org .
Index: adduser.sh
===================================================================
RCS file: /home/cvs/src/usr.sbin/adduser/adduser.sh,v
retrieving revision 1.2
retrieving revision 1.3
diff -L usr.sbin/adduser/adduser.sh -L usr.sbin/adduser/adduser.sh -u -r1.2 -r1.3
--- usr.sbin/adduser/adduser.sh
+++ usr.sbin/adduser/adduser.sh
@@ -24,7 +24,8 @@
 #
 #       Email: Mike Makonnen <mtm at FreeBSD.Org>
 #
-# $FreeBSD: src/usr.sbin/adduser/adduser.sh,v 1.26.2.1 2006/01/25 07:43:48 matteo Exp $
+# $MidnightBSD$
+# $FreeBSD: src/usr.sbin/adduser/adduser.sh,v 1.30.2.1 2007/10/28 21:06:34 mtm Exp $
 #
 
 # err msg
@@ -199,6 +200,7 @@
 	echo "udotdir=$udotdir"		>> ${ADDUSERCONF}
 	echo "msgfile=$msgfile"		>> ${ADDUSERCONF}
 	echo "disableflag=$disableflag" >> ${ADDUSERCONF}
+	echo "uidstart=$uidstart"       >> ${ADDUSERCONF}
 }
 
 # add_user
@@ -283,10 +285,6 @@
 		err "There was an error adding user ($username)."
 		return 1
 	else
-		if [ -z "$Dflag" ]; then
-			chmod 700 $uhome
-		fi
-
 		info "Successfully added ($username) to the user database."
 		if [ "random" = "$passwdtype" ]; then
 			randompass="$_output"
@@ -350,13 +348,19 @@
 			_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"
@@ -451,16 +455,10 @@
 #	allocates one if it is not specified.
 #
 get_uid() {
-	if [ -z "$uuid" ]; then
-		uuid=${uidstart}
-	fi
-
+	uuid=${uidstart}
 	_input=
 	_prompt=
 
-	# No need to take down uids for a configuration saving run.
-	[ -n "$configflag" ] && return
-
 	if [ -n "$uuid" ]; then
 		_prompt="Uid [$uuid]: "
 	else
@@ -596,19 +594,21 @@
 		case "$fileline" in
 		\#*|'')
 			;;
-		esac
-
-		get_user || continue
-		get_gecos
-		get_uid
-		get_logingroup
-		get_class
-		get_shell
-		get_homedir
-		get_password
-		get_expire_dates
+		*)
+			get_user || continue
+			get_gecos
+			get_uid
+			get_logingroup
+			get_class
+			get_shell
+			get_homedir
+			get_password
+			get_expire_dates
+			ugroups="$defaultgroups"
 
-		add_user
+			add_user
+			;;
+		esac
 	done
 }
 
Index: adduser.8
===================================================================
RCS file: /home/cvs/src/usr.sbin/adduser/adduser.8,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.sbin/adduser/adduser.8 -L usr.sbin/adduser/adduser.8 -u -r1.1.1.1 -r1.2
--- usr.sbin/adduser/adduser.8
+++ usr.sbin/adduser/adduser.8
@@ -24,9 +24,10 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/usr.sbin/adduser/adduser.8,v 1.55 2004/06/06 17:55:55 mtm Exp $
+.\" $MidnightBSD$
+.\" $FreeBSD: src/usr.sbin/adduser/adduser.8,v 1.59.2.1 2007/10/28 21:06:34 mtm Exp $
 .\"
-.Dd March 30, 2004
+.Dd June 7, 2006
 .Dt ADDUSER 8
 .Os
 .Sh NAME
@@ -66,7 +67,9 @@
 .Xr pw 8
 will accept.
 Generally this means it
-may contain only lowercase characters or digits.
+may contain only lowercase characters or digits but cannot begin with the
+.Ql -
+character.
 Maximum length
 is 16 characters.
 The reasons for this limit are historical.
@@ -81,7 +84,7 @@
 and recompile the
 world; people have done this and it works, but you will have problems
 with any precompiled programs, or source that assumes the 8-character
-name limit and NIS.
+name limit, such as NIS.
 The NIS protocol mandates an 8-character username.
 If you need a longer login name for e-mail addresses,
 you can define an alias in
@@ -203,14 +206,14 @@
 The format
 of the input file is described below.
 .It Fl g Ar login_group
-Normaly,
+Normally,
 if no login group is specified,
 it is assumed to be the same as the username.
 This option makes
 .Ar login_group
 the default.
 .It Fl G Ar groups
-Additional groups.
+Space-separated list of additional groups.
 This option allows the user to specify additional groups to add users to.
 The user is a member of these groups in addition to their login group.
 .It Fl h
@@ -431,6 +434,7 @@
 .Xr login.conf 5 ,
 .Xr passwd 5 ,
 .Xr shells 5 ,
+.Xr adding_user 8 ,
 .Xr pw 8 ,
 .Xr pwd_mkdb 8 ,
 .Xr rmuser 8 ,
@@ -462,12 +466,12 @@
 The
 .Nm
 utility attempts to mitigate the possibility of an attacker using this
-feature by refusing to evaluate the file if it is not owned and writeable
+feature by refusing to evaluate the file if it is not owned and writable
 only by the root user.
 In addition, shell special characters and operators will have to be
 escaped when used in the message file.
 .Pp
-Also, password ageing and account expiry times are currently setable
+Also, password ageing and account expiry times are currently settable
 only in batch mode or when specified in
 .Pa /etc/adduser.conf .
 The user should be able to set them in interactive mode as well.
Index: rmuser.8
===================================================================
RCS file: /home/cvs/src/usr.sbin/adduser/rmuser.8,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.sbin/adduser/rmuser.8 -L usr.sbin/adduser/rmuser.8 -u -r1.1.1.1 -r1.2
--- usr.sbin/adduser/rmuser.8
+++ usr.sbin/adduser/rmuser.8
@@ -24,7 +24,8 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/usr.sbin/adduser/rmuser.8,v 1.23 2004/06/08 14:52:55 csjp Exp $
+.\" $MidnightBSD$
+.\" $FreeBSD: src/usr.sbin/adduser/rmuser.8,v 1.25 2006/12/05 23:20:14 ceri Exp $
 .\"
 .Dd May 10, 2002
 .Dt RMUSER 8
@@ -129,7 +130,7 @@
 including the hash mark itself, is considered a comment and will not
 be processed.
 If the file is owned by anyone other than a user with
-UID 0, or is writeable by anyone other than the owner,
+UID 0, or is writable by anyone other than the owner,
 .Nm
 will refuse to continue.
 .It Fl y
@@ -146,7 +147,7 @@
 .It Fl v
 Enable verbose mode.
 Normally,
-the output inlcudes one line per removed user;
+the output includes one line per removed user;
 however,
 with this option
 .Nm
Index: rmuser.sh
===================================================================
RCS file: /home/cvs/src/usr.sbin/adduser/rmuser.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.sbin/adduser/rmuser.sh -L usr.sbin/adduser/rmuser.sh -u -r1.1.1.1 -r1.2
--- usr.sbin/adduser/rmuser.sh
+++ usr.sbin/adduser/rmuser.sh
@@ -24,7 +24,8 @@
 #
 #	Email: Mike Makonnen <mtm at FreeBSD.Org>
 #
-# $FreeBSD: src/usr.sbin/adduser/rmuser.sh,v 1.9 2005/05/24 04:50:07 adamw Exp $
+# $MidnightBSD$
+# $FreeBSD: src/usr.sbin/adduser/rmuser.sh,v 1.9.10.1 2007/10/19 07:46:33 mtm Exp $
 #
 
 ATJOBDIR="/var/at/jobs"
@@ -86,10 +87,10 @@
 		    echo -n " mailspool"
 		rm ${MAILSPOOL}/$login
 	fi
-	if [ -f ${MAILSPOOL}/${login}.pop ]; then
-		verbose && echo -n " ${MAILSPOOL}/${login}.pop" ||
+	if [ -f ${MAILSPOOL}/.${login}.pop ]; then
+		verbose && echo -n " ${MAILSPOOL}/.${login}.pop" ||
 		    echo -n " pop3"
-		rm ${MAILSPOOL}/${login}.pop
+		rm ${MAILSPOOL}/.${login}.pop
 	fi
 	verbose && echo '.'
 }
Index: Makefile
===================================================================
RCS file: /home/cvs/src/usr.sbin/adduser/Makefile,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L usr.sbin/adduser/Makefile -L usr.sbin/adduser/Makefile -u -r1.1.1.1 -r1.2
--- usr.sbin/adduser/Makefile
+++ usr.sbin/adduser/Makefile
@@ -1,3 +1,4 @@
+# $MidnightBSD$
 # $FreeBSD: src/usr.sbin/adduser/Makefile,v 1.19 2004/03/30 21:50:42 trhodes Exp $
 
 SCRIPTS=adduser.sh rmuser.sh


More information about the Midnightbsd-cvs mailing list