summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2004-02-20 02:25:18 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2004-02-20 02:25:18 +0000
commitc9f1fce9bb2cae41309dba87291cd0a1da5b6d2e (patch)
treeb1a49ad051b709d215d8547f40c463788784e676
parentb0e163a93bbfd6f90e41a67256ca57217bce54be (diff)
downloadbusybox-w32-c9f1fce9bb2cae41309dba87291cd0a1da5b6d2e.tar.gz
busybox-w32-c9f1fce9bb2cae41309dba87291cd0a1da5b6d2e.tar.bz2
busybox-w32-c9f1fce9bb2cae41309dba87291cd0a1da5b6d2e.zip
A strict interpretation of the ustar format requires the type flag to be
interpreted, we cannot depend on the file type being set in the mode field.
-rw-r--r--archival/libunarchive/get_header_tar.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index 013450a2a..10b21c874 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -13,9 +13,9 @@
13 * along with this program; if not, write to the Free Software 13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 14 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 * 15 *
16 * FIXME: Better checking required in oldcompatability mode, 16 * FIXME:
17 * the file db.1.85.tar.gz from sleepycat.com has trailing garbage 17 * In privelidged mode if uname and gname map to a uid amd gid then use the
18 * GNU tar can handle it, busybox tar reports invalid tar header. 18 * mapped value instead of the uid/gid values in tar header
19 * 19 *
20 * References: 20 * References:
21 * GNU tar and star man pages, 21 * GNU tar and star man pages,
@@ -135,14 +135,16 @@ extern char get_header_tar(archive_handle_t *archive_handle)
135 case 'g': 135 case 'g':
136 bb_error_msg_and_die("pax is not tar"); 136 bb_error_msg_and_die("pax is not tar");
137 break; 137 break;
138#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY 138 case '7':
139 /* Reserved for high performance files, treat as normal file */
139 case 0: 140 case 0:
140 case '0': 141 case '0':
142#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATABILITY
141 if (last_char_is(file_header->name, '/')) { 143 if (last_char_is(file_header->name, '/')) {
142 file_header->mode |= S_IFDIR; 144 file_header->mode |= S_IFDIR;
143 } else { 145 } else
146#endif
144 file_header->mode |= S_IFREG; 147 file_header->mode |= S_IFREG;
145 }
146 break; 148 break;
147 case '2': 149 case '2':
148 file_header->mode |= S_IFLNK; 150 file_header->mode |= S_IFLNK;
@@ -159,11 +161,6 @@ extern char get_header_tar(archive_handle_t *archive_handle)
159 case '6': 161 case '6':
160 file_header->mode |= S_IFIFO; 162 file_header->mode |= S_IFIFO;
161 break; 163 break;
162 case '7':
163 /* Reserved for high performance files, treat as normal file */
164 file_header->mode |= S_IFREG;
165 break;
166#endif
167#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS 164#ifdef CONFIG_FEATURE_TAR_GNU_EXTENSIONS
168 case 'L': { 165 case 'L': {
169 longname = xmalloc(file_header->size + 1); 166 longname = xmalloc(file_header->size + 1);