libarchive-static 1.0.6 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/ext/extconf.rb +2 -9
  3. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
  4. data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
  5. data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
  6. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
  7. data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
  8. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
  9. data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
  10. data/ext/libarchive-0.1.1/ext/config.h +23 -0
  11. data/ext/libarchive-0.1.1/ext/config.log +230 -0
  12. data/ext/libarchive-0.1.1/ext/config.status +671 -0
  13. data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
  14. data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
  15. data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
  16. data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
  17. data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
  18. data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
  19. data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
  20. data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
  21. data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
  22. data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
  23. data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
  24. data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
  25. data/ext/libarchive-3.6.2/Makefile.in +16892 -0
  26. data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
  27. data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
  28. data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
  29. data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
  30. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
  31. data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
  32. data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
  33. data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
  34. data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
  35. data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
  36. data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
  37. data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
  38. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
  39. data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
  40. data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
  41. data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
  42. data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
  43. data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
  44. data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
  45. data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
  46. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
  47. data/ext/libarchive-3.6.2/config.h.in +1504 -0
  48. data/ext/libarchive-3.6.2/configure +25558 -0
  49. data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
  50. data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
  51. data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
  52. data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
  53. data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
  54. data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
  55. data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
  56. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
  57. data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
  58. data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
  59. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
  60. data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
  61. data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
  62. data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
  63. data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
  64. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
  65. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
  66. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
  67. data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
  68. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
  69. data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
  70. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
  71. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
  72. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
  73. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
  74. data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
  75. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
  76. data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
  77. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
  78. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
  79. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
  80. data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
  81. data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
  82. data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
  83. data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
  84. data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
  85. data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
  86. data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
  87. data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
  88. data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
  89. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
  90. data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
  91. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
  92. data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
  93. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
  94. data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
  95. data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
  96. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
  97. data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
  98. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
  99. data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
  100. data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
  101. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
  102. data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
  103. data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
  104. data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
  105. data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
  106. data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
  107. data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
  108. data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
  109. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
  110. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  111. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
  112. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
  113. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
  114. data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
  115. data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
  116. data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
  117. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
  118. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
  119. data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
  120. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
  121. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
  122. data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
  123. data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
  124. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
  125. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
  126. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
  127. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
  128. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
  129. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
  130. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
  131. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
  132. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
  133. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
  134. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
  135. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
  136. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
  137. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
  138. data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
  139. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
  140. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
  141. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
  142. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
  143. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
  144. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
  145. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
  146. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
  147. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
  148. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
  149. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
  150. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
  151. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
  152. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
  153. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
  154. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
  155. data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
  156. data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
  157. data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
  158. data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
  159. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
  160. data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
  161. data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
  162. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
  163. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
  164. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
  165. data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
  166. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
  167. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
  168. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
  169. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
  170. data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
  171. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
  172. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
  173. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
  174. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
  175. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
  176. data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
  177. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
  178. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
  179. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
  180. data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
  181. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
  182. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
  183. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
  184. data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
  185. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
  186. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
  187. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
  188. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
  189. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
  190. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
  191. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
  192. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
  193. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
  194. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
  195. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
  196. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  197. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
  198. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
  199. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
  200. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
  201. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
  202. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
  203. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
  204. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
  205. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
  206. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
  207. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
  208. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
  209. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
  210. data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
  211. data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
  212. data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
  213. data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
  214. data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
  215. data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
  216. data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
  217. data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
  218. data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
  219. data/ext/libarchive-static-makefile +144 -80
  220. data/ext/libarchive-static-wrapper-makefile +1 -1
  221. data/ext/zlib-1.2.13/Makefile.in +404 -0
  222. data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
  223. data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
  224. data/ext/zlib-1.2.13/configure +922 -0
  225. data/ext/zlib-1.2.13/crc32.c +1125 -0
  226. data/ext/zlib-1.2.13/crc32.h +9446 -0
  227. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
  228. data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
  229. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
  230. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
  231. data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
  232. data/ext/zlib-1.2.13/gzread.c +650 -0
  233. data/ext/zlib-1.2.13/gzwrite.c +677 -0
  234. data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
  235. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
  236. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
  237. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
  238. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
  239. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
  240. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
  241. data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
  242. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
  243. data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
  244. data/ext/zlib-1.2.13/uncompr.c +93 -0
  245. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
  246. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
  247. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
  248. data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
  249. metadata +241 -133
  250. data/ext/libarchive-0.1.1/libarchive.c +0 -1762
  251. data/ext/libarchive-2.8.4/Makefile.in +0 -7076
  252. data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
  253. data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
  254. data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
  255. data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
  256. data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
  257. data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
  258. data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
  259. data/ext/libarchive-2.8.4/config.h.in +0 -772
  260. data/ext/libarchive-2.8.4/configure +0 -17916
  261. data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
  262. data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
  263. data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
  264. data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
  265. data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
  266. data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
  267. data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
  268. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
  269. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
  270. data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
  271. data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
  272. data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
  273. data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
  274. data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
  275. data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
  276. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
  277. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
  278. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
  279. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
  280. data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
  281. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
  282. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
  283. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
  284. data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
  285. data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
  286. data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
  287. data/ext/zlib-1.2.5/Makefile.in +0 -257
  288. data/ext/zlib-1.2.5/configure +0 -596
  289. data/ext/zlib-1.2.5/crc32.c +0 -442
  290. data/ext/zlib-1.2.5/crc32.h +0 -441
  291. data/ext/zlib-1.2.5/example.c +0 -565
  292. data/ext/zlib-1.2.5/gzread.c +0 -653
  293. data/ext/zlib-1.2.5/gzwrite.c +0 -531
  294. data/ext/zlib-1.2.5/minigzip.c +0 -440
  295. data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -0,0 +1,760 @@
1
+ /*-
2
+ * Copyright (c) 2003-2009 Tim Kientzle
3
+ * Copyright (c) 2010-2012 Michihiro NAKAJIMA
4
+ * Copyright (c) 2017 Martin Matuska
5
+ * All rights reserved.
6
+ *
7
+ * Redistribution and use in source and binary forms, with or without
8
+ * modification, are permitted provided that the following conditions
9
+ * are met:
10
+ * 1. Redistributions of source code must retain the above copyright
11
+ * notice, this list of conditions and the following disclaimer.
12
+ * 2. Redistributions in binary form must reproduce the above copyright
13
+ * notice, this list of conditions and the following disclaimer in the
14
+ * documentation and/or other materials provided with the distribution.
15
+ *
16
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
17
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
20
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
+ */
27
+
28
+ #include "archive_platform.h"
29
+
30
+ #if ARCHIVE_ACL_LIBACL || ARCHIVE_ACL_LIBRICHACL
31
+
32
+ #ifdef HAVE_ERRNO_H
33
+ #include <errno.h>
34
+ #endif
35
+ #ifdef HAVE_FCNTL_H
36
+ #include <fcntl.h>
37
+ #endif
38
+ #if HAVE_ACL_LIBACL_H
39
+ #include <acl/libacl.h>
40
+ #endif
41
+ #ifdef HAVE_SYS_ACL_H
42
+ #include <sys/acl.h>
43
+ #endif
44
+ #ifdef HAVE_SYS_RICHACL_H
45
+ #include <sys/richacl.h>
46
+ #endif
47
+
48
+ #include "archive_entry.h"
49
+ #include "archive_private.h"
50
+ #include "archive_read_disk_private.h"
51
+ #include "archive_write_disk_private.h"
52
+
53
+ typedef struct {
54
+ const int a_perm; /* Libarchive permission or flag */
55
+ const int p_perm; /* Platform permission or flag */
56
+ } acl_perm_map_t;
57
+
58
+ #if ARCHIVE_ACL_LIBACL
59
+ static const acl_perm_map_t acl_posix_perm_map[] = {
60
+ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
61
+ {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
62
+ {ARCHIVE_ENTRY_ACL_READ, ACL_READ},
63
+ };
64
+
65
+ static const int acl_posix_perm_map_size =
66
+ (int)(sizeof(acl_posix_perm_map)/sizeof(acl_posix_perm_map[0]));
67
+ #endif /* ARCHIVE_ACL_LIBACL */
68
+
69
+ #if ARCHIVE_ACL_LIBRICHACL
70
+ static const acl_perm_map_t acl_nfs4_perm_map[] = {
71
+ {ARCHIVE_ENTRY_ACL_EXECUTE, RICHACE_EXECUTE},
72
+ {ARCHIVE_ENTRY_ACL_READ_DATA, RICHACE_READ_DATA},
73
+ {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, RICHACE_LIST_DIRECTORY},
74
+ {ARCHIVE_ENTRY_ACL_WRITE_DATA, RICHACE_WRITE_DATA},
75
+ {ARCHIVE_ENTRY_ACL_ADD_FILE, RICHACE_ADD_FILE},
76
+ {ARCHIVE_ENTRY_ACL_APPEND_DATA, RICHACE_APPEND_DATA},
77
+ {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, RICHACE_ADD_SUBDIRECTORY},
78
+ {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, RICHACE_READ_NAMED_ATTRS},
79
+ {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, RICHACE_WRITE_NAMED_ATTRS},
80
+ {ARCHIVE_ENTRY_ACL_DELETE_CHILD, RICHACE_DELETE_CHILD},
81
+ {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, RICHACE_READ_ATTRIBUTES},
82
+ {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, RICHACE_WRITE_ATTRIBUTES},
83
+ {ARCHIVE_ENTRY_ACL_DELETE, RICHACE_DELETE},
84
+ {ARCHIVE_ENTRY_ACL_READ_ACL, RICHACE_READ_ACL},
85
+ {ARCHIVE_ENTRY_ACL_WRITE_ACL, RICHACE_WRITE_ACL},
86
+ {ARCHIVE_ENTRY_ACL_WRITE_OWNER, RICHACE_WRITE_OWNER},
87
+ {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, RICHACE_SYNCHRONIZE}
88
+ };
89
+
90
+ static const int acl_nfs4_perm_map_size =
91
+ (int)(sizeof(acl_nfs4_perm_map)/sizeof(acl_nfs4_perm_map[0]));
92
+
93
+ static const acl_perm_map_t acl_nfs4_flag_map[] = {
94
+ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, RICHACE_FILE_INHERIT_ACE},
95
+ {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, RICHACE_DIRECTORY_INHERIT_ACE},
96
+ {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, RICHACE_NO_PROPAGATE_INHERIT_ACE},
97
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, RICHACE_INHERIT_ONLY_ACE},
98
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, RICHACE_INHERITED_ACE}
99
+ };
100
+
101
+ static const int acl_nfs4_flag_map_size =
102
+ (int)(sizeof(acl_nfs4_flag_map)/sizeof(acl_nfs4_flag_map[0]));
103
+ #endif /* ARCHIVE_ACL_LIBRICHACL */
104
+
105
+ #if ARCHIVE_ACL_LIBACL
106
+ /*
107
+ * Translate POSIX.1e ACLs into libarchive internal structure
108
+ */
109
+ static int
110
+ translate_acl(struct archive_read_disk *a,
111
+ struct archive_entry *entry, acl_t acl, int default_entry_acl_type)
112
+ {
113
+ acl_tag_t acl_tag;
114
+ acl_entry_t acl_entry;
115
+ acl_permset_t acl_permset;
116
+ int i, entry_acl_type;
117
+ int r, s, ae_id, ae_tag, ae_perm;
118
+ void *q;
119
+ const char *ae_name;
120
+
121
+ s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
122
+ if (s == -1) {
123
+ archive_set_error(&a->archive, errno,
124
+ "Failed to get first ACL entry");
125
+ return (ARCHIVE_WARN);
126
+ }
127
+
128
+ while (s == 1) {
129
+ ae_id = -1;
130
+ ae_name = NULL;
131
+ ae_perm = 0;
132
+
133
+ if (acl_get_tag_type(acl_entry, &acl_tag) != 0) {
134
+ archive_set_error(&a->archive, errno,
135
+ "Failed to get ACL tag type");
136
+ return (ARCHIVE_WARN);
137
+ }
138
+ switch (acl_tag) {
139
+ case ACL_USER:
140
+ q = acl_get_qualifier(acl_entry);
141
+ if (q != NULL) {
142
+ ae_id = (int)*(uid_t *)q;
143
+ acl_free(q);
144
+ ae_name = archive_read_disk_uname(&a->archive,
145
+ ae_id);
146
+ }
147
+ ae_tag = ARCHIVE_ENTRY_ACL_USER;
148
+ break;
149
+ case ACL_GROUP:
150
+ q = acl_get_qualifier(acl_entry);
151
+ if (q != NULL) {
152
+ ae_id = (int)*(gid_t *)q;
153
+ acl_free(q);
154
+ ae_name = archive_read_disk_gname(&a->archive,
155
+ ae_id);
156
+ }
157
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
158
+ break;
159
+ case ACL_MASK:
160
+ ae_tag = ARCHIVE_ENTRY_ACL_MASK;
161
+ break;
162
+ case ACL_USER_OBJ:
163
+ ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
164
+ break;
165
+ case ACL_GROUP_OBJ:
166
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
167
+ break;
168
+ case ACL_OTHER:
169
+ ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
170
+ break;
171
+ default:
172
+ /* Skip types that libarchive can't support. */
173
+ s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
174
+ continue;
175
+ }
176
+
177
+ // XXX acl_type maps to allow/deny/audit/YYYY bits
178
+ entry_acl_type = default_entry_acl_type;
179
+
180
+ if (acl_get_permset(acl_entry, &acl_permset) != 0) {
181
+ archive_set_error(&a->archive, errno,
182
+ "Failed to get ACL permission set");
183
+ return (ARCHIVE_WARN);
184
+ }
185
+
186
+ for (i = 0; i < acl_posix_perm_map_size; ++i) {
187
+ r = acl_get_perm(acl_permset,
188
+ acl_posix_perm_map[i].p_perm);
189
+ if (r == -1) {
190
+ archive_set_error(&a->archive, errno,
191
+ "Failed to check permission in an ACL "
192
+ "permission set");
193
+ return (ARCHIVE_WARN);
194
+ } else if (r)
195
+ ae_perm |= acl_posix_perm_map[i].a_perm;
196
+ }
197
+
198
+ archive_entry_acl_add_entry(entry, entry_acl_type,
199
+ ae_perm, ae_tag,
200
+ ae_id, ae_name);
201
+
202
+ s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
203
+ if (s == -1) {
204
+ archive_set_error(&a->archive, errno,
205
+ "Failed to get next ACL entry");
206
+ return (ARCHIVE_WARN);
207
+ }
208
+ }
209
+ return (ARCHIVE_OK);
210
+ }
211
+ #endif /* ARCHIVE_ACL_LIBACL */
212
+
213
+ #if ARCHIVE_ACL_LIBRICHACL
214
+ /*
215
+ * Translate RichACL into libarchive internal ACL
216
+ */
217
+ static int
218
+ translate_richacl(struct archive_read_disk *a, struct archive_entry *entry,
219
+ struct richacl *richacl)
220
+ {
221
+ int ae_id, ae_tag, ae_perm;
222
+ int entry_acl_type, i;
223
+ const char *ae_name;
224
+
225
+ struct richace *richace;
226
+
227
+ richacl_for_each_entry(richace, richacl) {
228
+ ae_name = NULL;
229
+ ae_tag = 0;
230
+ ae_perm = 0;
231
+ ae_id = -1;
232
+
233
+ switch (richace->e_type) {
234
+ case RICHACE_ACCESS_ALLOWED_ACE_TYPE:
235
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
236
+ break;
237
+ case RICHACE_ACCESS_DENIED_ACE_TYPE:
238
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
239
+ break;
240
+ default: /* Unknown entry type, skip */
241
+ continue;
242
+ }
243
+
244
+ /* Unsupported */
245
+ if (richace->e_flags & RICHACE_UNMAPPED_WHO)
246
+ continue;
247
+
248
+ if (richace->e_flags & RICHACE_SPECIAL_WHO) {
249
+ switch (richace->e_id) {
250
+ case RICHACE_OWNER_SPECIAL_ID:
251
+ ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
252
+ break;
253
+ case RICHACE_GROUP_SPECIAL_ID:
254
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
255
+ break;
256
+ case RICHACE_EVERYONE_SPECIAL_ID:
257
+ ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
258
+ break;
259
+ default: /* Unknown special ID type */
260
+ continue;
261
+ }
262
+ } else {
263
+ ae_id = richace->e_id;
264
+ if (richace->e_flags & RICHACE_IDENTIFIER_GROUP) {
265
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
266
+ ae_name = archive_read_disk_gname(&a->archive,
267
+ (gid_t)(richace->e_id));
268
+ } else {
269
+ ae_tag = ARCHIVE_ENTRY_ACL_USER;
270
+ ae_name = archive_read_disk_uname(&a->archive,
271
+ (uid_t)(richace->e_id));
272
+ }
273
+ }
274
+ for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
275
+ if ((richace->e_flags &
276
+ acl_nfs4_flag_map[i].p_perm) != 0)
277
+ ae_perm |= acl_nfs4_flag_map[i].a_perm;
278
+ }
279
+ for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
280
+ if ((richace->e_mask &
281
+ acl_nfs4_perm_map[i].p_perm) != 0)
282
+ ae_perm |=
283
+ acl_nfs4_perm_map[i].a_perm;
284
+ }
285
+
286
+ archive_entry_acl_add_entry(entry, entry_acl_type,
287
+ ae_perm, ae_tag, ae_id, ae_name);
288
+ }
289
+ return (ARCHIVE_OK);
290
+ }
291
+ #endif /* ARCHIVE_ACL_LIBRICHACL */
292
+
293
+ #if ARCHIVE_ACL_LIBRICHACL
294
+ static int
295
+ _richacl_mode_to_mask(short mode)
296
+ {
297
+ int mask = 0;
298
+
299
+ if (mode & S_IROTH)
300
+ mask |= RICHACE_POSIX_MODE_READ;
301
+ if (mode & S_IWOTH)
302
+ mask |= RICHACE_POSIX_MODE_WRITE;
303
+ if (mode & S_IXOTH)
304
+ mask |= RICHACE_POSIX_MODE_EXEC;
305
+
306
+ return (mask);
307
+ }
308
+
309
+ static void
310
+ _richacl_mode_to_masks(struct richacl *richacl, __LA_MODE_T mode)
311
+ {
312
+ richacl->a_owner_mask = _richacl_mode_to_mask((mode & 0700) >> 6);
313
+ richacl->a_group_mask = _richacl_mode_to_mask((mode & 0070) >> 3);
314
+ richacl->a_other_mask = _richacl_mode_to_mask(mode & 0007);
315
+ }
316
+ #endif /* ARCHIVE_ACL_LIBRICHACL */
317
+
318
+ #if ARCHIVE_ACL_LIBRICHACL
319
+ static int
320
+ set_richacl(struct archive *a, int fd, const char *name,
321
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
322
+ int ae_requested_type, const char *tname)
323
+ {
324
+ int ae_type, ae_permset, ae_tag, ae_id;
325
+ uid_t ae_uid;
326
+ gid_t ae_gid;
327
+ const char *ae_name;
328
+ int entries;
329
+ int i;
330
+ int ret;
331
+ int e = 0;
332
+ struct richacl *richacl = NULL;
333
+ struct richace *richace;
334
+
335
+ ret = ARCHIVE_OK;
336
+ entries = archive_acl_reset(abstract_acl, ae_requested_type);
337
+ if (entries == 0)
338
+ return (ARCHIVE_OK);
339
+
340
+ if (ae_requested_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
341
+ errno = ENOENT;
342
+ archive_set_error(a, errno, "Unsupported ACL type");
343
+ return (ARCHIVE_FAILED);
344
+ }
345
+
346
+ if (S_ISLNK(mode)) {
347
+ /* Linux does not support RichACLs on symbolic links */
348
+ return (ARCHIVE_OK);
349
+ }
350
+
351
+ richacl = richacl_alloc(entries);
352
+ if (richacl == NULL) {
353
+ archive_set_error(a, errno,
354
+ "Failed to initialize RichACL working storage");
355
+ return (ARCHIVE_FAILED);
356
+ }
357
+
358
+ e = 0;
359
+
360
+ while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
361
+ &ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
362
+ richace = &(richacl->a_entries[e]);
363
+
364
+ richace->e_flags = 0;
365
+ richace->e_mask = 0;
366
+
367
+ switch (ae_tag) {
368
+ case ARCHIVE_ENTRY_ACL_USER:
369
+ ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
370
+ richace->e_id = ae_uid;
371
+ break;
372
+ case ARCHIVE_ENTRY_ACL_GROUP:
373
+ ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
374
+ richace->e_id = ae_gid;
375
+ richace->e_flags |= RICHACE_IDENTIFIER_GROUP;
376
+ break;
377
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
378
+ richace->e_flags |= RICHACE_SPECIAL_WHO;
379
+ richace->e_id = RICHACE_OWNER_SPECIAL_ID;
380
+ break;
381
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
382
+ richace->e_flags |= RICHACE_SPECIAL_WHO;
383
+ richace->e_id = RICHACE_GROUP_SPECIAL_ID;
384
+ break;
385
+ case ARCHIVE_ENTRY_ACL_EVERYONE:
386
+ richace->e_flags |= RICHACE_SPECIAL_WHO;
387
+ richace->e_id = RICHACE_EVERYONE_SPECIAL_ID;
388
+ break;
389
+ default:
390
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
391
+ "Unsupported ACL tag");
392
+ ret = ARCHIVE_FAILED;
393
+ goto exit_free;
394
+ }
395
+
396
+ switch (ae_type) {
397
+ case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
398
+ richace->e_type =
399
+ RICHACE_ACCESS_ALLOWED_ACE_TYPE;
400
+ break;
401
+ case ARCHIVE_ENTRY_ACL_TYPE_DENY:
402
+ richace->e_type =
403
+ RICHACE_ACCESS_DENIED_ACE_TYPE;
404
+ break;
405
+ case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
406
+ case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
407
+ break;
408
+ default:
409
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
410
+ "Unsupported ACL entry type");
411
+ ret = ARCHIVE_FAILED;
412
+ goto exit_free;
413
+ }
414
+
415
+ for (i = 0; i < acl_nfs4_perm_map_size; ++i) {
416
+ if (ae_permset & acl_nfs4_perm_map[i].a_perm)
417
+ richace->e_mask |= acl_nfs4_perm_map[i].p_perm;
418
+ }
419
+
420
+ for (i = 0; i < acl_nfs4_flag_map_size; ++i) {
421
+ if (ae_permset &
422
+ acl_nfs4_flag_map[i].a_perm)
423
+ richace->e_flags |= acl_nfs4_flag_map[i].p_perm;
424
+ }
425
+ e++;
426
+ }
427
+
428
+ /* Fill RichACL masks */
429
+ _richacl_mode_to_masks(richacl, mode);
430
+
431
+ if (fd >= 0) {
432
+ if (richacl_set_fd(fd, richacl) == 0)
433
+ ret = ARCHIVE_OK;
434
+ else {
435
+ if (errno == EOPNOTSUPP) {
436
+ /* Filesystem doesn't support ACLs */
437
+ ret = ARCHIVE_OK;
438
+ } else {
439
+ archive_set_error(a, errno,
440
+ "Failed to set richacl on fd: %s", tname);
441
+ ret = ARCHIVE_WARN;
442
+ }
443
+ }
444
+ } else if (richacl_set_file(name, richacl) != 0) {
445
+ if (errno == EOPNOTSUPP) {
446
+ /* Filesystem doesn't support ACLs */
447
+ ret = ARCHIVE_OK;
448
+ } else {
449
+ archive_set_error(a, errno, "Failed to set richacl: %s",
450
+ tname);
451
+ ret = ARCHIVE_WARN;
452
+ }
453
+ }
454
+ exit_free:
455
+ richacl_free(richacl);
456
+ return (ret);
457
+ }
458
+ #endif /* ARCHIVE_ACL_RICHACL */
459
+
460
+ #if ARCHIVE_ACL_LIBACL
461
+ static int
462
+ set_acl(struct archive *a, int fd, const char *name,
463
+ struct archive_acl *abstract_acl, __LA_MODE_T mode,
464
+ int ae_requested_type, const char *tname)
465
+ {
466
+ int acl_type = 0;
467
+ int ae_type, ae_permset, ae_tag, ae_id;
468
+ uid_t ae_uid;
469
+ gid_t ae_gid;
470
+ const char *ae_name;
471
+ int entries;
472
+ int i;
473
+ int ret;
474
+ acl_t acl = NULL;
475
+ acl_entry_t acl_entry;
476
+ acl_permset_t acl_permset;
477
+
478
+ ret = ARCHIVE_OK;
479
+ entries = archive_acl_reset(abstract_acl, ae_requested_type);
480
+ if (entries == 0)
481
+ return (ARCHIVE_OK);
482
+
483
+ switch (ae_requested_type) {
484
+ case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
485
+ acl_type = ACL_TYPE_ACCESS;
486
+ break;
487
+ case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
488
+ acl_type = ACL_TYPE_DEFAULT;
489
+ break;
490
+ default:
491
+ errno = ENOENT;
492
+ archive_set_error(a, errno, "Unsupported ACL type");
493
+ return (ARCHIVE_FAILED);
494
+ }
495
+
496
+ if (S_ISLNK(mode)) {
497
+ /* Linux does not support ACLs on symbolic links */
498
+ return (ARCHIVE_OK);
499
+ }
500
+
501
+ if (acl_type == ACL_TYPE_DEFAULT && !S_ISDIR(mode)) {
502
+ errno = EINVAL;
503
+ archive_set_error(a, errno,
504
+ "Cannot set default ACL on non-directory");
505
+ return (ARCHIVE_WARN);
506
+ }
507
+
508
+ acl = acl_init(entries);
509
+ if (acl == (acl_t)NULL) {
510
+ archive_set_error(a, errno,
511
+ "Failed to initialize ACL working storage");
512
+ return (ARCHIVE_FAILED);
513
+ }
514
+
515
+ while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
516
+ &ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
517
+
518
+ if (acl_create_entry(&acl, &acl_entry) != 0) {
519
+ archive_set_error(a, errno,
520
+ "Failed to create a new ACL entry");
521
+ ret = ARCHIVE_FAILED;
522
+ goto exit_free;
523
+ }
524
+
525
+ switch (ae_tag) {
526
+ case ARCHIVE_ENTRY_ACL_USER:
527
+ ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
528
+ acl_set_tag_type(acl_entry, ACL_USER);
529
+ acl_set_qualifier(acl_entry, &ae_uid);
530
+ break;
531
+ case ARCHIVE_ENTRY_ACL_GROUP:
532
+ ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
533
+ acl_set_tag_type(acl_entry, ACL_GROUP);
534
+ acl_set_qualifier(acl_entry, &ae_gid);
535
+ break;
536
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
537
+ acl_set_tag_type(acl_entry, ACL_USER_OBJ);
538
+ break;
539
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
540
+ acl_set_tag_type(acl_entry, ACL_GROUP_OBJ);
541
+ break;
542
+ case ARCHIVE_ENTRY_ACL_MASK:
543
+ acl_set_tag_type(acl_entry, ACL_MASK);
544
+ break;
545
+ case ARCHIVE_ENTRY_ACL_OTHER:
546
+ acl_set_tag_type(acl_entry, ACL_OTHER);
547
+ break;
548
+ default:
549
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
550
+ "Unsupported ACL tag");
551
+ ret = ARCHIVE_FAILED;
552
+ goto exit_free;
553
+ }
554
+
555
+ if (acl_get_permset(acl_entry, &acl_permset) != 0) {
556
+ archive_set_error(a, errno,
557
+ "Failed to get ACL permission set");
558
+ ret = ARCHIVE_FAILED;
559
+ goto exit_free;
560
+ }
561
+ if (acl_clear_perms(acl_permset) != 0) {
562
+ archive_set_error(a, errno,
563
+ "Failed to clear ACL permissions");
564
+ ret = ARCHIVE_FAILED;
565
+ goto exit_free;
566
+ }
567
+
568
+ for (i = 0; i < acl_posix_perm_map_size; ++i) {
569
+ if (ae_permset & acl_posix_perm_map[i].a_perm) {
570
+ if (acl_add_perm(acl_permset,
571
+ acl_posix_perm_map[i].p_perm) != 0) {
572
+ archive_set_error(a, errno,
573
+ "Failed to add ACL permission");
574
+ ret = ARCHIVE_FAILED;
575
+ goto exit_free;
576
+ }
577
+ }
578
+ }
579
+
580
+ }
581
+
582
+ if (fd >= 0 && ae_requested_type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) {
583
+ if (acl_set_fd(fd, acl) == 0)
584
+ ret = ARCHIVE_OK;
585
+ else {
586
+ if (errno == EOPNOTSUPP) {
587
+ /* Filesystem doesn't support ACLs */
588
+ ret = ARCHIVE_OK;
589
+ } else {
590
+ archive_set_error(a, errno,
591
+ "Failed to set acl on fd: %s", tname);
592
+ ret = ARCHIVE_WARN;
593
+ }
594
+ }
595
+ } else if (acl_set_file(name, acl_type, acl) != 0) {
596
+ if (errno == EOPNOTSUPP) {
597
+ /* Filesystem doesn't support ACLs */
598
+ ret = ARCHIVE_OK;
599
+ } else {
600
+ archive_set_error(a, errno, "Failed to set acl: %s",
601
+ tname);
602
+ ret = ARCHIVE_WARN;
603
+ }
604
+ }
605
+ exit_free:
606
+ acl_free(acl);
607
+ return (ret);
608
+ }
609
+ #endif /* ARCHIVE_ACL_LIBACL */
610
+
611
+ int
612
+ archive_read_disk_entry_setup_acls(struct archive_read_disk *a,
613
+ struct archive_entry *entry, int *fd)
614
+ {
615
+ const char *accpath;
616
+ int r;
617
+ #if ARCHIVE_ACL_LIBACL
618
+ acl_t acl;
619
+ #endif
620
+ #if ARCHIVE_ACL_LIBRICHACL
621
+ struct richacl *richacl;
622
+ mode_t mode;
623
+ #endif
624
+
625
+ accpath = NULL;
626
+ r = ARCHIVE_OK;
627
+
628
+ /* For default ACLs we need reachable accpath */
629
+ if (*fd < 0 || S_ISDIR(archive_entry_mode(entry))) {
630
+ accpath = archive_read_disk_entry_setup_path(a, entry, fd);
631
+ if (accpath == NULL)
632
+ return (ARCHIVE_WARN);
633
+ }
634
+
635
+ archive_entry_acl_clear(entry);
636
+
637
+ #if ARCHIVE_ACL_LIBACL
638
+ acl = NULL;
639
+ #endif
640
+ #if ARCHIVE_ACL_LIBRICHACL
641
+ richacl = NULL;
642
+ #endif
643
+
644
+ #if ARCHIVE_ACL_LIBRICHACL
645
+ /* Try NFSv4 ACL first. */
646
+ if (*fd >= 0)
647
+ richacl = richacl_get_fd(*fd);
648
+ else if ((!a->follow_symlinks)
649
+ && (archive_entry_filetype(entry) == AE_IFLNK))
650
+ /* We can't get the ACL of a symlink, so we assume it can't
651
+ have one */
652
+ richacl = NULL;
653
+ else
654
+ richacl = richacl_get_file(accpath);
655
+
656
+ /* Ignore "trivial" ACLs that just mirror the file mode. */
657
+ if (richacl != NULL) {
658
+ mode = archive_entry_mode(entry);
659
+ if (richacl_equiv_mode(richacl, &mode) == 0) {
660
+ richacl_free(richacl);
661
+ richacl = NULL;
662
+ return (ARCHIVE_OK);
663
+ }
664
+ }
665
+
666
+ if (richacl != NULL) {
667
+ r = translate_richacl(a, entry, richacl);
668
+ richacl_free(richacl);
669
+ richacl = NULL;
670
+
671
+ if (r != ARCHIVE_OK) {
672
+ archive_set_error(&a->archive, errno,
673
+ "Couldn't translate NFSv4 ACLs");
674
+ }
675
+
676
+ return (r);
677
+ }
678
+ #endif /* ARCHIVE_ACL_LIBRICHACL */
679
+
680
+ #if ARCHIVE_ACL_LIBACL
681
+ /* Retrieve access ACL from file. */
682
+ if (*fd >= 0)
683
+ acl = acl_get_fd(*fd);
684
+ else if ((!a->follow_symlinks)
685
+ && (archive_entry_filetype(entry) == AE_IFLNK))
686
+ /* We can't get the ACL of a symlink, so we assume it can't
687
+ have one. */
688
+ acl = NULL;
689
+ else
690
+ acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
691
+
692
+ if (acl != NULL) {
693
+ r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
694
+ acl_free(acl);
695
+ acl = NULL;
696
+
697
+ if (r != ARCHIVE_OK) {
698
+ archive_set_error(&a->archive, errno,
699
+ "Couldn't translate access ACLs");
700
+ return (r);
701
+ }
702
+ }
703
+
704
+ /* Only directories can have default ACLs. */
705
+ if (S_ISDIR(archive_entry_mode(entry))) {
706
+ acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
707
+ if (acl != NULL) {
708
+ r = translate_acl(a, entry, acl,
709
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
710
+ acl_free(acl);
711
+ if (r != ARCHIVE_OK) {
712
+ archive_set_error(&a->archive, errno,
713
+ "Couldn't translate default ACLs");
714
+ return (r);
715
+ }
716
+ }
717
+ }
718
+ #endif /* ARCHIVE_ACL_LIBACL */
719
+ return (r);
720
+ }
721
+
722
+ int
723
+ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
724
+ struct archive_acl *abstract_acl, __LA_MODE_T mode)
725
+ {
726
+ int ret = ARCHIVE_OK;
727
+
728
+ #if !ARCHIVE_ACL_LIBRICHACL
729
+ (void)mode; /* UNUSED */
730
+ #endif
731
+
732
+ #if ARCHIVE_ACL_LIBRICHACL
733
+ if ((archive_acl_types(abstract_acl)
734
+ & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
735
+ ret = set_richacl(a, fd, name, abstract_acl, mode,
736
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
737
+ }
738
+ #if ARCHIVE_ACL_LIBACL
739
+ else
740
+ #endif
741
+ #endif /* ARCHIVE_ACL_LIBRICHACL */
742
+ #if ARCHIVE_ACL_LIBACL
743
+ if ((archive_acl_types(abstract_acl)
744
+ & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
745
+ if ((archive_acl_types(abstract_acl)
746
+ & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
747
+ ret = set_acl(a, fd, name, abstract_acl, mode,
748
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
749
+ if (ret != ARCHIVE_OK)
750
+ return (ret);
751
+ }
752
+ if ((archive_acl_types(abstract_acl)
753
+ & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
754
+ ret = set_acl(a, fd, name, abstract_acl, mode,
755
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
756
+ }
757
+ #endif /* ARCHIVE_ACL_LIBACL */
758
+ return (ret);
759
+ }
760
+ #endif /* ARCHIVE_ACL_LIBACL || ARCHIVE_ACL_LIBRICHACL */