From owner-svn-src-stable-7@FreeBSD.ORG Thu Jun 11 18:32:54 2009 Return-Path: Delivered-To: svn-src-stable-7@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 35DCA106564A; Thu, 11 Jun 2009 18:32:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 23BEC8FC15; Thu, 11 Jun 2009 18:32:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5BIWrPf056898; Thu, 11 Jun 2009 18:32:53 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5BIWr5N056897; Thu, 11 Jun 2009 18:32:53 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200906111832.n5BIWr5N056897@svn.freebsd.org> From: Andriy Gapon Date: Thu, 11 Jun 2009 18:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r194035 - stable/7/usr.bin/find X-BeenThere: svn-src-stable-7@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 7-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Jun 2009 18:32:54 -0000 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 */