tar no longer extracting with setuid bits

Stephane Billiart stephane.billiart at gmail.com
Sun Feb 11 14:24:19 PST 2007


While trying to upgrade from busybox 1.2.2.1 to 1.4.1, I noticed that
setuid files in tar files are no longer created with the setuid bit
while running as root.

The attached patch (which partially reverts r15775 of
archival/libunarchive/data_extract_all.c) fixes the problem.

Any idea why the chmod call was removed?

-- 
Stéphane Billiart                      http://perso.orange.fr/billiart/
-------------- next part --------------
--- archival/libunarchive/data_extract_all.c.orig	2007-01-24 16:34:38.000000000 -0500
+++ archival/libunarchive/data_extract_all.c	2007-02-11 17:22:14.000000000 -0500
@@ -111,6 +111,12 @@
 		lchown(file_header->name, file_header->uid, file_header->gid);
 	}
 
+	if (!(archive_handle->flags & ARCHIVE_NOPRESERVE_PERM) &&
+		 (file_header->mode & S_IFMT) !+	{
+		chmod(file_header->name, file_header->mode);
+	}
+
 	if (archive_handle->flags & ARCHIVE_PRESERVE_DATE) {
 		struct utimbuf t;
 		t.actime 


More information about the busybox mailing list