From owner-cvs-all Mon Dec 2 22:14:11 2002 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7DC4D37B401; Mon, 2 Dec 2002 22:14:10 -0800 (PST) Received: from smtp02.iprimus.net.au (smtp02.iprimus.net.au [210.50.76.70]) by mx1.FreeBSD.org (Postfix) with ESMTP id F310A43E4A; Mon, 2 Dec 2002 22:14:08 -0800 (PST) (envelope-from tim@robbins.dropbear.id.au) Received: from dilbert.robbins.dropbear.id.au ([210.50.202.189]) by smtp02.iprimus.net.au with Microsoft SMTPSVC(5.0.2195.5600); Tue, 3 Dec 2002 17:13:56 +1100 Received: from dilbert.robbins.dropbear.id.au (n8ac74l0m9lgxlg3@localhost [127.0.0.1]) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6) with ESMTP id gB36DjWo070564; Tue, 3 Dec 2002 17:13:46 +1100 (EST) (envelope-from tim@dilbert.robbins.dropbear.id.au) Received: (from tim@localhost) by dilbert.robbins.dropbear.id.au (8.12.6/8.12.6/Submit) id gB36DgnM070563; Tue, 3 Dec 2002 17:13:42 +1100 (EST) (envelope-from tim) Date: Tue, 3 Dec 2002 17:13:41 +1100 From: Tim Robbins Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, Mike Makonnen Subject: Re: cvs commit: src/usr.sbin/adduser Makefile adduser.8 adduser.perl adduser.sh rmuser.8 rmuser.perl rmuser.sh Message-ID: <20021203171341.A69835@dilbert.robbins.dropbear.id.au> References: <200212030541.gB35f9E0007218@repoman.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <200212030541.gB35f9E0007218@repoman.freebsd.org>; from scottl@FreeBSD.ORG on Mon, Dec 02, 2002 at 09:41:09PM -0800 X-OriginalArrivalTime: 03 Dec 2002 06:13:57.0265 (UTC) FILETIME=[29D77010:01C29A93] Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Dec 02, 2002 at 09:41:09PM -0800, Scott Long wrote: > scottl 2002/12/02 21:41:09 PST > > Modified files: > usr.sbin/adduser Makefile adduser.8 rmuser.8 > Added files: > usr.sbin/adduser adduser.sh rmuser.sh > Removed files: > usr.sbin/adduser adduser.perl rmuser.perl > Log: > Replace the perl versions of adduser and rmuser with shell script versions. I think this loop is unsafe, mainly because it does not escape "$_file" adequately, and could be tricked by filenames beginning with a dash (-) or containing IFS characters. filecount=0 _ownedfiles=`find 2>/dev/null $_dir -maxdepth 1 -user $login -print` for _file in $_ownedfiles ; do rm -fd $_file filecount=`expr $filecount + 1` done echo " $filecount removed." Consider using find ... -delete instead filecount=`find "$_dir" -user "$login" -delete -print | wc -l` I'm also not sure what the point of -maxdepth 1 is. I think find(1) is smart enough not to get stuck in symlink loops. Thanks for writing the replacement scripts, though. Tim To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message