Date: Tue, 3 Dec 2002 17:13:41 +1100 From: Tim Robbins <tjr@FreeBSD.ORG> Cc: cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG, Mike Makonnen <mtm@identd.net> 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> In-Reply-To: <200212030541.gB35f9E0007218@repoman.freebsd.org>; from scottl@FreeBSD.ORG on Mon, Dec 02, 2002 at 09:41:09PM -0800 References: <200212030541.gB35f9E0007218@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20021203171341.A69835>