svn commit: r194035 - stable/7/usr.bin/find
Andriy Gapon
avg at FreeBSD.org
Thu Jun 11 18:32:54 UTC 2009
Author: avg
Date: Thu Jun 11 18:32:53 2009
New Revision: 194035
URL: http://svn.freebsd.org/changeset/base/194035
Log:
MFC r192381: find: do not silently disable -L when -delete is used
Approved by: jhb (mentor)
Modified:
stable/7/usr.bin/find/ (props changed)
stable/7/usr.bin/find/function.c
Modified: stable/7/usr.bin/find/function.c
==============================================================================
--- stable/7/usr.bin/find/function.c Thu Jun 11 18:29:11 2009 (r194034)
+++ stable/7/usr.bin/find/function.c Thu Jun 11 18:32:53 2009 (r194035)
@@ -427,11 +427,13 @@ f_delete(PLAN *plan __unused, FTSENT *en
/* sanity check */
if (isdepth == 0 || /* depth off */
- (ftsoptions & FTS_NOSTAT) || /* not stat()ing */
- !(ftsoptions & FTS_PHYSICAL) || /* physical off */
- (ftsoptions & FTS_LOGICAL)) /* or finally, logical on */
+ (ftsoptions & FTS_NOSTAT)) /* not stat()ing */
errx(1, "-delete: insecure options got turned on");
+ if (!(ftsoptions & FTS_PHYSICAL) || /* physical off */
+ (ftsoptions & FTS_LOGICAL)) /* or finally, logical on */
+ errx(1, "-delete: forbidden when symlinks are followed");
+
/* Potentially unsafe - do not accept relative paths whatsoever */
if (strchr(entry->fts_accpath, '/') != NULL)
errx(1, "-delete: %s: relative path potentially not safe",
@@ -462,8 +464,6 @@ c_delete(OPTION *option, char ***argvp _
{
ftsoptions &= ~FTS_NOSTAT; /* no optimise */
- ftsoptions |= FTS_PHYSICAL; /* disable -follow */
- ftsoptions &= ~FTS_LOGICAL; /* disable -follow */
isoutput = 1; /* possible output */
isdepth = 1; /* -depth implied */
More information about the svn-src-stable-7
mailing list