diff options
| author | Andriy Gapon <avg@FreeBSD.org> | 2009-05-19 14:23:54 +0000 |
|---|---|---|
| committer | Andriy Gapon <avg@FreeBSD.org> | 2009-05-19 14:23:54 +0000 |
| commit | 05e605b7649eaa47028b444ece1800b5ed11e6e5 (patch) | |
| tree | a06959b26a50fc91f24df7c7798d54296726df29 /usr.bin | |
| parent | 51ca6cd6df0db322e57b18398fde69e2f7c69556 (diff) | |
Notes
Diffstat (limited to 'usr.bin')
| -rw-r--r-- | usr.bin/find/function.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/find/function.c b/usr.bin/find/function.c index c3c90f84a18f..26412644ff46 100644 --- a/usr.bin/find/function.c +++ b/usr.bin/find/function.c @@ -427,11 +427,13 @@ f_delete(PLAN *plan __unused, FTSENT *entry) /* 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 __unused) { ftsoptions &= ~FTS_NOSTAT; /* no optimise */ - ftsoptions |= FTS_PHYSICAL; /* disable -follow */ - ftsoptions &= ~FTS_LOGICAL; /* disable -follow */ isoutput = 1; /* possible output */ isdepth = 1; /* -depth implied */ |
