summaryrefslogtreecommitdiffstats
path: root/contrib/tar/src
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-06-07 00:03:23 +0000
committersobomax <sobomax@FreeBSD.org>2002-06-07 00:03:23 +0000
commit87323b540c9c5a8ffb8df3d49d28e7a8b3dbc7dc (patch)
tree612b96b20719657abb022a041a148abb35973e3d /contrib/tar/src
parent865fcaca350e0d40489dc706f3ee42fa73ba587f (diff)
downloadFreeBSD-src-87323b540c9c5a8ffb8df3d49d28e7a8b3dbc7dc.zip
FreeBSD-src-87323b540c9c5a8ffb8df3d49d28e7a8b3dbc7dc.tar.gz
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.
Diffstat (limited to 'contrib/tar/src')
-rw-r--r--contrib/tar/src/extract.c4
1 files changed, 4 insertions, 0 deletions
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 <quotearg.h>
@@ -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
OpenPOWER on IntegriCloud