summaryrefslogtreecommitdiff
path: root/archive-tar.c
diff options
context:
space:
mode:
authorbrian m. carlson <sandals@crustytoothpaste.net>2014-08-03 03:02:03 +0000
committerJunio C Hamano <gitster@pobox.com>2014-08-04 11:39:11 -0700
commit10f343ea814f5c18a0913997904ee11cd9b7da24 (patch)
tree9152810c20e2c9a5453f2c69c35904826030be55 /archive-tar.c
parente6aaa393478bf3ee9f4cde8d82cd258c034cd335 (diff)
downloadgit-10f343ea814f5c18a0913997904ee11cd9b7da24.tar.gz
archive: honor tar.umask even for pax headersbc/archive-pax-header-mode
git archive's tar format uses extended pax headers to encode metadata into the archive. Most tar implementations correctly treat these as metadata, but some that do not understand the pax format extract these as files instead. Apply the tar.umask setting to these entries to prevent tampering by other users. Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'archive-tar.c')
-rw-r--r--archive-tar.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/archive-tar.c b/archive-tar.c
index 719b6298e6..603650fa3c 100644
--- a/archive-tar.c
+++ b/archive-tar.c
@@ -192,7 +192,7 @@ static int write_extended_header(struct archiver_args *args,
unsigned int mode;
memset(&header, 0, sizeof(header));
*header.typeflag = TYPEFLAG_EXT_HEADER;
- mode = 0100666;
+ mode = 0100666 & ~tar_umask;
sprintf(header.name, "%s.paxheader", sha1_to_hex(sha1));
prepare_header(args, &header, mode, size);
write_blocked(&header, sizeof(header));
@@ -300,7 +300,7 @@ static int write_global_extended_header(struct archiver_args *args)
strbuf_append_ext_header(&ext_header, "comment", sha1_to_hex(sha1), 40);
memset(&header, 0, sizeof(header));
*header.typeflag = TYPEFLAG_GLOBAL_HEADER;
- mode = 0100666;
+ mode = 0100666 & ~tar_umask;
strcpy(header.name, "pax_global_header");
prepare_header(args, &header, mode, ext_header.len);
write_blocked(&header, sizeof(header));