diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-09-17 04:39:07 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-09-17 04:39:07 +0000 |
commit | e572c5e1cf5110dca2131bb7ba2d1c7d7814ee76 (patch) | |
tree | 337b640e30ab3e19c99ba1f0e2d525cc5b1add11 /lib/libarchive/archive_write_set_format_pax.c | |
parent | 68182686e72f13dc4e6760f590d6e34800c35581 (diff) | |
download | FreeBSD-src-e572c5e1cf5110dca2131bb7ba2d1c7d7814ee76.zip FreeBSD-src-e572c5e1cf5110dca2131bb7ba2d1c7d7814ee76.tar.gz |
Fix two ugly errors:
1. The correct cutoff for large uid/gid handling is 1<<18, not 1<<20.
2. Limit the uid/gid in the 'x' extension header (where numeric extensions
are not permitted) to 1<<18, but use the correct value in the regular
header (where numeric extensions are permitted).
Thanks to: Dan Nelson
MFC after: 3 days
Diffstat (limited to 'lib/libarchive/archive_write_set_format_pax.c')
-rw-r--r-- | lib/libarchive/archive_write_set_format_pax.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libarchive/archive_write_set_format_pax.c b/lib/libarchive/archive_write_set_format_pax.c index f5ee4c6..7987e08 100644 --- a/lib/libarchive/archive_write_set_format_pax.c +++ b/lib/libarchive/archive_write_set_format_pax.c @@ -414,7 +414,7 @@ archive_write_pax_header(struct archive *a, } /* If numeric GID is too large, add 'gid' to pax extended attrs. */ - if (st_main->st_gid >= (1 << 20)) { + if (st_main->st_gid >= (1 << 18)) { add_pax_attr_int(&(pax->pax_header), "gid", st_main->st_gid); need_extension = 1; } @@ -429,7 +429,7 @@ archive_write_pax_header(struct archive *a, } /* If numeric UID is too large, add 'uid' to pax extended attrs. */ - if (st_main->st_uid >= (1 << 20)) { + if (st_main->st_uid >= (1 << 18)) { add_pax_attr_int(&(pax->pax_header), "uid", st_main->st_uid); need_extension = 1; } @@ -636,7 +636,11 @@ archive_write_pax_header(struct archive *a, archive_entry_set_pathname(pax_attr_entry, pax_attr_name); st.st_size = archive_strlen(&(pax->pax_header)); st.st_uid = st_main->st_uid; + if (st.st_uid >= 1 << 18) + st.st_uid = (1 << 18) - 1; st.st_gid = st_main->st_gid; + if (st.st_gid >= 1 << 18) + st.st_gid = (1 << 18) - 1; st.st_mode = st_main->st_mode; archive_entry_copy_stat(pax_attr_entry, &st); |