From 87323b540c9c5a8ffb8df3d49d28e7a8b3dbc7dc Mon Sep 17 00:00:00 2001 From: sobomax Date: Fri, 7 Jun 2002 00:03:23 +0000 Subject: IMO it was a quite ugly idea that if we are running as uid 0 then we can safely ignore current umask(2) and assume that permissions should be set right like in the archive. Not only it violates POLA, but introduces huge potential security vulnerability, particularly for ports, where many popular archives come with 777 files and dirs. --- contrib/tar/src/extract.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'contrib/tar/src') diff --git a/contrib/tar/src/extract.c b/contrib/tar/src/extract.c index 2a3f9bf..e5f5ea6 100644 --- a/contrib/tar/src/extract.c +++ b/contrib/tar/src/extract.c @@ -19,6 +19,8 @@ with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +/* $FreeBSD$ */ + #include "system.h" #include @@ -110,8 +112,10 @@ void extr_init (void) { we_are_root = geteuid () == 0; +#ifndef __FreeBSD__ same_permissions_option += we_are_root; same_owner_option += we_are_root; +#endif xalloc_fail_func = extract_finish; /* Option -p clears the kernel umask, so it does not affect proper -- cgit v1.1