summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2017-02-23 06:28:41 -0300
committerRenato Botelho <renato@netgate.com>2017-02-23 06:28:41 -0300
commit82ceeb2ea625cd9bff60f2863b9a0830f55b7905 (patch)
tree263ca9347bf664a4489743f9302e699ce14de1df
parent4a05f5440acda223e6a0ec5157bc32ecc0f09ff9 (diff)
parentd20dd8b36e7a565be7bfbb22aade51c8ffd753e9 (diff)
downloadFreeBSD-src-devel.zip
FreeBSD-src-devel.tar.gz
Merge remote-tracking branch 'origin/stable/10' into develdevel
-rw-r--r--Makefile11
-rw-r--r--Makefile.inc121
-rw-r--r--ObsoleteFiles.inc10
-rw-r--r--bin/cat/tests/Makefile16
-rw-r--r--bin/date/tests/Makefile2
-rw-r--r--bin/expr/tests/Makefile6
-rw-r--r--bin/ls/tests/Makefile2
-rw-r--r--bin/mv/tests/Makefile2
-rw-r--r--bin/pax/tests/Makefile2
-rw-r--r--bin/pkill/tests/Makefile2
-rw-r--r--bin/sh/tests/Makefile4
-rw-r--r--bin/sleep/tests/Makefile7
-rw-r--r--bin/test/tests/Makefile2
-rw-r--r--bin/tests/Makefile4
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c13
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c5
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh112
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh2
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d26
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.biglocal.d26
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c1
-rw-r--r--cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c4
-rw-r--r--cddl/lib/tests/Makefile4
-rw-r--r--cddl/sbin/tests/Makefile4
-rw-r--r--cddl/tests/Makefile4
-rw-r--r--cddl/usr.bin/tests/Makefile4
-rw-r--r--cddl/usr.sbin/dtrace/tests/Makefile14
-rw-r--r--cddl/usr.sbin/dtrace/tests/Makefile.inc152
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/Makefile89
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/aggs/Makefile189
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/arrays/Makefile29
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/assocs/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/begin/Makefile22
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/buffering/Makefile37
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile48
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/cg/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/clauses/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/cpc/Makefile27
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/decls/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/drops/Makefile24
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile118
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/end/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/enum/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/error/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/exit/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/funcs/Makefile113
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/grammar/Makefile20
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/include/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/inline/Makefile28
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/io/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/ip/Makefile36
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/java_api/Makefile44
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/json/Makefile23
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/lexer/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile50
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/mdb/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/mib/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/misc/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile34
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/nfs/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile28
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/operators/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/pid/Makefile69
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/pointers/Makefile48
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/pragma/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/predicates/Makefile25
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile53
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/print/Makefile32
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/printa/Makefile40
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/printf/Makefile68
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/privs/Makefile24
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/probes/Makefile36
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/proc/Makefile30
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile53
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/providers/Makefile44
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/raise/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/rates/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/safety/Makefile54
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/scalars/Makefile37
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sched/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/scripting/Makefile49
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sdt/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile31
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/speculation/Makefile75
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stability/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stack/Makefile22
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/stop/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/strlen/Makefile17
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile20
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/struct/Makefile31
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/syscall/Makefile18
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile19
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile38
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/trace/Makefile24
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile26
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/translators/Makefile51
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/typedef/Makefile21
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/types/Makefile69
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/uctf/Makefile41
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/union/Makefile27
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/usdt/Makefile65
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/ustack/Makefile20
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/vars/Makefile23
-rw-r--r--cddl/usr.sbin/dtrace/tests/common/version/Makefile17
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/dtest.sh129
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/exclude.sh194
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh85
-rwxr-xr-xcddl/usr.sbin/dtrace/tests/tools/gentest.sh110
-rw-r--r--cddl/usr.sbin/tests/Makefile4
-rw-r--r--contrib/libarchive/NEWS7
-rw-r--r--contrib/libarchive/cpio/cpio.c1
-rw-r--r--contrib/libarchive/libarchive/archive_acl.c1619
-rw-r--r--contrib/libarchive/libarchive/archive_acl_private.h22
-rw-r--r--contrib/libarchive/libarchive/archive_entry.c114
-rw-r--r--contrib/libarchive/libarchive/archive_entry.h68
-rw-r--r--contrib/libarchive/libarchive/archive_entry_acl.3324
-rw-r--r--contrib/libarchive/libarchive/archive_entry_locale.h10
-rw-r--r--contrib/libarchive/libarchive/archive_entry_strmode.c2
-rw-r--r--contrib/libarchive/libarchive/archive_match.c12
-rw-r--r--contrib/libarchive/libarchive/archive_platform.h19
-rw-r--r--contrib/libarchive/libarchive/archive_random.c2
-rw-r--r--contrib/libarchive/libarchive/archive_rb.c2
-rw-r--r--contrib/libarchive/libarchive/archive_read_disk.36
-rw-r--r--contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c738
-rw-r--r--contrib/libarchive/libarchive/archive_read_disk_posix.c6
-rw-r--r--contrib/libarchive/libarchive/archive_read_open_filename.c20
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_filter_lz4.c11
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_filter_lzop.c2
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_filter_program.c2
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_7zip.c10
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_cab.c2
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_cpio.c11
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_iso9660.c40
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_lha.c5
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_mtree.c15
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_rar.c2
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_tar.c162
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_warc.c230
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_xar.c18
-rw-r--r--contrib/libarchive/libarchive/archive_read_support_format_zip.c80
-rw-r--r--contrib/libarchive/libarchive/archive_string.c26
-rw-r--r--contrib/libarchive/libarchive/archive_string.h4
-rw-r--r--contrib/libarchive/libarchive/archive_string_composition.h2
-rw-r--r--contrib/libarchive/libarchive/archive_write.c2
-rw-r--r--contrib/libarchive/libarchive/archive_write_add_filter_program.c1
-rw-r--r--contrib/libarchive/libarchive/archive_write_add_filter_xz.c2
-rw-r--r--contrib/libarchive/libarchive/archive_write_disk_acl.c456
-rw-r--r--contrib/libarchive/libarchive/archive_write_disk_posix.c62
-rw-r--r--contrib/libarchive/libarchive/archive_write_open.311
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_7zip.c2
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_gnutar.c8
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_iso9660.c34
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_pax.c178
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_warc.c2
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_xar.c15
-rw-r--r--contrib/libarchive/libarchive/archive_write_set_format_zip.c10
-rw-r--r--contrib/libarchive/libarchive/libarchive-formats.54
-rw-r--r--contrib/libarchive/libarchive/tar.511
-rw-r--r--contrib/libarchive/libarchive/test/main.c134
-rw-r--r--contrib/libarchive/libarchive/test/test.h43
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_nfs4.c126
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_pax.c364
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_pax_nfs4.tar.uu129
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_pax_posix1e.tar.uu (renamed from contrib/libarchive/libarchive/test/test_acl_pax.tar.uu)2
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_platform_nfs4.c (renamed from contrib/libarchive/libarchive/test/test_acl_freebsd_nfs4.c)474
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_platform_posix1e.c (renamed from contrib/libarchive/libarchive/test/test_acl_freebsd_posix1e.c)431
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_posix1e.c144
-rw-r--r--contrib/libarchive/libarchive/test/test_acl_text.c473
-rw-r--r--contrib/libarchive/libarchive/test/test_archive_read_add_passphrase.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_archive_string.c24
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_gtar.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.c297
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_solaris_tar_acl.tar.uu220
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_star_acl.c321
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_star_acl_nfs4.tar.uu231
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_star_acl_posix1e.c215
-rw-r--r--contrib/libarchive/libarchive/test/test_compat_uudecode.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_fuzz.c4
-rw-r--r--contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c12
-rw-r--r--contrib/libarchive/libarchive/test/test_read_filter_lzop.c9
-rw-r--r--contrib/libarchive/libarchive/test/test_read_filter_lzop_multiple_parts.c8
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_7zip.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_cpio_afio.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_isorr_bz2.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip.c5
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_comment_stored.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_filename.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_mac_metadata.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_malformed.c1
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_nested.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_padded.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_sfx.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_traditional_encryption_data.c4
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_format_zip_winzip_aes_large.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_read_pax_schily_xattr.c70
-rw-r--r--contrib/libarchive/libarchive/test/test_read_pax_schily_xattr.tar.uu231
-rw-r--r--contrib/libarchive/libarchive/test/test_sparse_basic.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_write_disk_secure746.c3
-rw-r--r--contrib/libarchive/libarchive/test/test_write_filter_lz4.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_write_filter_lzop.c6
-rw-r--r--contrib/libarchive/libarchive/test/test_write_format_iso9660.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_write_format_iso9660_zisofs.c2
-rw-r--r--contrib/libarchive/libarchive/test/test_write_format_zip_large.c1
-rw-r--r--contrib/libarchive/libarchive/test/test_write_format_zip_zip64.c2
-rw-r--r--contrib/libarchive/libarchive/xxhash.c5
-rw-r--r--contrib/libarchive/tar/test/test_option_uid_uname.c8
-rw-r--r--contrib/libarchive/tar/util.c1
-rw-r--r--contrib/libc++/include/memory14
-rw-r--r--contrib/netbsd-tests/bin/cat/d_align.in2
-rw-r--r--contrib/netbsd-tests/bin/cat/d_align.out2
-rw-r--r--contrib/netbsd-tests/bin/cat/d_se_output.in3
-rw-r--r--contrib/netbsd-tests/bin/cat/d_se_output.out3
-rwxr-xr-xcontrib/netbsd-tests/bin/cat/t_cat.sh14
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/dotcmd/scoped_command25
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/dotcmd/t_dotcmd.sh6
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_arith.sh1035
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_cmdsub.sh783
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_evaltested.sh6
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_exit.sh120
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_expand.sh296
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_fsplit.sh244
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_here.sh536
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_option.sh674
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_redir.sh903
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_redircloexec.sh178
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_set_e.sh42
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_shift.sh181
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_ulimit.sh23
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_varquote.sh95
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_varval.sh251
-rwxr-xr-xcontrib/netbsd-tests/bin/sh/t_wait.sh152
-rwxr-xr-xcontrib/netbsd-tests/crypto/libcrypto/t_libcrypto.sh4
-rwxr-xr-xcontrib/netbsd-tests/crypto/libcrypto/t_pubkey.sh8
-rwxr-xr-xcontrib/netbsd-tests/crypto/opencrypto/t_opencrypto.sh10
-rw-r--r--contrib/netbsd-tests/dev/audio/h_pad.c10
-rw-r--r--contrib/netbsd-tests/dev/audio/t_pad_output.bz2.uue2032
-rw-r--r--contrib/netbsd-tests/dev/cgd/t_cgd_3des.c913
-rw-r--r--contrib/netbsd-tests/dev/cgd/t_cgd_aes.c3606
-rw-r--r--contrib/netbsd-tests/dev/cgd/t_cgd_blowfish.c2341
-rw-r--r--contrib/netbsd-tests/dev/dm/h_dm.c4
-rwxr-xr-xcontrib/netbsd-tests/dev/fss/t_fss.sh84
-rwxr-xr-xcontrib/netbsd-tests/dev/sysmon/t_swsensor.sh12
-rw-r--r--contrib/netbsd-tests/dev/sysmon/t_swwdog.c3
-rw-r--r--contrib/netbsd-tests/dev/usb/t_hid.c267
-rw-r--r--contrib/netbsd-tests/fs/common/fstest_lfs.c4
-rw-r--r--contrib/netbsd-tests/fs/common/h_fsmacros.h12
-rwxr-xr-xcontrib/netbsd-tests/fs/ffs/ffs_common.sh4
-rw-r--r--contrib/netbsd-tests/fs/fifofs/t_fifo.c3
-rw-r--r--contrib/netbsd-tests/fs/h_funcs.subr12
-rw-r--r--contrib/netbsd-tests/fs/nfs/nfsservice/mountd.c2575
-rw-r--r--contrib/netbsd-tests/fs/nfs/nfsservice/nfsd.c571
-rw-r--r--contrib/netbsd-tests/fs/nfs/nfsservice/rumpnfsd.c5
-rwxr-xr-xcontrib/netbsd-tests/fs/nfs/t_rquotad.sh4
-rwxr-xr-xcontrib/netbsd-tests/fs/psshfs/t_psshfs.sh23
-rw-r--r--contrib/netbsd-tests/fs/puffs/t_basic.c6
-rw-r--r--contrib/netbsd-tests/fs/tmpfs/h_funcs.subr19
-rw-r--r--contrib/netbsd-tests/fs/tmpfs/h_tools.c24
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_link.sh15
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_mknod.sh16
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_mount.sh16
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_readdir.sh8
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_remove.sh15
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_sizes.sh8
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_statvfs.sh8
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_vnd.sh33
-rwxr-xr-xcontrib/netbsd-tests/fs/tmpfs/t_vnode_leak.sh8
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_io.c20
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_renamerace.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_unpriv.c4
-rw-r--r--contrib/netbsd-tests/fs/vfs/t_vnops.c191
-rwxr-xr-xcontrib/netbsd-tests/games/t_factor.sh43
-rw-r--r--contrib/netbsd-tests/h_macros.h8
-rw-r--r--contrib/netbsd-tests/include/sys/t_bitops.c204
-rw-r--r--contrib/netbsd-tests/include/sys/t_cdefs.c116
-rw-r--r--contrib/netbsd-tests/include/sys/t_pslist.c125
-rw-r--r--contrib/netbsd-tests/include/sys/t_socket.c4
-rw-r--r--contrib/netbsd-tests/include/t_paths.c23
-rw-r--r--contrib/netbsd-tests/ipf/expected/n146
-rw-r--r--contrib/netbsd-tests/ipf/expected/n14_66
-rwxr-xr-xcontrib/netbsd-tests/ipf/t_filter_parse.sh3
-rwxr-xr-xcontrib/netbsd-tests/ipf/t_nat_exec.sh6
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_fifo.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_file.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_pipe.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/read/t_ttypty.c4
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_ioctl.c7
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc1.c13
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc2.c10
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_proc3.c9
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_sig.c17
-rw-r--r--contrib/netbsd-tests/kernel/kqueue/t_vnode.c536
-rw-r--r--contrib/netbsd-tests/kernel/msg.h136
-rw-r--r--contrib/netbsd-tests/kernel/t_mqueue.c3
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace.c208
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_wait.c5082
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_wait.h431
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_wait3.c30
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_wait4.c30
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_wait6.c30
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_waitid.c30
-rw-r--r--contrib/netbsd-tests/kernel/t_ptrace_waitpid.c30
-rw-r--r--contrib/netbsd-tests/kernel/t_rnd.c25
-rw-r--r--contrib/netbsd-tests/lib/libbpfjit/t_bpfjit.c818
-rw-r--r--contrib/netbsd-tests/lib/libc/arch/ia64/return_one.S11
-rw-r--r--contrib/netbsd-tests/lib/libc/arch/powerpc/return_one.S5
-rw-r--r--contrib/netbsd-tests/lib/libc/arch/riscv/return_one.S4
-rw-r--r--contrib/netbsd-tests/lib/libc/arch/sparc64/exec_prot_support.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/arch/sparc64/return_one.S11
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_faccessat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fchmodat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fchownat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fexecve.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_fstatat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mkfifoat.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_mknodat.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_o_search.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_openat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_readlinkat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_unlinkat.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/c063/t_utimensat.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/db/h_db.c77
-rw-r--r--contrib/netbsd-tests/lib/libc/db/h_lfsr.c179
-rwxr-xr-xcontrib/netbsd-tests/lib/libc/db/t_db.sh442
-rw-r--r--contrib/netbsd-tests/lib/libc/db/t_db_hash_seq.c343
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/execve/t_execve.c5
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/isqemu.h28
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_fileactions.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawn.c4
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/posix_spawn/t_spawnattr.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_assert.c17
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_dir.c56
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_floatunditf.c5
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_fnmatch.c30
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_fpsetmask.c25
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_ftok.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_humanize_number.c3
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_nice.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_randomid.c22
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_siginfo.c25
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_sleep.c24
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_time.c17
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_ttyname.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/gen/t_vis.c37
-rw-r--r--contrib/netbsd-tests/lib/libc/inet/t_inet_addr.c109
-rw-r--r--contrib/netbsd-tests/lib/libc/inet/t_inet_network.c68
-rwxr-xr-xcontrib/netbsd-tests/lib/libc/net/t_servent.sh4
-rw-r--r--contrib/netbsd-tests/lib/libc/rpc/t_rpc.c296
-rw-r--r--contrib/netbsd-tests/lib/libc/setjmp/t_setjmp.c2
-rw-r--r--contrib/netbsd-tests/lib/libc/setjmp/t_threadjmp.c2
-rwxr-xr-xcontrib/netbsd-tests/lib/libc/ssp/t_ssp.sh3
-rw-r--r--contrib/netbsd-tests/lib/libc/stdio/t_open_memstream.c96
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_getenv.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_posix_memalign.c75
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_strtod.c14
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_strtoi.c304
-rw-r--r--contrib/netbsd-tests/lib/libc/stdlib/t_strtol.c13
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_memcpy.c6
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_memmem.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_memset.c52
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strchr.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/string/t_strerror.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sync/cpp_atomic_ops_linkable.cc107
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_access.c19
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_bind.c78
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_chroot.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_clock_nanosleep.c63
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_connect.c31
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getcontext.c12
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getrusage.c10
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_getsockname.c82
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_kevent.c14
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mincore.c9
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mlock.c116
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mmap.c89
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_mprotect.c17
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_posix_fallocate.c63
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_setrlimit.c50
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_sigqueue.c155
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_timer_create.c119
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait.c323
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait_noproc.c345
-rw-r--r--contrib/netbsd-tests/lib/libc/sys/t_wait_noproc_wnohang.c30
-rw-r--r--contrib/netbsd-tests/lib/libc/t_cdb.c7
-rw-r--r--contrib/netbsd-tests/lib/libc/time/t_strptime.c257
-rw-r--r--contrib/netbsd-tests/lib/libcurses/director/testlang_parse.y5
-rw-r--r--contrib/netbsd-tests/lib/libm/t_casinh.c81
-rw-r--r--contrib/netbsd-tests/lib/libm/t_exp.c41
-rw-r--r--contrib/netbsd-tests/lib/libm/t_fe_round.c124
-rw-r--r--contrib/netbsd-tests/lib/libm/t_fenv.c220
-rw-r--r--contrib/netbsd-tests/lib/libm/t_fmod.c9
-rw-r--r--contrib/netbsd-tests/lib/libm/t_hypot.c81
-rw-r--r--contrib/netbsd-tests/lib/libm/t_ilogb.c130
-rw-r--r--contrib/netbsd-tests/lib/libm/t_ldexp.c12
-rw-r--r--contrib/netbsd-tests/lib/libm/t_log.c16
-rw-r--r--contrib/netbsd-tests/lib/libm/t_pow.c7
-rw-r--r--contrib/netbsd-tests/lib/libm/t_precision.c8
-rw-r--r--contrib/netbsd-tests/lib/libpthread/h_common.h6
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_cond.c25
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_mutex.c460
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_rwlock.c20
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_swapcontext.c9
-rw-r--r--contrib/netbsd-tests/lib/libpthread/t_timedmutex.c30
-rw-r--r--contrib/netbsd-tests/lib/librumpclient/h_execthr.c68
-rwxr-xr-xcontrib/netbsd-tests/lib/librumpclient/t_exec.sh4
-rw-r--r--contrib/netbsd-tests/lib/librumpclient/t_fd.c4
-rwxr-xr-xcontrib/netbsd-tests/lib/librumphijack/t_tcpip.sh19
-rw-r--r--contrib/netbsd-tests/lib/libusbhid/hid_test_data.c137
-rw-r--r--contrib/netbsd-tests/lib/libusbhid/t_usbhid.c452
-rw-r--r--contrib/netbsd-tests/lib/libusbhid/test_usb_hid_usages17
-rw-r--r--contrib/netbsd-tests/lib/libutil/t_parsedate.c473
-rwxr-xr-xcontrib/netbsd-tests/net/arp/t_arp.sh612
-rwxr-xr-xcontrib/netbsd-tests/net/arp/t_dad.sh201
-rw-r--r--contrib/netbsd-tests/net/bpfilter/t_bpfilter.c86
-rw-r--r--contrib/netbsd-tests/net/bpfjit/t_bpfjit.c756
-rw-r--r--contrib/netbsd-tests/net/icmp/t_forward.c6
-rwxr-xr-xcontrib/netbsd-tests/net/icmp/t_icmp6_redirect.sh152
-rwxr-xr-xcontrib/netbsd-tests/net/icmp/t_icmp_redirect.sh285
-rw-r--r--contrib/netbsd-tests/net/icmp/t_ping.c8
-rwxr-xr-xcontrib/netbsd-tests/net/icmp/t_ping2.sh4
-rw-r--r--contrib/netbsd-tests/net/if/ifconf.c134
-rw-r--r--contrib/netbsd-tests/net/if/t_compat.c4
-rwxr-xr-xcontrib/netbsd-tests/net/if/t_ifconf.sh100
-rwxr-xr-xcontrib/netbsd-tests/net/if/t_ifconfig.sh333
-rwxr-xr-xcontrib/netbsd-tests/net/if_bridge/t_bridge.sh409
-rwxr-xr-xcontrib/netbsd-tests/net/if_gif/t_gif.sh763
-rwxr-xr-xcontrib/netbsd-tests/net/if_pppoe/t_pppoe.sh416
-rwxr-xr-xcontrib/netbsd-tests/net/if_tap/t_tap.sh198
-rw-r--r--contrib/netbsd-tests/net/in_cksum/assym.h10
-rw-r--r--contrib/netbsd-tests/net/in_cksum/in_cksum.c270
-rwxr-xr-xcontrib/netbsd-tests/net/in_cksum/t_in_cksum.sh78
-rw-r--r--contrib/netbsd-tests/net/mcast/mcast.c559
-rwxr-xr-xcontrib/netbsd-tests/net/mcast/t_mcast.sh106
-rwxr-xr-xcontrib/netbsd-tests/net/mpls/t_ldp_regen.sh11
-rwxr-xr-xcontrib/netbsd-tests/net/mpls/t_mpls_fw.sh6
-rwxr-xr-xcontrib/netbsd-tests/net/mpls/t_mpls_fw6.sh220
-rwxr-xr-xcontrib/netbsd-tests/net/mpls/t_mpls_fw64.sh226
-rwxr-xr-xcontrib/netbsd-tests/net/mpls/t_rfc4182.sh6
-rwxr-xr-xcontrib/netbsd-tests/net/ndp/t_dad.sh276
-rwxr-xr-xcontrib/netbsd-tests/net/ndp/t_ndp.sh406
-rwxr-xr-xcontrib/netbsd-tests/net/ndp/t_ra.sh687
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_forwarding.sh530
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_ipaddress.sh193
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_ipv6_lifetime.sh127
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_ipv6address.sh387
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_mtudisc.sh192
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_mtudisc6.sh179
-rwxr-xr-xcontrib/netbsd-tests/net/net/t_ping6_opts.sh380
-rw-r--r--contrib/netbsd-tests/net/net/t_tcp.c15
-rwxr-xr-xcontrib/netbsd-tests/net/net_common.sh314
-rwxr-xr-xcontrib/netbsd-tests/net/route/t_change.sh255
-rwxr-xr-xcontrib/netbsd-tests/net/route/t_flags.sh334
-rwxr-xr-xcontrib/netbsd-tests/net/route/t_flags6.sh268
-rwxr-xr-xcontrib/netbsd-tests/net/route/t_route.sh406
-rw-r--r--contrib/netbsd-tests/rump/modautoload/t_modautoload.c15
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/h_server/h_simpleserver.c3
-rw-r--r--contrib/netbsd-tests/rump/rumpkern/t_lwproc.c4
-rwxr-xr-xcontrib/netbsd-tests/rump/rumpkern/t_sp.sh7
-rwxr-xr-xcontrib/netbsd-tests/rump/rumpnet/t_shmif.sh4
-rw-r--r--contrib/netbsd-tests/rump/rumpvfs/t_p2kifs.c3
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.2part.show.label8
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.2part.show.normal8
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.2part.show.uuid8
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.backup1851
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.disklabel27
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.disklabel.show.normal12
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.empty.show.normal7
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.removepart.show.normal8
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.resizedisk.show.normal9
-rw-r--r--contrib/netbsd-tests/sbin/gpt/gpt.resizepart.show.normal8
-rwxr-xr-xcontrib/netbsd-tests/sbin/gpt/t_gpt.sh318
-rwxr-xr-xcontrib/netbsd-tests/sbin/resize_ffs/common.sh4
-rwxr-xr-xcontrib/netbsd-tests/sbin/resize_ffs/t_check.sh (renamed from contrib/netbsd-tests/bin/sh/t_compexit.sh)57
-rwxr-xr-xcontrib/netbsd-tests/sbin/resize_ffs/t_grow.sh4
-rwxr-xr-xcontrib/netbsd-tests/sbin/resize_ffs/t_grow_swapped.sh4
-rwxr-xr-xcontrib/netbsd-tests/sbin/resize_ffs/t_shrink.sh4
-rwxr-xr-xcontrib/netbsd-tests/sbin/resize_ffs/t_shrink_swapped.sh4
-rwxr-xr-xcontrib/netbsd-tests/sbin/sysctl/t_perm.sh5
-rwxr-xr-xcontrib/netbsd-tests/share/mk/t_lib.sh8
-rwxr-xr-xcontrib/netbsd-tests/share/mk/t_prog.sh8
-rwxr-xr-xcontrib/netbsd-tests/share/mk/t_test.sh4
-rw-r--r--contrib/netbsd-tests/sys/net/t_print.c178
-rw-r--r--contrib/netbsd-tests/sys/netatalk/t_print.c135
-rw-r--r--contrib/netbsd-tests/sys/netinet/t_print.c144
-rw-r--r--contrib/netbsd-tests/sys/netinet6/t_print.c154
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/cc/t_hello.sh4
-rw-r--r--contrib/netbsd-tests/usr.bin/config/d_min6
-rw-r--r--contrib/netbsd-tests/usr.bin/config/support/conf/files15
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/config/t_config.sh203
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/gdb/t_regress.sh77
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/ld/t_script.sh230
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/ld/t_section.sh100
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/make/t_make.sh13
-rw-r--r--contrib/netbsd-tests/usr.bin/netpgpverify/Testspec114
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/netpgpverify/t_netpgpverify.sh15140
-rwxr-xr-xcontrib/netbsd-tests/usr.bin/sed/t_sed.sh19
-rw-r--r--contrib/netbsd-tests/usr.bin/sort/d_any_char_dflag_out.txtbin4 -> 1530 bytes
-rw-r--r--contrib/netbsd-tests/usr.bin/sort/d_any_char_fflag_out.txtbin4 -> 1530 bytes
-rw-r--r--contrib/netbsd-tests/usr.bin/sort/d_any_char_iflag_out.txtbin4 -> 1530 bytes
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_struct.c26
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_anon_union.c16
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_compound_literal_comma.c14
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_flex_array_packed.c6
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_nested_struct.c25
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_cast.c18
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_c99_union_init4.c15
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_cast_fun_array_param.c9
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_type_question_colon.c14
-rw-r--r--contrib/netbsd-tests/usr.bin/xlint/lint1/d_typefun.c22
-rwxr-xr-xcontrib/netbsd-tests/usr.sbin/traceroute/t_traceroute.sh4
-rw-r--r--contrib/zlib/ChangeLog55
-rw-r--r--contrib/zlib/README6
-rw-r--r--contrib/zlib/adler32.c21
-rw-r--r--contrib/zlib/compress.c42
-rw-r--r--contrib/zlib/contrib/README.contrib4
-rw-r--r--contrib/zlib/crc32.c41
-rw-r--r--contrib/zlib/deflate.c802
-rw-r--r--contrib/zlib/deflate.h35
-rw-r--r--contrib/zlib/gzguts.h23
-rw-r--r--contrib/zlib/gzlib.c31
-rw-r--r--contrib/zlib/gzread.c156
-rw-r--r--contrib/zlib/gzwrite.c332
-rw-r--r--contrib/zlib/infback.c4
-rw-r--r--contrib/zlib/inffast.c85
-rw-r--r--contrib/zlib/inflate.c123
-rw-r--r--contrib/zlib/inflate.h11
-rw-r--r--contrib/zlib/inftrees.c26
-rw-r--r--contrib/zlib/test/example.c17
-rw-r--r--contrib/zlib/test/infcover.c18
-rw-r--r--contrib/zlib/test/minigzip.c12
-rw-r--r--contrib/zlib/trees.c99
-rw-r--r--contrib/zlib/uncompr.c98
-rw-r--r--contrib/zlib/zconf.h41
-rw-r--r--contrib/zlib/zconf.h.in41
-rw-r--r--contrib/zlib/zlib.372
-rw-r--r--contrib/zlib/zlib.h452
-rw-r--r--contrib/zlib/zlib.map177
-rw-r--r--contrib/zlib/zutil.c49
-rw-r--r--contrib/zlib/zutil.h52
-rw-r--r--etc/mtree/BSD.tests.dist176
-rw-r--r--etc/mtree/BSD.var.dist2
-rw-r--r--gnu/lib/tests/Makefile4
-rw-r--r--gnu/tests/Makefile4
-rw-r--r--gnu/usr.bin/diff/tests/Makefile11
-rw-r--r--gnu/usr.bin/gdb/gdbserver/Makefile2
-rw-r--r--gnu/usr.bin/tests/Makefile4
-rw-r--r--include/stdlib.h2
-rw-r--r--lib/atf/libatf-c++/tests/Makefile3
-rw-r--r--lib/atf/libatf-c++/tests/detail/Makefile2
-rw-r--r--lib/atf/libatf-c/tests/Makefile3
-rw-r--r--lib/atf/libatf-c/tests/detail/Makefile2
-rw-r--r--lib/atf/tests/Makefile2
-rw-r--r--lib/atf/tests/test-programs/Makefile2
-rw-r--r--lib/csu/amd64/Makefile6
-rw-r--r--lib/csu/arm/Makefile6
-rw-r--r--lib/csu/i386-elf/Makefile6
-rw-r--r--lib/csu/mips/Makefile6
-rw-r--r--lib/csu/powerpc/Makefile6
-rw-r--r--lib/csu/powerpc64/Makefile6
-rw-r--r--lib/csu/sparc64/Makefile5
-rw-r--r--lib/libalias/libalias/Makefile2
-rw-r--r--lib/libalias/modules/Makefile2
-rw-r--r--lib/libalias/modules/Makefile.inc2
-rw-r--r--lib/libarchive/Makefile2
-rw-r--r--lib/libarchive/config_freebsd.h1
-rw-r--r--lib/libarchive/tests/Makefile18
-rw-r--r--lib/libauditd/Makefile2
-rw-r--r--lib/libbegemot/Makefile2
-rw-r--r--lib/libblocksruntime/Makefile2
-rw-r--r--lib/libbluetooth/Makefile2
-rw-r--r--lib/libbsm/Makefile2
-rw-r--r--lib/libbsnmp/libbsnmp/Makefile2
-rw-r--r--lib/libbz2/Makefile2
-rw-r--r--lib/libc++/Makefile6
-rw-r--r--lib/libc/db/hash/hash_page.c13
-rw-r--r--lib/libc/gen/nice.336
-rw-r--r--lib/libc/gen/nice.c16
-rw-r--r--lib/libc/string/memmem.322
-rw-r--r--lib/libc/string/memmem.c6
-rw-r--r--lib/libc/sys/recv.255
-rw-r--r--lib/libc/tests/Makefile3
-rw-r--r--lib/libc/tests/Makefile.netbsd-tests6
-rw-r--r--lib/libc/tests/c063/Makefile5
-rw-r--r--lib/libc/tests/db/Makefile8
-rw-r--r--lib/libc/tests/gen/Makefile14
-rw-r--r--lib/libc/tests/gen/execve/Makefile6
-rw-r--r--lib/libc/tests/gen/posix_spawn/Makefile6
-rw-r--r--lib/libc/tests/hash/Makefile8
-rw-r--r--lib/libc/tests/inet/Makefile5
-rw-r--r--lib/libc/tests/locale/Makefile2
-rw-r--r--lib/libc/tests/net/Makefile2
-rw-r--r--lib/libc/tests/net/getaddrinfo/Makefile4
-rw-r--r--lib/libc/tests/regex/Makefile2
-rw-r--r--lib/libc/tests/rpc/Makefile1
-rw-r--r--lib/libc/tests/setjmp/Makefile4
-rw-r--r--lib/libc/tests/ssp/Makefile6
-rw-r--r--lib/libc/tests/stdio/Makefile5
-rw-r--r--lib/libc/tests/stdio/open_memstream2_test.c (renamed from lib/libc/tests/stdio/open_memstream_test.c)0
-rw-r--r--lib/libc/tests/stdio/printbasic_test.c22
-rw-r--r--lib/libc/tests/stdio/printfloat_test.c19
-rw-r--r--lib/libc/tests/stdlib/Makefile10
-rw-r--r--lib/libc/tests/string/Makefile2
-rw-r--r--lib/libc/tests/sys/Makefile13
-rw-r--r--lib/libc/tests/sys/mlock_helper.c114
-rw-r--r--lib/libc/tests/termios/Makefile2
-rw-r--r--lib/libc/tests/time/Makefile2
-rw-r--r--lib/libc/tests/tls/Makefile1
-rw-r--r--lib/libc/tests/tls/dso/Makefile1
-rw-r--r--lib/libc/tests/ttyio/Makefile2
-rw-r--r--lib/libc_nonshared/Makefile6
-rw-r--r--lib/libcam/Makefile7
-rw-r--r--lib/libcom_err/Makefile2
-rw-r--r--lib/libcompat/Makefile2
-rw-r--r--lib/libcrypt/tests/Makefile2
-rw-r--r--lib/libcxxrt/Makefile2
-rw-r--r--lib/libexecinfo/Makefile2
-rw-r--r--lib/libexpat/Makefile2
-rw-r--r--lib/libgssapi/Makefile2
-rw-r--r--lib/libiconv_modules/Makefile.inc4
-rw-r--r--lib/libiconv_modules/mapper_parallel/Makefile2
-rw-r--r--lib/libkiconv/Makefile2
-rw-r--r--lib/libldns/Makefile2
-rw-r--r--lib/liblzma/Makefile6
-rw-r--r--lib/libmagic/Makefile2
-rw-r--r--lib/libmilter/Makefile2
-rw-r--r--lib/libmp/Makefile4
-rw-r--r--lib/libmp/tests/Makefile2
-rw-r--r--lib/libngatm/Makefile4
-rw-r--r--lib/libnv/tests/Makefile2
-rw-r--r--lib/libopie/Makefile2
-rw-r--r--lib/libpam/libpam/Makefile6
-rw-r--r--lib/libpam/libpam/tests/Makefile19
-rw-r--r--lib/libpam/modules/Makefile.inc4
-rw-r--r--lib/libpam/modules/pam_passwdqc/Makefile2
-rw-r--r--lib/libpam/modules/pam_ssh/Makefile2
-rw-r--r--lib/libpcap/Makefile2
-rw-r--r--lib/libprocstat/zfs/Makefile22
-rw-r--r--lib/librpcsec_gss/Makefile6
-rw-r--r--lib/librpcsvc/Makefile2
-rw-r--r--lib/librt/tests/Makefile6
-rw-r--r--lib/libsbuf/Makefile2
-rw-r--r--lib/libsm/Makefile2
-rw-r--r--lib/libsmb/Makefile2
-rw-r--r--lib/libsmdb/Makefile2
-rw-r--r--lib/libsmutil/Makefile2
-rw-r--r--lib/libstdthreads/Makefile2
-rw-r--r--lib/libtelnet/Makefile2
-rw-r--r--lib/libthr/Makefile12
-rw-r--r--lib/libthr/support/Makefile.inc12
-rw-r--r--lib/libthr/tests/Makefile5
-rw-r--r--lib/libthr/tests/dlopen/Makefile2
-rw-r--r--lib/libthr/tests/dlopen/dso/Makefile2
-rw-r--r--lib/libthread_db/Makefile2
-rw-r--r--lib/libufs/Makefile2
-rw-r--r--lib/libulog/Makefile2
-rw-r--r--lib/libunbound/Makefile4
-rw-r--r--lib/libutil/Makefile2
-rw-r--r--lib/libutil/tests/Makefile2
-rw-r--r--lib/libypclnt/Makefile6
-rw-r--r--lib/libz/Symbol.map11
-rw-r--r--lib/libz/Versions.def3
-rw-r--r--lib/libz/zlib.pc2
-rw-r--r--lib/msun/tests/Makefile13
-rw-r--r--lib/msun/tests/fmaxmin_test.c22
-rw-r--r--lib/ncurses/config.mk12
-rw-r--r--lib/ncurses/form/Makefile2
-rw-r--r--lib/ncurses/formw/Makefile2
-rw-r--r--lib/ncurses/menu/Makefile2
-rw-r--r--lib/ncurses/menuw/Makefile2
-rw-r--r--lib/ncurses/ncurses/Makefile2
-rw-r--r--lib/ncurses/ncursesw/Makefile4
-rw-r--r--lib/ncurses/panel/Makefile2
-rw-r--r--lib/ncurses/panelw/Makefile2
-rw-r--r--lib/tests/Makefile4
-rw-r--r--libexec/atf/atf-check/tests/Makefile4
-rw-r--r--libexec/atf/atf-sh/tests/Makefile4
-rw-r--r--libexec/atf/tests/Makefile4
-rw-r--r--libexec/tests/Makefile4
-rw-r--r--sbin/devd/tests/Makefile2
-rw-r--r--sbin/dhclient/tests/Makefile2
-rw-r--r--sbin/growfs/tests/Makefile2
-rw-r--r--sbin/kldload/kldload.c59
-rw-r--r--sbin/mdconfig/tests/Makefile3
-rw-r--r--sbin/tests/Makefile4
-rw-r--r--secure/lib/tests/Makefile4
-rw-r--r--secure/libexec/tests/Makefile4
-rw-r--r--secure/tests/Makefile4
-rw-r--r--secure/usr.bin/tests/Makefile4
-rw-r--r--secure/usr.sbin/tests/Makefile4
-rw-r--r--share/examples/tests/Makefile4
-rw-r--r--share/man/man4/alc.42
-rw-r--r--share/man/man4/unix.481
-rw-r--r--share/man/man7/build.713
-rw-r--r--share/mk/bsd.README21
-rw-r--r--share/mk/bsd.subdir.mk15
-rw-r--r--share/mk/bsd.sys.mk4
-rw-r--r--share/mk/bsd.test.mk20
-rw-r--r--share/mk/suite.test.mk77
-rw-r--r--share/tests/Makefile2
-rw-r--r--sys/cam/ctl/ctl.c3
-rw-r--r--sys/cam/ctl/ctl_backend_ramdisk.c4
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c67
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c2
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c17
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c4
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/sys/dtrace_impl.h19
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c3
-rw-r--r--sys/contrib/ipfilter/netinet/ip_fil.h8
-rw-r--r--sys/dev/alc/if_alc.c7
-rw-r--r--sys/dev/alc/if_alcreg.h1
-rw-r--r--sys/dev/e1000/if_em.c2
-rw-r--r--sys/dev/hyperv/include/hyperv.h12
-rw-r--r--sys/dev/hyperv/netvsc/hn_nvs.c14
-rw-r--r--sys/dev/hyperv/netvsc/hn_nvs.h1
-rw-r--r--sys/dev/hyperv/netvsc/if_hn.c202
-rw-r--r--sys/dev/hyperv/netvsc/if_hnreg.h11
-rw-r--r--sys/dev/hyperv/netvsc/if_hnvar.h7
-rw-r--r--sys/dev/hyperv/utilities/vmbus_timesync.c5
-rw-r--r--sys/dev/hyperv/vmbus/amd64/hyperv_machdep.c18
-rw-r--r--sys/dev/hyperv/vmbus/hyperv.c15
-rw-r--r--sys/dev/hyperv/vmbus/vmbus_et.c17
-rw-r--r--sys/dev/isp/isp.c15
-rw-r--r--sys/dev/nand/nand_geom.c2
-rw-r--r--sys/dev/pci/pci.c5
-rw-r--r--sys/dev/ppbus/vpo.c2
-rw-r--r--sys/fs/devfs/devfs_devs.c5
-rw-r--r--sys/fs/nfsserver/nfs_nfsdkrpc.c20
-rw-r--r--sys/i386/i386/pmap.c2
-rw-r--r--sys/kern/kern_lockf.c4
-rw-r--r--sys/modules/ath/Makefile34
-rw-r--r--sys/net/if.c8
-rw-r--r--sys/net/if_var.h5
-rw-r--r--sys/netinet/udp_usrreq.c8
-rw-r--r--sys/netpfil/ipfw/dn_heap.h2
-rw-r--r--sys/rpc/svc.c42
-rw-r--r--sys/rpc/svc.h6
-rw-r--r--sys/sys/syscallsubr.h2
-rw-r--r--sys/vm/vm_mmap.c81
-rw-r--r--tests/etc/Makefile2
-rw-r--r--tests/sys/Makefile3
-rw-r--r--tests/sys/fs/Makefile21
-rw-r--r--tests/sys/fs/tmpfs/Makefile56
-rw-r--r--tests/sys/geom/class/gate/1_test.sh63
-rw-r--r--tests/sys/geom/class/gate/2_test.sh48
-rw-r--r--tests/sys/geom/class/gate/3_test.sh49
-rw-r--r--tests/sys/geom/class/gate/Makefile12
-rwxr-xr-xtests/sys/geom/class/gate/conf.sh8
-rwxr-xr-xtests/sys/geom/class/gate/ggate_test.sh207
-rw-r--r--tests/sys/kqueue/Makefile28
-rw-r--r--tests/sys/kqueue/libkqueue/Makefile21
-rw-r--r--tests/sys/kqueue/libkqueue/Makefile.depend18
-rw-r--r--tests/sys/kqueue/libkqueue/common.h (renamed from tests/sys/kqueue/common.h)0
-rw-r--r--tests/sys/kqueue/libkqueue/config.h (renamed from tests/sys/kqueue/config.h)0
-rwxr-xr-xtests/sys/kqueue/libkqueue/kqueue_test.sh (renamed from tests/sys/kqueue/kqueue_test.sh)4
-rw-r--r--tests/sys/kqueue/libkqueue/main.c323
-rw-r--r--tests/sys/kqueue/libkqueue/proc.c (renamed from tests/sys/kqueue/proc.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/read.c326
-rw-r--r--tests/sys/kqueue/libkqueue/signal.c (renamed from tests/sys/kqueue/signal.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/timer.c (renamed from tests/sys/kqueue/timer.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/user.c (renamed from tests/sys/kqueue/user.c)0
-rw-r--r--tests/sys/kqueue/libkqueue/vnode.c (renamed from tests/sys/kqueue/vnode.c)22
-rw-r--r--tests/sys/mqueue/Makefile2
-rw-r--r--tests/sys/pjdfstest/tests/Makefile4
-rw-r--r--tools/test/dtrace/Makefile5
-rw-r--r--usr.bin/apply/tests/Makefile2
-rw-r--r--usr.bin/atm/sscop/Makefile2
-rw-r--r--usr.bin/awk/Makefile4
-rw-r--r--usr.bin/basename/tests/Makefile9
-rw-r--r--usr.bin/bluetooth/Makefile.inc2
-rw-r--r--usr.bin/bmake/tests/Makefile.inc3
-rw-r--r--usr.bin/bsdcat/Makefile6
-rw-r--r--usr.bin/calendar/tests/Makefile2
-rw-r--r--usr.bin/cmp/tests/Makefile9
-rw-r--r--usr.bin/col/tests/Makefile2
-rw-r--r--usr.bin/comm/tests/Makefile2
-rw-r--r--usr.bin/cut/tests/Makefile10
-rwxr-xr-xusr.bin/cut/tests/cut2_test.sh51
-rw-r--r--usr.bin/dirname/tests/Makefile9
-rw-r--r--usr.bin/file2c/tests/Makefile2
-rw-r--r--usr.bin/grep/tests/Makefile10
-rw-r--r--usr.bin/gzip/tests/Makefile9
-rw-r--r--usr.bin/join/tests/Makefile2
-rw-r--r--usr.bin/jot/tests/Makefile2
-rw-r--r--usr.bin/lastcomm/tests/Makefile2
-rw-r--r--usr.bin/m4/tests/Makefile2
-rw-r--r--usr.bin/ncal/tests/Makefile2
-rw-r--r--usr.bin/printf/tests/Makefile2
-rw-r--r--usr.bin/sed/tests/Makefile6
-rw-r--r--usr.bin/svn/Makefile.inc50
-rw-r--r--usr.bin/svn/svn/Makefile8
-rw-r--r--usr.bin/svn/svnadmin/Makefile8
-rw-r--r--usr.bin/svn/svnbench/Makefile8
-rw-r--r--usr.bin/svn/svndumpfilter/Makefile8
-rw-r--r--usr.bin/svn/svnfsfs/Makefile8
-rw-r--r--usr.bin/svn/svnlook/Makefile8
-rw-r--r--usr.bin/svn/svnmucc/Makefile8
-rw-r--r--usr.bin/svn/svnrdump/Makefile8
-rw-r--r--usr.bin/svn/svnserve/Makefile8
-rw-r--r--usr.bin/svn/svnsync/Makefile8
-rw-r--r--usr.bin/svn/svnversion/Makefile8
-rw-r--r--usr.bin/tests/Makefile4
-rw-r--r--usr.bin/truncate/tests/Makefile3
-rw-r--r--usr.bin/uudecode/tests/Makefile2
-rw-r--r--usr.bin/uuencode/tests/Makefile2
-rw-r--r--usr.bin/xargs/tests/Makefile2
-rw-r--r--usr.bin/yacc/tests/Makefile4
-rw-r--r--usr.sbin/arp/arp.c114
-rw-r--r--usr.sbin/bhyve/virtio.h2
-rwxr-xr-xusr.sbin/bsdinstall/scripts/auto7
-rw-r--r--usr.sbin/etcupdate/tests/Makefile2
-rw-r--r--usr.sbin/fstyp/tests/Makefile2
-rw-r--r--usr.sbin/kldxref/ef.c4
-rw-r--r--usr.sbin/newsyslog/tests/Makefile2
-rw-r--r--usr.sbin/nmtree/tests/Makefile4
-rw-r--r--usr.sbin/pw/tests/Makefile2
-rw-r--r--usr.sbin/sa/tests/Makefile2
-rw-r--r--usr.sbin/syslogd/syslogd.c14
-rw-r--r--usr.sbin/tests/Makefile4
-rw-r--r--usr.sbin/vidcontrol/vidcontrol.c44
-rw-r--r--usr.sbin/watchdogd/watchdogd.82
-rw-r--r--usr.sbin/watchdogd/watchdogd.c2
843 files changed, 64511 insertions, 18029 deletions
diff --git a/Makefile b/Makefile
index 3953bd4..a77f1ae 100644
--- a/Makefile
+++ b/Makefile
@@ -21,6 +21,7 @@
# kernel-toolchains - Build kernel-toolchain for all universe targets.
# doxygen - Build API documentation of the kernel, needs doxygen.
# update - Convenient way to update your source tree(s).
+# checkworld - Run test suite on installed world.
# check-old - List obsolete directories/files/libraries.
# check-old-dirs - List obsolete directories.
# check-old-files - List obsolete files.
@@ -99,8 +100,8 @@
# For more information, see the build(7) manual page.
#
TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
- check-old check-old-dirs check-old-files check-old-libs \
- checkdpadd clean cleandepend cleandir \
+ check check-old check-old-dirs check-old-files check-old-libs \
+ checkdpadd checkworld clean cleandepend cleandir \
delete-old delete-old-dirs delete-old-files delete-old-libs \
depend distribute distributekernel distributekernel.debug \
distributeworld distrib-dirs distribution doxygen \
@@ -108,7 +109,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel buildworld \
installkernel.debug packagekernel packageworld \
reinstallkernel reinstallkernel.debug \
installworld kernel-toolchain libraries lint maninstall \
- obj objlink regress rerelease showconfig tags toolchain update \
+ obj objlink rerelease showconfig tags toolchain update \
_worldtmp _legacy _bootstrap-tools _cleanobj _obj \
_build-tools _cross-tools _includes _libraries _depend \
build32 builddtb distribute32 install32 xdev xdev-build xdev-install \
@@ -374,6 +375,10 @@ make bmake: .PHONY
${MMAKE} all; \
${MMAKE} install DESTDIR=${MYMAKE:H} BINDIR=
+regress: .PHONY
+ @echo "'make regress' has been renamed 'make check'" | /usr/bin/fmt
+ @false
+
tinderbox toolchains kernel-toolchains: upgrade_checks
tinderbox:
diff --git a/Makefile.inc1 b/Makefile.inc1
index c1a071a..74756b9 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -35,6 +35,7 @@
# The intended user-driven targets are:
# buildworld - rebuild *everything*, including glue to help do upgrades
# installworld- install everything built by "buildworld"
+# checkworld - run test suite on installed world
# doxygen - build API documentation of the kernel
# update - convenient way to update your source tree (eg: svn/svnup)
#
@@ -50,6 +51,8 @@
.include <bsd.arch.inc.mk>
.include <bsd.compiler.mk>
+LOCALBASE?= /usr/local
+
# We must do share/info early so that installation of info `dir'
# entries works correctly. Do it first since it is less likely to
# grow dependencies on include and lib than vice versa.
@@ -784,7 +787,7 @@ _zoneinfo= zic tzsetup
_nmtree_itools= nmtree
.endif
-ITOOLS= [ awk cap_mkdb cat chflags chmod chown \
+ITOOLS= [ awk cap_mkdb cat chflags chmod chown cmp cp \
date echo egrep find grep id install ${_install-info} \
ln lockf make mkdir mtree ${_nmtree_itools} mv pwd_mkdb \
rm sed sh strip sysctl test true uname wc ${_zoneinfo} \
@@ -1190,12 +1193,26 @@ packagekernel:
.endif
#
+#
+# checkworld
+#
+# Run test suite on installed world.
+#
+checkworld: .PHONY
+ @if [ ! -x ${LOCALBASE}/bin/kyua ]; then \
+ echo "You need kyua (devel/kyua) to run the test suite." | /usr/bin/fmt; \
+ exit 1; \
+ fi
+ ${_+_}${LOCALBASE}/bin/kyua test -k ${TESTSBASE}/Kyuafile
+
+#
+#
# doxygen
#
# Build the API documentation with doxygen
#
doxygen: .PHONY
- @if [ ! -x `/usr/bin/which doxygen` ]; then \
+ @if [ ! -x ${LOCALBASE}/bin/doxygen ]; then \
echo "You need doxygen (devel/doxygen) to generate the API documentation of the kernel." | /usr/bin/fmt; \
exit 1; \
fi
diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index d5a4a1c..8e3c66a 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -38,6 +38,13 @@
# xargs -n1 | sort | uniq -d;
# done
+# 20170214: Four files from ggate tests consolidated into one
+OLD_FILES+=usr/tests/sys/geom/class/gate/1_test
+OLD_FILES+=usr/tests/sys/geom/class/gate/2_test
+OLD_FILES+=usr/tests/sys/geom/class/gate/3_test
+OLD_FILES+=usr/tests/sys/geom/class/gate/conf.sh
+# 20170211: libarchive ACL pax test renamed to test_acl_pax_posix1e.tar.uu
+OLD_FILES+=usr/tests/lib/libarchive/test_acl_pax.tar.uu
# 20161229: Three files from gnop tests consolidated into one
OLD_FILES+=usr/tests/sys/geom/class/nop/1_test
OLD_FILES+=usr/tests/sys/geom/class/nop/2_test
@@ -53,6 +60,9 @@ OLD_FILES+=usr/share/man/man4/hv_vss.4.gz
.endif
# 20161118: Remove hv_ata_pci_disengage(4)
OLD_FILES+=usr/share/man/man4/hv_ata_pci_disengage.4.gz
+# 20160906: libkqueue tests moved to /usr/tests/sys/kqueue/libkqueue
+OLD_FILES+=usr/tests/sys/kqueue/kqtest
+OLD_FILES+=usr/tests/sys/kqueue/kqueue_test
# 20160723: stale MLINK removed
OLD_FILES+=usr/share/man/man9/rman_await_resource.9.gz
# 20160216: Remove obsolete unbound-control-setup
diff --git a/bin/cat/tests/Makefile b/bin/cat/tests/Makefile
index 73f82e1..8ac1ffb 100644
--- a/bin/cat/tests/Makefile
+++ b/bin/cat/tests/Makefile
@@ -1,18 +1,20 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR}/../../..
-SRCTOP= ${.CURDIR}/../../..
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/bin/cat
-
-TESTSDIR= ${TESTSBASE}/bin/cat
-
NETBSD_ATF_TESTS_SH= cat_test
FILESDIR= ${TESTSDIR}
-FILES= d_align.in
+FILES+= d_align.in
FILES+= d_align.out
+FILES+= d_se_output.in
+FILES+= d_se_output.out
.include <netbsd-tests.test.mk>
+d_align.out: ${TESTSRC}/d_align.out
+ sed -E -e 's,^[[:space:]]{7}\$$$$,\$$,' < ${.ALLSRC} > ${.TARGET}.tmp
+ mv ${.TARGET}.tmp ${.TARGET}
+
+CLEANFILES+= d_align.out d_align.out.tmp
+
.include <bsd.test.mk>
diff --git a/bin/date/tests/Makefile b/bin/date/tests/Makefile
index d023195..ecce803 100644
--- a/bin/date/tests/Makefile
+++ b/bin/date/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/date
-
ATF_TESTS_SH= format_string_test
.include <bsd.test.mk>
diff --git a/bin/expr/tests/Makefile b/bin/expr/tests/Makefile
index 80c130c..21b0e99 100644
--- a/bin/expr/tests/Makefile
+++ b/bin/expr/tests/Makefile
@@ -1,11 +1,5 @@
# $FreeBSD$
-OBJTOP= ${.OBJDIR}/../../..
-SRCTOP= ${.CURDIR}/../../..
-TESTSRC= ${SRCTOP}/contrib/netbsd-tests/bin/expr
-
-TESTSDIR= ${TESTSBASE}/bin/expr
-
NETBSD_ATF_TESTS_SH= expr_test
ATF_TESTS_SH_SED_expr_test+= -e 's/eval expr/eval expr --/g'
diff --git a/bin/ls/tests/Makefile b/bin/ls/tests/Makefile
index ba8038c..89a2e8c 100644
--- a/bin/ls/tests/Makefile
+++ b/bin/ls/tests/Makefile
@@ -1,7 +1,5 @@
# $FreeBSD$
-TESTSDIR= ${TESTSBASE}/bin/ls
-
ATF_TESTS_SH+= ls_tests
# This seems like overkill, but the idea in mind is that all of the testcases
# should be runnable as !root
diff --git a/bin/mv/tests/Makefile b/bin/mv/tests/Makefile
index 3d437ef..229d96e 100644
--- a/bin/mv/tests/Makefile
+++ b/bin/mv/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/mv
-
TAP_TESTS_SH= legacy_test
.include <bsd.test.mk>
diff --git a/bin/pax/tests/Makefile b/bin/pax/tests/Makefile
index 1f27c18..8334fea 100644
--- a/bin/pax/tests/Makefile
+++ b/bin/pax/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/pax
-
TAP_TESTS_PERL= legacy_test
.include <bsd.test.mk>
diff --git a/bin/pkill/tests/Makefile b/bin/pkill/tests/Makefile
index a4a2c91..be46707 100644
--- a/bin/pkill/tests/Makefile
+++ b/bin/pkill/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/pkill
-
TAP_TESTS_SH= pgrep-F_test
TAP_TESTS_SH+= pgrep-LF_test
TAP_TESTS_SH+= pgrep-P_test
diff --git a/bin/sh/tests/Makefile b/bin/sh/tests/Makefile
index d10156c..d93e19a 100644
--- a/bin/sh/tests/Makefile
+++ b/bin/sh/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/sh
-
TESTS_SUBDIRS+= builtins
TESTS_SUBDIRS+= errors
TESTS_SUBDIRS+= execution
@@ -12,6 +10,4 @@ TESTS_SUBDIRS+= parameters
TESTS_SUBDIRS+= parser
TESTS_SUBDIRS+= set-e
-SUBDIR_PARALLEL=
-
.include <bsd.test.mk>
diff --git a/bin/sleep/tests/Makefile b/bin/sleep/tests/Makefile
index 9b286e6..6fc95f3 100644
--- a/bin/sleep/tests/Makefile
+++ b/bin/sleep/tests/Makefile
@@ -1,12 +1,7 @@
# $FreeBSD$
-TESTSRC= ${.CURDIR}/../../../contrib/netbsd-tests/bin/sleep
-.PATH: ${TESTSRC}
-
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/sleep
-ATF_TESTS_SH= sleep_test
-ATF_TESTS_SH_SRC_sleep_test= t_sleep.sh
+NETBSD_ATF_TESTS_SH= sleep_test
.include <bsd.test.mk>
diff --git a/bin/test/tests/Makefile b/bin/test/tests/Makefile
index 5ee337a..a1a5d4f 100644
--- a/bin/test/tests/Makefile
+++ b/bin/test/tests/Makefile
@@ -2,8 +2,6 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin/test
-
TAP_TESTS_SH= legacy_test
# Some tests in here are silently not run when the tests are executed as
# root. Explicitly tell Kyua to drop privileges.
diff --git a/bin/tests/Makefile b/bin/tests/Makefile
index 7a59b10..a0e63e5 100644
--- a/bin/tests/Makefile
+++ b/bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/bin
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
index 3cded11..9b878a2 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.c
@@ -26,6 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#include <sys/ioctl.h>
+
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
@@ -69,7 +71,7 @@ main(int argc, char *argv[])
*/
if (sigsetjmp(env, 1) == 0) {
for (;;)
- (void) ioctl(-1, -1, NULL);
+ (void) ioctl(-1, 0, NULL);
}
/*
@@ -80,20 +82,19 @@ main(int argc, char *argv[])
fds[n++] = open(file, O_WRONLY);
fds[n++] = open(file, O_RDWR);
- fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT | O_DSYNC |
- O_LARGEFILE | O_NOCTTY | O_NONBLOCK | O_NDELAY | O_RSYNC |
- O_SYNC | O_TRUNC | O_XATTR, 0666);
+ fds[n++] = open(file, O_RDWR | O_APPEND | O_CREAT |
+ O_NOCTTY | O_NONBLOCK | O_NDELAY | O_SYNC | O_TRUNC | 0666);
fds[n++] = open(file, O_RDWR);
(void) lseek(fds[n - 1], 123, SEEK_SET);
/*
* Once we have all the file descriptors in the state we want to test,
- * issue a bogus ioctl() on each fd with cmd -1 and arg NULL to whack
+ * issue a bogus ioctl() on each fd with cmd 0 and arg NULL to whack
* our DTrace script into recording the content of the fds[] array.
*/
for (i = 0; i < n; i++)
- (void) ioctl(fds[i], -1, NULL);
+ (void) ioctl(fds[i], 0, NULL);
assert(n <= sizeof (fds) / sizeof (fds[0]));
exit(0);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d
index 52a3312..8685142 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/io/tst.fds.d
@@ -36,7 +36,7 @@ syscall::ioctl:entry
}
syscall::ioctl:entry
-/pid == $1 && arg0 != -1u && arg1 == -1u && arg2 == NULL/
+/pid == $1 && arg0 != -1u && arg1 == 0 && arg2 == NULL/
{
printf("fds[%d] fi_name = %s\n", arg0, fds[arg0].fi_name);
printf("fds[%d] fi_dirname = %s\n", arg0, fds[arg0].fi_dirname);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c
index 307106d..2a54d49 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/json/tst.usdt.c
@@ -14,6 +14,8 @@
*/
#include <sys/sdt.h>
+#include <stdio.h>
+#include <stdlib.h>
#include "usdt.h"
#define FMT "{" \
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c
index bd89fff..dda3ef2 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/nfs/tst.call3.c
@@ -28,6 +28,7 @@
#include <strings.h>
#include <rpc/rpc.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <rpcsvc/mount.h>
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c
index 23bbab2..28d0677 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.args1.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
int
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
index 69df472..b3959c3 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.gcc.c
@@ -26,6 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#include <sys/types.h>
+#include <sys/wait.h>
#include <spawn.h>
#include <signal.h>
#include <stdio.h>
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c
index cfb88a8..12b3f72 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret1.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c
index b64aa05..ea5394e 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.ret2.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c
index 1418f2a..765c285 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak1.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c
index 8dabbe6..756745d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/pid/tst.weak2.c
@@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
+#include <stdlib.h>
#include <unistd.h>
/*
@@ -34,14 +35,14 @@
* leading underscores.
*/
-#pragma weak _go = go
-
static int
go(int a)
{
return (a + 1);
}
+#pragma weak _go = go
+
static void
handle(int sig)
{
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d
index 8d4bb81..10dc61d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d
@@ -44,7 +44,7 @@ BEGIN
printf("\n");
- printf("%%a = %a\n", &`kmem_alloc);
+ printf("%%a = %a\n", &`malloc);
printf("%%c = %c\n", i);
printf("%%d = %d\n", i);
printf("%%hd = %hd\n", (short)i);
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
index 55c1222..1d27405 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.basics.d.out
@@ -1,5 +1,5 @@
-%a = genunix`kmem_alloc
+%a = kernel`malloc
%c = a
%d = 97
%hd = 97
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
index a740413..67d7749 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d
@@ -36,6 +36,6 @@
BEGIN
{
- printf("sysname = %s", `utsname.sysname);
+ printf("sysname = %s", `ostype);
exit(0);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
index ba31981..82d597b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.str.d.out
@@ -1 +1 @@
-sysname = SunOS
+sysname = FreeBSD
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
index 32bc682..c2cf77d 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d
@@ -38,6 +38,6 @@
BEGIN
{
- printf("symbol = %a", &`kmem_alloc);
+ printf("symbol = %a", &`malloc);
exit(0);
}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
index 5ed9d8e..7f645e1 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/printf/tst.sym.d.out
@@ -1 +1 @@
-symbol = kernel`kmem_alloc
+symbol = kernel`malloc
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh
new file mode 100644
index 0000000..da776d0
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/privs/tst.kpriv.ksh
@@ -0,0 +1,112 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+#
+# Copyright (c) 2015, Joyent, Inc. All rights reserved.
+#
+
+err=/tmp/err.$$
+
+ppriv -s A=basic,dtrace_user $$
+
+#
+# When we lack dtrace_kernel, we expect to not be able to get at kernel memory
+# via any subroutine or other vector.
+#
+# trace(func((void *)&\`utsname)); }
+/usr/sbin/dtrace -wq -Cs /dev/stdin 2> $err <<EOF
+
+#define FAIL \
+ printf("able to read kernel memory via %s!\n", badsubr); \
+ exit(2);
+
+#define CANTREAD1(func) \
+ BEGIN { badsubr = "func()"; func((void *)&\`utsname); FAIL }
+
+#define CANTREAD2(func, arg1) \
+ BEGIN { badsubr = "func()"; func((void *)&\`utsname, arg1); FAIL }
+
+#define CANTREAD2ARG1(func, arg0) \
+ BEGIN { badsubr = "func() (arg1)"; func(arg0, (void *)&\`utsname); FAIL }
+
+#define CANTREAD3(func, arg1, arg2) \
+ BEGIN { badsubr = "func()"; func((void *)&\`utsname, arg1, arg2); FAIL }
+
+CANTREAD1(mutex_owned)
+CANTREAD1(mutex_owner)
+CANTREAD1(mutex_type_adaptive)
+CANTREAD1(mutex_type_spin)
+CANTREAD1(rw_read_held)
+CANTREAD1(rw_write_held)
+CANTREAD1(rw_iswriter)
+CANTREAD3(bcopy, alloca(1), 1)
+CANTREAD1(msgsize)
+CANTREAD1(msgdsize)
+CANTREAD1(strlen)
+CANTREAD2(strchr, '!')
+CANTREAD2(strrchr, '!')
+CANTREAD2(strstr, "doogle")
+CANTREAD2ARG1(strstr, "doogle")
+CANTREAD2(index, "bagnoogle")
+CANTREAD2ARG1(index, "bagnoogle")
+CANTREAD2(rindex, "bagnoogle")
+CANTREAD2ARG1(rindex, "bagnoogle")
+CANTREAD2(strtok, "doogle")
+CANTREAD2ARG1(strtok, "doogle")
+CANTREAD2(json, "doogle")
+CANTREAD2ARG1(json, "doogle")
+CANTREAD1(toupper)
+CANTREAD1(tolower)
+CANTREAD2(ddi_pathname, 1)
+CANTREAD2(strjoin, "doogle")
+CANTREAD2ARG1(strjoin, "doogle")
+CANTREAD1(strtoll)
+CANTREAD1(dirname)
+CANTREAD1(basename)
+CANTREAD1(cleanpath)
+
+#if defined(__amd64)
+CANTREAD3(copyout, uregs[R_R9], 1)
+CANTREAD3(copyoutstr, uregs[R_R9], 1)
+#else
+#if defined(__i386)
+CANTREAD3(copyout, uregs[R_ESP], 1)
+CANTREAD3(copyoutstr, uregs[R_ESP], 1)
+#endif
+#endif
+
+BEGIN
+{
+ exit(0);
+}
+
+ERROR
+/arg4 != DTRACEFLT_KPRIV/
+{
+ printf("bad error code via %s (expected %d, found %d)\n",
+ badsubr, DTRACEFLT_KPRIV, arg4);
+ exit(3);
+}
+
+ERROR
+/arg4 == DTRACEFLT_KPRIV/
+{
+ printf("illegal kernel access properly prevented from %s\n", badsubr);
+}
+EOF
+
+status=$?
+
+if [[ $status -eq 1 ]]; then
+ cat $err
+fi
+
+exit $status
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh
index 69c0f84..d2afbed 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.ufunc.ksh
@@ -64,7 +64,7 @@ child=$!
# ksh doing work. (This actually goes one step further and assumes that we
# catch some non-static function in ksh.)
#
-script | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
+script | tee /dev/fd/2 | egrep 'ksh(93)?`[a-zA-Z_]' > /dev/null
status=$?
kill $child
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh
index 6ca823f..8be34ec 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.umod.ksh
@@ -62,7 +62,7 @@ child=$!
#
# The only thing we can be sure of here is that ksh is doing some work.
#
-script | tee /dev/fd/2 | grep -w ksh > /dev/null
+script | tee /dev/fd/2 | egrep -w 'ksh(93)?' > /dev/null
status=$?
kill $child
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh
index b1a3ab9..8842d2b 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/profile-n/tst.usym.ksh
@@ -63,7 +63,7 @@ child=$!
# This test is essentially the same as that in the ufunc test; see that
# test for the rationale.
#
-script | tee /dev/fd/2 | grep 'ksh`[a-zA-Z_]' > /dev/null
+script | tee /dev/fd/2 | egrep 'ksh(93)?`[a-zA-Z_]' > /dev/null
status=$?
kill $child
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d
new file mode 100644
index 0000000..a50a759
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.bigglobal.d
@@ -0,0 +1,26 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ */
+
+struct mrbig {
+ char toomany[100000];
+};
+
+struct mrbig mrbig;
+
+BEGIN
+{
+ mrbig.toomany[0] = '!';
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.biglocal.d b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.biglocal.d
new file mode 100644
index 0000000..08a2a4c
--- /dev/null
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/scalars/err.biglocal.d
@@ -0,0 +1,26 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright (c) 2015, Joyent, Inc. All rights reserved.
+ */
+
+struct mrbig {
+ char toomany[100000];
+};
+
+this struct mrbig mrbig;
+
+BEGIN
+{
+ this->mrbig.toomany[0] = '!';
+ exit(0);
+}
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c
index 209160b..198d9db 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/syscall/tst.args.c
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <sys/syscall.h>
+#include <unistd.h>
/*ARGSUSED*/
int
diff --git a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c
index ade7f83..e229c0c 100644
--- a/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c
+++ b/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/usdt/tst.forker.c
@@ -26,6 +26,10 @@
#pragma ident "%Z%%M% %I% %E% SMI"
+#include <sys/types.h>
+#include <sys/wait.h>
+
+#include <stdlib.h>
#include <unistd.h>
#include "forker.h"
diff --git a/cddl/lib/tests/Makefile b/cddl/lib/tests/Makefile
index 4a49d9f..a0e63e5 100644
--- a/cddl/lib/tests/Makefile
+++ b/cddl/lib/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/lib
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/sbin/tests/Makefile b/cddl/sbin/tests/Makefile
index 91bbaee..a0e63e5 100644
--- a/cddl/sbin/tests/Makefile
+++ b/cddl/sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/sbin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/tests/Makefile b/cddl/tests/Makefile
index 34a27ea..a0e63e5 100644
--- a/cddl/tests/Makefile
+++ b/cddl/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl
-
-.PATH: ${.CURDIR:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/usr.bin/tests/Makefile b/cddl/usr.bin/tests/Makefile
index c94d591..a0e63e5 100644
--- a/cddl/usr.bin/tests/Makefile
+++ b/cddl/usr.bin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/usr.bin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/Makefile b/cddl/usr.sbin/dtrace/tests/Makefile
new file mode 100644
index 0000000..7db6f2f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+TESTS_SUBDIRS+= common
+
+.PATH: ${SRCTOP}/tests
+KYUAFILE= YES
+
+.PATH: ${.CURDIR}/tools
+SCRIPTSDIR= ${TESTSDIR}
+SCRIPTS= dtest.sh
+
+.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/Makefile.inc1 b/cddl/usr.sbin/dtrace/tests/Makefile.inc1
new file mode 100644
index 0000000..6958f78
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/Makefile.inc1
@@ -0,0 +1,52 @@
+# $FreeBSD$
+
+TESTGROUP= ${.CURDIR:H:T}/${.CURDIR:T}
+TESTSRC= ${.CURDIR:H:H:H:H:H}/contrib/opensolaris/cmd/dtrace/test/tst/${TESTGROUP}
+TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace/${TESTGROUP}
+
+.if !defined(_RECURSING_PROGS)
+FILESGROUPS+= FILES ${TESTGROUP} ${TESTGROUP}EXE
+
+${TESTGROUP}= ${TESTFILES}
+${TESTGROUP}EXE= ${TESTEXES}
+${TESTGROUP}EXEMODE= 0555
+
+${TESTGROUP}DIR= ${TESTSDIR}
+${TESTGROUP}EXEDIR= ${TESTSDIR}
+
+TESTWRAPPER= t_dtrace_contrib
+ATF_TESTS_SH+= ${TESTWRAPPER}
+TEST_METADATA.t_dtrace_contrib+= required_files="/usr/local/bin/ksh"
+TEST_METADATA.t_dtrace_contrib+= required_user="root"
+
+GENTEST?= ${.CURDIR:H:H}/tools/gentest.sh
+EXCLUDE= ${.CURDIR:H:H}/tools/exclude.sh
+${TESTWRAPPER}.sh: ${GENTEST} ${EXCLUDE} ${${TESTGROUP}}
+ sh ${GENTEST} -e ${EXCLUDE} ${TESTGROUP} ${${TESTGROUP}:S/ */ /} > ${.TARGET}
+
+CLEANFILES+= ${TESTWRAPPER}.sh
+.endif # !defined(_RECURSING_PROGS)
+
+.PATH: ${TESTSRC}
+
+PROGS= ${CFILES:T:S/.c$/.exe/g}
+.for prog in ${PROGS}
+SRCS.${prog}+= ${prog:S/.exe$/.c/}
+BINDIR.${prog}= ${TESTSDIR}
+MAN.${prog}=
+
+.if exists(${prog:S/^tst.//:S/.exe$/.d/})
+SRCS.${prog}+= ${prog:S/^tst.//:S/.exe$/.d/}
+.endif
+.endfor
+
+# Some tests depend on the internals of their corresponding test programs,
+# so make sure the optimizer doesn't interfere with them.
+CFLAGS+= -O0
+
+# Test programs shouldn't be stripped; else we generally can't use the PID
+# provider.
+DEBUG_FLAGS= -g
+STRIP=
+
+.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/common/Makefile b/cddl/usr.sbin/dtrace/tests/common/Makefile
new file mode 100644
index 0000000..7c7bb17
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/Makefile
@@ -0,0 +1,89 @@
+# $FreeBSD$
+
+# We exclude several subdirectories: nfs and sysevent do not compile on
+# FreeBSD, and docsExamples doesn't seem amenable to automated testing.
+
+TESTSDIR= ${TESTSBASE}/cddl/usr.sbin/dtrace/common
+TESTS_SUBDIRS+= aggs \
+ arithmetic \
+ arrays \
+ assocs \
+ begin \
+ bitfields \
+ buffering \
+ builtinvar \
+ cg \
+ clauses \
+ cpc \
+ decls \
+ drops \
+ dtraceUtil \
+ end \
+ enum \
+ error \
+ exit \
+ fbtprovider \
+ funcs \
+ grammar \
+ include \
+ inline \
+ io \
+ ip \
+ java_api \
+ json \
+ lexer \
+ llquantize \
+ mdb \
+ mib \
+ misc \
+ multiaggs \
+ offsetof \
+ operators \
+ pid \
+ plockstat \
+ pointers \
+ pragma \
+ predicates \
+ preprocessor \
+ print \
+ printa \
+ printf \
+ privs \
+ probes \
+ proc \
+ profile-n \
+ providers \
+ raise \
+ rates \
+ safety \
+ scalars \
+ sched \
+ scripting \
+ sdt \
+ sizeof \
+ speculation \
+ stability \
+ stack \
+ stackdepth \
+ stop \
+ strlen \
+ strtoll \
+ struct \
+ syscall \
+ tick-n \
+ trace \
+ tracemem \
+ translators \
+ typedef \
+ types \
+ uctf \
+ union \
+ usdt \
+ ustack \
+ vars \
+ version \
+
+.PATH: ${.CURDIR:H:H:H:H:H}/tests
+KYUAFILE= YES
+
+.include <bsd.test.mk>
diff --git a/cddl/usr.sbin/dtrace/tests/common/aggs/Makefile b/cddl/usr.sbin/dtrace/tests/common/aggs/Makefile
new file mode 100644
index 0000000..d8a5ef0
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/aggs/Makefile
@@ -0,0 +1,189 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_AGG_FUNC.bad.d \
+ err.D_AGG_MDIM.bad.d \
+ err.D_AGG_NULL.bad.d \
+ err.D_AGG_REDEF.redef.d \
+ err.D_AGG_SCALAR.avgtoofew.d \
+ err.D_AGG_SCALAR.maxnoarg.d \
+ err.D_AGG_SCALAR.mintoofew.d \
+ err.D_AGG_SCALAR.quantizetoofew.d \
+ err.D_AGG_SCALAR.stddevtoofew.d \
+ err.D_AGG_SCALAR.sumtoofew.d \
+ err.D_CLEAR_AGGARG.bad.d \
+ err.D_CLEAR_PROTO.bad.d \
+ err.D_FUNC_IDENT.bad.d \
+ err.D_FUNC_UNDEF.badaggfunc.d \
+ err.D_IDENT_UNDEF.badexpr.d \
+ err.D_IDENT_UNDEF.badkey3.d \
+ err.D_IDENT_UNDEF.noeffect.d \
+ err.D_KEY_TYPE.badkey1.d \
+ err.D_KEY_TYPE.badkey2.d \
+ err.D_KEY_TYPE.badkey4.d \
+ err.D_LQUANT_BASETYPE.lqbad1.d \
+ err.D_LQUANT_BASETYPE.lqshort.d \
+ err.D_LQUANT_BASEVAL.bad.d \
+ err.D_LQUANT_LIMTYPE.lqbad1.d \
+ err.D_LQUANT_LIMVAL.bad.d \
+ err.D_LQUANT_MATCHBASE.d \
+ err.D_LQUANT_MATCHBASE.order.d \
+ err.D_LQUANT_MATCHLIM.d \
+ err.D_LQUANT_MATCHLIM.order.d \
+ err.D_LQUANT_MATCHSTEP.d \
+ err.D_LQUANT_MISMATCH.lqbadarg.d \
+ err.D_LQUANT_STEPLARGE.lqtoofew.d \
+ err.D_LQUANT_STEPSMALL.bad.d \
+ err.D_LQUANT_STEPTYPE.lqbadinc.d \
+ err.D_LQUANT_STEPVAL.bad.d \
+ err.D_NORMALIZE_AGGARG.bad.d \
+ err.D_NORMALIZE_PROTO.bad.d \
+ err.D_NORMALIZE_SCALAR.bad.d \
+ err.D_PROTO_ARG.lquantizetoofew.d \
+ err.D_PROTO_LEN.avgnoarg.d \
+ err.D_PROTO_LEN.avgtoomany.d \
+ err.D_PROTO_LEN.counttoomany.d \
+ err.D_PROTO_LEN.lquantizenoarg.d \
+ err.D_PROTO_LEN.lquantizetoomany.d \
+ err.D_PROTO_LEN.maxnoarg.d \
+ err.D_PROTO_LEN.maxtoomany.d \
+ err.D_PROTO_LEN.minnoarg.d \
+ err.D_PROTO_LEN.mintoomany.d \
+ err.D_PROTO_LEN.quantizenoarg.d \
+ err.D_PROTO_LEN.quantizetoomany.d \
+ err.D_PROTO_LEN.stddevnoarg.d \
+ err.D_PROTO_LEN.stddevtoomany.d \
+ err.D_PROTO_LEN.sumnoarg.d \
+ err.D_PROTO_LEN.sumtoomany.d \
+ err.D_TRUNC_AGGARG.bad.d \
+ err.D_TRUNC_PROTO.badmany.d \
+ err.D_TRUNC_PROTO.badnone.d \
+ err.D_TRUNC_SCALAR.bad.d \
+ tst.aggencoding.d \
+ tst.aggencoding.d.out \
+ tst.agghist.d \
+ tst.agghist.d.out \
+ tst.aggpack.d \
+ tst.aggpack.d.out \
+ tst.aggpackbanner.ksh \
+ tst.aggpackbanner.ksh.out \
+ tst.aggpackzoom.d \
+ tst.aggpackzoom.d.out \
+ tst.aggzoom.d \
+ tst.aggzoom.d.out \
+ tst.allquant.d \
+ tst.allquant.d.out \
+ tst.avg.d \
+ tst.avg.d.out \
+ tst.avg_neg.d \
+ tst.avg_neg.d.out \
+ tst.clear.d \
+ tst.clear.d.out \
+ tst.clearavg.d \
+ tst.clearavg.d.out \
+ tst.clearavg2.d \
+ tst.clearavg2.d.out \
+ tst.cleardenormalize.d \
+ tst.cleardenormalize.d.out \
+ tst.clearlquantize.d \
+ tst.clearlquantize.d.out \
+ tst.clearnormalize.d \
+ tst.clearnormalize.d.out \
+ tst.clearstddev.d \
+ tst.clearstddev.d.out \
+ tst.count.d \
+ tst.count.d.out \
+ tst.count2.d \
+ tst.count2.d.out \
+ tst.count3.d \
+ tst.denormalize.d \
+ tst.denormalize.d.out \
+ tst.denormalizeonly.d \
+ tst.denormalizeonly.d.out \
+ tst.fmtnormalize.d \
+ tst.fmtnormalize.d.out \
+ tst.forms.d \
+ tst.forms.d.out \
+ tst.goodkey.d \
+ tst.keysort.d \
+ tst.keysort.d.out \
+ tst.lquantize.d \
+ tst.lquantize.d.out \
+ tst.lquantnormal.d \
+ tst.lquantnormal.d.out \
+ tst.lquantrange.d \
+ tst.lquantrange.d.out \
+ tst.lquantround.d \
+ tst.lquantround.d.out \
+ tst.lquantzero.d \
+ tst.lquantzero.d.out \
+ tst.max.d \
+ tst.max.d.out \
+ tst.max_neg.d \
+ tst.max_neg.d.out \
+ tst.min.d \
+ tst.min.d.out \
+ tst.min_neg.d \
+ tst.min_neg.d.out \
+ tst.multiaggs1.d \
+ tst.multiaggs2.d \
+ tst.multiaggs2.d.out \
+ tst.multiaggs3.d \
+ tst.multiaggs3.d.out \
+ tst.multinormalize.d \
+ tst.multinormalize.d.out \
+ tst.neglquant.d \
+ tst.neglquant.d.out \
+ tst.negorder.d \
+ tst.negorder.d.out \
+ tst.negquant.d \
+ tst.negquant.d.out \
+ tst.negtrunc.d \
+ tst.negtrunc.d.out \
+ tst.negtruncquant.d \
+ tst.negtruncquant.d.out \
+ tst.normalize.d \
+ tst.normalize.d.out \
+ tst.order.d \
+ tst.order.d.out \
+ tst.quantize.d \
+ tst.quantize.d.out \
+ tst.quantmany.d \
+ tst.quantmany.d.out \
+ tst.quantround.d \
+ tst.quantround.d.out \
+ tst.quantzero.d \
+ tst.quantzero.d.out \
+ tst.signature.d \
+ tst.signedkeys.d \
+ tst.signedkeys.d.out \
+ tst.signedkeyspos.d \
+ tst.signedkeyspos.d.out \
+ tst.sizedkeys.d \
+ tst.sizedkeys.d.out \
+ tst.stddev.d \
+ tst.stddev.d.out \
+ tst.subr.d \
+ tst.sum.d \
+ tst.sum.d.out \
+ tst.trunc.d \
+ tst.trunc.d.out \
+ tst.trunc0.d \
+ tst.trunc0.d.out \
+ tst.truncquant.d \
+ tst.truncquant.d.out \
+ tst.valsortkeypos.d \
+ tst.valsortkeypos.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile b/cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile
new file mode 100644
index 0000000..7f1fa96
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/arithmetic/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DIV_ZERO.divby0.d \
+ err.D_DIV_ZERO.divby0_1.d \
+ err.D_DIV_ZERO.divby0_2.d \
+ err.D_DIV_ZERO.modby0.d \
+ err.D_SYNTAX.addmin.d \
+ err.D_SYNTAX.divmin.d \
+ err.D_SYNTAX.muladd.d \
+ err.D_SYNTAX.muldiv.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.compcast.d \
+ tst.compcast.d.out \
+ tst.compnarrowassign.d \
+ tst.compnarrowassign.d.out \
+ tst.execcast.d \
+ tst.execcast.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/arrays/Makefile b/cddl/usr.sbin/dtrace/tests/common/arrays/Makefile
new file mode 100644
index 0000000..608388f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/arrays/Makefile
@@ -0,0 +1,29 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ARR_BADREF.bad.d \
+ err.D_DECL_ARRBIG.toobig.d \
+ err.D_DECL_ARRNULL.bad.d \
+ err.D_DECL_ARRSUB.bad.d \
+ err.D_DECL_PROTO_TYPE.badtuple.d \
+ err.D_IDENT_UNDEF.badureg.d \
+ tst.basic1.d \
+ tst.basic2.d \
+ tst.basic3.d \
+ tst.basic4.d \
+ tst.basic5.d \
+ tst.basic6.d \
+ tst.uregsarray.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/assocs/Makefile b/cddl/usr.sbin/dtrace/tests/common/assocs/Makefile
new file mode 100644
index 0000000..5d20b61
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/assocs/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_OP_INCOMPAT.dupgtype.d \
+ err.D_OP_INCOMPAT.dupttype.d \
+ err.D_OP_INCOMPAT.this.d \
+ err.D_PROTO_ARG.badsig.d \
+ err.D_PROTO_LEN.toofew.d \
+ err.D_PROTO_LEN.toomany.d \
+ err.D_SYNTAX.errassign.d \
+ err.tupoflow.d \
+ tst.cpyarray.d \
+ tst.diffprofile.d \
+ tst.initialize.d \
+ tst.invalidref.d \
+ tst.misc.d \
+ tst.orthogonality.d \
+ tst.this.d \
+ tst.valassign.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/begin/Makefile b/cddl/usr.sbin/dtrace/tests/common/begin/Makefile
new file mode 100644
index 0000000..4437db9
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/begin/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.begin.d \
+ err.D_PDESC_ZERO.tick.d \
+ tst.begin.d \
+ tst.begin.d.out \
+ tst.multibegin.d \
+ tst.multibegin.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile b/cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile
new file mode 100644
index 0000000..838ad68
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/bitfields/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_BITFIELD.BitfieldAddress.d \
+ err.D_DECL_BFCONST.NegBitField.d \
+ err.D_DECL_BFCONST.ZeroBitField.d \
+ err.D_DECL_BFSIZE.ExceedBaseType.d \
+ err.D_DECL_BFSIZE.GreaterThan64.d \
+ err.D_DECL_BFTYPE.badtype.d \
+ err.D_OFFSETOF_BITFIELD.d \
+ err.D_SIZEOF_BITFIELD.SizeofBitfield.d \
+ tst.BitFieldPromotion.d \
+ tst.SizeofBitField.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/buffering/Makefile b/cddl/usr.sbin/dtrace/tests/common/buffering/Makefile
new file mode 100644
index 0000000..7fe869b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/buffering/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.end.d \
+ err.resize1.d \
+ err.resize2.d \
+ err.resize3.d \
+ err.zerobuf.d \
+ tst.alignring.d \
+ tst.cputime.ksh \
+ tst.dynvarsize.d \
+ tst.fill1.d \
+ tst.fill1.d.out \
+ tst.resize1.d \
+ tst.resize2.d \
+ tst.resize3.d \
+ tst.ring1.d \
+ tst.ring2.d \
+ tst.ring2.d.out \
+ tst.ring3.d \
+ tst.ring3.d.out \
+ tst.smallring.d \
+ tst.switch1.d \
+ tst.switch1.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile b/cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile
new file mode 100644
index 0000000..b955be5
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/builtinvar/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_XLATE_NOCONV.cpuusage.d \
+ err.D_XLATE_NOCONV.nice.d \
+ err.D_XLATE_NOCONV.priority.d \
+ err.D_XLATE_NOCONV.prsize.d \
+ err.D_XLATE_NOCONV.rssize.d \
+ tst.arg0.d \
+ tst.arg0clause.d \
+ tst.arg1.d \
+ tst.arg1to8.d \
+ tst.arg1to8clause.d \
+ tst.caller.d \
+ tst.caller1.d \
+ tst.epid.d \
+ tst.epid1.d \
+ tst.errno.d \
+ tst.errno1.d \
+ tst.execname.d \
+ tst.hpriority.d \
+ tst.id.d \
+ tst.id1.d \
+ tst.ipl.d \
+ tst.ipl1.d \
+ tst.lwpsinfo.d \
+ tst.lwpsinfo1.d \
+ tst.pid.d \
+ tst.pid1.d \
+ tst.psinfo.d \
+ tst.psinfo1.d \
+ tst.tid.d \
+ tst.tid1.d \
+ tst.timestamp.d \
+ tst.vtimestamp.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/cg/Makefile b/cddl/usr.sbin/dtrace/tests/common/cg/Makefile
new file mode 100644
index 0000000..5550a8e
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/cg/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_NOREG.noreg.d \
+ err.baddif.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/clauses/Makefile b/cddl/usr.sbin/dtrace/tests/common/clauses/Makefile
new file mode 100644
index 0000000..5d582f3
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/clauses/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_UNDEF.aggfun.d \
+ err.D_IDENT_UNDEF.aggtup.d \
+ err.D_IDENT_UNDEF.arrtup.d \
+ err.D_IDENT_UNDEF.body.d \
+ err.D_IDENT_UNDEF.both.d \
+ err.D_IDENT_UNDEF.pred.d \
+ tst.nopred.d \
+ tst.pred.d \
+ tst.predfirst.d \
+ tst.predlast.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/cpc/Makefile b/cddl/usr.sbin/dtrace/tests/common/cpc/Makefile
new file mode 100644
index 0000000..ad23c5a1
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/cpc/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.lowfrequency.d \
+ err.D_PDESC_ZERO.malformedoverflow.d \
+ err.D_PDESC_ZERO.nonexistentevent.d \
+ err.cpcvscpustatpart1.ksh \
+ err.cpcvscpustatpart2.ksh \
+ err.cputrackfailtostart.ksh \
+ err.cputrackterminates.ksh \
+ err.toomanyenablings.d \
+ tst.allcpus.ksh \
+ tst.genericevent.d \
+ tst.platformevent.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/decls/Makefile b/cddl/usr.sbin/dtrace/tests/common/decls/Makefile
new file mode 100644
index 0000000..21544d9
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/decls/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_LOCASSC.NonLocalAssoc.d \
+ err.D_DECL_LONGINT.LongStruct.d \
+ err.D_DECL_PARMCLASS.BadStorageClass.d \
+ err.D_DECL_PROTO_NAME.VoidName.d \
+ err.D_DECL_PROTO_TYPE.Dyn.d \
+ err.D_DECL_PROTO_VARARGS.VarLenArgs.d \
+ err.D_DECL_PROTO_VOID.NonSoleVoid.d \
+ err.D_DECL_SIGNINT.UnsignedStruct.d \
+ err.D_DECL_VOIDATTR.ShortVoidDecl.d \
+ tst.arrays.d \
+ tst.basics.d \
+ tst.funcs.d \
+ tst.pointers.d \
+ tst.varargsfuncs.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile b/cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile
new file mode 100644
index 0000000..6212862
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/docsExamples/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ badptr.d \
+ countdown.d \
+ counter.d \
+ errorpath.d \
+ hello.d \
+ kstat.d \
+ ksyms.d \
+ renormalize.d \
+ rtime.d \
+ rw.d \
+ rwinfo.d \
+ rwtime.d \
+ specopen.d \
+ truss.d \
+ trussrw.d \
+ userfunc.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/drops/Makefile b/cddl/usr.sbin/dtrace/tests/common/drops/Makefile
new file mode 100644
index 0000000..248c201
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/drops/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ drp.DTRACEDROP_AGGREGATION.d \
+ drp.DTRACEDROP_DBLERROR.d \
+ drp.DTRACEDROP_DYNAMIC.d \
+ drp.DTRACEDROP_PRINCIPAL.d \
+ drp.DTRACEDROP_PRINCIPAL.end.d \
+ drp.DTRACEDROP_SPEC.d \
+ drp.DTRACEDROP_SPECUNAVAIL.d \
+ drp.DTRACEDROP_STKSTROVERFLOW.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile b/cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile
new file mode 100644
index 0000000..60e6599
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/dtraceUtil/Makefile
@@ -0,0 +1,118 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.InvalidDescription1.d \
+ man.APIVersion.d \
+ man.AddSearchPath.d \
+ man.CoalesceTrace.d \
+ man.ELFGeneration.d \
+ man.IncludedFilePath.d \
+ man.ShowCompilerCode.d \
+ man.VerboseStabilityReport.d \
+ tst.AddSearchPath.d.ksh \
+ tst.BufsizeGiga.d.ksh \
+ tst.BufsizeKilo.d.ksh \
+ tst.BufsizeMega.d.ksh \
+ tst.BufsizeTera.d.ksh \
+ tst.DataModel32.d.ksh \
+ tst.DataModel64.d.ksh \
+ tst.DefineNameWithCPP.d.ksh \
+ tst.DefineNameWithCPP.d.ksh.out \
+ tst.DestructWithFunction.d.ksh \
+ tst.DestructWithFunction.d.ksh.out \
+ tst.DestructWithID.d.ksh \
+ tst.DestructWithID.d.ksh.out \
+ tst.DestructWithModule.d.ksh \
+ tst.DestructWithModule.d.ksh.out \
+ tst.DestructWithName.d.ksh \
+ tst.DestructWithName.d.ksh.out \
+ tst.DestructWithProvider.d.ksh \
+ tst.DestructWithProvider.d.ksh.out \
+ tst.DestructWithoutW.d.ksh \
+ tst.ELFGenerationOut.d.ksh \
+ tst.ELFGenerationWithO.d.ksh \
+ tst.ExitStatus1.d.ksh \
+ tst.ExitStatus2.d.ksh \
+ tst.ExtraneousProbeIds.d.ksh \
+ tst.InvalidFuncName1.d.ksh \
+ tst.InvalidFuncName2.d.ksh \
+ tst.InvalidId1.d.ksh \
+ tst.InvalidId2.d.ksh \
+ tst.InvalidId3.d.ksh \
+ tst.InvalidModule1.d.ksh \
+ tst.InvalidModule2.d.ksh \
+ tst.InvalidModule3.d.ksh \
+ tst.InvalidModule4.d.ksh \
+ tst.InvalidProbeIdentifier.d.ksh \
+ tst.InvalidProvider1.d.ksh \
+ tst.InvalidProvider2.d.ksh \
+ tst.InvalidProvider3.d.ksh \
+ tst.InvalidProvider4.d.ksh \
+ tst.InvalidTraceFunc1.d.ksh \
+ tst.InvalidTraceFunc2.d.ksh \
+ tst.InvalidTraceFunc3.d.ksh \
+ tst.InvalidTraceFunc4.d.ksh \
+ tst.InvalidTraceFunc5.d.ksh \
+ tst.InvalidTraceFunc6.d.ksh \
+ tst.InvalidTraceFunc7.d.ksh \
+ tst.InvalidTraceFunc8.d.ksh \
+ tst.InvalidTraceFunc9.d.ksh \
+ tst.InvalidTraceID1.d.ksh \
+ tst.InvalidTraceID2.d.ksh \
+ tst.InvalidTraceID3.d.ksh \
+ tst.InvalidTraceID4.d.ksh \
+ tst.InvalidTraceID5.d.ksh \
+ tst.InvalidTraceID6.d.ksh \
+ tst.InvalidTraceID7.d.ksh \
+ tst.InvalidTraceModule1.d.ksh \
+ tst.InvalidTraceModule2.d.ksh \
+ tst.InvalidTraceModule3.d.ksh \
+ tst.InvalidTraceModule4.d.ksh \
+ tst.InvalidTraceModule5.d.ksh \
+ tst.InvalidTraceModule6.d.ksh \
+ tst.InvalidTraceModule7.d.ksh \
+ tst.InvalidTraceModule8.d.ksh \
+ tst.InvalidTraceName1.d.ksh \
+ tst.InvalidTraceName2.d.ksh \
+ tst.InvalidTraceName3.d.ksh \
+ tst.InvalidTraceName4.d.ksh \
+ tst.InvalidTraceName5.d.ksh \
+ tst.InvalidTraceName6.d.ksh \
+ tst.InvalidTraceName7.d.ksh \
+ tst.InvalidTraceName8.d.ksh \
+ tst.InvalidTraceName9.d.ksh \
+ tst.InvalidTraceProvider1.d.ksh \
+ tst.InvalidTraceProvider2.d.ksh \
+ tst.InvalidTraceProvider3.d.ksh \
+ tst.InvalidTraceProvider4.d.ksh \
+ tst.InvalidTraceProvider5.d.ksh \
+ tst.MultipleInvalidProbeId.d.ksh \
+ tst.PreprocessorStatement.d.ksh \
+ tst.QuietMode.d.ksh \
+ tst.QuietMode.d.ksh.out \
+ tst.TestCompile.d.ksh \
+ tst.TestCompile.d.ksh.out \
+ tst.UnDefineNameWithCPP.d.ksh \
+ tst.ZeroFunctionProbes.d.ksh \
+ tst.ZeroFunctionProbes.d.ksh.out \
+ tst.ZeroModuleProbes.d.ksh \
+ tst.ZeroModuleProbes.d.ksh.out \
+ tst.ZeroNameProbes.d.ksh \
+ tst.ZeroNameProbes.d.ksh.out \
+ tst.ZeroProbeIdentfier.d.ksh \
+ tst.ZeroProbesWithoutZ.d.ksh \
+ tst.ZeroProviderProbes.d.ksh \
+ tst.ZeroProviderProbes.d.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/end/Makefile b/cddl/usr.sbin/dtrace/tests/common/end/Makefile
new file mode 100644
index 0000000..120a0dd
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/end/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_UNDEF.timespent.d \
+ tst.end.d \
+ tst.endwithoutbegin.d \
+ tst.multibeginend.d \
+ tst.multiend.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/enum/Makefile b/cddl/usr.sbin/dtrace/tests/common/enum/Makefile
new file mode 100644
index 0000000..ee6ab1a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/enum/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_IDRED.EnumSameName.d \
+ err.D_UNKNOWN.RepeatIdentifiers.d \
+ tst.EnumEquality.d \
+ tst.EnumSameValue.d \
+ tst.EnumValAssign.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/error/Makefile b/cddl/usr.sbin/dtrace/tests/common/error/Makefile
new file mode 100644
index 0000000..999e28c
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/error/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.DTRACEFLT_BADADDR.d \
+ tst.DTRACEFLT_DIVZERO.d \
+ tst.DTRACEFLT_UNKNOWN.d \
+ tst.error.d \
+ tst.errorend.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/exit/Makefile b/cddl/usr.sbin/dtrace/tests/common/exit/Makefile
new file mode 100644
index 0000000..d5aa843
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/exit/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PROTO_LEN.noarg.d \
+ err.exitarg1.d \
+ tst.basic1.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile b/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile
new file mode 100644
index 0000000..a84c38d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/fbtprovider/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.notreturn.d \
+ tst.basic.d \
+ tst.functionentry.d \
+ tst.functionreturnvalue.d \
+ tst.ioctlargs.d \
+ tst.offset.d \
+ tst.offsetzero.d \
+ tst.return.d \
+ tst.return0.d \
+ tst.tailcall.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/funcs/Makefile b/cddl/usr.sbin/dtrace/tests/common/funcs/Makefile
new file mode 100644
index 0000000..4a76912
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/funcs/Makefile
@@ -0,0 +1,113 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_FUNC_UNDEF.progenyofbad1.d \
+ err.D_OP_VFPTR.badop.d \
+ err.D_PROTO_ARG.chillbadarg.d \
+ err.D_PROTO_ARG.copyoutbadarg.d \
+ err.D_PROTO_ARG.mobadarg.d \
+ err.D_PROTO_ARG.raisebadarg.d \
+ err.D_PROTO_ARG.tolower.d \
+ err.D_PROTO_ARG.toupper.d \
+ err.D_PROTO_LEN.allocanoarg.d \
+ err.D_PROTO_LEN.badbreakpoint.d \
+ err.D_PROTO_LEN.chilltoofew.d \
+ err.D_PROTO_LEN.chilltoomany.d \
+ err.D_PROTO_LEN.copyoutstrbadarg.d \
+ err.D_PROTO_LEN.copyoutstrtoofew.d \
+ err.D_PROTO_LEN.copyouttoofew.d \
+ err.D_PROTO_LEN.copyouttoomany.d \
+ err.D_PROTO_LEN.motoofew.d \
+ err.D_PROTO_LEN.motoomany.d \
+ err.D_PROTO_LEN.mtabadarg.d \
+ err.D_PROTO_LEN.mtatoofew.d \
+ err.D_PROTO_LEN.mtatoomany.d \
+ err.D_PROTO_LEN.panicbadarg.d \
+ err.D_PROTO_LEN.progenyofbad2.d \
+ err.D_PROTO_LEN.stopbadarg.d \
+ err.D_PROTO_LEN.tolower.d \
+ err.D_PROTO_LEN.tolowertoomany.d \
+ err.D_PROTO_LEN.toupper.d \
+ err.D_PROTO_LEN.touppertoomany.d \
+ err.D_STRINGOF_TYPE.badstringof.d \
+ err.D_VAR_UNDEF.badvar.d \
+ err.badalloca.d \
+ err.badalloca2.d \
+ err.badbcopy.d \
+ err.badbcopy1.d \
+ err.badbcopy2.d \
+ err.badbcopy3.d \
+ err.badbcopy4.d \
+ err.badbcopy5.d \
+ err.badbcopy6.d \
+ err.badchill.d \
+ err.chillbadarg.ksh \
+ err.copyout.d \
+ err.copyoutbadaddr.ksh \
+ err.copyoutstrbadaddr.ksh \
+ err.inet_ntoa6badaddr.d \
+ err.inet_ntoabadaddr.d \
+ err.inet_ntopbadaddr.d \
+ err.inet_ntopbadarg.d \
+ tst.badfreopen.ksh \
+ tst.basename.d \
+ tst.basename.d.out \
+ tst.bcopy.d \
+ tst.chill.ksh \
+ tst.cleanpath.d \
+ tst.cleanpath.d.out \
+ tst.copyin.d \
+ tst.copyinto.d \
+ tst.ddi_pathname.d \
+ tst.default.d \
+ tst.freopen.ksh \
+ tst.ftruncate.ksh \
+ tst.ftruncate.ksh.out \
+ tst.hton.d \
+ tst.index.d \
+ tst.index.d.out \
+ tst.inet_ntoa.d \
+ tst.inet_ntoa.d.out \
+ tst.inet_ntoa6.d \
+ tst.inet_ntoa6.d.out \
+ tst.inet_ntop.d \
+ tst.inet_ntop.d.out \
+ tst.lltostr.d \
+ tst.lltostr.d.out \
+ tst.lltostrbase.d \
+ tst.lltostrbase.d.out \
+ tst.mutex_owned.d \
+ tst.mutex_owner.d \
+ tst.mutex_type_adaptive.d \
+ tst.progenyof.d \
+ tst.rand.d \
+ tst.strchr.d \
+ tst.strchr.d.out \
+ tst.strjoin.d \
+ tst.strjoin.d.out \
+ tst.strstr.d \
+ tst.strstr.d.out \
+ tst.strtok.d \
+ tst.strtok.d.out \
+ tst.strtok_null.d \
+ tst.substr.d \
+ tst.substr.d.out \
+ tst.substrminate.d \
+ tst.substrminate.d.out \
+ tst.system.d \
+ tst.system.d.out \
+ tst.tolower.d \
+ tst.toupper.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/grammar/Makefile b/cddl/usr.sbin/dtrace/tests/common/grammar/Makefile
new file mode 100644
index 0000000..e1854ae
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/grammar/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_LVAL.d \
+ err.D_EMPTY.empty.d \
+ tst.clauses.d \
+ tst.stmts.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/include/Makefile b/cddl/usr.sbin/dtrace/tests/common/include/Makefile
new file mode 100644
index 0000000..b5002e9
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/include/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.includefirst.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/inline/Makefile b/cddl/usr.sbin/dtrace/tests/common/inline/Makefile
new file mode 100644
index 0000000..7f848fd
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/inline/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_IDRED.redef1.d \
+ err.D_DECL_IDRED.redef2.d \
+ err.D_IDENT_UNDEF.recur.d \
+ err.D_OP_INCOMPAT.baddef1.d \
+ err.D_OP_INCOMPAT.baddef2.d \
+ err.D_OP_INCOMPAT.badxlate.d \
+ tst.InlineDataAssign.d \
+ tst.InlineExpression.d \
+ tst.InlineKinds.d \
+ tst.InlineKinds.d.out \
+ tst.InlineTypedef.d \
+ tst.InlineWritableAssign.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/io/Makefile b/cddl/usr.sbin/dtrace/tests/common/io/Makefile
new file mode 100644
index 0000000..ad62351
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/io/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.fds.d \
+ tst.fds.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.fds.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/ip/Makefile b/cddl/usr.sbin/dtrace/tests/common/ip/Makefile
new file mode 100644
index 0000000..369068a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/ip/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.ipv4localicmp.ksh \
+ tst.ipv4localicmp.ksh.out \
+ tst.ipv4localtcp.ksh \
+ tst.ipv4localtcp.ksh.out \
+ tst.ipv4localudp.ksh \
+ tst.ipv4localudp.ksh.out \
+ tst.ipv4remoteicmp.ksh \
+ tst.ipv4remoteicmp.ksh.out \
+ tst.ipv4remotetcp.ksh \
+ tst.ipv4remotetcp.ksh.out \
+ tst.ipv4remoteudp.ksh \
+ tst.ipv4remoteudp.ksh.out \
+ tst.ipv6localicmp.ksh \
+ tst.ipv6localicmp.ksh.out \
+ tst.ipv6remoteicmp.ksh \
+ tst.ipv6remoteicmp.ksh.out \
+ tst.localtcpstate.ksh \
+ tst.localtcpstate.ksh.out \
+ tst.remotetcpstate.ksh \
+ tst.remotetcpstate.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/java_api/Makefile b/cddl/usr.sbin/dtrace/tests/common/java_api/Makefile
new file mode 100644
index 0000000..4ef225a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/java_api/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.Abort.ksh \
+ tst.Abort.ksh.out \
+ tst.Bean.ksh \
+ tst.Bean.ksh.out \
+ tst.Close.ksh \
+ tst.Close.ksh.out \
+ tst.Drop.ksh \
+ tst.Drop.ksh.out \
+ tst.Enable.ksh \
+ tst.Enable.ksh.out \
+ tst.FunctionLookup.ksh \
+ tst.FunctionLookup.ksh.out \
+ tst.GetAggregate.ksh \
+ tst.MaxConsumers.ksh \
+ tst.MaxConsumers.ksh.out \
+ tst.MultiAggPrinta.ksh \
+ tst.MultiAggPrinta.ksh.out \
+ tst.ProbeData.ksh \
+ tst.ProbeData.ksh.out \
+ tst.ProbeDescription.ksh \
+ tst.ProbeDescription.ksh.out \
+ tst.StateMachine.ksh \
+ tst.StateMachine.ksh.out \
+ tst.StopLock.ksh \
+ tst.StopLock.ksh.out \
+ tst.printa.d \
+ tst.printa.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.FunctionLookup.c \
+ tst.ProbeData.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/json/Makefile b/cddl/usr.sbin/dtrace/tests/common/json/Makefile
new file mode 100644
index 0000000..160fcae
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/json/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.general.d \
+ tst.general.d.out \
+ tst.strsize.d \
+ tst.strsize.d.out \
+ tst.usdt.d \
+ tst.usdt.d.out \
+ usdt.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.usdt.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/lexer/Makefile b/cddl/usr.sbin/dtrace/tests/common/lexer/Makefile
new file mode 100644
index 0000000..39063e4
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/lexer/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_CHR_NL.char.d \
+ err.D_CHR_NULL.char.d \
+ err.D_INT_DIGIT.InvalidDigit.d \
+ err.D_INT_OFLOW.BigInt.d \
+ err.D_STR_NL.string.d \
+ err.D_SYNTAX.brace1.d \
+ err.D_SYNTAX.brace2.d \
+ err.D_SYNTAX.brack1.d \
+ err.D_SYNTAX.brack2.d \
+ err.D_SYNTAX.brack3.d \
+ err.D_SYNTAX.paren1.d \
+ err.D_SYNTAX.paren2.d \
+ err.D_SYNTAX.paren3.d \
+ tst.D_MACRO_OFLOW.ParIntOvflow.d.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile b/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile
new file mode 100644
index 0000000..1f33e8a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/llquantize/Makefile
@@ -0,0 +1,50 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_LLQUANT_FACTOREVEN.nodivide.d \
+ err.D_LLQUANT_FACTOREVEN.notfactor.d \
+ err.D_LLQUANT_FACTORMATCH.d \
+ err.D_LLQUANT_FACTORNSTEPS.d \
+ err.D_LLQUANT_FACTORSMALL.d \
+ err.D_LLQUANT_FACTORTYPE.d \
+ err.D_LLQUANT_FACTORVAL.d \
+ err.D_LLQUANT_HIGHMATCH.d \
+ err.D_LLQUANT_HIGHTYPE.d \
+ err.D_LLQUANT_HIGHVAL.d \
+ err.D_LLQUANT_LOWMATCH.d \
+ err.D_LLQUANT_LOWTYPE.d \
+ err.D_LLQUANT_LOWVAL.d \
+ err.D_LLQUANT_MAGRANGE.d \
+ err.D_LLQUANT_MAGTOOBIG.d \
+ err.D_LLQUANT_NSTEPMATCH.d \
+ err.D_LLQUANT_NSTEPTYPE.d \
+ err.D_LLQUANT_NSTEPVAL.d \
+ tst.bases.d \
+ tst.bases.d.out \
+ tst.basic.d \
+ tst.basic.d.out \
+ tst.negorder.d \
+ tst.negorder.d.out \
+ tst.negvalue.d \
+ tst.negvalue.d.out \
+ tst.normal.d \
+ tst.normal.d.out \
+ tst.range.d \
+ tst.range.d.out \
+ tst.steps.d \
+ tst.steps.d.out \
+ tst.trunc.d \
+ tst.trunc.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/mdb/Makefile b/cddl/usr.sbin/dtrace/tests/common/mdb/Makefile
new file mode 100644
index 0000000..24a3f88
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/mdb/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.dtracedcmd.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/mib/Makefile b/cddl/usr.sbin/dtrace/tests/common/mib/Makefile
new file mode 100644
index 0000000..ef3a05d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/mib/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.icmp.ksh \
+ tst.tcp.ksh \
+ tst.udp.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/misc/Makefile b/cddl/usr.sbin/dtrace/tests/common/misc/Makefile
new file mode 100644
index 0000000..31de20b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/misc/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRAGMA_OPTSET.d \
+ tst.badopt.d \
+ tst.boolopt.d \
+ tst.boolopt.d.out \
+ tst.dofmax.ksh \
+ tst.dynopt.d \
+ tst.dynopt.d.out \
+ tst.enablerace.ksh \
+ tst.haslam.d \
+ tst.include.ksh \
+ tst.macroglob.ksh \
+ tst.macroglob.ksh.out \
+ tst.roch.d \
+ tst.schrock.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile b/cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile
new file mode 100644
index 0000000..e21c90a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/multiaggs/Makefile
@@ -0,0 +1,34 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINTA_AGGKEY.d \
+ err.D_PRINTA_AGGPROTO.d \
+ tst.many.d \
+ tst.many.d.out \
+ tst.same.d \
+ tst.same.d.out \
+ tst.sort.d \
+ tst.sort.d.out \
+ tst.sortpos.d \
+ tst.sortpos.d.out \
+ tst.tuplecompat.d \
+ tst.tuplecompat.d.out \
+ tst.zero.d \
+ tst.zero.d.out \
+ tst.zero2.d \
+ tst.zero2.d.out \
+ tst.zero3.d \
+ tst.zero3.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/nfs/Makefile b/cddl/usr.sbin/dtrace/tests/common/nfs/Makefile
new file mode 100644
index 0000000..446c35e
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/nfs/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.call.d \
+ tst.call3.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.call.c \
+ tst.call3.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile b/cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile
new file mode 100644
index 0000000..375aecb
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/offsetof/Makefile
@@ -0,0 +1,28 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_OFFSETOF_BITFIELD.bitfield.d \
+ err.D_OFFSETOF_TYPE.badtype.d \
+ err.D_OFFSETOF_TYPE.notsou.d \
+ err.D_UNKNOWN.OffsetofNULL.d \
+ err.D_UNKNOWN.badmemb.d \
+ tst.OffsetofAlias.d \
+ tst.OffsetofArith.d \
+ tst.OffsetofUnion.d \
+ tst.struct.d \
+ tst.struct.d.out \
+ tst.union.d \
+ tst.union.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/operators/Makefile b/cddl/usr.sbin/dtrace/tests/common/operators/Makefile
new file mode 100644
index 0000000..08bbfe6
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/operators/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.ternary.d \
+ tst.ternary.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/pid/Makefile b/cddl/usr.sbin/dtrace/tests/common/pid/Makefile
new file mode 100644
index 0000000..faa5ac8
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/pid/Makefile
@@ -0,0 +1,69 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.badlib.d \
+ err.D_PDESC_ZERO.badproc1.d \
+ err.D_PROC_BADPID.badproc2.d \
+ err.D_PROC_CREATEFAIL.many.d \
+ err.D_PROC_FUNC.badfunc.d \
+ err.D_PROC_LIB.libdash.d \
+ err.D_PROC_NAME.alldash.d \
+ err.D_PROC_NAME.badname.d \
+ err.D_PROC_NAME.globdash.d \
+ err.D_PROC_OFF.toobig.d \
+ tst.addprobes.ksh \
+ tst.args1.d \
+ tst.coverage.d \
+ tst.emptystack.d \
+ tst.emptystack.d.out \
+ tst.float.d \
+ tst.fork.d \
+ tst.gcc.d \
+ tst.killonerror.ksh \
+ tst.main.ksh \
+ tst.manypids.ksh \
+ tst.newprobes.ksh \
+ tst.newprobes.ksh.out \
+ tst.probemod.ksh \
+ tst.provregex1.ksh \
+ tst.provregex2.ksh \
+ tst.provregex2.ksh.out \
+ tst.provregex3.ksh \
+ tst.provregex3.ksh.out \
+ tst.provregex4.ksh \
+ tst.provregex4.ksh.out \
+ tst.ret1.d \
+ tst.ret2.d \
+ tst.vfork.d \
+ tst.weak1.d \
+ tst.weak2.d \
+
+TESTEXES= \
+ err.D_PDESC_ZERO.badlib.exe \
+ err.D_PROC_CREATEFAIL.many.exe \
+ err.D_PROC_FUNC.badfunc.exe \
+ err.D_PROC_LIB.libdash.exe \
+ err.D_PROC_NAME.alldash.exe \
+ err.D_PROC_NAME.badname.exe \
+ err.D_PROC_NAME.globdash.exe \
+ err.D_PROC_OFF.toobig.exe \
+ tst.coverage.exe \
+ tst.emptystack.exe \
+
+CFILES= \
+ tst.args1.c \
+ tst.float.c \
+ tst.fork.c \
+ tst.gcc.c \
+ tst.ret1.c \
+ tst.ret2.c \
+ tst.vfork.c \
+ tst.weak1.c \
+ tst.weak2.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile b/cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile
new file mode 100644
index 0000000..0f36f34
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/plockstat/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.available.d \
+ tst.libmap.d \
+
+TESTEXES= \
+ tst.available.exe \
+ tst.libmap.exe \
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/pointers/Makefile b/cddl/usr.sbin/dtrace/tests/common/pointers/Makefile
new file mode 100644
index 0000000..2953c54
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/pointers/Makefile
@@ -0,0 +1,48 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.BadAlign.d \
+ err.D_ADDROF_VAR.ArrayVar.d \
+ err.D_ADDROF_VAR.DynamicVar.d \
+ err.D_ADDROF_VAR.agg.d \
+ err.D_DEREF_NONPTR.noptr.d \
+ err.D_DEREF_VOID.VoidPointerDeref.d \
+ err.D_OP_ARRFUN.ArrayAssignment.d \
+ err.D_OP_INCOMPAT.VoidPointerArith.d \
+ err.D_OP_LVAL.AddressChange.d \
+ err.D_OP_PTR.NonPointerAccess.d \
+ err.D_OP_PTR.badpointer.d \
+ err.D_OP_SOU.BadPointerAccess.d \
+ err.D_OP_SOU.badpointer.d \
+ err.InvalidAddress1.d \
+ err.InvalidAddress2.d \
+ err.InvalidAddress3.d \
+ err.InvalidAddress4.d \
+ err.InvalidAddress5.d \
+ tst.ArrayPointer1.d \
+ tst.ArrayPointer2.d \
+ tst.ArrayPointer3.d \
+ tst.GlobalVar.d \
+ tst.IntegerArithmetic1.d \
+ tst.PointerArithmetic1.d \
+ tst.PointerArithmetic2.d \
+ tst.PointerArithmetic3.d \
+ tst.PointerAssignment.d \
+ tst.ValidPointer1.d \
+ tst.ValidPointer2.d \
+ tst.VoidCast.d \
+ tst.basic1.d \
+ tst.basic2.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/pragma/Makefile b/cddl/usr.sbin/dtrace/tests/common/pragma/Makefile
new file mode 100644
index 0000000..86010ac
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/pragma/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRAGERR.d \
+ err.D_PRAGMA_DEPEND.main.d \
+ err.D_PRAGMA_INVAL.d \
+ err.D_PRAGMA_MALFORM.d \
+ err.D_PRAGMA_UNUSED.UnusedPragma.d \
+ err.circlibdep.ksh \
+ err.invalidlibdep.ksh \
+ tst.libchain.ksh \
+ tst.libdep.ksh \
+ tst.libdepfullyconnected.ksh \
+ tst.libdepsepdir.ksh \
+ tst.temporal.ksh \
+ tst.temporal2.ksh \
+ tst.temporal3.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/predicates/Makefile b/cddl/usr.sbin/dtrace/tests/common/predicates/Makefile
new file mode 100644
index 0000000..67cfabe
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/predicates/Makefile
@@ -0,0 +1,25 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRED_SCALAR.NonScalarPred.d \
+ err.D_SYNTAX.invalid.d \
+ err.D_SYNTAX.operr.d \
+ tst.argsnotcached.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.complex.d \
+ tst.complex.d.out \
+ tst.predcache.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile b/cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile
new file mode 100644
index 0000000..8108375
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/preprocessor/Makefile
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_UNDEF.afterprobe.d \
+ err.D_PRAGCTL_INVAL.tabdefine.d \
+ err.D_SYNTAX.withoutpound.d \
+ err.defincomp.d \
+ err.ifdefelsenotendif.d \
+ err.ifdefincomp.d \
+ err.ifdefnotendif.d \
+ err.incompelse.d \
+ err.mulelse.d \
+ tst.ifdef.d \
+ tst.ifdef.d.out \
+ tst.ifndef.d \
+ tst.ifndef.d.out \
+ tst.ifnotdef.d \
+ tst.ifnotdef.d.out \
+ tst.logicaland.d \
+ tst.logicaland.d.out \
+ tst.logicalandor.d \
+ tst.logicalandor.d.out \
+ tst.logicalor.d \
+ tst.logicalor.d.out \
+ tst.muland.d \
+ tst.muland.d.out \
+ tst.mulor.d \
+ tst.mulor.d.out \
+ tst.precondi.d \
+ tst.precondi.d.out \
+ tst.predicatedeclare.d \
+ tst.preexp.d \
+ tst.preexp.d.out \
+ tst.preexpelse.d \
+ tst.preexpelse.d.out \
+ tst.preexpif.d \
+ tst.preexpif.d.out \
+ tst.preexpifelse.d \
+ tst.preexpifelse.d.out \
+ tst.withinprobe.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/print/Makefile b/cddl/usr.sbin/dtrace/tests/common/print/Makefile
new file mode 100644
index 0000000..4360794
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/print/Makefile
@@ -0,0 +1,32 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINT_AGG.bad.d \
+ err.D_PRINT_VOID.bad.d \
+ err.D_PROTO_LEN.bad.d \
+ tst.array.d \
+ tst.array.d.out \
+ tst.bitfield.d \
+ tst.bitfield.d.out \
+ tst.dyn.d \
+ tst.enum.d \
+ tst.enum.d.out \
+ tst.primitive.d \
+ tst.primitive.d.out \
+ tst.struct.d \
+ tst.struct.d.out \
+ tst.xlate.d \
+ tst.xlate.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/printa/Makefile b/cddl/usr.sbin/dtrace/tests/common/printa/Makefile
new file mode 100644
index 0000000..c972db3
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/printa/Makefile
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINTA_AGGARG.badagg.d \
+ err.D_PRINTA_AGGARG.badfmt.d \
+ err.D_PRINTA_AGGARG.badval.d \
+ err.D_PRINTA_PROTO.bad.d \
+ err.D_PRINTF_ARG_TYPE.jstack.d \
+ err.D_PRINTF_ARG_TYPE.stack.d \
+ err.D_PRINTF_ARG_TYPE.ustack.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.def.d \
+ tst.def.d.out \
+ tst.dynwidth.d \
+ tst.dynwidth.d.out \
+ tst.fmt.d \
+ tst.fmt.d.out \
+ tst.largeusersym.ksh \
+ tst.many.d \
+ tst.manyval.d \
+ tst.manyval.d.out \
+ tst.stack.d \
+ tst.tuple.d \
+ tst.tuple.d.out \
+ tst.walltimestamp.ksh \
+ tst.walltimestamp.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/printf/Makefile b/cddl/usr.sbin/dtrace/tests/common/printf/Makefile
new file mode 100644
index 0000000..d4658b1
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/printf/Makefile
@@ -0,0 +1,68 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PRINTF_AGG_CONV.aggfmt.d \
+ err.D_PRINTF_ARG_EXTRA.toomany.d \
+ err.D_PRINTF_ARG_EXTRA.widths.d \
+ err.D_PRINTF_ARG_FMT.badfmt.d \
+ err.D_PRINTF_ARG_PROTO.novalue.d \
+ err.D_PRINTF_ARG_TYPE.aggarg.d \
+ err.D_PRINTF_ARG_TYPE.recursive.d \
+ err.D_PRINTF_DYN_PROTO.noprec.d \
+ err.D_PRINTF_DYN_PROTO.nowidth.d \
+ err.D_PRINTF_DYN_TYPE.badprec.d \
+ err.D_PRINTF_DYN_TYPE.badwidth.d \
+ err.D_PROTO_LEN.toofew.d \
+ err.D_SYNTAX.badconv1.d \
+ err.D_SYNTAX.badconv2.d \
+ err.D_SYNTAX.badconv3.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.flags.d \
+ tst.flags.d.out \
+ tst.hello.d \
+ tst.hello.d.out \
+ tst.ints.d \
+ tst.ints.d.out \
+ tst.precs.d \
+ tst.precs.d.out \
+ tst.print-f.d \
+ tst.print-f.d.out \
+ tst.printT.ksh \
+ tst.printT.ksh.out \
+ tst.printY.ksh \
+ tst.printY.ksh.out \
+ tst.printcont.d \
+ tst.printcont.d.out \
+ tst.printeE.d \
+ tst.printeE.d.out \
+ tst.printgG.d \
+ tst.printgG.d.out \
+ tst.rawfmt.d \
+ tst.rawfmt.d.out \
+ tst.signs.d \
+ tst.signs.d.out \
+ tst.str.d \
+ tst.str.d.out \
+ tst.sym.d \
+ tst.sym.d.out \
+ tst.uints.d \
+ tst.uints.d.out \
+ tst.widths.d \
+ tst.widths.d.out \
+ tst.widths1.d \
+ tst.wp.d \
+ tst.wp.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/privs/Makefile b/cddl/usr.sbin/dtrace/tests/common/privs/Makefile
new file mode 100644
index 0000000..02cd83b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/privs/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.fds.ksh \
+ tst.func_access.ksh \
+ tst.getf.ksh \
+ tst.kpriv.ksh \
+ tst.op_access.ksh \
+ tst.procpriv.ksh \
+ tst.providers.ksh \
+ tst.unpriv_funcs.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/probes/Makefile b/cddl/usr.sbin/dtrace/tests/common/probes/Makefile
new file mode 100644
index 0000000..463290b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/probes/Makefile
@@ -0,0 +1,36 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.probeqtn.d \
+ err.D_PDESC_ZERO.probestar.d \
+ err.D_PDESC_ZERO.tickstar.d \
+ err.D_SYNTAX.assign.d \
+ err.D_SYNTAX.declare.d \
+ err.D_SYNTAX.declarein.d \
+ err.D_SYNTAX.lbraces.d \
+ err.D_SYNTAX.probespec.d \
+ err.D_SYNTAX.rbraces.d \
+ err.D_SYNTAX.recdec.d \
+ tst.basic1.d \
+ tst.check.d \
+ tst.declare.d \
+ tst.declareafter.d \
+ tst.emptyprobe.d \
+ tst.pragma.d \
+ tst.pragmaaftertab.d \
+ tst.pragmainside.d \
+ tst.pragmaoutside.d \
+ tst.probestar.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/proc/Makefile b/cddl/usr.sbin/dtrace/tests/common/proc/Makefile
new file mode 100644
index 0000000..5ab672b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/proc/Makefile
@@ -0,0 +1,30 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.create.ksh \
+ tst.discard.ksh \
+ tst.exec.ksh \
+ tst.execfail.ENOENT.ksh \
+ tst.execfail.ksh \
+ tst.exitcore.ksh \
+ tst.exitexit.ksh \
+ tst.exitkilled.ksh \
+ tst.signal.ksh \
+ tst.sigwait.d \
+ tst.startexit.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.sigwait.c \
+
+
+LDADD.tst.sigwait.exe+= -lrt
+DPADD.tst.sigwait.exe+= ${LIBRT}
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile b/cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile
new file mode 100644
index 0000000..cb6ad9f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/profile-n/Makefile
@@ -0,0 +1,53 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.profile.d \
+ err.D_PDESC_ZEROonens.d \
+ err.D_PDESC_ZEROonensec.d \
+ err.D_PDESC_ZEROoneus.d \
+ err.D_PDESC_ZEROoneusec.d \
+ tst.argtest.d \
+ tst.argtest.d.out \
+ tst.basic.d \
+ tst.basic.d.out \
+ tst.func.ksh \
+ tst.mod.ksh \
+ tst.profilehz.d \
+ tst.profilehz.d.out \
+ tst.profilems.d \
+ tst.profilems.d.out \
+ tst.profilemsec.d \
+ tst.profilemsec.d.out \
+ tst.profilenhz.d \
+ tst.profilenhz.d.out \
+ tst.profilens.d \
+ tst.profilens.d.out \
+ tst.profilensec.d \
+ tst.profilensec.d.out \
+ tst.profiles.d \
+ tst.profiles.d.out \
+ tst.profilesec.d \
+ tst.profilesec.d.out \
+ tst.profileus.d \
+ tst.profileus.d.out \
+ tst.profileusec.d \
+ tst.profileusec.d.out \
+ tst.sym.ksh \
+ tst.ufunc.ksh \
+ tst.ufuncsort.ksh \
+ tst.ufuncsort.ksh.out \
+ tst.umod.ksh \
+ tst.usym.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.ufuncsort.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/providers/Makefile b/cddl/usr.sbin/dtrace/tests/common/providers/Makefile
new file mode 100644
index 0000000..763d60b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/providers/Makefile
@@ -0,0 +1,44 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_INVAL.wrongdec4.d \
+ err.D_PDESC_ZERO.nonprofile.d \
+ err.D_PDESC_ZERO.wrongdec1.d \
+ err.D_PDESC_ZERO.wrongdec2.d \
+ err.D_PDESC_ZERO.wrongdec3.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.beginexit.d \
+ tst.beginprof.d \
+ tst.beginprof.d.out \
+ tst.probattrs.d \
+ tst.probattrs.d.out \
+ tst.probefunc.d \
+ tst.probefunc.d.out \
+ tst.probemod.d \
+ tst.probemod.d.out \
+ tst.probename.d \
+ tst.probename.d.out \
+ tst.probprov.d \
+ tst.probprov.d.out \
+ tst.profend.d \
+ tst.profend.d.out \
+ tst.profexit.d \
+ tst.profexit.d.out \
+ tst.trace.d \
+ tst.trace.d.out \
+ tst.twoprof.d \
+ tst.twoprof.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/raise/Makefile b/cddl/usr.sbin/dtrace/tests/common/raise/Makefile
new file mode 100644
index 0000000..f84ac52
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/raise/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.raise1.d \
+ tst.raise2.d \
+ tst.raise3.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.raise1.c \
+ tst.raise2.c \
+ tst.raise3.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/rates/Makefile b/cddl/usr.sbin/dtrace/tests/common/rates/Makefile
new file mode 100644
index 0000000..a3f54f5
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/rates/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.aggrate.d \
+ tst.aggrate.d.out \
+ tst.statusrate.d \
+ tst.switchrate.d \
+ tst.switchrate.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/safety/Makefile b/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
new file mode 100644
index 0000000..0e88ea3
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/safety/Makefile
@@ -0,0 +1,54 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.basename.d \
+ tst.caller.d \
+ tst.cleanpath.d \
+ tst.copyin.d \
+ tst.copyin2.d \
+ tst.ddi_pathname.d \
+ tst.dirname.d \
+ tst.errno.d \
+ tst.execname.d \
+ tst.gid.d \
+ tst.hton.d \
+ tst.index.d \
+ tst.msgdsize.d \
+ tst.msgsize.d \
+ tst.null.d \
+ tst.pid.d \
+ tst.ppid.d \
+ tst.progenyof.d \
+ tst.random.d \
+ tst.rw.d \
+ tst.shortstr.d \
+ tst.stack.d \
+ tst.stackdepth.d \
+ tst.stddev.d \
+ tst.strchr.d \
+ tst.strjoin.d \
+ tst.strstr.d \
+ tst.strtok.d \
+ tst.substr.d \
+ tst.ucaller.d \
+ tst.uid.d \
+ tst.unalign.d \
+ tst.uregs.d \
+ tst.ustack.d \
+ tst.ustackdepth.d \
+ tst.vahole.d \
+ tst.violentdeath.ksh \
+ tst.zonename.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile b/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile
new file mode 100644
index 0000000..2f471a6
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/scalars/Makefile
@@ -0,0 +1,37 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ARR_LOCAL.thisarray.d \
+ err.D_DECL_CLASS.selfthis.d \
+ err.D_DECL_CLASS.thisself.d \
+ err.D_DECL_IDRED.errval.d \
+ err.D_OP_INCOMPAT.dec.err.d \
+ err.D_OP_INCOMPAT.dupgtype.d \
+ err.D_OP_INCOMPAT.dupltype.d \
+ err.D_OP_INCOMPAT.dupttype.d \
+ err.D_SYNTAX.declare.d \
+ err.bigglobal.d \
+ err.biglocal.d \
+ tst.basicvar.d \
+ tst.basicvar.d.out \
+ tst.localvar.d \
+ tst.misc.d \
+ tst.self.d \
+ tst.selfarray.d \
+ tst.selfarray2.d \
+ tst.selfthis.d \
+ tst.this.d \
+ tst.thisself.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sched/Makefile b/cddl/usr.sbin/dtrace/tests/common/sched/Makefile
new file mode 100644
index 0000000..adf8c98
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sched/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.enqueue.d \
+ tst.oncpu.d \
+ tst.stackdepth.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/scripting/Makefile b/cddl/usr.sbin/dtrace/tests/common/scripting/Makefile
new file mode 100644
index 0000000..0bb10cf
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/scripting/Makefile
@@ -0,0 +1,49 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_MACRO_UNDEF.invalidargs.d \
+ err.D_OP_LVAL.rdonly.d \
+ err.D_OP_WRITE.usepidmacro.d \
+ err.D_SYNTAX.concat.d \
+ err.D_SYNTAX.desc.d \
+ err.D_SYNTAX.inval.d \
+ err.D_SYNTAX.pid.d \
+ tst.D_MACRO_UNUSED.overflow.ksh \
+ tst.arg0.d \
+ tst.arguments.ksh \
+ tst.assign.d \
+ tst.basic.d \
+ tst.egid.d \
+ tst.egid.ksh \
+ tst.euid.d \
+ tst.euid.ksh \
+ tst.gid.d \
+ tst.gid.ksh \
+ tst.pgid.d \
+ tst.pid.d \
+ tst.ppid.d \
+ tst.ppid.ksh \
+ tst.projid.d \
+ tst.projid.ksh \
+ tst.quite.d \
+ tst.sid.d \
+ tst.sid.ksh \
+ tst.stringmacro.ksh \
+ tst.taskid.d \
+ tst.taskid.ksh \
+ tst.trace.d \
+ tst.uid.d \
+ tst.uid.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sdt/Makefile b/cddl/usr.sbin/dtrace/tests/common/sdt/Makefile
new file mode 100644
index 0000000..598cc69
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sdt/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.sdtargs.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.sdtargs.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile b/cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile
new file mode 100644
index 0000000..6b146b0
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sizeof/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_IDENT_BADREF.SizeofAssoc.d \
+ err.D_IDENT_UNDEF.UnknownSymbol.d \
+ err.D_SIZEOF_TYPE.badstruct.d \
+ err.D_SIZEOF_TYPE.d \
+ err.D_SYNTAX.SizeofBadType.d \
+ tst.SizeofArray.d \
+ tst.SizeofDataTypes.d \
+ tst.SizeofExpression.d \
+ tst.SizeofNULL.d \
+ tst.SizeofStrConst.d \
+ tst.SizeofStrConst.d.out \
+ tst.SizeofString1.d \
+ tst.SizeofString1.d.out \
+ tst.SizeofString2.d \
+ tst.SizeofString2.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile b/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile
new file mode 100644
index 0000000..f17ded9
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/speculation/Makefile
@@ -0,0 +1,75 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ bug.1001148.SpecSizeVariations.d \
+ err.BufSizeVariations1.d \
+ err.BufSizeVariations2.d \
+ err.D_ACT_SPEC.SpeculateWithBreakPoint.d \
+ err.D_ACT_SPEC.SpeculateWithChill.d \
+ err.D_ACT_SPEC.SpeculateWithCopyOut.d \
+ err.D_ACT_SPEC.SpeculateWithCopyOutStr.d \
+ err.D_ACT_SPEC.SpeculateWithPanic.d \
+ err.D_ACT_SPEC.SpeculateWithRaise.d \
+ err.D_ACT_SPEC.SpeculateWithStop.d \
+ err.D_AGG_COMM.AggAftCommit.d \
+ err.D_AGG_SPEC.SpeculateWithAvg.d \
+ err.D_AGG_SPEC.SpeculateWithCount.d \
+ err.D_AGG_SPEC.SpeculateWithLquant.d \
+ err.D_AGG_SPEC.SpeculateWithMax.d \
+ err.D_AGG_SPEC.SpeculateWithMin.d \
+ err.D_AGG_SPEC.SpeculateWithQuant.d \
+ err.D_AGG_SPEC.SpeculateWithStddev.d \
+ err.D_AGG_SPEC.SpeculateWithSum.d \
+ err.D_COMM_COMM.CommitAftCommit.d \
+ err.D_COMM_COMM.DisjointCommit.d \
+ err.D_COMM_DREC.CommitAftDataRec.d \
+ err.D_DREC_COMM.DataRecAftCommit.d \
+ err.D_DREC_COMM.ExitAfterCommit.d \
+ err.D_EXIT_SPEC.ExitAftSpec.d \
+ err.D_PRAGMA_MALFORM.NspecExpr.d \
+ err.D_PRAGMA_OPTSET.HugeNspecValue.d \
+ err.D_PRAGMA_OPTSET.InvalidSpecSize.d \
+ err.D_PRAGMA_OPTSET.NegSpecSize.d \
+ err.D_PROTO_LEN.SpecNoId.d \
+ err.D_SPEC_COMM.SpecAftCommit.d \
+ err.D_SPEC_DREC.SpecAftDataRec.d \
+ err.D_SPEC_SPEC.SpecAftSpec.d \
+ err.NegativeBufSize.d \
+ err.NegativeNspec.d \
+ err.NegativeSpecSize.d \
+ err.SpecSizeVariations1.d \
+ err.SpecSizeVariations2.d \
+ tst.CommitAfterDiscard.d \
+ tst.CommitWithZero.d \
+ tst.DataRecAftDiscard.d \
+ tst.DiscardAftCommit.d \
+ tst.DiscardAftDataRec.d \
+ tst.DiscardAftDiscard.d \
+ tst.DiscardWithZero.d \
+ tst.ExitAftDiscard.d \
+ tst.NoSpecBuffer.d \
+ tst.SpecSizeVariations1.d \
+ tst.SpecSizeVariations2.d \
+ tst.SpecSizeVariations3.d \
+ tst.SpeculateWithRandom.d \
+ tst.SpeculationCommit.d \
+ tst.SpeculationDiscard.d \
+ tst.SpeculationID.d \
+ tst.SpeculationWithZero.d \
+ tst.TwoSpecBuffers.d \
+ tst.negcommit.d \
+ tst.negspec.d \
+ tst.zerosize.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stability/Makefile b/cddl/usr.sbin/dtrace/tests/common/stability/Makefile
new file mode 100644
index 0000000..8fb9afa
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stability/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ATTR_MIN.MinAttributes.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stack/Makefile b/cddl/usr.sbin/dtrace/tests/common/stack/Makefile
new file mode 100644
index 0000000..ca01f42
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stack/Makefile
@@ -0,0 +1,22 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_STACK_PROTO.bad.d \
+ err.D_STACK_SIZE.d \
+ err.D_USTACK_FRAMES.bad.d \
+ err.D_USTACK_PROTO.bad.d \
+ err.D_USTACK_STRSIZE.bad.d \
+ tst.default.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile b/cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile
new file mode 100644
index 0000000..8e94963
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stackdepth/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.default.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/stop/Makefile b/cddl/usr.sbin/dtrace/tests/common/stop/Makefile
new file mode 100644
index 0000000..a03d9aa
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/stop/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.stop1.d \
+ tst.stop2.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.stop1.c \
+ tst.stop2.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/strlen/Makefile b/cddl/usr.sbin/dtrace/tests/common/strlen/Makefile
new file mode 100644
index 0000000..0fec541
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/strlen/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.strlen1.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile b/cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile
new file mode 100644
index 0000000..8af2d41
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/strtoll/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.BaseTooLarge.d \
+ err.BaseTooSmall.d \
+ tst.strtoll.d \
+ tst.strtoll.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/struct/Makefile b/cddl/usr.sbin/dtrace/tests/common/struct/Makefile
new file mode 100644
index 0000000..fb039f2
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/struct/Makefile
@@ -0,0 +1,31 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_VAR.StructPointer.d \
+ err.D_DECL_COMBO.StructWithoutColon.d \
+ err.D_DECL_COMBO.StructWithoutColon1.d \
+ err.D_DECL_INCOMPLETE.circular.d \
+ err.D_DECL_INCOMPLETE.order.d \
+ err.D_DECL_INCOMPLETE.order2.d \
+ err.D_DECL_INCOMPLETE.recursive.d \
+ err.D_DECL_INCOMPLETE.simple.d \
+ err.D_DECL_VOIDOBJ.baddec.d \
+ err.D_PROTO_ARG.DupStructAssoc.d \
+ tst.StructAssoc.d \
+ tst.StructDataTypes.d \
+ tst.StructInside.d \
+ tst.clauselocal.d \
+ tst.clauselocal.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/syscall/Makefile b/cddl/usr.sbin/dtrace/tests/common/syscall/Makefile
new file mode 100644
index 0000000..035fdf0
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/syscall/Makefile
@@ -0,0 +1,18 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.args.d \
+ tst.openret.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.args.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile b/cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile
new file mode 100644
index 0000000..496360e
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/sysevent/Makefile
@@ -0,0 +1,19 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.post.d \
+ tst.post_chan.d \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.post.c \
+ tst.post_chan.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile b/cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile
new file mode 100644
index 0000000..d843b9a
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/tick-n/Makefile
@@ -0,0 +1,38 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PDESC_ZERO.tick.d \
+ err.D_PDESC_ZEROonens.d \
+ err.D_PDESC_ZEROonensec.d \
+ err.D_PDESC_ZEROoneus.d \
+ err.D_PDESC_ZEROoneusec.d \
+ tst.tickarg0.d \
+ tst.tickms.d \
+ tst.tickms.d.out \
+ tst.tickmsec.d \
+ tst.tickmsec.d.out \
+ tst.tickns.d \
+ tst.tickns.d.out \
+ tst.ticknsec.d \
+ tst.ticknsec.d.out \
+ tst.ticks.d \
+ tst.ticks.d.out \
+ tst.ticksec.d \
+ tst.ticksec.d.out \
+ tst.tickus.d \
+ tst.tickus.d.out \
+ tst.tickusec.d \
+ tst.tickusec.d.out \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/trace/Makefile b/cddl/usr.sbin/dtrace/tests/common/trace/Makefile
new file mode 100644
index 0000000..e1500f2
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/trace/Makefile
@@ -0,0 +1,24 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PROTO_LEN.bad.d \
+ err.D_TRACE_AGG.bad.d \
+ err.D_TRACE_VOID.bad.d \
+ tst.dyn.d \
+ tst.misc.d \
+ tst.qstring.d \
+ tst.qstring.d.out \
+ tst.string.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile b/cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile
new file mode 100644
index 0000000..5ba7b6f
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/tracemem/Makefile
@@ -0,0 +1,26 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_PROTO_ARG.badsize.d \
+ err.D_PROTO_LEN.toofew.d \
+ err.D_TRACEMEM_ADDR.badaddr.d \
+ err.D_TRACEMEM_ARGS.d \
+ err.D_TRACEMEM_DYNSIZE.d \
+ err.D_TRACEMEM_SIZE.negsize.d \
+ err.D_TRACEMEM_SIZE.zerosize.d \
+ tst.dynsize.d \
+ tst.dynsize.d.out \
+ tst.rootvp.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/translators/Makefile b/cddl/usr.sbin/dtrace/tests/common/translators/Makefile
new file mode 100644
index 0000000..4d57edf
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/translators/Makefile
@@ -0,0 +1,51 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_TYPERED.BadTransDecl.d \
+ err.D_OP_INCOMPLETE.NonExistentInput1.d \
+ err.D_SYNTAX.BadTransDecl1.d \
+ err.D_SYNTAX.BadTransDecl3.d \
+ err.D_SYNTAX.BadTransDecl4.d \
+ err.D_TYPE_MEMBER.NonExistentInput2.d \
+ err.D_XLATE_INCOMPAT.BadInputType1.d \
+ err.D_XLATE_MEMB.NonExistentOutput2.d \
+ err.D_XLATE_NONE.BadTransDecl6.d \
+ err.D_XLATE_REDECL.RepeatTransDecl.d \
+ err.D_XLATE_SOU.BadTransDecl8.d \
+ err.D_XLATE_SOU.BadTransInt.d \
+ err.D_XLATE_SOU.NonExistentOutput1.d \
+ tst.CircularTransDecl.d \
+ tst.EmptyTransDecl.d \
+ tst.ForwardTag.d \
+ tst.InputAliasTrans.d \
+ tst.InputIntTrans.d \
+ tst.OutputAliasTrans.d \
+ tst.PartialDereferencing.d \
+ tst.PartialOutputTransDefn.d \
+ tst.ProcModelTrans.d \
+ tst.RepeatDeclaration.d \
+ tst.SimultaneousTranslators.d \
+ tst.StructureAssignment.d \
+ tst.TestTransStability1.ksh \
+ tst.TestTransStability1.ksh.out \
+ tst.TestTransStability2.ksh \
+ tst.TestTransStability2.ksh.out \
+ tst.TransNonPointer.d \
+ tst.TransOutputPointer.d \
+ tst.TransPointer.d \
+ tst.TranslateSelf.d \
+ tst.UnionInputTrans.d \
+ tst.UnionOutputTrans.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/typedef/Makefile b/cddl/usr.sbin/dtrace/tests/common/typedef/Makefile
new file mode 100644
index 0000000..477fd74
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/typedef/Makefile
@@ -0,0 +1,21 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_DECL_IDRED.DupTypeDef.d \
+ err.D_SYNTAX.BadExistingTypedef.d \
+ err.D_SYNTAX.TypedefInClause.d \
+ tst.ChainTypedef.d \
+ tst.TypedefDataAssign.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/types/Makefile b/cddl/usr.sbin/dtrace/tests/common/types/Makefile
new file mode 100644
index 0000000..1a3d326
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/types/Makefile
@@ -0,0 +1,69 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_CAST_INVAL.badcast.d \
+ err.D_CG_DYN.ResultDynType.d \
+ err.D_CHR_OFLOW.charconst.d \
+ err.D_DECL_BADCLASS.bad.d \
+ err.D_DECL_CHARATTR.badtype3.d \
+ err.D_DECL_COMBO.badtype4.d \
+ err.D_DECL_COMBO.badtype5.d \
+ err.D_DECL_ENCONST.badeval.d \
+ err.D_DECL_ENOFLOW.enoflow.d \
+ err.D_DECL_ENOFLOW.enuflow.d \
+ err.D_DECL_SCOPE.scopeop.d \
+ err.D_DECL_USELESS.baddec.d \
+ err.D_OP_ACT.badcond.d \
+ err.D_OP_ARITH.badoperand.d \
+ err.D_OP_INCOMPAT.badassign.d \
+ err.D_OP_INT.badbitop.d \
+ err.D_OP_INT.badshift.d \
+ err.D_OP_SCALAR.badcond.d \
+ err.D_OP_SCALAR.badincop.d \
+ err.D_OP_SCALAR.badlogop.d \
+ err.D_PROTO_LEN.badcond1.d \
+ err.D_SYNTAX.badenum.d \
+ err.D_SYNTAX.badid.d \
+ err.D_SYNTAX.badstruct.d \
+ err.D_UNKNOWN.badtype1.d \
+ err.D_UNKNOWN.badtype2.d \
+ err.D_UNKNOWN.dupenum.d \
+ err.D_UNKNOWN.dupstruct.d \
+ err.D_XLATE_REDECL.ResultDynType.d \
+ tst.assignops.d \
+ tst.badshiftops.d \
+ tst.basics.d \
+ tst.basics.d.out \
+ tst.bitops.d \
+ tst.charconstants.d \
+ tst.complex.d \
+ tst.condexpr.d \
+ tst.const.d \
+ tst.constants.d \
+ tst.conv.d \
+ tst.enum.d \
+ tst.intincop.d \
+ tst.intops.d \
+ tst.inttypes.d \
+ tst.ptrincop.d \
+ tst.ptrops.d \
+ tst.relenum.d \
+ tst.relstring.d \
+ tst.shiftops.d \
+ tst.stringconstants.d \
+ tst.struct.d \
+ tst.typedef.d \
+ tst.unaryop.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/uctf/Makefile b/cddl/usr.sbin/dtrace/tests/common/uctf/Makefile
new file mode 100644
index 0000000..493d550
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/uctf/Makefile
@@ -0,0 +1,41 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.invalidpid.d \
+ err.invalidpid2.d \
+ err.invalidpid3.d \
+ err.invalidtype.ksh \
+ err.invalidtype2.ksh \
+ err.user64mode.ksh \
+ tst.aouttype.ksh \
+ tst.chasestrings.ksh \
+ tst.chasestrings.ksh.out \
+ tst.libtype.ksh \
+ tst.linkmap.ksh \
+ tst.pidprint.ksh \
+ tst.pidprinttarg.ksh \
+ tst.printtype.ksh \
+ tst.printtype.ksh.out \
+ tst.printtypetarg.ksh \
+ tst.userlandkey.ksh \
+ tst.userlandkey.ksh.out \
+ tst.userstrings.ksh \
+ tst.userstrings.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.aouttype.c \
+ tst.chasestrings.c \
+ tst.libtype.c \
+ tst.printtype.c \
+
+
+WITH_CTF=YES
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/union/Makefile b/cddl/usr.sbin/dtrace/tests/common/union/Makefile
new file mode 100644
index 0000000..69e0ca8
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/union/Makefile
@@ -0,0 +1,27 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ err.D_ADDROF_VAR.UnionPointer.d \
+ err.D_DECL_COMBO.UnionWithoutColon.d \
+ err.D_DECL_COMBO.UnionWithoutColon1.d \
+ err.D_DECL_INCOMPLETE.circular.d \
+ err.D_DECL_INCOMPLETE.order.d \
+ err.D_DECL_INCOMPLETE.recursive.d \
+ err.D_DECL_INCOMPLETE.simple.d \
+ err.D_PROTO_ARG.DupUnionAssoc.d \
+ tst.UnionAssoc.d \
+ tst.UnionDataTypes.d \
+ tst.UnionInside.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/usdt/Makefile b/cddl/usr.sbin/dtrace/tests/common/usdt/Makefile
new file mode 100644
index 0000000..f6fa49b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/usdt/Makefile
@@ -0,0 +1,65 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ argmap.d \
+ args.d \
+ forker.d \
+ prov.d \
+ tst.andpid.ksh \
+ tst.argmap.d \
+ tst.args.d \
+ tst.badguess.ksh \
+ tst.corruptenv.ksh \
+ tst.dlclose1.ksh \
+ tst.dlclose1.ksh.out \
+ tst.dlclose2.ksh \
+ tst.dlclose2.ksh.out \
+ tst.dlclose3.ksh \
+ tst.eliminate.ksh \
+ tst.enabled.ksh \
+ tst.enabled.ksh.out \
+ tst.enabled2.ksh \
+ tst.enabled2.ksh.out \
+ tst.entryreturn.ksh \
+ tst.entryreturn.ksh.out \
+ tst.fork.ksh \
+ tst.fork.ksh.out \
+ tst.forker.ksh \
+ tst.guess32.ksh \
+ tst.guess64.ksh \
+ tst.header.ksh \
+ tst.include.ksh \
+ tst.linkpriv.ksh \
+ tst.linkunpriv.ksh \
+ tst.multiple.ksh \
+ tst.multiple.ksh.out \
+ tst.multiprov.ksh \
+ tst.multiprov.ksh.out \
+ tst.nodtrace.ksh \
+ tst.noprobes.ksh \
+ tst.noreap.ksh \
+ tst.noreapring.ksh \
+ tst.onlyenabled.ksh \
+ tst.reap.ksh \
+ tst.reeval.ksh \
+ tst.static.ksh \
+ tst.static.ksh.out \
+ tst.static2.ksh \
+ tst.static2.ksh.out \
+ tst.user.ksh \
+ tst.user.ksh.out \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.argmap.c \
+ tst.args.c \
+ tst.forker.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/ustack/Makefile b/cddl/usr.sbin/dtrace/tests/common/ustack/Makefile
new file mode 100644
index 0000000..960c407
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/ustack/Makefile
@@ -0,0 +1,20 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.bigstack.d \
+ tst.depth.ksh \
+ tst.spin.ksh \
+
+TESTEXES= \
+
+
+CFILES= \
+ tst.bigstack.c \
+ tst.spin.c \
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/vars/Makefile b/cddl/usr.sbin/dtrace/tests/common/vars/Makefile
new file mode 100644
index 0000000..5b47557
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/vars/Makefile
@@ -0,0 +1,23 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.gid.d \
+ tst.nullassign.d \
+ tst.ppid.d \
+ tst.ucaller.ksh \
+ tst.ucaller.ksh.out \
+ tst.uid.d \
+ tst.walltimestamp.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/common/version/Makefile b/cddl/usr.sbin/dtrace/tests/common/version/Makefile
new file mode 100644
index 0000000..0491cea
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/common/version/Makefile
@@ -0,0 +1,17 @@
+# $FreeBSD$
+
+#
+# This Makefile was generated by $srcdir/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh.
+#
+
+TESTFILES= \
+ tst.1.0.d \
+
+TESTEXES= \
+
+
+CFILES= \
+
+
+
+.include "../../Makefile.inc1"
diff --git a/cddl/usr.sbin/dtrace/tests/tools/dtest.sh b/cddl/usr.sbin/dtrace/tests/tools/dtest.sh
new file mode 100755
index 0000000..e60837b
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/dtest.sh
@@ -0,0 +1,129 @@
+# $FreeBSD$
+
+usage()
+{
+ cat >&2 <<__EOF__
+A harness for test cases in the DTrace test suite.
+
+usage: $(basename $0) <testfile>
+__EOF__
+ exit 1
+}
+
+gettag()
+{
+ local tag
+
+ tag=$(basename $1)
+ tag=${tag#*.}
+ tag=${tag%%[a-z.]*}
+ echo $tag
+}
+
+runtest()
+{
+ local dflags exe exstatus pid retval status
+
+ exstatus=0
+ retval=0
+
+ case $TFILE in
+ drp.DTRACEDROP_*.d|err.*.d|tst.*.d)
+ case $TFILE in
+ drp.DTRACEDROP_*.d)
+ dflags="-x droptags"
+ tag=$(gettag "$TFILE")
+ ;;
+ err.D_*.d)
+ exstatus=1
+ dflags="-x errtags"
+ tag=$(gettag "$TFILE")
+ ;;
+ err.*.d)
+ exstatus=1
+ ;;
+ esac
+
+ exe=${TFILE%.*}.exe
+ if [ -f "$exe" -a -x "$exe" ]; then
+ ./$exe &
+ pid=$!
+ dflags="$dflags ${pid}"
+ fi
+
+ dtrace -C -s "${TFILE}" $dflags >$STDOUT 2>$STDERR
+ status=$?
+
+ if [ $status -ne $exstatus ]; then
+ ERRMSG="dtrace exited with status ${status}, expected ${exstatus}"
+ retval=1
+ elif [ -n "${tag}" ] && ! grep -Fq " [${tag}] " ${STDERR}; then
+ ERRMSG="dtrace's error output did not contain expected tag ${tag}"
+ retval=1
+ fi
+
+ if [ -n "$pid" ]; then
+ kill -0 $pid >/dev/null 2>&1 && kill -9 $pid >/dev/null 2>&1
+ wait
+ fi
+ ;;
+ err.*.ksh|tst.*.ksh)
+ expr "$TFILE" : 'err.*' >/dev/null && exstatus=1
+
+ ksh "$TFILE" /usr/sbin/dtrace >$STDOUT 2>$STDERR
+ status=$?
+
+ if [ $status -ne $exstatus ]; then
+ ERRMSG="script exited with status ${status}, expected ${exstatus}"
+ retval=1
+ fi
+ ;;
+ *)
+ ERRMSG="unexpected test file name $TFILE"
+ retval=1
+ ;;
+ esac
+
+ return $retval
+}
+
+[ $# -eq 1 ] || usage
+
+readonly STDERR=$(mktemp)
+readonly STDOUT=$(mktemp)
+readonly TFILE=$(basename $1)
+readonly EXOUT=${TFILE}.out
+
+kldstat -q -m dtrace_test || kldload dtrace_test
+cd $(dirname $1)
+runtest
+RESULT=$?
+
+if [ $RESULT -eq 0 -a -f $EXOUT -a -r $EXOUT ] && \
+ ! cmp $STDOUT $EXOUT >/dev/null 2>&1; then
+ ERRMSG="test output mismatch"
+ RESULT=1
+fi
+
+if [ $RESULT -ne 0 ]; then
+ echo "test $TFILE failed: $ERRMSG" >&2
+ if [ $(stat -f '%z' $STDOUT) -gt 0 ]; then
+ cat >&2 <<__EOF__
+test stdout:
+--
+$(cat $STDOUT)
+--
+__EOF__
+ fi
+ if [ $(stat -f '%z' $STDERR) -gt 0 ]; then
+ cat >&2 <<__EOF__
+test stderr:
+--
+$(cat $STDERR)
+--
+__EOF__
+ fi
+fi
+
+rm -f $STDERR $STDOUT
+exit $RESULT
diff --git a/cddl/usr.sbin/dtrace/tests/tools/exclude.sh b/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
new file mode 100755
index 0000000..a42773d
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/exclude.sh
@@ -0,0 +1,194 @@
+# $FreeBSD$
+
+# This file lists DTrace tests which are known to fail or hang/crash the
+# system. They were pulled from the legacy DTrace test infrastructure in
+# tools/tests/dtrace and may be out of date.
+#
+# Tests are listed here generally because one or more of the following is true:
+#
+# 1) The test is broken (usually because it assumes it's running on Solaris and
+# the test encodes some sort of Solarisism).
+# 2) The functionality being tested is buggy (often but not always the result
+# of a FreeBSD-specific bug).
+# 3) The test relies on DTrace functionality that's not yet available in FreeBSD
+# (e.g. tests for a specific SDT provider that we don't have).
+#
+# An end goal is to remove this file, concentrating first on instances of
+# 1) and 2).
+#
+# The SKIP variable contains tests that should not be executed at all. The
+# EXFAIL variable contains tests that are expected to fail when run. Please
+# avoid adding tests to SKIP unless it really is necessary; with EXFAIL, tests
+# that begin passing as the result of a change are visible in the test summary.
+
+exclude()
+{
+ eval $1=\"\$$1\\n$2\"
+}
+
+exclude EXFAIL common/aggs/tst.subr.d
+exclude EXFAIL common/dtraceUtil/tst.DataModel32.d.ksh
+exclude EXFAIL common/dtraceUtil/tst.ELFGenerationOut.d.ksh
+exclude EXFAIL common/dtraceUtil/tst.ELFGenerationWithO.d.ksh
+exclude EXFAIL common/funcs/tst.copyin.d
+exclude EXFAIL common/funcs/tst.copyinto.d
+exclude EXFAIL common/funcs/tst.ddi_pathname.d
+exclude EXFAIL common/io/tst.fds.d
+exclude EXFAIL common/ip/tst.ipv4localudp.ksh
+exclude EXFAIL common/mdb/tst.dtracedcmd.ksh
+exclude EXFAIL common/misc/tst.dofmax.ksh
+exclude EXFAIL common/misc/tst.include.ksh
+exclude EXFAIL common/pragma/tst.libchain.ksh
+exclude EXFAIL common/safety/tst.copyin2.d
+exclude EXFAIL common/safety/tst.msgdsize.d
+exclude EXFAIL common/safety/tst.msgsize.d
+exclude EXFAIL common/safety/tst.zonename.d
+exclude EXFAIL common/scalars/tst.misc.d
+exclude EXFAIL common/scalars/tst.selfarray2.d
+exclude EXFAIL common/sched/tst.enqueue.d
+exclude EXFAIL common/speculation/tst.SpecSizeVariations3.d
+exclude EXFAIL common/tracemem/err.D_TRACEMEM_ADDR.badaddr.d
+exclude EXFAIL common/translators/tst.TestTransStability2.ksh
+exclude EXFAIL common/types/tst.struct.d
+exclude EXFAIL common/types/tst.typedef.d
+
+# We don't have a cpc provider.
+exclude SKIP common/cpc/err.D_PDESC_ZERO.lowfrequency.d
+exclude SKIP common/cpc/err.D_PDESC_ZERO.malformedoverflow.d
+exclude SKIP common/cpc/err.D_PDESC_ZERO.nonexistentevent.d
+exclude SKIP common/cpc/err.cpcvscpustatpart1.ksh
+exclude SKIP common/cpc/err.cpcvscpustatpart2.ksh
+exclude SKIP common/cpc/err.cputrackfailtostart.ksh
+exclude SKIP common/cpc/err.cputrackterminates.ksh
+exclude SKIP common/cpc/err.toomanyenablings.d
+exclude SKIP common/cpc/tst.allcpus.ksh
+exclude SKIP common/cpc/tst.genericevent.d
+exclude SKIP common/cpc/tst.platformevent.ksh
+
+# We don't have a mib provider.
+exclude EXFAIL common/mib/tst.icmp.ksh
+exclude EXFAIL common/mib/tst.tcp.ksh
+exclude EXFAIL common/mib/tst.udp.ksh
+
+# At the moment dtrace(1) always needs to run as root.
+exclude SKIP common/privs/tst.fds.ksh
+exclude SKIP common/privs/tst.func_access.ksh
+exclude SKIP common/privs/tst.getf.ksh
+exclude SKIP common/privs/tst.op_access.ksh
+exclude SKIP common/privs/tst.procpriv.ksh
+exclude SKIP common/privs/tst.providers.ksh
+exclude SKIP common/privs/tst.unpriv_funcs.ksh
+
+# These tests hang for reasons unknown.
+exclude SKIP common/buffering/tst.ring3.d
+exclude SKIP common/funcs/tst.chill.ksh
+exclude SKIP common/funcs/tst.index.d
+
+# No Java support at the moment.
+exclude EXFAIL common/java_api/tst.Abort.ksh
+exclude EXFAIL common/java_api/tst.Bean.ksh
+exclude EXFAIL common/java_api/tst.Close.ksh
+exclude EXFAIL common/java_api/tst.Drop.ksh
+exclude EXFAIL common/java_api/tst.Enable.ksh
+exclude EXFAIL common/java_api/tst.FunctionLookup.ksh
+exclude EXFAIL common/java_api/tst.GetAggregate.ksh
+exclude EXFAIL common/java_api/tst.MaxConsumers.ksh
+exclude EXFAIL common/java_api/tst.MultiAggPrinta.ksh
+exclude EXFAIL common/java_api/tst.ProbeData.ksh
+exclude EXFAIL common/java_api/tst.ProbeDescription.ksh
+exclude EXFAIL common/java_api/tst.StateMachine.ksh
+exclude EXFAIL common/java_api/tst.StopLock.ksh
+
+# Expects specific formatting from banner(6).
+exclude EXFAIL common/aggs/tst.aggpackbanner.ksh
+
+# Test assumes we're running on a Solaris kernel.
+exclude EXFAIL common/misc/tst.roch.d
+exclude EXFAIL common/predicates/tst.argsnotcached.d
+exclude EXFAIL common/safety/tst.vahole.d
+
+# Tests that depend on the plockstat provider.
+exclude EXFAIL common/plockstat/tst.available.d
+exclude EXFAIL common/plockstat/tst.libmap.d
+exclude EXFAIL common/usdt/tst.andpid.ksh
+
+# Depends on java.
+exclude SKIP common/drops/drp.DTRACEDROP_STKSTROVERFLOW.d
+
+# Interrupt priority isn't relevant on FreeBSD.
+exclude SKIP common/builtinvar/tst.ipl.d
+exclude SKIP common/builtinvar/tst.ipl1.d
+
+# These tests rely on being able to find a host via broadcast pings.
+exclude EXFAIL common/ip/tst.ipv4remotetcp.ksh
+exclude EXFAIL common/ip/tst.ipv4remoteudp.ksh
+exclude EXFAIL common/ip/tst.ipv6remoteicmp.ksh
+exclude EXFAIL common/ip/tst.ipv4remoteicmp.ksh
+
+# FreeBSD never places tcpcbs in the TIME_WAIT state, so the probe never fires.
+exclude EXFAIL common/ip/tst.localtcpstate.ksh
+exclude EXFAIL common/ip/tst.remotetcpstate.ksh
+
+# Depends on the number of probes in /bin/sh and the current DOF limit.
+exclude EXFAIL common/pid/err.D_PROC_CREATEFAIL.many.d
+
+# Tries to enable pid$target:libc::entry, though there's no "libc" module.
+# Currently unsure as to whether this might be a libproc bug.
+exclude EXFAIL common/pid/tst.probemod.ksh
+
+# Assumes date(1) has a pid$target::main:return probe.
+exclude EXFAIL common/pid/tst.newprobes.ksh
+
+# libproc+librtld_db don't handle dlopen(2) yet.
+exclude EXFAIL common/pid/tst.provregex2.ksh
+exclude EXFAIL common/pid/tst.provregex4.ksh
+
+# libproc doesn't properly handle probe sites that correspond to multiple
+# symbols.
+exclude EXFAIL common/pid/tst.weak1.d
+exclude EXFAIL common/pid/tst.weak2.d
+
+# This test checks for a leading tab on a line before #define. That is illegal
+# on Solaris, but the clang pre-processor on FreeBSD is happy with code like
+# that.
+exclude EXFAIL common/preprocessor/err.D_PRAGCTL_INVAL.tabdefine.d
+
+# This test uses proc:::signal-handle, which we don't appear to have.
+exclude EXFAIL common/proc/tst.signal.ksh
+
+# This test uses proc:::lwp-start, which we don't appear to have.
+exclude EXFAIL common/proc/tst.startexit.ksh
+
+# This test causes a panic at the moment because fbt instruments the lock class'
+# lc_owned method.
+exclude SKIP common/safety/tst.rw.d
+
+# Depends on some implementation details of the runtime linker.
+exclude EXFAIL common/vars/tst.ucaller.ksh
+
+# These rely on process attributes that FreeBSD doesn't carry.
+exclude EXFAIL common/scripting/tst.projid.ksh
+exclude EXFAIL common/scripting/tst.taskid.ksh
+
+# This test expects its test program to be installed without CTF data, but
+# the rest of the programs for this feature need CTF data. Not yet sure how
+# to build that.
+exclude EXFAIL common/uctf/tst.libtype.ksh
+
+# libproc doesn't have linkmap support yet.
+exclude EXFAIL common/uctf/tst.linkmap.ksh
+
+# Uses Sun-specific compiler options.
+exclude EXFAIL common/usdt/tst.badguess.ksh
+exclude EXFAIL common/usdt/tst.guess32.ksh
+exclude EXFAIL common/usdt/tst.guess64.ksh
+
+# Generated headers include <sys/sdt.h>, so _DTRACE_VERSION is always defined.
+exclude EXFAIL common/usdt/tst.nodtrace.ksh
+
+# The second dtrace -G invocation returns an error with "no probes found," which
+# makes sense to me. Not yet sure what the expected behaviour is here.
+exclude EXFAIL common/usdt/tst.static2.ksh
+
+# Uses the Solaris-specific ppriv(1).
+exclude EXFAIL common/usdt/tst.user.ksh
diff --git a/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh b/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
new file mode 100755
index 0000000..bf0e181
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/genmakefiles.sh
@@ -0,0 +1,85 @@
+# $FreeBSD$
+
+usage()
+{
+ cat <<__EOF__ >&2
+usage: $(basename $0)
+
+This script regenerates the DTrace test suite makefiles. It should be run
+whenever \$srcdir/cddl/contrib/opensolaris/cmd/dtrace/test/tst is modified.
+__EOF__
+ exit 1
+}
+
+# Format a file list for use in a make(1) variable assignment: take the
+# basename of each input file and append " \" to it.
+fmtflist()
+{
+ awk 'function bn(f) {
+ sub(".*/", "", f)
+ return f
+ }
+ {print " ", bn($1), " \\"}'
+}
+
+genmakefile()
+{
+ local basedir=$1
+
+ local tdir=${CONTRIB_TESTDIR}/${basedir}
+ local tfiles=$(find $tdir -type f -a \
+ \( -name \*.d -o -name \*.ksh -o -name \*.out \) | sort | fmtflist)
+ local tcfiles=$(find $tdir -type f -a -name \*.c | sort | fmtflist)
+ local texes=$(find $tdir -type f -a -name \*.exe | sort | fmtflist)
+
+ # One-off variable definitions.
+ local special
+ if [ "$basedir" = proc ]; then
+ special="
+LDADD.tst.sigwait.exe+= -lrt
+DPADD.tst.sigwait.exe+= \${LIBRT}
+"
+ elif [ "$basedir" = uctf ]; then
+ special="
+WITH_CTF=YES
+"
+ fi
+
+ local makefile=$(mktemp)
+ cat <<__EOF__ > $makefile
+# \$FreeBSD$
+
+#
+# This Makefile was generated by \$srcdir${ORIGINDIR#${TOPDIR}}/genmakefiles.sh.
+#
+
+TESTFILES= \\
+$tfiles
+
+TESTEXES= \\
+$texes
+
+CFILES= \\
+$tcfiles
+
+$special
+.include "../../Makefile.inc1"
+__EOF__
+
+ mv -f $makefile ${ORIGINDIR}/../common/${basedir}/Makefile
+}
+
+set -e
+
+if [ $# -ne 0 ]; then
+ usage
+fi
+
+readonly ORIGINDIR=$(realpath $(dirname $0))
+readonly TOPDIR=$(realpath ${ORIGINDIR}/../../../../..)
+readonly CONTRIB_TESTDIR=${TOPDIR}/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common
+
+# Generate a Makefile for each test group under common/.
+for dir in $(find ${CONTRIB_TESTDIR} -mindepth 1 -maxdepth 1 -type d); do
+ genmakefile $(basename $dir)
+done
diff --git a/cddl/usr.sbin/dtrace/tests/tools/gentest.sh b/cddl/usr.sbin/dtrace/tests/tools/gentest.sh
new file mode 100755
index 0000000..9c34b79
--- /dev/null
+++ b/cddl/usr.sbin/dtrace/tests/tools/gentest.sh
@@ -0,0 +1,110 @@
+# $FreeBSD$
+
+usage()
+{
+ cat <<__EOF__ >&2
+Generate ATF test cases from a set of DTrace tests.
+
+usage: sh $(basename $0) [-e <excludes>] <category> [<testfiles>]
+
+ excludes: A shell script which defines test cases that are to be skipped,
+ or aren't expected to pass.
+ category: The test category, in the form of <arch>/<feature>. For example,
+ "common/aggs" is the test category for D aggregations.
+ testfiles: The test files for the tests in the specified category.
+__EOF__
+ exit 1
+}
+
+gentestcase()
+{
+ local mod tcase tfile
+
+ tfile=$1
+ tcase=$2
+ mod=$3
+
+ cat <<__EOF__
+atf_test_case $tcase
+${tcase}_head()
+{
+ atf_set 'descr' 'DTrace test ${CATEGORY}/${tfile}'
+}
+${tcase}_body()
+{
+ $mod
+ atf_check -s exit:0 -o empty -e empty \\
+ "\$(atf_get_srcdir)/../../dtest" "\$(atf_get_srcdir)/${tfile}"
+}
+__EOF__
+}
+
+gentestcases()
+{
+ local mod tcase tfile tfiles
+
+ eval tfiles=\$$1
+ mod=$2
+
+ for tfile in ${tfiles}; do
+ case $tfile in
+ drp.*.d|err.*.d|tst.*.d|*.ksh)
+ # Test names need to be mangled for ATF.
+ tcase=$(echo "$tfile" | tr '.-' '_')
+ gentestcase "$tfile" "$tcase" "$mod"
+ TCASES="$TCASES $tcase"
+ ;;
+ esac
+ done
+}
+
+set -e
+
+#
+# Parse arguments.
+#
+case $1 in
+-e)
+ shift; EXCLUDES=$1; shift
+ ;;
+esac
+
+CATEGORY=$1
+shift
+if ! expr "$CATEGORY" : '[^/]*/[^/]*' >/dev/null 2>&1; then
+ usage
+fi
+FEATURE=$(basename ${CATEGORY})
+ARCH=$(dirname ${CATEGORY})
+
+#
+# Remove skipped tests and expected failures from the main test list.
+#
+. $EXCLUDES
+EXFAILS=$(echo -e "$EXFAIL" | grep "^${CATEGORY}/" | xargs basename -a)
+SKIPS=$(echo -e "$SKIP" | grep "^${CATEGORY}/" | xargs basename -a)
+
+FILELIST=$(mktemp)
+trap 'rm -f $FILELIST' EXIT
+
+echo "$@" | tr ' ' '\n' | xargs basename -a | sort > ${FILELIST}
+TFILES=$(printf '%s\n%s' "$EXFAILS" "$SKIPS" | sort | comm -13 /dev/stdin $FILELIST)
+
+#
+# Generate test cases.
+#
+gentestcases SKIPS "atf_skip \"test may hang or cause system instability\""
+gentestcases EXFAILS "atf_expect_fail \"test is known to fail\""
+gentestcases TFILES
+
+#
+# Generate the test init function.
+#
+cat <<__EOF__
+atf_init_test_cases()
+{
+$(for tcase in ${TCASES}; do echo " atf_add_test_case $tcase"; done)
+}
+__EOF__
+
+rm -f $FILELIST
diff --git a/cddl/usr.sbin/tests/Makefile b/cddl/usr.sbin/tests/Makefile
index 0305aee..a0e63e5 100644
--- a/cddl/usr.sbin/tests/Makefile
+++ b/cddl/usr.sbin/tests/Makefile
@@ -2,9 +2,7 @@
.include <bsd.own.mk>
-TESTSDIR= ${TESTSBASE}/cddl/usr.sbin
-
-.PATH: ${.CURDIR:H:H:H}/tests
+.PATH: ${SRCTOP}/tests
KYUAFILE= yes
.include <bsd.test.mk>
diff --git a/contrib/libarchive/NEWS b/contrib/libarchive/NEWS
index 6f16b88..7b5c31f 100644
--- a/contrib/libarchive/NEWS
+++ b/contrib/libarchive/NEWS
@@ -1,3 +1,10 @@
+Jan 29, 2017: Limited NFSv4 ACL support for Mac OS (Darwin)
+
+Jan 10, 2017: POSIX.1e and NFSv4 ACL support for Solaris and derivates
+
+Dec 27, 2016: NFSv4 ACL read and write support for pax
+ Deprecated functions: archive_entry_acl_text(), archive_entry_acl_text_w()
+
Oct 26, 2016: Remove liblzmadec support
Oct 23, 2016: libarchive 3.2.2 released
diff --git a/contrib/libarchive/cpio/cpio.c b/contrib/libarchive/cpio/cpio.c
index a7a747a..30c9ad3 100644
--- a/contrib/libarchive/cpio/cpio.c
+++ b/contrib/libarchive/cpio/cpio.c
@@ -703,6 +703,7 @@ file_to_archive(struct cpio *cpio, const char *srcpath)
lafe_warnc(0, "%s",
archive_error_string(cpio->archive_read_disk));
if (r <= ARCHIVE_FAILED) {
+ archive_entry_free(entry);
cpio->return_value = 1;
return (r);
}
diff --git a/contrib/libarchive/libarchive/archive_acl.c b/contrib/libarchive/libarchive/archive_acl.c
index 3653d6f..b8b6b63 100644
--- a/contrib/libarchive/libarchive/archive_acl.c
+++ b/contrib/libarchive/libarchive/archive_acl.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2003-2010 Tim Kientzle
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -55,25 +56,77 @@ static struct archive_acl_entry *acl_new_entry(struct archive_acl *acl,
static int archive_acl_add_entry_len_l(struct archive_acl *acl,
int type, int permset, int tag, int id, const char *name,
size_t len, struct archive_string_conv *sc);
+static int archive_acl_text_want_type(struct archive_acl *acl, int flags);
+static ssize_t archive_acl_text_len(struct archive_acl *acl, int want_type,
+ int flags, int wide, struct archive *a,
+ struct archive_string_conv *sc);
static int isint_w(const wchar_t *start, const wchar_t *end, int *result);
static int ismode_w(const wchar_t *start, const wchar_t *end, int *result);
+static int is_nfs4_flags_w(const wchar_t *start, const wchar_t *end,
+ int *result);
+static int is_nfs4_perms_w(const wchar_t *start, const wchar_t *end,
+ int *result);
static void next_field_w(const wchar_t **wp, const wchar_t **start,
const wchar_t **end, wchar_t *sep);
-static int prefix_w(const wchar_t *start, const wchar_t *end,
- const wchar_t *test);
-static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
- const wchar_t *wname, int perm, int id);
+static void append_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
+ int tag, int flags, const wchar_t *wname, int perm, int id);
static void append_id_w(wchar_t **wp, int id);
static int isint(const char *start, const char *end, int *result);
static int ismode(const char *start, const char *end, int *result);
+static int is_nfs4_flags(const char *start, const char *end,
+ int *result);
+static int is_nfs4_perms(const char *start, const char *end,
+ int *result);
static void next_field(const char **p, const char **start,
const char **end, char *sep);
-static int prefix_c(const char *start, const char *end,
- const char *test);
-static void append_entry(char **p, const char *prefix, int tag,
- const char *name, int perm, int id);
+static void append_entry(char **p, const char *prefix, int type,
+ int tag, int flags, const char *name, int perm, int id);
static void append_id(char **p, int id);
+static const struct {
+ const int perm;
+ const char c;
+ const wchar_t wc;
+} nfsv4_acl_perm_map[] = {
+ { ARCHIVE_ENTRY_ACL_READ_DATA | ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, 'r',
+ L'r' },
+ { ARCHIVE_ENTRY_ACL_WRITE_DATA | ARCHIVE_ENTRY_ACL_ADD_FILE, 'w',
+ L'w' },
+ { ARCHIVE_ENTRY_ACL_EXECUTE, 'x', L'x' },
+ { ARCHIVE_ENTRY_ACL_APPEND_DATA | ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY,
+ 'p', L'p' },
+ { ARCHIVE_ENTRY_ACL_DELETE, 'd', L'd' },
+ { ARCHIVE_ENTRY_ACL_DELETE_CHILD, 'D', L'D' },
+ { ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, 'a', L'a' },
+ { ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, 'A', L'A' },
+ { ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, 'R', L'R' },
+ { ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, 'W', L'W' },
+ { ARCHIVE_ENTRY_ACL_READ_ACL, 'c', L'c' },
+ { ARCHIVE_ENTRY_ACL_WRITE_ACL, 'C', L'C' },
+ { ARCHIVE_ENTRY_ACL_WRITE_OWNER, 'o', L'o' },
+ { ARCHIVE_ENTRY_ACL_SYNCHRONIZE, 's', L's' }
+};
+
+static const int nfsv4_acl_perm_map_size = (int)(sizeof(nfsv4_acl_perm_map) /
+ sizeof(nfsv4_acl_perm_map[0]));
+
+static const struct {
+ const int perm;
+ const char c;
+ const wchar_t wc;
+} nfsv4_acl_flag_map[] = {
+ { ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, 'f', L'f' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, 'd', L'd' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, 'i', L'i' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, 'n', L'n' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, 'S', L'S' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, 'F', L'F' },
+ { ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, 'I', L'I' }
+};
+
+static const int nfsv4_acl_flag_map_size = (int)(sizeof(nfsv4_acl_flag_map) /
+ sizeof(nfsv4_acl_flag_map[0]));
+
void
archive_acl_clear(struct archive_acl *acl)
{
@@ -340,6 +393,15 @@ archive_acl_count(struct archive_acl *acl, int want_type)
}
/*
+ * Return a bitmask of stored ACL types in an ACL list
+ */
+int
+archive_acl_types(struct archive_acl *acl)
+{
+ return (acl->acl_types);
+}
+
+/*
* Prepare for reading entries from the ACL data. Returns a count
* of entries matching "want_type", or zero if there are no
* non-extended ACL entries of that type.
@@ -375,8 +437,8 @@ archive_acl_reset(struct archive_acl *acl, int want_type)
* standard permissions and include them in the returned list.
*/
int
-archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, int *type,
- int *permset, int *tag, int *id, const char **name)
+archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type,
+ int *type, int *permset, int *tag, int *id, const char **name)
{
*name = NULL;
*id = -1;
@@ -441,130 +503,273 @@ archive_acl_next(struct archive *a, struct archive_acl *acl, int want_type, int
}
/*
- * Generate a text version of the ACL. The flags parameter controls
- * the style of the generated ACL.
+ * Determine what type of ACL do we want
*/
-const wchar_t *
-archive_acl_text_w(struct archive *a, struct archive_acl *acl, int flags)
+static int
+archive_acl_text_want_type(struct archive_acl *acl, int flags)
{
- int count;
- size_t length;
- const wchar_t *wname;
- const wchar_t *prefix;
- wchar_t separator;
- struct archive_acl_entry *ap;
- int id, r;
- wchar_t *wp;
+ int want_type;
- if (acl->acl_text_w != NULL) {
- free (acl->acl_text_w);
- acl->acl_text_w = NULL;
+ /* Check if ACL is NFSv4 */
+ if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ /* NFSv4 should never mix with POSIX.1e */
+ if ((acl->acl_types & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0)
+ return (0);
+ else
+ return (ARCHIVE_ENTRY_ACL_TYPE_NFS4);
}
- separator = L',';
+ /* Now deal with POSIX.1e ACLs */
+
+ want_type = 0;
+ if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)
+ want_type |= ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
+ want_type |= ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
+
+ /* By default we want both access and default ACLs */
+ if (want_type == 0)
+ return (ARCHIVE_ENTRY_ACL_TYPE_POSIX1E);
+
+ return (want_type);
+}
+
+/*
+ * Calculate ACL text string length
+ */
+static ssize_t
+archive_acl_text_len(struct archive_acl *acl, int want_type, int flags,
+ int wide, struct archive *a, struct archive_string_conv *sc) {
+ struct archive_acl_entry *ap;
+ const char *name;
+ const wchar_t *wname;
+ int count, idlen, tmp, r;
+ ssize_t length;
+ size_t len;
+
count = 0;
length = 0;
- ap = acl->acl_head;
- while (ap != NULL) {
- if ((ap->type & flags) != 0) {
- count++;
- if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) &&
- (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT))
- length += 8; /* "default:" */
- length += 5; /* tag name */
- length += 1; /* colon */
- r = archive_mstring_get_wcs(a, &ap->name, &wname);
- if (r == 0 && wname != NULL)
- length += wcslen(wname);
- else if (r < 0 && errno == ENOMEM)
- return (NULL);
- else
- length += sizeof(uid_t) * 3 + 1;
- length ++; /* colon */
+ for (ap = acl->acl_head; ap != NULL; ap = ap->next) {
+ if ((ap->type & want_type) == 0)
+ continue;
+ /*
+ * Filemode-mapping ACL entries are stored exclusively in
+ * ap->mode so they should not be in the list
+ */
+ if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS)
+ && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ
+ || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ
+ || ap->tag == ARCHIVE_ENTRY_ACL_OTHER))
+ continue;
+ count++;
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0
+ && (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
+ length += 8; /* "default:" */
+ switch (ap->tag) {
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+ length += 6; /* "owner@" */
+ break;
+ }
+ /* FALLTHROUGH */
+ case ARCHIVE_ENTRY_ACL_USER:
+ case ARCHIVE_ENTRY_ACL_MASK:
+ length += 4; /* "user", "mask" */
+ break;
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+ length += 6; /* "group@" */
+ break;
+ }
+ /* FALLTHROUGH */
+ case ARCHIVE_ENTRY_ACL_GROUP:
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ length += 5; /* "group", "other" */
+ break;
+ case ARCHIVE_ENTRY_ACL_EVERYONE:
+ length += 9; /* "everyone@" */
+ break;
+ }
+ length += 1; /* colon after tag */
+ if (ap->tag == ARCHIVE_ENTRY_ACL_USER ||
+ ap->tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ if (wide) {
+ r = archive_mstring_get_wcs(a, &ap->name,
+ &wname);
+ if (r == 0 && wname != NULL)
+ length += wcslen(wname);
+ else if (r < 0 && errno == ENOMEM)
+ return (0);
+ else
+ length += sizeof(uid_t) * 3 + 1;
+ } else {
+ r = archive_mstring_get_mbs_l(&ap->name, &name,
+ &len, sc);
+ if (r != 0)
+ return (0);
+ if (len > 0 && name != NULL)
+ length += len;
+ else
+ length += sizeof(uid_t) * 3 + 1;
+ }
+ length += 1; /* colon after user or group name */
+ } else if (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4)
+ length += 1; /* 2nd colon empty user,group or other */
+
+ if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) != 0)
+ && ((want_type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0)
+ && (ap->tag == ARCHIVE_ENTRY_ACL_OTHER
+ || ap->tag == ARCHIVE_ENTRY_ACL_MASK)) {
+ /* Solaris has no colon after other: and mask: */
+ length = length - 1;
+ }
+
+ if (want_type == ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+ /* rwxpdDaARWcCos:fdinSFI:deny */
+ length += 27;
+ if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DENY) == 0)
+ length += 1; /* allow, alarm, audit */
+ } else
length += 3; /* rwx */
+
+ if ((ap->tag == ARCHIVE_ENTRY_ACL_USER ||
+ ap->tag == ARCHIVE_ENTRY_ACL_GROUP) &&
+ (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) != 0) {
length += 1; /* colon */
- length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1;
- length ++; /* newline */
+ /* ID digit count */
+ idlen = 1;
+ tmp = ap->id;
+ while (tmp > 9) {
+ tmp = tmp / 10;
+ idlen++;
+ }
+ length += idlen;
}
- ap = ap->next;
+ length ++; /* entry separator */
}
- if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) {
- length += 10; /* "user::rwx\n" */
- length += 11; /* "group::rwx\n" */
- length += 11; /* "other::rwx\n" */
- }
+ /* Add filemode-mapping access entries to the length */
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ if ((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) != 0) {
+ /* "user::rwx\ngroup::rwx\nother:rwx\n" */
+ length += 31;
+ } else {
+ /* "user::rwx\ngroup::rwx\nother::rwx\n" */
+ length += 32;
+ }
+ } else if (count == 0)
+ return (0);
+
+ /* The terminating character is included in count */
+ return (length);
+}
+
+/*
+ * Generate a wide text version of the ACL. The flags parameter controls
+ * the type and style of the generated ACL.
+ */
+wchar_t *
+archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags,
+ struct archive *a)
+{
+ int count;
+ ssize_t length;
+ size_t len;
+ const wchar_t *wname;
+ const wchar_t *prefix;
+ wchar_t separator;
+ struct archive_acl_entry *ap;
+ int id, r, want_type;
+ wchar_t *wp, *ws;
- if (count == 0)
+ want_type = archive_acl_text_want_type(acl, flags);
+
+ /* Both NFSv4 and POSIX.1 types found */
+ if (want_type == 0)
return (NULL);
+ if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E)
+ flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT;
+
+ length = archive_acl_text_len(acl, want_type, flags, 1, a, NULL);
+
+ if (length == 0)
+ return (NULL);
+
+ if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA)
+ separator = L',';
+ else
+ separator = L'\n';
+
/* Now, allocate the string and actually populate it. */
- wp = acl->acl_text_w = (wchar_t *)malloc(length * sizeof(wchar_t));
- if (wp == NULL)
+ wp = ws = (wchar_t *)malloc(length * sizeof(wchar_t));
+ if (wp == NULL) {
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
return (NULL);
+ }
count = 0;
- if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
- append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL,
+
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL,
acl->mode & 0700, -1);
- *wp++ = ',';
- append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL,
+ *wp++ = separator;
+ append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL,
acl->mode & 0070, -1);
- *wp++ = ',';
- append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL,
+ *wp++ = separator;
+ append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_OTHER, flags, NULL,
acl->mode & 0007, -1);
count += 3;
-
- ap = acl->acl_head;
- while (ap != NULL) {
- if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
- r = archive_mstring_get_wcs(a, &ap->name, &wname);
- if (r == 0) {
- *wp++ = separator;
- if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
- id = ap->id;
- else
- id = -1;
- append_entry_w(&wp, NULL, ap->tag, wname,
- ap->permset, id);
- count++;
- } else if (r < 0 && errno == ENOMEM)
- return (NULL);
- }
- ap = ap->next;
- }
}
-
- if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) {
- if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT)
+ for (ap = acl->acl_head; ap != NULL; ap = ap->next) {
+ if ((ap->type & want_type) == 0)
+ continue;
+ /*
+ * Filemode-mapping ACL entries are stored exclusively in
+ * ap->mode so they should not be in the list
+ */
+ if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS)
+ && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ
+ || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ
+ || ap->tag == ARCHIVE_ENTRY_ACL_OTHER))
+ continue;
+ if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT &&
+ (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0)
prefix = L"default:";
else
prefix = NULL;
- ap = acl->acl_head;
- count = 0;
- while (ap != NULL) {
- if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) {
- r = archive_mstring_get_wcs(a, &ap->name, &wname);
- if (r == 0) {
- if (count > 0)
- *wp++ = separator;
- if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
- id = ap->id;
- else
- id = -1;
- append_entry_w(&wp, prefix, ap->tag,
- wname, ap->permset, id);
- count ++;
- } else if (r < 0 && errno == ENOMEM)
- return (NULL);
- }
- ap = ap->next;
- }
+ r = archive_mstring_get_wcs(a, &ap->name, &wname);
+ if (r == 0) {
+ if (count > 0)
+ *wp++ = separator;
+ if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
+ id = ap->id;
+ else
+ id = -1;
+ append_entry_w(&wp, prefix, ap->type, ap->tag, flags,
+ wname, ap->permset, id);
+ count++;
+ } else if (r < 0 && errno == ENOMEM)
+ return (NULL);
}
- return (acl->acl_text_w);
-}
+ /* Add terminating character */
+ *wp++ = L'\0';
+
+ len = wcslen(ws);
+ if ((ssize_t)len > (length - 1))
+ __archive_errx(1, "Buffer overrun");
+
+ if (text_len != NULL)
+ *text_len = len;
+
+ return (ws);
+}
static void
append_id_w(wchar_t **wp, int id)
@@ -577,9 +782,11 @@ append_id_w(wchar_t **wp, int id)
}
static void
-append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
- const wchar_t *wname, int perm, int id)
+append_entry_w(wchar_t **wp, const wchar_t *prefix, int type,
+ int tag, int flags, const wchar_t *wname, int perm, int id)
{
+ int i;
+
if (prefix != NULL) {
wcscpy(*wp, prefix);
*wp += wcslen(*wp);
@@ -588,6 +795,10 @@ append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
case ARCHIVE_ENTRY_ACL_USER_OBJ:
wname = NULL;
id = -1;
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ wcscpy(*wp, L"owner@");
+ break;
+ }
/* FALLTHROUGH */
case ARCHIVE_ENTRY_ACL_USER:
wcscpy(*wp, L"user");
@@ -595,6 +806,10 @@ append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
wname = NULL;
id = -1;
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ wcscpy(*wp, L"group@");
+ break;
+ }
/* FALLTHROUGH */
case ARCHIVE_ENTRY_ACL_GROUP:
wcscpy(*wp, L"group");
@@ -609,154 +824,184 @@ append_entry_w(wchar_t **wp, const wchar_t *prefix, int tag,
wname = NULL;
id = -1;
break;
+ case ARCHIVE_ENTRY_ACL_EVERYONE:
+ wcscpy(*wp, L"everyone@");
+ wname = NULL;
+ id = -1;
+ break;
}
*wp += wcslen(*wp);
*(*wp)++ = L':';
- if (wname != NULL) {
- wcscpy(*wp, wname);
+ if (((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) ||
+ tag == ARCHIVE_ENTRY_ACL_USER ||
+ tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ if (wname != NULL) {
+ wcscpy(*wp, wname);
+ *wp += wcslen(*wp);
+ } else if (tag == ARCHIVE_ENTRY_ACL_USER
+ || tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ append_id_w(wp, id);
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0)
+ id = -1;
+ }
+ /* Solaris style has no second colon after other and mask */
+ if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0)
+ || (tag != ARCHIVE_ENTRY_ACL_OTHER
+ && tag != ARCHIVE_ENTRY_ACL_MASK))
+ *(*wp)++ = L':';
+ }
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
+ /* POSIX.1e ACL perms */
+ *(*wp)++ = (perm & 0444) ? L'r' : L'-';
+ *(*wp)++ = (perm & 0222) ? L'w' : L'-';
+ *(*wp)++ = (perm & 0111) ? L'x' : L'-';
+ } else {
+ /* NFSv4 ACL perms */
+ for (i = 0; i < nfsv4_acl_perm_map_size; i++) {
+ if (perm & nfsv4_acl_perm_map[i].perm)
+ *(*wp)++ = nfsv4_acl_perm_map[i].wc;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*wp)++ = L'-';
+ }
+ *(*wp)++ = L':';
+ for (i = 0; i < nfsv4_acl_flag_map_size; i++) {
+ if (perm & nfsv4_acl_flag_map[i].perm)
+ *(*wp)++ = nfsv4_acl_flag_map[i].wc;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*wp)++ = L'-';
+ }
+ *(*wp)++ = L':';
+ switch (type) {
+ case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
+ wcscpy(*wp, L"allow");
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_DENY:
+ wcscpy(*wp, L"deny");
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
+ wcscpy(*wp, L"audit");
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
+ wcscpy(*wp, L"alarm");
+ break;
+ default:
+ break;
+ }
*wp += wcslen(*wp);
- } else if (tag == ARCHIVE_ENTRY_ACL_USER
- || tag == ARCHIVE_ENTRY_ACL_GROUP) {
- append_id_w(wp, id);
- id = -1;
}
- *(*wp)++ = L':';
- *(*wp)++ = (perm & 0444) ? L'r' : L'-';
- *(*wp)++ = (perm & 0222) ? L'w' : L'-';
- *(*wp)++ = (perm & 0111) ? L'x' : L'-';
if (id != -1) {
*(*wp)++ = L':';
append_id_w(wp, id);
}
- **wp = L'\0';
}
-int
-archive_acl_text_l(struct archive_acl *acl, int flags,
- const char **acl_text, size_t *acl_text_len,
+/*
+ * Generate a text version of the ACL. The flags parameter controls
+ * the type and style of the generated ACL.
+ */
+char *
+archive_acl_to_text_l(struct archive_acl *acl, ssize_t *text_len, int flags,
struct archive_string_conv *sc)
{
int count;
- size_t length;
+ ssize_t length;
+ size_t len;
const char *name;
const char *prefix;
char separator;
struct archive_acl_entry *ap;
- size_t len;
- int id, r;
- char *p;
+ int id, r, want_type;
+ char *p, *s;
- if (acl->acl_text != NULL) {
- free (acl->acl_text);
- acl->acl_text = NULL;
- }
+ want_type = archive_acl_text_want_type(acl, flags);
- *acl_text = NULL;
- if (acl_text_len != NULL)
- *acl_text_len = 0;
- separator = ',';
- count = 0;
- length = 0;
- ap = acl->acl_head;
- while (ap != NULL) {
- if ((ap->type & flags) != 0) {
- count++;
- if ((flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) &&
- (ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT))
- length += 8; /* "default:" */
- length += 5; /* tag name */
- length += 1; /* colon */
- r = archive_mstring_get_mbs_l(
- &ap->name, &name, &len, sc);
- if (r != 0)
- return (-1);
- if (len > 0 && name != NULL)
- length += len;
- else
- length += sizeof(uid_t) * 3 + 1;
- length ++; /* colon */
- length += 3; /* rwx */
- length += 1; /* colon */
- length += max(sizeof(uid_t), sizeof(gid_t)) * 3 + 1;
- length ++; /* newline */
- }
- ap = ap->next;
- }
+ /* Both NFSv4 and POSIX.1 types found */
+ if (want_type == 0)
+ return (NULL);
- if (count > 0 && ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)) {
- length += 10; /* "user::rwx\n" */
- length += 11; /* "group::rwx\n" */
- length += 11; /* "other::rwx\n" */
- }
+ if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E)
+ flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT;
- if (count == 0)
- return (0);
+ length = archive_acl_text_len(acl, want_type, flags, 0, NULL, sc);
+
+ if (length == 0)
+ return (NULL);
+
+ if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA)
+ separator = ',';
+ else
+ separator = '\n';
/* Now, allocate the string and actually populate it. */
- p = acl->acl_text = (char *)malloc(length);
- if (p == NULL)
- return (-1);
+ p = s = (char *)malloc(length * sizeof(char));
+ if (p == NULL) {
+ if (errno == ENOMEM)
+ __archive_errx(1, "No memory");
+ return (NULL);
+ }
count = 0;
- if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
- append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_USER_OBJ, NULL,
+
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL,
acl->mode & 0700, -1);
- *p++ = ',';
- append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_GROUP_OBJ, NULL,
+ *p++ = separator;
+ append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL,
acl->mode & 0070, -1);
- *p++ = ',';
- append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_OTHER, NULL,
+ *p++ = separator;
+ append_entry(&p, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ ARCHIVE_ENTRY_ACL_OTHER, flags, NULL,
acl->mode & 0007, -1);
count += 3;
-
- for (ap = acl->acl_head; ap != NULL; ap = ap->next) {
- if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) == 0)
- continue;
- r = archive_mstring_get_mbs_l(
- &ap->name, &name, &len, sc);
- if (r != 0)
- return (-1);
- *p++ = separator;
- if (name == NULL || (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) {
- id = ap->id;
- } else {
- id = -1;
- }
- append_entry(&p, NULL, ap->tag, name,
- ap->permset, id);
- count++;
- }
}
-
- if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0) {
- if (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT)
+ for (ap = acl->acl_head; ap != NULL; ap = ap->next) {
+ if ((ap->type & want_type) == 0)
+ continue;
+ /*
+ * Filemode-mapping ACL entries are stored exclusively in
+ * ap->mode so they should not be in the list
+ */
+ if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS)
+ && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ
+ || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ
+ || ap->tag == ARCHIVE_ENTRY_ACL_OTHER))
+ continue;
+ if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT &&
+ (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0)
prefix = "default:";
else
prefix = NULL;
- count = 0;
- for (ap = acl->acl_head; ap != NULL; ap = ap->next) {
- if ((ap->type & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) == 0)
- continue;
- r = archive_mstring_get_mbs_l(
- &ap->name, &name, &len, sc);
- if (r != 0)
- return (-1);
- if (count > 0)
- *p++ = separator;
- if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)
- id = ap->id;
- else
- id = -1;
- append_entry(&p, prefix, ap->tag,
- name, ap->permset, id);
- count ++;
+ r = archive_mstring_get_mbs_l(
+ &ap->name, &name, &len, sc);
+ if (r != 0)
+ return (NULL);
+ if (count > 0)
+ *p++ = separator;
+ if (name == NULL ||
+ (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID)) {
+ id = ap->id;
+ } else {
+ id = -1;
}
+ append_entry(&p, prefix, ap->type, ap->tag, flags, name,
+ ap->permset, id);
+ count++;
}
- *acl_text = acl->acl_text;
- if (acl_text_len != NULL)
- *acl_text_len = strlen(acl->acl_text);
- return (0);
+ /* Add terminating character */
+ *p++ = '\0';
+
+ len = strlen(s);
+
+ if ((ssize_t)len > (length - 1))
+ __archive_errx(1, "Buffer overrun");
+
+ if (text_len != NULL)
+ *text_len = len;
+
+ return (s);
}
static void
@@ -770,9 +1015,11 @@ append_id(char **p, int id)
}
static void
-append_entry(char **p, const char *prefix, int tag,
- const char *name, int perm, int id)
+append_entry(char **p, const char *prefix, int type,
+ int tag, int flags, const char *name, int perm, int id)
{
+ int i;
+
if (prefix != NULL) {
strcpy(*p, prefix);
*p += strlen(*p);
@@ -781,6 +1028,10 @@ append_entry(char **p, const char *prefix, int tag,
case ARCHIVE_ENTRY_ACL_USER_OBJ:
name = NULL;
id = -1;
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ strcpy(*p, "owner@");
+ break;
+ }
/* FALLTHROUGH */
case ARCHIVE_ENTRY_ACL_USER:
strcpy(*p, "user");
@@ -788,6 +1039,10 @@ append_entry(char **p, const char *prefix, int tag,
case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
name = NULL;
id = -1;
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ strcpy(*p, "group@");
+ break;
+ }
/* FALLTHROUGH */
case ARCHIVE_ENTRY_ACL_GROUP:
strcpy(*p, "group");
@@ -802,48 +1057,120 @@ append_entry(char **p, const char *prefix, int tag,
name = NULL;
id = -1;
break;
+ case ARCHIVE_ENTRY_ACL_EVERYONE:
+ strcpy(*p, "everyone@");
+ name = NULL;
+ id = -1;
+ break;
}
*p += strlen(*p);
*(*p)++ = ':';
- if (name != NULL) {
- strcpy(*p, name);
+ if (((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) ||
+ tag == ARCHIVE_ENTRY_ACL_USER ||
+ tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ if (name != NULL) {
+ strcpy(*p, name);
+ *p += strlen(*p);
+ } else if (tag == ARCHIVE_ENTRY_ACL_USER
+ || tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ append_id(p, id);
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0)
+ id = -1;
+ }
+ /* Solaris style has no second colon after other and mask */
+ if (((flags & ARCHIVE_ENTRY_ACL_STYLE_SOLARIS) == 0)
+ || (tag != ARCHIVE_ENTRY_ACL_OTHER
+ && tag != ARCHIVE_ENTRY_ACL_MASK))
+ *(*p)++ = ':';
+ }
+ if ((type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
+ /* POSIX.1e ACL perms */
+ *(*p)++ = (perm & 0444) ? 'r' : '-';
+ *(*p)++ = (perm & 0222) ? 'w' : '-';
+ *(*p)++ = (perm & 0111) ? 'x' : '-';
+ } else {
+ /* NFSv4 ACL perms */
+ for (i = 0; i < nfsv4_acl_perm_map_size; i++) {
+ if (perm & nfsv4_acl_perm_map[i].perm)
+ *(*p)++ = nfsv4_acl_perm_map[i].c;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*p)++ = '-';
+ }
+ *(*p)++ = ':';
+ for (i = 0; i < nfsv4_acl_flag_map_size; i++) {
+ if (perm & nfsv4_acl_flag_map[i].perm)
+ *(*p)++ = nfsv4_acl_flag_map[i].c;
+ else if ((flags & ARCHIVE_ENTRY_ACL_STYLE_COMPACT) == 0)
+ *(*p)++ = '-';
+ }
+ *(*p)++ = ':';
+ switch (type) {
+ case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
+ strcpy(*p, "allow");
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_DENY:
+ strcpy(*p, "deny");
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
+ strcpy(*p, "audit");
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
+ strcpy(*p, "alarm");
+ break;
+ }
*p += strlen(*p);
- } else if (tag == ARCHIVE_ENTRY_ACL_USER
- || tag == ARCHIVE_ENTRY_ACL_GROUP) {
- append_id(p, id);
- id = -1;
}
- *(*p)++ = ':';
- *(*p)++ = (perm & 0444) ? 'r' : '-';
- *(*p)++ = (perm & 0222) ? 'w' : '-';
- *(*p)++ = (perm & 0111) ? 'x' : '-';
if (id != -1) {
*(*p)++ = ':';
append_id(p, id);
}
- **p = '\0';
}
/*
- * Parse a textual ACL. This automatically recognizes and supports
- * extensions described above. The 'type' argument is used to
- * indicate the type that should be used for any entries not
- * explicitly marked as "default:".
+ * Parse a wide ACL text string.
+ *
+ * The want_type argument may be one of the following:
+ * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - text is a POSIX.1e ACL of type ACCESS
+ * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - text is a POSIX.1e ACL of type DEFAULT
+ * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - text is as a NFSv4 ACL
+ *
+ * POSIX.1e ACL entries prefixed with "default:" are treated as
+ * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT unless type is ARCHIVE_ENTRY_ACL_TYPE_NFS4
*/
int
-archive_acl_parse_w(struct archive_acl *acl,
- const wchar_t *text, int default_type)
+archive_acl_from_text_w(struct archive_acl *acl, const wchar_t *text,
+ int want_type)
{
struct {
const wchar_t *start;
const wchar_t *end;
- } field[4], name;
+ } field[6], name;
+
+ const wchar_t *s, *st;
- int fields, n;
- int type, tag, permset, id;
+ int numfields, fields, n, r, sol, ret;
+ int type, types, tag, permset, id;
+ size_t len;
wchar_t sep;
- while (text != NULL && *text != L'\0') {
+ ret = ARCHIVE_OK;
+ types = 0;
+
+ switch (want_type) {
+ case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
+ want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
+ case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
+ numfields = 5;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_NFS4:
+ numfields = 6;
+ break;
+ default:
+ return (ARCHIVE_FATAL);
+ }
+
+ while (text != NULL && *text != L'\0') {
/*
* Parse the fields out of the next entry,
* advance 'text' to start of next entry.
@@ -852,7 +1179,7 @@ archive_acl_parse_w(struct archive_acl *acl,
do {
const wchar_t *start, *end;
next_field_w(&text, &start, &end, &sep);
- if (fields < 4) {
+ if (fields < numfields) {
field[fields].start = start;
field[fields].end = end;
}
@@ -860,78 +1187,210 @@ archive_acl_parse_w(struct archive_acl *acl,
} while (sep == L':');
/* Set remaining fields to blank. */
- for (n = fields; n < 4; ++n)
+ for (n = fields; n < numfields; ++n)
field[n].start = field[n].end = NULL;
- /* Check for a numeric ID in field 1 or 3. */
- id = -1;
- isint_w(field[1].start, field[1].end, &id);
- /* Field 3 is optional. */
- if (id == -1 && fields > 3)
- isint_w(field[3].start, field[3].end, &id);
-
- /*
- * Solaris extension: "defaultuser::rwx" is the
- * default ACL corresponding to "user::rwx", etc.
- */
- if (field[0].end - field[0].start > 7
- && wmemcmp(field[0].start, L"default", 7) == 0) {
- type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
- field[0].start += 7;
- } else
- type = default_type;
+ if (field[0].start != NULL && *(field[0].start) == L'#') {
+ /* Comment, skip entry */
+ continue;
+ }
+ n = 0;
+ sol = 0;
+ id = -1;
+ permset = 0;
name.start = name.end = NULL;
- if (prefix_w(field[0].start, field[0].end, L"user")) {
- if (!ismode_w(field[2].start, field[2].end, &permset))
- return (ARCHIVE_WARN);
- if (id != -1 || field[1].start < field[1].end) {
- tag = ARCHIVE_ENTRY_ACL_USER;
- name = field[1];
+
+ if (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+ /* POSIX.1e ACLs */
+ /*
+ * Default keyword "default:user::rwx"
+ * if found, we have one more field
+ *
+ * We also support old Solaris extension:
+ * "defaultuser::rwx" is the default ACL corresponding
+ * to "user::rwx", etc. valid only for first field
+ */
+ s = field[0].start;
+ len = field[0].end - field[0].start;
+ if (*s == L'd' && (len == 1 || (len >= 7
+ && wmemcmp((s + 1), L"efault", 6) == 0))) {
+ type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
+ if (len > 7)
+ field[0].start += 7;
+ else
+ n = 1;
} else
- tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
- } else if (prefix_w(field[0].start, field[0].end, L"group")) {
- if (!ismode_w(field[2].start, field[2].end, &permset))
- return (ARCHIVE_WARN);
- if (id != -1 || field[1].start < field[1].end) {
- tag = ARCHIVE_ENTRY_ACL_GROUP;
+ type = want_type;
+
+ /* Check for a numeric ID in field n+1 or n+3. */
+ isint_w(field[n + 1].start, field[n + 1].end, &id);
+ /* Field n+3 is optional. */
+ if (id == -1 && fields > n+3)
+ isint_w(field[n + 3].start, field[n + 3].end,
+ &id);
+
+ tag = 0;
+ s = field[n].start;
+ st = field[n].start + 1;
+ len = field[n].end - field[n].start;
+
+ switch (*s) {
+ case L'u':
+ if (len == 1 || (len == 4
+ && wmemcmp(st, L"ser", 3) == 0))
+ tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ break;
+ case L'g':
+ if (len == 1 || (len == 5
+ && wmemcmp(st, L"roup", 4) == 0))
+ tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ break;
+ case L'o':
+ if (len == 1 || (len == 5
+ && wmemcmp(st, L"ther", 4) == 0))
+ tag = ARCHIVE_ENTRY_ACL_OTHER;
+ break;
+ case L'm':
+ if (len == 1 || (len == 4
+ && wmemcmp(st, L"ask", 3) == 0))
+ tag = ARCHIVE_ENTRY_ACL_MASK;
+ break;
+ default:
+ break;
+ }
+
+ switch (tag) {
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ case ARCHIVE_ENTRY_ACL_MASK:
+ if (fields == (n + 2)
+ && field[n + 1].start < field[n + 1].end
+ && ismode_w(field[n + 1].start,
+ field[n + 1].end, &permset)) {
+ /* This is Solaris-style "other:rwx" */
+ sol = 1;
+ } else if (fields == (n + 3) &&
+ field[n + 1].start < field[n + 1].end) {
+ /* Invalid mask or other field */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ break;
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ if (id != -1 ||
+ field[n + 1].start < field[n + 1].end) {
+ name = field[n + 1];
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
+ tag = ARCHIVE_ENTRY_ACL_USER;
+ else
+ tag = ARCHIVE_ENTRY_ACL_GROUP;
+ }
+ break;
+ default:
+ /* Invalid tag, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+
+ /*
+ * Without "default:" we expect mode in field 2
+ * Exception: Solaris other and mask fields
+ */
+ if (permset == 0 && !ismode_w(field[n + 2 - sol].start,
+ field[n + 2 - sol].end, &permset)) {
+ /* Invalid mode, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ } else {
+ /* NFS4 ACLs */
+ s = field[0].start;
+ len = field[0].end - field[0].start;
+ tag = 0;
+
+ switch (len) {
+ case 4:
+ if (wmemcmp(s, L"user", 4) == 0)
+ tag = ARCHIVE_ENTRY_ACL_USER;
+ break;
+ case 5:
+ if (wmemcmp(s, L"group", 5) == 0)
+ tag = ARCHIVE_ENTRY_ACL_GROUP;
+ break;
+ case 6:
+ if (wmemcmp(s, L"owner@", 6) == 0)
+ tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ else if (wmemcmp(s, L"group@", len) == 0)
+ tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ break;
+ case 9:
+ if (wmemcmp(s, L"everyone@", 9) == 0)
+ tag = ARCHIVE_ENTRY_ACL_EVERYONE;
+ default:
+ break;
+ }
+
+ if (tag == 0) {
+ /* Invalid tag, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ } else if (tag == ARCHIVE_ENTRY_ACL_USER ||
+ tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ n = 1;
name = field[1];
+ isint_w(name.start, name.end, &id);
} else
- tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
- } else if (prefix_w(field[0].start, field[0].end, L"other")) {
- if (fields == 2
- && field[1].start < field[1].end
- && ismode_w(field[1].start, field[1].end, &permset)) {
- /* This is Solaris-style "other:rwx" */
- } else if (fields == 3
- && field[1].start == field[1].end
- && field[2].start < field[2].end
- && ismode_w(field[2].start, field[2].end, &permset)) {
- /* This is FreeBSD-style "other::rwx" */
- } else
- return (ARCHIVE_WARN);
- tag = ARCHIVE_ENTRY_ACL_OTHER;
- } else if (prefix_w(field[0].start, field[0].end, L"mask")) {
- if (fields == 2
- && field[1].start < field[1].end
- && ismode_w(field[1].start, field[1].end, &permset)) {
- /* This is Solaris-style "mask:rwx" */
- } else if (fields == 3
- && field[1].start == field[1].end
- && field[2].start < field[2].end
- && ismode_w(field[2].start, field[2].end, &permset)) {
- /* This is FreeBSD-style "mask::rwx" */
- } else
- return (ARCHIVE_WARN);
- tag = ARCHIVE_ENTRY_ACL_MASK;
- } else
- return (ARCHIVE_WARN);
+ n = 0;
+
+ if (!is_nfs4_perms_w(field[1 + n].start,
+ field[1 + n].end, &permset)) {
+ /* Invalid NFSv4 perms, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ if (!is_nfs4_flags_w(field[2 + n].start,
+ field[2 + n].end, &permset)) {
+ /* Invalid NFSv4 flags, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ s = field[3 + n].start;
+ len = field[3 + n].end - field[3 + n].start;
+ type = 0;
+ if (len == 4) {
+ if (wmemcmp(s, L"deny", 4) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
+ } else if (len == 5) {
+ if (wmemcmp(s, L"allow", 5) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
+ else if (wmemcmp(s, L"audit", 5) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;
+ else if (wmemcmp(s, L"alarm", 5) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
+ }
+ if (type == 0) {
+ /* Invalid entry type, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ isint_w(field[4 + n].start, field[4 + n].end, &id);
+ }
/* Add entry to the internal list. */
- archive_acl_add_entry_w_len(acl, type, permset,
+ r = archive_acl_add_entry_w_len(acl, type, permset,
tag, id, name.start, name.end - name.start);
+ if (r < ARCHIVE_WARN)
+ return (r);
+ if (r != ARCHIVE_OK)
+ ret = ARCHIVE_WARN;
+ types |= type;
}
- return (ARCHIVE_OK);
+
+ /* Reset ACL */
+ archive_acl_reset(acl, types);
+
+ return (ret);
}
/*
@@ -977,16 +1436,122 @@ ismode_w(const wchar_t *start, const wchar_t *end, int *permset)
*permset = 0;
while (p < end) {
switch (*p++) {
- case 'r': case 'R':
+ case L'r': case L'R':
*permset |= ARCHIVE_ENTRY_ACL_READ;
break;
- case 'w': case 'W':
+ case L'w': case L'W':
*permset |= ARCHIVE_ENTRY_ACL_WRITE;
break;
- case 'x': case 'X':
+ case L'x': case L'X':
*permset |= ARCHIVE_ENTRY_ACL_EXECUTE;
break;
- case '-':
+ case L'-':
+ break;
+ default:
+ return (0);
+ }
+ }
+ return (1);
+}
+
+/*
+ * Parse a string as a NFS4 ACL permission field.
+ * Returns true if the string is non-empty and consists only of NFS4 ACL
+ * permission characters, false otherwise
+ */
+static int
+is_nfs4_perms_w(const wchar_t *start, const wchar_t *end, int *permset)
+{
+ const wchar_t *p = start;
+
+ while (p < end) {
+ switch (*p++) {
+ case L'r':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_DATA;
+ break;
+ case L'w':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_DATA;
+ break;
+ case L'x':
+ *permset |= ARCHIVE_ENTRY_ACL_EXECUTE;
+ break;
+ case L'p':
+ *permset |= ARCHIVE_ENTRY_ACL_APPEND_DATA;
+ break;
+ case L'D':
+ *permset |= ARCHIVE_ENTRY_ACL_DELETE_CHILD;
+ break;
+ case L'd':
+ *permset |= ARCHIVE_ENTRY_ACL_DELETE;
+ break;
+ case L'a':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES;
+ break;
+ case L'A':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES;
+ break;
+ case L'R':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS;
+ break;
+ case L'W':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS;
+ break;
+ case L'c':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_ACL;
+ break;
+ case L'C':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_ACL;
+ break;
+ case L'o':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_OWNER;
+ break;
+ case L's':
+ *permset |= ARCHIVE_ENTRY_ACL_SYNCHRONIZE;
+ break;
+ case L'-':
+ break;
+ default:
+ return(0);
+ }
+ }
+ return (1);
+}
+
+/*
+ * Parse a string as a NFS4 ACL flags field.
+ * Returns true if the string is non-empty and consists only of NFS4 ACL
+ * flag characters, false otherwise
+ */
+static int
+is_nfs4_flags_w(const wchar_t *start, const wchar_t *end, int *permset)
+{
+ const wchar_t *p = start;
+
+ while (p < end) {
+ switch(*p++) {
+ case L'f':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT;
+ break;
+ case L'd':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT;
+ break;
+ case L'i':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY;
+ break;
+ case L'n':
+ *permset |=
+ ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT;
+ break;
+ case L'S':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS;
+ break;
+ case L'F':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS;
+ break;
+ case L'I':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_INHERITED;
+ break;
+ case L'-':
break;
default:
return (0);
@@ -1033,46 +1598,48 @@ next_field_w(const wchar_t **wp, const wchar_t **start,
}
/*
- * Return true if the characters [start...end) are a prefix of 'test'.
- * This makes it easy to handle the obvious abbreviations: 'u' for 'user', etc.
- */
-static int
-prefix_w(const wchar_t *start, const wchar_t *end, const wchar_t *test)
-{
- if (start == end)
- return (0);
-
- if (*start++ != *test++)
- return (0);
-
- while (start < end && *start++ == *test++)
- ;
-
- if (start < end)
- return (0);
-
- return (1);
-}
-
-/*
- * Parse a textual ACL. This automatically recognizes and supports
- * extensions described above. The 'type' argument is used to
- * indicate the type that should be used for any entries not
- * explicitly marked as "default:".
+ * Parse an ACL text string.
+ *
+ * The want_type argument may be one of the following:
+ * ARCHIVE_ENTRY_ACL_TYPE_ACCESS - text is a POSIX.1e ACL of type ACCESS
+ * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - text is a POSIX.1e ACL of type DEFAULT
+ * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - text is as a NFSv4 ACL
+ *
+ * POSIX.1e ACL entries prefixed with "default:" are treated as
+ * ARCHIVE_ENTRY_ACL_TYPE_DEFAULT unless type is ARCHIVE_ENTRY_ACL_TYPE_NFS4
*/
int
-archive_acl_parse_l(struct archive_acl *acl,
- const char *text, int default_type, struct archive_string_conv *sc)
+archive_acl_from_text_l(struct archive_acl *acl, const char *text,
+ int want_type, struct archive_string_conv *sc)
{
struct {
const char *start;
const char *end;
- } field[4], name;
+ } field[6], name;
- int fields, n, r, ret = ARCHIVE_OK;
- int type, tag, permset, id;
+ const char *s, *st;
+ int numfields, fields, n, r, sol, ret;
+ int type, types, tag, permset, id;
+ size_t len;
char sep;
+ switch (want_type) {
+ case ARCHIVE_ENTRY_ACL_TYPE_POSIX1E:
+ want_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
+ case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
+ numfields = 5;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_NFS4:
+ numfields = 6;
+ break;
+ default:
+ return (ARCHIVE_FATAL);
+ }
+
+ ret = ARCHIVE_OK;
+ types = 0;
+
while (text != NULL && *text != '\0') {
/*
* Parse the fields out of the next entry,
@@ -1082,7 +1649,7 @@ archive_acl_parse_l(struct archive_acl *acl,
do {
const char *start, *end;
next_field(&text, &start, &end, &sep);
- if (fields < 4) {
+ if (fields < numfields) {
field[fields].start = start;
field[fields].end = end;
}
@@ -1090,72 +1657,197 @@ archive_acl_parse_l(struct archive_acl *acl,
} while (sep == ':');
/* Set remaining fields to blank. */
- for (n = fields; n < 4; ++n)
+ for (n = fields; n < numfields; ++n)
field[n].start = field[n].end = NULL;
- /* Check for a numeric ID in field 1 or 3. */
- id = -1;
- isint(field[1].start, field[1].end, &id);
- /* Field 3 is optional. */
- if (id == -1 && fields > 3)
- isint(field[3].start, field[3].end, &id);
-
- /*
- * Solaris extension: "defaultuser::rwx" is the
- * default ACL corresponding to "user::rwx", etc.
- */
- if (field[0].end - field[0].start > 7
- && memcmp(field[0].start, "default", 7) == 0) {
- type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
- field[0].start += 7;
- } else
- type = default_type;
+ if (field[0].start != NULL && *(field[0].start) == '#') {
+ /* Comment, skip entry */
+ continue;
+ }
+ n = 0;
+ sol = 0;
+ id = -1;
+ permset = 0;
name.start = name.end = NULL;
- if (prefix_c(field[0].start, field[0].end, "user")) {
- if (!ismode(field[2].start, field[2].end, &permset))
- return (ARCHIVE_WARN);
- if (id != -1 || field[1].start < field[1].end) {
- tag = ARCHIVE_ENTRY_ACL_USER;
- name = field[1];
+
+ if (want_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+ /* POSIX.1e ACLs */
+ /*
+ * Default keyword "default:user::rwx"
+ * if found, we have one more field
+ *
+ * We also support old Solaris extension:
+ * "defaultuser::rwx" is the default ACL corresponding
+ * to "user::rwx", etc. valid only for first field
+ */
+ s = field[0].start;
+ len = field[0].end - field[0].start;
+ if (*s == 'd' && (len == 1 || (len >= 7
+ && memcmp((s + 1), "efault", 6) == 0))) {
+ type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
+ if (len > 7)
+ field[0].start += 7;
+ else
+ n = 1;
} else
- tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
- } else if (prefix_c(field[0].start, field[0].end, "group")) {
- if (!ismode(field[2].start, field[2].end, &permset))
- return (ARCHIVE_WARN);
- if (id != -1 || field[1].start < field[1].end) {
- tag = ARCHIVE_ENTRY_ACL_GROUP;
+ type = want_type;
+
+ /* Check for a numeric ID in field n+1 or n+3. */
+ isint(field[n + 1].start, field[n + 1].end, &id);
+ /* Field n+3 is optional. */
+ if (id == -1 && fields > (n + 3))
+ isint(field[n + 3].start, field[n + 3].end,
+ &id);
+
+ tag = 0;
+ s = field[n].start;
+ st = field[n].start + 1;
+ len = field[n].end - field[n].start;
+
+ switch (*s) {
+ case 'u':
+ if (len == 1 || (len == 4
+ && memcmp(st, "ser", 3) == 0))
+ tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ break;
+ case 'g':
+ if (len == 1 || (len == 5
+ && memcmp(st, "roup", 4) == 0))
+ tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ break;
+ case 'o':
+ if (len == 1 || (len == 5
+ && memcmp(st, "ther", 4) == 0))
+ tag = ARCHIVE_ENTRY_ACL_OTHER;
+ break;
+ case 'm':
+ if (len == 1 || (len == 4
+ && memcmp(st, "ask", 3) == 0))
+ tag = ARCHIVE_ENTRY_ACL_MASK;
+ break;
+ default:
+ break;
+ }
+
+ switch (tag) {
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ case ARCHIVE_ENTRY_ACL_MASK:
+ if (fields == (n + 2)
+ && field[n + 1].start < field[n + 1].end
+ && ismode(field[n + 1].start,
+ field[n + 1].end, &permset)) {
+ /* This is Solaris-style "other:rwx" */
+ sol = 1;
+ } else if (fields == (n + 3) &&
+ field[n + 1].start < field[n + 1].end) {
+ /* Invalid mask or other field */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ break;
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ if (id != -1 ||
+ field[n + 1].start < field[n + 1].end) {
+ name = field[n + 1];
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
+ tag = ARCHIVE_ENTRY_ACL_USER;
+ else
+ tag = ARCHIVE_ENTRY_ACL_GROUP;
+ }
+ break;
+ default:
+ /* Invalid tag, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+
+ /*
+ * Without "default:" we expect mode in field 3
+ * Exception: Solaris other and mask fields
+ */
+ if (permset == 0 && !ismode(field[n + 2 - sol].start,
+ field[n + 2 - sol].end, &permset)) {
+ /* Invalid mode, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ } else {
+ /* NFS4 ACLs */
+ s = field[0].start;
+ len = field[0].end - field[0].start;
+ tag = 0;
+
+ switch (len) {
+ case 4:
+ if (memcmp(s, "user", 4) == 0)
+ tag = ARCHIVE_ENTRY_ACL_USER;
+ break;
+ case 5:
+ if (memcmp(s, "group", 5) == 0)
+ tag = ARCHIVE_ENTRY_ACL_GROUP;
+ break;
+ case 6:
+ if (memcmp(s, "owner@", 6) == 0)
+ tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ else if (memcmp(s, "group@", 6) == 0)
+ tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ break;
+ case 9:
+ if (memcmp(s, "everyone@", 9) == 0)
+ tag = ARCHIVE_ENTRY_ACL_EVERYONE;
+ break;
+ default:
+ break;
+ }
+
+ if (tag == 0) {
+ /* Invalid tag, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ } else if (tag == ARCHIVE_ENTRY_ACL_USER ||
+ tag == ARCHIVE_ENTRY_ACL_GROUP) {
+ n = 1;
name = field[1];
+ isint(name.start, name.end, &id);
} else
- tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
- } else if (prefix_c(field[0].start, field[0].end, "other")) {
- if (fields == 2
- && field[1].start < field[1].end
- && ismode(field[1].start, field[1].end, &permset)) {
- /* This is Solaris-style "other:rwx" */
- } else if (fields == 3
- && field[1].start == field[1].end
- && field[2].start < field[2].end
- && ismode(field[2].start, field[2].end, &permset)) {
- /* This is FreeBSD-style "other::rwx" */
- } else
- return (ARCHIVE_WARN);
- tag = ARCHIVE_ENTRY_ACL_OTHER;
- } else if (prefix_c(field[0].start, field[0].end, "mask")) {
- if (fields == 2
- && field[1].start < field[1].end
- && ismode(field[1].start, field[1].end, &permset)) {
- /* This is Solaris-style "mask:rwx" */
- } else if (fields == 3
- && field[1].start == field[1].end
- && field[2].start < field[2].end
- && ismode(field[2].start, field[2].end, &permset)) {
- /* This is FreeBSD-style "mask::rwx" */
- } else
- return (ARCHIVE_WARN);
- tag = ARCHIVE_ENTRY_ACL_MASK;
- } else
- return (ARCHIVE_WARN);
+ n = 0;
+
+ if (!is_nfs4_perms(field[1 + n].start,
+ field[1 + n].end, &permset)) {
+ /* Invalid NFSv4 perms, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ if (!is_nfs4_flags(field[2 + n].start,
+ field[2 + n].end, &permset)) {
+ /* Invalid NFSv4 flags, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ s = field[3 + n].start;
+ len = field[3 + n].end - field[3 + n].start;
+ type = 0;
+ if (len == 4) {
+ if (memcmp(s, "deny", 4) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
+ } else if (len == 5) {
+ if (memcmp(s, "allow", 5) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
+ else if (memcmp(s, "audit", 5) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_AUDIT;
+ else if (memcmp(s, "alarm", 5) == 0)
+ type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
+ }
+ if (type == 0) {
+ /* Invalid entry type, skip entry */
+ ret = ARCHIVE_WARN;
+ continue;
+ }
+ isint(field[4 + n].start, field[4 + n].end,
+ &id);
+ }
/* Add entry to the internal list. */
r = archive_acl_add_entry_len_l(acl, type, permset,
@@ -1164,7 +1856,12 @@ archive_acl_parse_l(struct archive_acl *acl,
return (r);
if (r != ARCHIVE_OK)
ret = ARCHIVE_WARN;
+ types |= type;
}
+
+ /* Reset ACL */
+ archive_acl_reset(acl, types);
+
return (ret);
}
@@ -1230,6 +1927,112 @@ ismode(const char *start, const char *end, int *permset)
}
/*
+ * Parse a string as a NFS4 ACL permission field.
+ * Returns true if the string is non-empty and consists only of NFS4 ACL
+ * permission characters, false otherwise
+ */
+static int
+is_nfs4_perms(const char *start, const char *end, int *permset)
+{
+ const char *p = start;
+
+ while (p < end) {
+ switch (*p++) {
+ case 'r':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_DATA;
+ break;
+ case 'w':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_DATA;
+ break;
+ case 'x':
+ *permset |= ARCHIVE_ENTRY_ACL_EXECUTE;
+ break;
+ case 'p':
+ *permset |= ARCHIVE_ENTRY_ACL_APPEND_DATA;
+ break;
+ case 'D':
+ *permset |= ARCHIVE_ENTRY_ACL_DELETE_CHILD;
+ break;
+ case 'd':
+ *permset |= ARCHIVE_ENTRY_ACL_DELETE;
+ break;
+ case 'a':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES;
+ break;
+ case 'A':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES;
+ break;
+ case 'R':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS;
+ break;
+ case 'W':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS;
+ break;
+ case 'c':
+ *permset |= ARCHIVE_ENTRY_ACL_READ_ACL;
+ break;
+ case 'C':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_ACL;
+ break;
+ case 'o':
+ *permset |= ARCHIVE_ENTRY_ACL_WRITE_OWNER;
+ break;
+ case 's':
+ *permset |= ARCHIVE_ENTRY_ACL_SYNCHRONIZE;
+ break;
+ case '-':
+ break;
+ default:
+ return(0);
+ }
+ }
+ return (1);
+}
+
+/*
+ * Parse a string as a NFS4 ACL flags field.
+ * Returns true if the string is non-empty and consists only of NFS4 ACL
+ * flag characters, false otherwise
+ */
+static int
+is_nfs4_flags(const char *start, const char *end, int *permset)
+{
+ const char *p = start;
+
+ while (p < end) {
+ switch(*p++) {
+ case 'f':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT;
+ break;
+ case 'd':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT;
+ break;
+ case 'i':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY;
+ break;
+ case 'n':
+ *permset |=
+ ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT;
+ break;
+ case 'S':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS;
+ break;
+ case 'F':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS;
+ break;
+ case 'I':
+ *permset |= ARCHIVE_ENTRY_ACL_ENTRY_INHERITED;
+ break;
+ case '-':
+ break;
+ default:
+ return (0);
+ }
+ }
+ return (1);
+}
+
+/*
* Match "[:whitespace:]*(.*)[:whitespace:]*[:,\n]". *wp is updated
* to point to just after the separator. *start points to the first
* character of the matched text and *end just after the last
@@ -1264,25 +2067,3 @@ next_field(const char **p, const char **start,
if (**p != '\0')
(*p)++;
}
-
-/*
- * Return true if the characters [start...end) are a prefix of 'test'.
- * This makes it easy to handle the obvious abbreviations: 'u' for 'user', etc.
- */
-static int
-prefix_c(const char *start, const char *end, const char *test)
-{
- if (start == end)
- return (0);
-
- if (*start++ != *test++)
- return (0);
-
- while (start < end && *start++ == *test++)
- ;
-
- if (start < end)
- return (0);
-
- return (1);
-}
diff --git a/contrib/libarchive/libarchive/archive_acl_private.h b/contrib/libarchive/libarchive/archive_acl_private.h
index 1421adb..ef0b023 100644
--- a/contrib/libarchive/libarchive/archive_acl_private.h
+++ b/contrib/libarchive/libarchive/archive_acl_private.h
@@ -56,6 +56,7 @@ struct archive_acl {
void archive_acl_clear(struct archive_acl *);
void archive_acl_copy(struct archive_acl *, struct archive_acl *);
int archive_acl_count(struct archive_acl *, int);
+int archive_acl_types(struct archive_acl *);
int archive_acl_reset(struct archive_acl *, int);
int archive_acl_next(struct archive *, struct archive_acl *, int,
int *, int *, int *, int *, const char **);
@@ -66,22 +67,17 @@ int archive_acl_add_entry_w_len(struct archive_acl *,
int archive_acl_add_entry_len(struct archive_acl *,
int, int, int, int, const char *, size_t);
-const wchar_t *archive_acl_text_w(struct archive *, struct archive_acl *, int);
-int archive_acl_text_l(struct archive_acl *, int, const char **, size_t *,
+wchar_t *archive_acl_to_text_w(struct archive_acl *, ssize_t *, int,
+ struct archive *);
+char *archive_acl_to_text_l(struct archive_acl *, ssize_t *, int,
struct archive_string_conv *);
/*
- * Private ACL parser. This is private because it handles some
- * very weird formats that clients should not be messing with.
- * Clients should only deal with their platform-native formats.
- * Because of the need to support many formats cleanly, new arguments
- * are likely to get added on a regular basis. Clients who try to use
- * this interface are likely to be surprised when it changes.
+ * ACL text parser.
*/
-int archive_acl_parse_w(struct archive_acl *,
- const wchar_t *, int /* type */);
-int archive_acl_parse_l(struct archive_acl *,
- const char *, int /* type */,
- struct archive_string_conv *);
+int archive_acl_from_text_w(struct archive_acl *, const wchar_t * /* wtext */,
+ int /* type */);
+int archive_acl_from_text_l(struct archive_acl *, const char * /* text */,
+ int /* type */, struct archive_string_conv *);
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
diff --git a/contrib/libarchive/libarchive/archive_entry.c b/contrib/libarchive/libarchive/archive_entry.c
index f240025..556c402 100644
--- a/contrib/libarchive/libarchive/archive_entry.c
+++ b/contrib/libarchive/libarchive/archive_entry.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -1446,7 +1447,7 @@ archive_entry_acl_add_entry_w(struct archive_entry *entry,
int
archive_entry_acl_types(struct archive_entry *entry)
{
- return ((&entry->acl)->acl_types);
+ return (archive_acl_types(&entry->acl));
}
/*
@@ -1486,34 +1487,121 @@ archive_entry_acl_next(struct archive_entry *entry, int want_type, int *type,
}
/*
- * Generate a text version of the ACL. The flags parameter controls
+ * Generate a text version of the ACL. The flags parameter controls
* the style of the generated ACL.
*/
+wchar_t *
+archive_entry_acl_to_text_w(struct archive_entry *entry, ssize_t *len,
+ int flags)
+{
+ return (archive_acl_to_text_w(&entry->acl, len, flags,
+ entry->archive));
+}
+
+char *
+archive_entry_acl_to_text(struct archive_entry *entry, ssize_t *len,
+ int flags)
+{
+ return (archive_acl_to_text_l(&entry->acl, len, flags, NULL));
+}
+
+char *
+_archive_entry_acl_to_text_l(struct archive_entry *entry, ssize_t *len,
+ int flags, struct archive_string_conv *sc)
+{
+ return (archive_acl_to_text_l(&entry->acl, len, flags, sc));
+}
+
+/*
+ * ACL text parser.
+ */
+int
+archive_entry_acl_from_text_w(struct archive_entry *entry,
+ const wchar_t *wtext, int type)
+{
+ return (archive_acl_from_text_w(&entry->acl, wtext, type));
+}
+
+int
+archive_entry_acl_from_text(struct archive_entry *entry,
+ const char *text, int type)
+{
+ return (archive_acl_from_text_l(&entry->acl, text, type, NULL));
+}
+
+int
+_archive_entry_acl_from_text_l(struct archive_entry *entry, const char *text,
+ int type, struct archive_string_conv *sc)
+{
+ return (archive_acl_from_text_l(&entry->acl, text, type, sc));
+}
+
+/* Deprecated */
+static int
+archive_entry_acl_text_compat(int *flags)
+{
+ if ((*flags & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) == 0)
+ return (1);
+
+ /* ABI compat with old ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID */
+ if ((*flags & OLD_ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) != 0)
+ *flags |= ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID;
+
+ /* ABI compat with old ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT */
+ if ((*flags & OLD_ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0)
+ *flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT;
+
+ *flags |= ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA;
+
+ return (0);
+}
+
+/* Deprecated */
const wchar_t *
archive_entry_acl_text_w(struct archive_entry *entry, int flags)
{
- const wchar_t *r;
- r = archive_acl_text_w(entry->archive, &entry->acl, flags);
- if (r == NULL && errno == ENOMEM)
- __archive_errx(1, "No memory");
- return (r);
+ if (entry->acl.acl_text_w != NULL) {
+ free(entry->acl.acl_text_w);
+ entry->acl.acl_text_w = NULL;
+ }
+ if (archive_entry_acl_text_compat(&flags) == 0)
+ entry->acl.acl_text_w = archive_acl_to_text_w(&entry->acl,
+ NULL, flags, entry->archive);
+ return (entry->acl.acl_text_w);
}
+/* Deprecated */
const char *
archive_entry_acl_text(struct archive_entry *entry, int flags)
{
- const char *p;
- if (archive_acl_text_l(&entry->acl, flags, &p, NULL, NULL) != 0
- && errno == ENOMEM)
- __archive_errx(1, "No memory");
- return (p);
+ if (entry->acl.acl_text != NULL) {
+ free(entry->acl.acl_text);
+ entry->acl.acl_text = NULL;
+ }
+ if (archive_entry_acl_text_compat(&flags) == 0)
+ entry->acl.acl_text = archive_acl_to_text_l(&entry->acl, NULL,
+ flags, NULL);
+
+ return (entry->acl.acl_text);
}
+/* Deprecated */
int
_archive_entry_acl_text_l(struct archive_entry *entry, int flags,
const char **acl_text, size_t *len, struct archive_string_conv *sc)
{
- return (archive_acl_text_l(&entry->acl, flags, acl_text, len, sc));
+ if (entry->acl.acl_text != NULL) {
+ free(entry->acl.acl_text);
+ entry->acl.acl_text = NULL;
+ }
+
+ if (archive_entry_acl_text_compat(&flags) == 0)
+ entry->acl.acl_text = archive_acl_to_text_l(&entry->acl,
+ (ssize_t *)len, flags, sc);
+
+ *acl_text = entry->acl.acl_text;
+
+ return (0);
}
/*
diff --git a/contrib/libarchive/libarchive/archive_entry.h b/contrib/libarchive/libarchive/archive_entry.h
index 27c473e..40d6afb 100644
--- a/contrib/libarchive/libarchive/archive_entry.h
+++ b/contrib/libarchive/libarchive/archive_entry.h
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2003-2008 Tim Kientzle
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -104,6 +105,12 @@ typedef int64_t la_int64_t;
# define __LA_DECL
#endif
+#if defined(__GNUC__) && __GNUC__ >= 3 && __GNUC_MINOR__ >= 1
+# define __LA_DEPRECATED __attribute__((deprecated))
+#else
+# define __LA_DEPRECATED
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -420,6 +427,7 @@ __LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const voi
/*
* Inheritance values (NFS4 ACLs only); included in permset.
*/
+#define ARCHIVE_ENTRY_ACL_ENTRY_INHERITED 0x01000000
#define ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT 0x02000000
#define ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT 0x04000000
#define ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT 0x08000000
@@ -433,15 +441,16 @@ __LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const voi
| ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT \
| ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY \
| ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS \
- | ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS)
+ | ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS \
+ | ARCHIVE_ENTRY_ACL_ENTRY_INHERITED)
/* We need to be able to specify combinations of these. */
-#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 256 /* POSIX.1e only */
-#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 512 /* POSIX.1e only */
-#define ARCHIVE_ENTRY_ACL_TYPE_ALLOW 1024 /* NFS4 only */
-#define ARCHIVE_ENTRY_ACL_TYPE_DENY 2048 /* NFS4 only */
-#define ARCHIVE_ENTRY_ACL_TYPE_AUDIT 4096 /* NFS4 only */
-#define ARCHIVE_ENTRY_ACL_TYPE_ALARM 8192 /* NFS4 only */
+#define ARCHIVE_ENTRY_ACL_TYPE_ACCESS 0x00000100 /* POSIX.1e only */
+#define ARCHIVE_ENTRY_ACL_TYPE_DEFAULT 0x00000200 /* POSIX.1e only */
+#define ARCHIVE_ENTRY_ACL_TYPE_ALLOW 0x00000400 /* NFS4 only */
+#define ARCHIVE_ENTRY_ACL_TYPE_DENY 0x00000800 /* NFS4 only */
+#define ARCHIVE_ENTRY_ACL_TYPE_AUDIT 0x00001000 /* NFS4 only */
+#define ARCHIVE_ENTRY_ACL_TYPE_ALARM 0x00002000 /* NFS4 only */
#define ARCHIVE_ENTRY_ACL_TYPE_POSIX1E (ARCHIVE_ENTRY_ACL_TYPE_ACCESS \
| ARCHIVE_ENTRY_ACL_TYPE_DEFAULT)
#define ARCHIVE_ENTRY_ACL_TYPE_NFS4 (ARCHIVE_ENTRY_ACL_TYPE_ALLOW \
@@ -492,21 +501,48 @@ __LA_DECL int archive_entry_acl_next_w(struct archive_entry *, int /* want_type
* Construct a text-format ACL. The flags argument is a bitmask that
* can include any of the following:
*
+ * Flags only for archive entries with POSIX.1e ACL:
* ARCHIVE_ENTRY_ACL_TYPE_ACCESS - Include POSIX.1e "access" entries.
* ARCHIVE_ENTRY_ACL_TYPE_DEFAULT - Include POSIX.1e "default" entries.
- * ARCHIVE_ENTRY_ACL_TYPE_NFS4 - Include NFS4 entries.
- * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
- * each ACL entry. ('star' introduced this for POSIX.1e, this flag
- * also applies to NFS4.)
* ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT - Include "default:" before each
- * default ACL entry, as used in old Solaris ACLs.
+ * default ACL entry.
+ * ARCHIVE_ENTRY_ACL_STYLE_SOLARIS - Output only one colon after "other" and
+ * "mask" entries.
+ *
+ * Flags only for archive entries with NFSv4 ACL:
+ * ARCHIVE_ENTRY_ACL_STYLE_COMPACT - Do not output the minus character for
+ * unset permissions and flags in NFSv4 ACL permission and flag fields
+ *
+ * Flags for for archive entries with POSIX.1e ACL or NFSv4 ACL:
+ * ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID - Include extra numeric ID field in
+ * each ACL entry.
+ * ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA - Separate entries with comma
+ * instead of newline.
*/
-#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
-#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
+#define ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 0x00000001
+#define ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 0x00000002
+#define ARCHIVE_ENTRY_ACL_STYLE_SOLARIS 0x00000004
+#define ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA 0x00000008
+#define ARCHIVE_ENTRY_ACL_STYLE_COMPACT 0x00000010
+
+__LA_DECL wchar_t *archive_entry_acl_to_text_w(struct archive_entry *,
+ ssize_t * /* len */, int /* flags */);
+__LA_DECL char *archive_entry_acl_to_text(struct archive_entry *,
+ ssize_t * /* len */, int /* flags */);
+__LA_DECL int archive_entry_acl_from_text_w(struct archive_entry *,
+ const wchar_t * /* wtext */, int /* type */);
+__LA_DECL int archive_entry_acl_from_text(struct archive_entry *,
+ const char * /* text */, int /* type */);
+
+/* Deprecated constants */
+#define OLD_ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID 1024
+#define OLD_ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT 2048
+
+/* Deprecated functions */
__LA_DECL const wchar_t *archive_entry_acl_text_w(struct archive_entry *,
- int /* flags */);
+ int /* flags */) __LA_DEPRECATED;
__LA_DECL const char *archive_entry_acl_text(struct archive_entry *,
- int /* flags */);
+ int /* flags */) __LA_DEPRECATED;
/* Return bitmask of ACL types in an archive entry */
__LA_DECL int archive_entry_acl_types(struct archive_entry *);
diff --git a/contrib/libarchive/libarchive/archive_entry_acl.3 b/contrib/libarchive/libarchive/archive_entry_acl.3
index e85c4de..c5115f7 100644
--- a/contrib/libarchive/libarchive/archive_entry_acl.3
+++ b/contrib/libarchive/libarchive/archive_entry_acl.3
@@ -1,4 +1,5 @@
.\" Copyright (c) 2010 Joerg Sonnenberger
+.\" Copyright (c) 2016 Martin Matuska
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -22,7 +23,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd February 2, 2012
+.Dd February 15, 2017
.Dt ARCHIVE_ENTRY_ACL 3
.Os
.Sh NAME
@@ -30,10 +31,13 @@
.Nm archive_entry_acl_add_entry_w ,
.Nm archive_entry_acl_clear ,
.Nm archive_entry_acl_count ,
+.Nm archive_entry_acl_from_text ,
+.Nm archive_entry_acl_from_text_w,
.Nm archive_entry_acl_next ,
.Nm archive_entry_acl_next_w ,
.Nm archive_entry_acl_reset ,
-.Nm archive_entry_acl_text_w ,
+.Nm archive_entry_acl_to_text ,
+.Nm archive_entry_acl_to_text_w ,
.Nm archive_entry_acl_types
.Nd functions for manipulating Access Control Lists in archive entry descriptions
.Sh LIBRARY
@@ -63,6 +67,18 @@ Streaming Archive Library (libarchive, -larchive)
.Ft int
.Fn archive_entry_acl_count "struct archive_entry *a" "int type"
.Ft int
+.Fo archive_entry_acl_from_text
+.Fa "struct archive_entry *a"
+.Fa "const char *text"
+.Fa "int type"
+.Fc
+.Ft int
+.Fo archive_entry_acl_from_text_w
+.Fa "struct archive_entry *a"
+.Fa "const wchar_t *text"
+.Fa "int type"
+.Fc
+.Ft int
.Fo archive_entry_acl_next
.Fa "struct archive_entry *a"
.Fa "int type"
@@ -84,33 +100,48 @@ Streaming Archive Library (libarchive, -larchive)
.Fc
.Ft int
.Fn archive_entry_acl_reset "struct archive_entry *a" "int type"
-.Ft const wchar_t *
-.Fn archive_entry_acl_text_w "struct archive_entry *a" "int flags"
+.Ft char *
+.Fo archive_entry_acl_to_text
+.Fa "struct archive_entry *a"
+.Fa "ssize_t *len_p"
+.Fa "int flags"
+.Fc
+.Ft wchar_t *
+.Fo archive_entry_acl_to_text_w
+.Fa "struct archive_entry *a"
+.Fa "ssize_t *len_p"
+.Fa "int flags"
+.Fc
.Ft int
.Fn archive_entry_acl_types "struct archive_entry *a"
.\" enum?
.Sh DESCRIPTION
-An
-.Dq Access Control List
-is a generalisation of the classic Unix permission system.
+The
+.Dq Access Control Lists (ACLs)
+extend the standard Unix perssion model.
The ACL interface of
.Nm libarchive
-is derived from the POSIX.1e draft, but restricted to simplify dealing
-with practical implementations in various Operating Systems and archive formats.
-.Pp
-An ACL consists of a number of independent entries.
+supports both POSIX.1e and NFSv4 style ACLs. Use of ACLs is restricted by
+various levels of ACL support in operating systems, file systems and archive
+formats.
+.Ss POSIX.1e Access Control Lists
+A POSIX.1e ACL consists of a number of independent entries.
Each entry specifies the permission set as bitmask of basic permissions.
-Valid permissions are:
+Valid permissions in the
+.Fa permset
+are:
.Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_EXECUTE"
-.It Dv ARCHIVE_ENTRY_ACL_EXECUTE
-.It Dv ARCHIVE_ENTRY_ACL_WRITE
-.It Dv ARCHIVE_ENTRY_ACL_READ
+.It Dv ARCHIVE_ENTRY_ACL_READ ( Sy r )
+.It Dv ARCHIVE_ENTRY_ACL_WRITE ( Sy w )
+.It Dv ARCHIVE_ENTRY_ACL_EXECUTE ( Sy x )
.El
The permissions correspond to the normal Unix permissions.
.Pp
-The tag specifies the principal to which the permission applies.
+The
+.Fa tag
+specifies the principal to which the permission applies.
Valid values are:
-.Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_GROUP_OBJ"
+.Bl -hang -offset indent -compact -width "ARCHIVE_ENTRY_ACL_GROUP_OBJ"
.It Dv ARCHIVE_ENTRY_ACL_USER
The user specified by the name field.
.It Dv ARCHIVE_ENTRY_ACL_USER_OBJ
@@ -122,8 +153,9 @@ The group who owns the file.
.It Dv ARCHIVE_ENTRY_ACL_MASK
The maximum permissions to be obtained via group permissions.
.It Dv ARCHIVE_ENTRY_ACL_OTHER
-Any principal who doesn't have a user or group entry.
+Any principal who is not file owner or a member of the owning group.
.El
+.Pp
The principals
.Dv ARCHIVE_ENTRY_ACL_USER_OBJ ,
.Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
@@ -132,19 +164,123 @@ and
are equivalent to user, group and other in the classic Unix permission
model and specify non-extended ACL entries.
.Pp
-All files have an access ACL
+All files with have an access ACL
.Pq Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS .
This specifies the permissions required for access to the file itself.
Directories have an additional ACL
.Pq Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT ,
which controls the initial access ACL for newly created directory entries.
+.Ss NFSv4 Access Control Lists
+A NFSv4 ACL consists of multiple individual entries called Access Control
+Entries (ACEs).
+.Pp
+There are four possible types of a NFSv4 ACE:
+.Bl -hang -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYE_ALLOW"
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ALLOW
+Allow principal to perform actions requiring given permissions.
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_DENY
+Prevent principal from performing actions requiring given permissions.
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_AUDIT
+Log access attempts by principal which require given permissions.
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ALARM
+Trigger a system alarm on access attempts by principal which require given
+permissions.
+.El
+.Pp
+The
+.Fa tag
+specifies the principal to which the permission applies.
+Valid values are:
+.Bl -hang -offset indent -compact -width "ARCHIVE_ENTRY_ACL_GROUP_OBJ"
+.It Dv ARCHIVE_ENTRY_ACL_USER
+The user specified by the name field.
+.It Dv ARCHIVE_ENTRY_ACL_USER_OBJ
+The owner of the file.
+.It Dv ARCHIVE_ENTRY_ACL_GROUP
+The group specied by the name field.
+.It Dv ARCHIVE_ENTRY_ACL_GROUP_OBJ
+The group who owns the file.
+.It Dv ARCHIVE_ENTRY_ACL_EVERYONE
+Any principal who is not file owner or a member of the owning group.
+.El
+.Pp
+Entries with the
+.Dv ARCHIVE_ENTRY_ACL_USER
+or
+.Dv ARCHIVE_ENTRY_ACL_GROUP
+tag store the user and group name in the
+.Fa name
+string and optionally the user or group ID in the
+.Fa qualifier
+integer.
+.Pp
+NFSv4 ACE permissions and flags are stored in the same
+.Fa permset
+bitfield. Some permissions share the same constant and permission character but
+have different effect on directories than on files. The following ACE
+permissions are supported:
+.Bl -tag -offset indent -compact -width ARCHIV
+.It Dv ARCHIVE_ENTRY_ACL_READ_DATA ( Sy r )
+Read data (file).
+.It Dv ARCHIVE_ENTRY_ACL_LIST_DIRECTORY ( Sy r )
+List entries (directory).
+.It ARCHIVE_ENTRY_ACL_WRITE_DATA ( Sy w )
+Write data (file).
+.It ARCHIVE_ENTRY_ACL_ADD_FILE ( Sy w )
+Create files (directory).
+.It Dv ARCHIVE_ENTRY_ACL_EXECUTE ( Sy x )
+Execute file or change into a directory.
+.It Dv ARCHIVE_ENTRY_ACL_APPEND_DATA ( Sy p )
+Append data (file).
+.It Dv ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY ( Sy p )
+Create subdirectories (directory).
+.It Dv ARCHIVE_ENTRY_ACL_DELETE_CHILD ( Sy D )
+Remove files and subdirectories inside a directory.
+.It Dv ARCHIVE_ENTRY_ACL_DELETE ( Sy d )
+Remove file or directory.
+.It Dv ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES ( Sy a )
+Read file or directory attributes.
+.It Dv ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES ( Sy A )
+Write file or directory attributes.
+.It Dv ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS ( Sy R )
+Read named file or directory attributes.
+.It Dv ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS ( Sy W )
+Write named file or directory attributes.
+.It Dv ARCHIVE_ENTRY_ACL_READ_ACL ( Sy c )
+Read file or directory ACL.
+.It Dv ARCHIVE_ENTRY_ACL_WRITE_ACL ( Sy C )
+Write file or directory ACL.
+.It Dv ARCHIVE_ENTRY_ACL_WRITE_OWNER ( Sy o )
+Change owner of a file or directory.
+.It Dv ARCHIVE_ENTRY_ACL_SYNCHRONIZE ( Sy s )
+Use synchronous I/O.
+.El
.Pp
+The following NFSv4 ACL inheritance flags are supported:
+.Bl -tag -offset indent -compact -width ARCHIV
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT ( Sy f )
+Inherit parent directory ACE to files.
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT ( Sy d )
+Inherit parent directory ACE to subdirectories.
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY ( Sy i )
+Only inherit, do not apply the permission on the directory itself.
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT ( Sy n )
+Do not propagate inherit flags. Only first-level entries inherit ACLs.
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS ( Sy S )
+Trigger alarm or audit on succesful access.
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS ( Sy F )
+Trigger alarm or audit on failed access.
+.It Dv ARCHIVE_ENTRY_ACL_ENTRY_INHERITED ( Sy I )
+Mark that ACE was inherited.
+.El
+.Ss Functions
.Fn archive_entry_acl_add_entry
and
.Fn archive_entry_acl_add_entry_w
add a single ACL entry.
For the access ACL and non-extended principals, the classic Unix permissions
-are updated.
+are updated. An archive enry cannot contain both POSIX.1e and NFSv4 ACL
+entries.
.Pp
.Fn archive_entry_acl_clear
removes all ACL entries and resets the enumeration pointer.
@@ -153,14 +289,58 @@ removes all ACL entries and resets the enumeration pointer.
counts the ACL entries that have the given type mask.
.Fa type
can be the bitwise-or of
-.Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
-and
-.Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT .
-If
+.Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_DEFAULT"
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
+.El
+for POSIX.1e ACLs and
+.Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_ALLOW"
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ALLOW
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_DENY
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_AUDIT
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ALARM
+.El
+for NFSv4 ACLs. For POSIX.1e ACLs if
.Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
is included and at least one extended ACL entry is found,
the three non-extened ACLs are added.
.Pp
+.Fn archive_entry_acl_from_text
+and
+.Fn archive_entry_acl_from_text_w
+add new
+.Pq or merge with existing
+ACL entries from
+.Pq wide
+text. The argument
+.Fa type
+may take one of the following values:
+.Bl -tag -offset indent -compact -width "ARCHIVE_ENTRY_ACL_TYPE_DEFAULT"
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_NFS4
+.El
+Supports all formats that can be created with
+.Fn archive_entry_acl_to_text
+or respective
+.Fn archive_entry_acl_to_text_w .
+Existing ACL entries are preserved. To get a clean new ACL from text
+.Fn archive_entry_acl_clear
+must be called first. Entries prefixed with
+.Dq default:
+are treated as
+.Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
+unless
+.Fa type
+is
+.Dv ARCHIVE_ENTRY_ACL_TYPE_NFS4 .
+Invalid entries, non-parseable ACL entries and entries beginning with
+the
+.Sq #
+character
+.Pq comments
+are skipped.
+.Pp
.Fn archive_entry_acl_next
and
.Fn archive_entry_acl_next_w
@@ -182,19 +362,57 @@ or set using
Otherwise, the function returns the same value as
.Fn archive_entry_acl_count .
.Pp
-.Fn archive_entry_acl_text_w
-converts the ACL entries for the given type mask into a wide string.
-In addition to the normal type flags,
-.Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
+.Fn archive_entry_acl_to_text
and
-.Dv ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
-can be specified to further customize the result.
-The returned long string is valid until the next call to
-.Fn archive_entry_acl_clear ,
-.Fn archive_entry_acl_add_entry ,
-.Fn archive_entry_acl_add_entry_w
+.Fn archive_entry_acl_to_text_w
+convert the ACL entries for the given type into a
+.Pq wide
+string of ACL entries separated by newline. If the the pointer
+.Fa len_p
+is not NULL, then the function shall return the length of the string
+.Pq not including the NULL terminator
+in the location pointed to by
+.Fa len_p .
+The
+.Fa flag
+argument is a bitwise-or.
+.Pp
+The following flags are effective only on POSIX.1e ACL:
+.Bl -tag -offset indent -compact -width ARCHIV
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
+Output access ACLs.
+.It Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
+Output POSIX.1e default ACLs.
+.It Dv ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
+Prefix each default ACL entry with the word
+.Dq default: .
+.It Dv ARCHIVE_ENTRY_ACL_STYLE_SOLARIS
+The mask and other ACLs don not contain a double colon.
+.El
+.Pp
+The following flags are effecive only on NFSv4 ACL:
+.Bl -tag -offset indent -compact -width ARCHIV
+.It Dv ARCHIVE_ENTRY_ACL_STYLE_COMPACT
+Do not output minus characters for unset permissions and flags in NFSv4 ACL
+permission and flag fields.
+.El
+.Pp
+The following flags are effective on both POSIX.1e and NFSv4 ACL:
+.Bl -tag -offset indent -compact -width ARCHIV
+.It Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
+Add an additional colon-separated field containing the user or group id.
+.It Dv ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA
+Separate ACL entries with comma instead of newline.
+.El
+.Pp
+If the archive entry contains NFSv4 ACLs, all types of NFSv4 ACLs are returned.
+It the entry contains POSIX.1e ACLs and none of the flags
+.Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
or
-.Fn archive_entry_acl_text_w .
+.Dv ARCHIVE_ENTRY_ACL_TYPE_DEFAULT
+are specified, both access and default entries are returned and default entries
+are prefixed with
+.Dq default: .
.Pp
.Fn archive_entry_acl_types
get ACL entry types contained in an archive entry's ACL. As POSIX.1e and NFSv4
@@ -205,11 +423,20 @@ an ACL already contains POSIX.1e or NFSv4 ACL entries.
and
.Fn archive_entry_acl_reset
returns the number of ACL entries that match the given type mask.
-If the type mask includes
+For POSIX.1e ACLS if the type mask includes
.Dv ARCHIVE_ENTRY_ACL_TYPE_ACCESS
and at least one extended ACL entry exists, the three classic Unix
permissions are counted.
.Pp
+.Fn archive_entry_acl_from_text
+and
+.Fn archive_entry_acl_from_text_w
+return
+.Dv ARCHIVE_OK
+if all entries were successfully parsed and
+.Dv ARCHIVE_WARN
+if one or more entries were invalid or non-parseable.
+.Pp
.Fn archive_entry_acl_next
and
.Fn archive_entry_acl_next_w
@@ -224,23 +451,16 @@ if
.Fn archive_entry_acl_reset
has not been called first.
.Pp
-.Fn archive_entry_text_w
-returns a wide string representation of the ACL entrise matching the
-given type mask.
-The returned long string is valid until the next call to
-.Fn archive_entry_acl_clear ,
-.Fn archive_entry_acl_add_entry ,
-.Fn archive_entry_acl_add_entry_w
-or
-.Fn archive_entry_acl_text_w .
+.Fn archive_entry_acl_to_text
+returns a string representing the ACL entries matching the given type and
+flags on success or NULL on error.
+.Pp
+.Fn archive_entry_acl_to_text_w
+returns a wide string representing the ACL entries matching the given type
+and flags on success or NULL on error.
.Pp
.Fn archive_entry_acl_types
returns a bitmask of ACL entry types or 0 if archive entry has no ACL entries.
.Sh SEE ALSO
-.Xr archive_entry 3
-.Xr libarchive 3 ,
-.Sh BUGS
-.Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID
-and
-.Dv ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT
-are not documented.
+.Xr archive_entry 3 ,
+.Xr libarchive 3
diff --git a/contrib/libarchive/libarchive/archive_entry_locale.h b/contrib/libarchive/libarchive/archive_entry_locale.h
index 02e024a..44550c5 100644
--- a/contrib/libarchive/libarchive/archive_entry_locale.h
+++ b/contrib/libarchive/libarchive/archive_entry_locale.h
@@ -63,9 +63,13 @@ int _archive_entry_uname_l(struct archive_entry *,
const char **, size_t *, struct archive_string_conv *);
#define archive_entry_acl_text_l _archive_entry_acl_text_l
int _archive_entry_acl_text_l(struct archive_entry *, int,
- const char **, size_t *, struct archive_string_conv *);
-
-
+const char **, size_t *, struct archive_string_conv *) __LA_DEPRECATED;
+#define archive_entry_acl_to_text_l _archive_entry_acl_to_text_l
+char *_archive_entry_acl_to_text_l(struct archive_entry *, ssize_t *, int,
+ struct archive_string_conv *);
+#define archive_entry_acl_from_text_l _archive_entry_acl_from_text_l
+int _archive_entry_acl_from_text_l(struct archive_entry *, const char* text,
+ int type, struct archive_string_conv *);
#define archive_entry_copy_gname_l _archive_entry_copy_gname_l
int _archive_entry_copy_gname_l(struct archive_entry *,
const char *, size_t, struct archive_string_conv *);
diff --git a/contrib/libarchive/libarchive/archive_entry_strmode.c b/contrib/libarchive/libarchive/archive_entry_strmode.c
index 8d7006a..d80a7d4 100644
--- a/contrib/libarchive/libarchive/archive_entry_strmode.c
+++ b/contrib/libarchive/libarchive/archive_entry_strmode.c
@@ -80,7 +80,7 @@ archive_entry_strmode(struct archive_entry *entry)
if (mode & 0001) bp[9] = 't';
else bp[9] = 'T';
}
- if (archive_entry_acl_count(entry, ARCHIVE_ENTRY_ACL_TYPE_ACCESS))
+ if (archive_entry_acl_types(entry) != 0)
bp[10] = '+';
return (bp);
diff --git a/contrib/libarchive/libarchive/archive_match.c b/contrib/libarchive/libarchive/archive_match.c
index 0719cbd..be72066 100644
--- a/contrib/libarchive/libarchive/archive_match.c
+++ b/contrib/libarchive/libarchive/archive_match.c
@@ -471,7 +471,7 @@ archive_match_path_excluded(struct archive *_a,
}
/*
- * Utilty functions to get statistic information for inclusion patterns.
+ * Utility functions to get statistic information for inclusion patterns.
*/
int
archive_match_path_unmatched_inclusions(struct archive *_a)
@@ -1270,7 +1270,7 @@ set_timefilter_pathname_wcs(struct archive_match *a, int timetype,
#endif /* _WIN32 && !__CYGWIN__ */
/*
- * Call back funtions for archive_rb.
+ * Call back functions for archive_rb.
*/
static int
cmp_node_mbs(const struct archive_rb_node *n1,
@@ -1405,7 +1405,7 @@ add_entry(struct archive_match *a, int flag,
&(a->exclusion_tree), pathname);
/*
- * We always overwrite comparison condision.
+ * We always overwrite comparison condition.
* If you do not want to overwrite it, you should not
* call archive_match_exclude_entry(). We cannot know
* what behavior you really expect since overwriting
@@ -1481,7 +1481,7 @@ time_excluded(struct archive_match *a, struct archive_entry *entry)
if (nsec == a->older_ctime_nsec &&
(a->older_ctime_filter & ARCHIVE_MATCH_EQUAL)
== 0)
- return (1); /* Eeual, skip it. */
+ return (1); /* Equal, skip it. */
}
}
if (a->newer_mtime_filter) {
@@ -1513,7 +1513,7 @@ time_excluded(struct archive_match *a, struct archive_entry *entry)
}
}
- /* If there is no excluson list, include the file. */
+ /* If there is no exclusion list, include the file. */
if (a->exclusion_entry_list.count == 0)
return (0);
@@ -1700,7 +1700,7 @@ add_owner_id(struct archive_match *a, struct id_array *ids, int64_t id)
break;
}
- /* Add oowner id. */
+ /* Add owner id. */
if (i == ids->count)
ids->ids[ids->count++] = id;
else if (ids->ids[i] != id) {
diff --git a/contrib/libarchive/libarchive/archive_platform.h b/contrib/libarchive/libarchive/archive_platform.h
index 76816c4..31383db 100644
--- a/contrib/libarchive/libarchive/archive_platform.h
+++ b/contrib/libarchive/libarchive/archive_platform.h
@@ -147,8 +147,25 @@
* acl_set_file(), and ACL_USER, we assume it has the rest of the
* POSIX.1e draft functions used in archive_read_extract.c.
*/
-#if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE && HAVE_ACL_USER
+#if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE
+#if HAVE_ACL_USER
#define HAVE_POSIX_ACL 1
+#elif HAVE_ACL_TYPE_EXTENDED
+#define HAVE_DARWIN_ACL 1
+#endif
+#endif
+
+/*
+ * If this platform has <sys/acl.h>, acl_get(), facl_get(), acl_set(),
+ * facl_set() and types aclent_t and ace_t it uses Solaris-style ACL functions
+ */
+#if HAVE_SYS_ACL_H && HAVE_ACL_GET && HAVE_FACL_GET && HAVE_ACL_SET && HAVE_FACL_SET && HAVE_ACLENT_T && HAVE_ACE_T
+#define HAVE_SUN_ACL 1
+#endif
+
+/* Define if platform supports NFSv4 ACLs */
+#if (HAVE_POSIX_ACL && HAVE_ACL_TYPE_NFS4) || HAVE_SUN_ACL || HAVE_DARWIN_ACL
+#define HAVE_NFS4_ACL 1
#endif
/*
diff --git a/contrib/libarchive/libarchive/archive_random.c b/contrib/libarchive/libarchive/archive_random.c
index a20b9b1..357f973 100644
--- a/contrib/libarchive/libarchive/archive_random.c
+++ b/contrib/libarchive/libarchive/archive_random.c
@@ -80,7 +80,7 @@ archive_random(void *buf, size_t nbytes)
success = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
- if (!success && GetLastError() == NTE_BAD_KEYSET) {
+ if (!success && GetLastError() == (DWORD)NTE_BAD_KEYSET) {
success = CryptAcquireContext(&hProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
}
diff --git a/contrib/libarchive/libarchive/archive_rb.c b/contrib/libarchive/libarchive/archive_rb.c
index 5b5da20..cf58ac3 100644
--- a/contrib/libarchive/libarchive/archive_rb.c
+++ b/contrib/libarchive/libarchive/archive_rb.c
@@ -312,7 +312,7 @@ __archive_rb_tree_insert_rebalance(struct archive_rb_tree *rbt,
father = RB_FATHER(self);
if (RB_BLACK_P(father)) {
/*
- * If our greatgrandpa is black, we're done.
+ * If our great-grandpa is black, we're done.
*/
return;
}
diff --git a/contrib/libarchive/libarchive/archive_read_disk.3 b/contrib/libarchive/libarchive/archive_read_disk.3
index 525dc59..2a5c130 100644
--- a/contrib/libarchive/libarchive/archive_read_disk.3
+++ b/contrib/libarchive/libarchive/archive_read_disk.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 2, 2012
+.Dd December 30, 2016
.Dt ARCHIVE_READ_DISK 3
.Os
.Sh NAME
@@ -54,9 +54,9 @@ Streaming Archive Library (libarchive, -larchive)
.Fn archive_read_disk_set_symlink_physical "struct archive *"
.Ft int
.Fn archive_read_disk_set_symlink_hybrid "struct archive *"
-.Ft int
+.Ft const char *
.Fn archive_read_disk_gname "struct archive *" "gid_t"
-.Ft int
+.Ft const char *
.Fn archive_read_disk_uname "struct archive *" "uid_t"
.Ft int
.Fo archive_read_disk_set_gname_lookup
diff --git a/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c b/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
index e9fb8ba..ef6875f 100644
--- a/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
+++ b/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2003-2009 Tim Kientzle
* Copyright (c) 2010-2012 Michihiro NAKAJIMA
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -37,6 +38,11 @@ __FBSDID("$FreeBSD$");
#ifdef HAVE_SYS_ACL_H
#include <sys/acl.h>
#endif
+#ifdef HAVE_DARWIN_ACL
+#include <membership.h>
+#include <grp.h>
+#include <pwd.h>
+#endif
#ifdef HAVE_SYS_EXTATTR_H
#include <sys/extattr.h>
#endif
@@ -117,6 +123,15 @@ __FBSDID("$FreeBSD$");
#define ACL_GET_PERM acl_get_perm_np
#endif
+/* NFSv4 platform ACL type */
+#if HAVE_SUN_ACL
+#define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACE_T
+#elif HAVE_DARWIN_ACL
+#define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_EXTENDED
+#elif HAVE_ACL_TYPE_NFS4
+#define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_NFS4
+#endif
+
static int setup_acls(struct archive_read_disk *,
struct archive_entry *, int *fd);
static int setup_mac_metadata(struct archive_read_disk *,
@@ -404,17 +419,38 @@ setup_mac_metadata(struct archive_read_disk *a,
}
#endif
+#if HAVE_DARWIN_ACL
+static int translate_guid(struct archive *, acl_entry_t,
+ int *, int *, const char **);
+
+static void add_trivial_nfs4_acl(struct archive_entry *);
+#endif
-#ifdef HAVE_POSIX_ACL
+#if HAVE_SUN_ACL
+static int
+sun_acl_is_trivial(acl_t *, mode_t, int *trivialp);
+#endif
+
+#if HAVE_POSIX_ACL || HAVE_NFS4_ACL
static int translate_acl(struct archive_read_disk *a,
- struct archive_entry *entry, acl_t acl, int archive_entry_acl_type);
+ struct archive_entry *entry,
+#if HAVE_SUN_ACL
+ acl_t *acl,
+#else
+ acl_t acl,
+#endif
+ int archive_entry_acl_type);
static int
setup_acls(struct archive_read_disk *a,
struct archive_entry *entry, int *fd)
{
const char *accpath;
- acl_t acl;
+#if HAVE_SUN_ACL
+ acl_t *acl;
+#else
+ acl_t acl;
+#endif
int r;
accpath = archive_entry_sourcepath(entry);
@@ -439,17 +475,20 @@ setup_acls(struct archive_read_disk *a,
acl = NULL;
-#ifdef ACL_TYPE_NFS4
- /* Try NFS4 ACL first. */
+#if HAVE_NFS4_ACL
+ /* Try NFSv4 ACL first. */
if (*fd >= 0)
-#if HAVE_ACL_GET_FD_NP
- acl = acl_get_fd_np(*fd, ACL_TYPE_NFS4);
+#if HAVE_SUN_ACL
+ /* Solaris reads both POSIX.1e and NFSv4 ACL here */
+ facl_get(*fd, 0, &acl);
+#elif HAVE_ACL_GET_FD_NP
+ acl = acl_get_fd_np(*fd, ARCHIVE_PLATFORM_ACL_TYPE_NFS4);
#else
acl = acl_get_fd(*fd);
#endif
#if HAVE_ACL_GET_LINK_NP
else if (!a->follow_symlinks)
- acl = acl_get_link_np(accpath, ACL_TYPE_NFS4);
+ acl = acl_get_link_np(accpath, ARCHIVE_PLATFORM_ACL_TYPE_NFS4);
#else
else if ((!a->follow_symlinks)
&& (archive_entry_filetype(entry) == AE_IFLNK))
@@ -458,12 +497,24 @@ setup_acls(struct archive_read_disk *a,
acl = NULL;
#endif
else
- acl = acl_get_file(accpath, ACL_TYPE_NFS4);
+#if HAVE_SUN_ACL
+ /* Solaris reads both POSIX.1e and NFSv4 ACLs here */
+ acl_get(accpath, 0, &acl);
+#else
+ acl = acl_get_file(accpath, ARCHIVE_PLATFORM_ACL_TYPE_NFS4);
+#endif
-#if HAVE_ACL_IS_TRIVIAL_NP
- if (acl != NULL && acl_is_trivial_np(acl, &r) == 0) {
- /* Ignore "trivial" ACLs that just mirror the file mode. */
- if (r) {
+
+#if HAVE_ACL_IS_TRIVIAL_NP || HAVE_SUN_ACL
+ /* Ignore "trivial" ACLs that just mirror the file mode. */
+ if (acl != NULL) {
+#if HAVE_SUN_ACL
+ if (sun_acl_is_trivial(acl, archive_entry_mode(entry),
+ &r) == 0 && r == 1)
+#elif HAVE_ACL_IS_TRIVIAL_NP
+ if (acl_is_trivial_np(acl, &r) == 0 && r == 1)
+#endif
+ {
acl_free(acl);
acl = NULL;
/*
@@ -473,17 +524,35 @@ setup_acls(struct archive_read_disk *a,
return (ARCHIVE_OK);
}
}
-#endif
+#endif /* HAVE_ACL_IS_TRIVIAL_NP || HAVE_SUN_ACL */
if (acl != NULL) {
r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4);
acl_free(acl);
if (r != ARCHIVE_OK) {
archive_set_error(&a->archive, errno,
+#if HAVE_SUN_ACL
+ "Couldn't translate ACLs: %s", accpath);
+#else
"Couldn't translate NFSv4 ACLs: %s", accpath);
+#endif
}
+#if HAVE_DARWIN_ACL
+ /*
+ * Because Mac OS doesn't support owner@, group@ and everyone@
+ * ACLs we need to add NFSv4 ACLs mirroring the file mode to
+ * the archive entry. Otherwise extraction on non-Mac platforms
+ * would lead to an invalid file mode.
+ */
+ if (archive_entry_acl_count(entry,
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4) > 0)
+ add_trivial_nfs4_acl(entry);
+#endif
return (r);
}
-#endif /* ACL_TYPE_NFS4 */
+#endif /* HAVE_NFS4_ACL */
+
+#if HAVE_POSIX_ACL
+ /* This code path is skipped on MacOS and Solaris */
/* Retrieve access ACL from file. */
if (*fd >= 0)
@@ -512,8 +581,7 @@ setup_acls(struct archive_read_disk *a,
#endif
if (acl != NULL) {
- r = translate_acl(a, entry, acl,
- ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ r = translate_acl(a, entry, acl, ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
acl_free(acl);
acl = NULL;
if (r != ARCHIVE_OK) {
@@ -525,6 +593,11 @@ setup_acls(struct archive_read_disk *a,
/* Only directories can have default ACLs. */
if (S_ISDIR(archive_entry_mode(entry))) {
+#if HAVE_ACL_GET_FD_NP
+ if (*fd >= 0)
+ acl = acl_get_fd_np(*fd, ACL_TYPE_DEFAULT);
+ else
+#endif
acl = acl_get_file(accpath, ACL_TYPE_DEFAULT);
if (acl != NULL) {
r = translate_acl(a, entry, acl,
@@ -538,68 +611,560 @@ setup_acls(struct archive_read_disk *a,
}
}
}
+#endif /* HAVE_POSIX_ACL */
return (ARCHIVE_OK);
}
/*
- * Translate system ACL into libarchive internal structure.
+ * Translate system ACL permissions into libarchive internal structure
*/
-
-static struct {
- int archive_perm;
- int platform_perm;
+static const struct {
+ const int archive_perm;
+ const int platform_perm;
} acl_perm_map[] = {
- {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
- {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
- {ARCHIVE_ENTRY_ACL_READ, ACL_READ},
-#ifdef ACL_TYPE_NFS4
- {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
- {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
- {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
- {ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE},
- {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA},
- {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY},
- {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS},
- {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS},
- {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD},
- {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES},
- {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
- {ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE},
- {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_ACL},
- {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL},
- {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER},
- {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
+#if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */
+ {ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE},
+ {ARCHIVE_ENTRY_ACL_READ_DATA, ACE_READ_DATA},
+ {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACE_LIST_DIRECTORY},
+ {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACE_WRITE_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_FILE, ACE_ADD_FILE},
+ {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACE_APPEND_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACE_ADD_SUBDIRECTORY},
+ {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACE_READ_NAMED_ATTRS},
+ {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACE_WRITE_NAMED_ATTRS},
+ {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACE_DELETE_CHILD},
+ {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACE_READ_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACE_WRITE_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_DELETE, ACE_DELETE},
+ {ARCHIVE_ENTRY_ACL_READ_ACL, ACE_READ_ACL},
+ {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACE_WRITE_ACL},
+ {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACE_WRITE_OWNER},
+ {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACE_SYNCHRONIZE}
+#elif HAVE_DARWIN_ACL /* MacOS ACL permissions */
+ {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
+ {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
+ {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE},
+ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
+ {ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE},
+ {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY},
+ {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD},
+ {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_EXTATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_EXTATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_SECURITY},
+ {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_SECURITY},
+ {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_CHANGE_OWNER},
+ {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
+#else /* POSIX.1e ACL permissions */
+ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
+ {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
+ {ARCHIVE_ENTRY_ACL_READ, ACL_READ},
+#if HAVE_ACL_TYPE_NFS4 /* FreeBSD NFSv4 ACL permissions */
+ {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
+ {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
+ {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE},
+ {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY},
+ {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_NAMED_ATTRS},
+ {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_NAMED_ATTRS},
+ {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD},
+ {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE},
+ {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_ACL},
+ {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL},
+ {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER},
+ {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
#endif
+#endif /* !HAVE_SUN_ACL && !HAVE_DARWIN_ACL */
};
-#ifdef ACL_TYPE_NFS4
-static struct {
- int archive_inherit;
- int platform_inherit;
+#if HAVE_NFS4_ACL
+/*
+ * Translate system NFSv4 inheritance flags into libarchive internal structure
+ */
+static const struct {
+ const int archive_inherit;
+ const int platform_inherit;
} acl_inherit_map[] = {
- {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
+#if HAVE_SUN_ACL /* Solaris ACL inheritance flags */
+ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACE_DIRECTORY_INHERIT_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACE_NO_PROPAGATE_INHERIT_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACE_INHERIT_ONLY_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACE_SUCCESSFUL_ACCESS_ACE_FLAG},
+ {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACE_FAILED_ACCESS_ACE_FLAG},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACE_INHERITED_ACE}
+#elif HAVE_DARWIN_ACL /* MacOS NFSv4 inheritance flags */
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED},
+ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
+ {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
+ {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_LIMIT_INHERIT},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_ONLY_INHERIT}
+#else /* FreeBSD NFSv4 ACL inheritance flags */
+ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
- {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY},
+ {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS},
+ {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}
+#endif /* !HAVE_SUN_ACL && !HAVE_DARWIN_ACL */
};
-#endif
+#endif /* HAVE_NFS4_ACL */
+
+#if HAVE_DARWIN_ACL
+static int translate_guid(struct archive *a, acl_entry_t acl_entry,
+ int *ae_id, int *ae_tag, const char **ae_name)
+{
+ void *q;
+ uid_t ugid;
+ int r, idtype;
+ struct passwd *pwd;
+ struct group *grp;
+
+ q = acl_get_qualifier(acl_entry);
+ if (q == NULL)
+ return (1);
+ r = mbr_uuid_to_id((const unsigned char *)q, &ugid, &idtype);
+ if (r != 0) {
+ acl_free(q);
+ return (1);
+ }
+ if (idtype == ID_TYPE_UID) {
+ *ae_tag = ARCHIVE_ENTRY_ACL_USER;
+ pwd = getpwuuid(q);
+ if (pwd == NULL) {
+ *ae_id = ugid;
+ *ae_name = NULL;
+ } else {
+ *ae_id = pwd->pw_uid;
+ *ae_name = archive_read_disk_uname(a, *ae_id);
+ }
+ } else if (idtype == ID_TYPE_GID) {
+ *ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
+ grp = getgruuid(q);
+ if (grp == NULL) {
+ *ae_id = ugid;
+ *ae_name = NULL;
+ } else {
+ *ae_id = grp->gr_gid;
+ *ae_name = archive_read_disk_gname(a, *ae_id);
+ }
+ } else
+ r = 1;
+
+ acl_free(q);
+ return (r);
+}
+
+/*
+ * Add trivial NFSv4 ACL entries from mode
+ */
+static void
+add_trivial_nfs4_acl(struct archive_entry *entry)
+{
+ mode_t mode;
+ int i;
+ const int rperm = ARCHIVE_ENTRY_ACL_READ_DATA;
+ const int wperm = ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA;
+ const int eperm = ARCHIVE_ENTRY_ACL_EXECUTE;
+ const int pubset = ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE;
+ const int ownset = pubset | ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_WRITE_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_OWNER;
+
+ struct {
+ const int type;
+ const int tag;
+ int permset;
+ } tacl_entry[] = {
+ {ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_USER_OBJ, 0},
+ {ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_USER_OBJ, 0},
+ {ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0},
+ {ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_USER_OBJ, ownset},
+ {ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_GROUP_OBJ, pubset},
+ {ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EVERYONE, pubset}
+ };
+
+ mode = archive_entry_mode(entry);
+
+ /* Permissions for everyone@ */
+ if (mode & 0004)
+ tacl_entry[5].permset |= rperm;
+ if (mode & 0002)
+ tacl_entry[5].permset |= wperm;
+ if (mode & 0001)
+ tacl_entry[5].permset |= eperm;
+
+ /* Permissions for group@ */
+ if (mode & 0040)
+ tacl_entry[4].permset |= rperm;
+ else if (mode & 0004)
+ tacl_entry[2].permset |= rperm;
+ if (mode & 0020)
+ tacl_entry[4].permset |= wperm;
+ else if (mode & 0002)
+ tacl_entry[2].permset |= wperm;
+ if (mode & 0010)
+ tacl_entry[4].permset |= eperm;
+ else if (mode & 0001)
+ tacl_entry[2].permset |= eperm;
+
+ /* Permissions for owner@ */
+ if (mode & 0400) {
+ tacl_entry[3].permset |= rperm;
+ if (!(mode & 0040) && (mode & 0004))
+ tacl_entry[0].permset |= rperm;
+ } else if ((mode & 0040) || (mode & 0004))
+ tacl_entry[1].permset |= rperm;
+ if (mode & 0200) {
+ tacl_entry[3].permset |= wperm;
+ if (!(mode & 0020) && (mode & 0002))
+ tacl_entry[0].permset |= wperm;
+ } else if ((mode & 0020) || (mode & 0002))
+ tacl_entry[1].permset |= wperm;
+ if (mode & 0100) {
+ tacl_entry[3].permset |= eperm;
+ if (!(mode & 0010) && (mode & 0001))
+ tacl_entry[0].permset |= eperm;
+ } else if ((mode & 0010) || (mode & 0001))
+ tacl_entry[1].permset |= eperm;
+
+ for (i = 0; i < 6; i++) {
+ if (tacl_entry[i].permset != 0) {
+ archive_entry_acl_add_entry(entry,
+ tacl_entry[i].type, tacl_entry[i].permset,
+ tacl_entry[i].tag, -1, NULL);
+ }
+ }
+
+ return;
+}
+#elif HAVE_SUN_ACL
+/*
+ * Check if acl is trivial
+ * This is a FreeBSD acl_is_trivial_np() implementation for Solaris
+ */
+static int
+sun_acl_is_trivial(acl_t *acl, mode_t mode, int *trivialp)
+{
+ int i, p;
+ const uint32_t rperm = ACE_READ_DATA;
+ const uint32_t wperm = ACE_WRITE_DATA | ACE_APPEND_DATA;
+ const uint32_t eperm = ACE_EXECUTE;
+ const uint32_t pubset = ACE_READ_ATTRIBUTES | ACE_READ_NAMED_ATTRS |
+ ACE_READ_ACL | ACE_SYNCHRONIZE;
+ const uint32_t ownset = pubset | ACE_WRITE_ATTRIBUTES |
+ ACE_WRITE_NAMED_ATTRS | ACE_WRITE_ACL | ACE_WRITE_OWNER;
+
+ ace_t *ace;
+ ace_t tace[6];
+
+ if (acl == NULL || trivialp == NULL)
+ return (-1);
+
+ *trivialp = 0;
+
+ /* ACL_IS_TRIVIAL flag must be set for both POSIX.1e and NFSv4 ACLs */
+ if ((acl->acl_flags & ACL_IS_TRIVIAL) == 0)
+ return (0);
+
+ /*
+ * POSIX.1e ACLs marked with ACL_IS_TRIVIAL are compatible with
+ * FreeBSD acl_is_trivial_np(). On Solaris they have 4 entries,
+ * including mask.
+ */
+ if (acl->acl_type == ACLENT_T) {
+ if (acl->acl_cnt == 4)
+ *trivialp = 1;
+ return (0);
+ }
+
+ if (acl->acl_type != ACE_T || acl->acl_entry_size != sizeof(ace_t))
+ return (-1);
+
+ /*
+ * Continue with checking NFSv4 ACLs
+ *
+ * Create list of trivial ace's to be compared
+ */
+
+ /* owner@ allow pre */
+ tace[0].a_flags = ACE_OWNER;
+ tace[0].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
+ tace[0].a_access_mask = 0;
+
+ /* owner@ deny */
+ tace[1].a_flags = ACE_OWNER;
+ tace[1].a_type = ACE_ACCESS_DENIED_ACE_TYPE;
+ tace[1].a_access_mask = 0;
+
+ /* group@ deny */
+ tace[2].a_flags = ACE_GROUP | ACE_IDENTIFIER_GROUP;
+ tace[2].a_type = ACE_ACCESS_DENIED_ACE_TYPE;
+ tace[2].a_access_mask = 0;
+
+ /* owner@ allow */
+ tace[3].a_flags = ACE_OWNER;
+ tace[3].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
+ tace[3].a_access_mask = ownset;
+
+ /* group@ allow */
+ tace[4].a_flags = ACE_GROUP | ACE_IDENTIFIER_GROUP;
+ tace[4].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
+ tace[4].a_access_mask = pubset;
+
+ /* everyone@ allow */
+ tace[5].a_flags = ACE_EVERYONE;
+ tace[5].a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
+ tace[5].a_access_mask = pubset;
+
+ /* Permissions for everyone@ */
+ if (mode & 0004)
+ tace[5].a_access_mask |= rperm;
+ if (mode & 0002)
+ tace[5].a_access_mask |= wperm;
+ if (mode & 0001)
+ tace[5].a_access_mask |= eperm;
+
+ /* Permissions for group@ */
+ if (mode & 0040)
+ tace[4].a_access_mask |= rperm;
+ else if (mode & 0004)
+ tace[2].a_access_mask |= rperm;
+ if (mode & 0020)
+ tace[4].a_access_mask |= wperm;
+ else if (mode & 0002)
+ tace[2].a_access_mask |= wperm;
+ if (mode & 0010)
+ tace[4].a_access_mask |= eperm;
+ else if (mode & 0001)
+ tace[2].a_access_mask |= eperm;
+
+ /* Permissions for owner@ */
+ if (mode & 0400) {
+ tace[3].a_access_mask |= rperm;
+ if (!(mode & 0040) && (mode & 0004))
+ tace[0].a_access_mask |= rperm;
+ } else if ((mode & 0040) || (mode & 0004))
+ tace[1].a_access_mask |= rperm;
+ if (mode & 0200) {
+ tace[3].a_access_mask |= wperm;
+ if (!(mode & 0020) && (mode & 0002))
+ tace[0].a_access_mask |= wperm;
+ } else if ((mode & 0020) || (mode & 0002))
+ tace[1].a_access_mask |= wperm;
+ if (mode & 0100) {
+ tace[3].a_access_mask |= eperm;
+ if (!(mode & 0010) && (mode & 0001))
+ tace[0].a_access_mask |= eperm;
+ } else if ((mode & 0010) || (mode & 0001))
+ tace[1].a_access_mask |= eperm;
+
+ /* Check if the acl count matches */
+ p = 3;
+ for (i = 0; i < 3; i++) {
+ if (tace[i].a_access_mask != 0)
+ p++;
+ }
+ if (acl->acl_cnt != p)
+ return (0);
+
+ p = 0;
+ for (i = 0; i < 6; i++) {
+ if (tace[i].a_access_mask != 0) {
+ ace = &((ace_t *)acl->acl_aclp)[p];
+ /*
+ * Illumos added ACE_DELETE_CHILD to write perms for
+ * directories. We have to check against that, too.
+ */
+ if (ace->a_flags != tace[i].a_flags ||
+ ace->a_type != tace[i].a_type ||
+ (ace->a_access_mask != tace[i].a_access_mask &&
+ ((acl->acl_flags & ACL_IS_DIR) == 0 ||
+ (tace[i].a_access_mask & wperm) == 0 ||
+ ace->a_access_mask !=
+ (tace[i].a_access_mask | ACE_DELETE_CHILD))))
+ return (0);
+ p++;
+ }
+ }
+
+ *trivialp = 1;
+ return (0);
+}
+#endif /* HAVE_SUN_ACL */
+
+#if HAVE_SUN_ACL
+/*
+ * Translate Solaris POSIX.1e and NFSv4 ACLs into libarchive internal ACL
+ */
+static int
+translate_acl(struct archive_read_disk *a,
+ struct archive_entry *entry, acl_t *acl, int default_entry_acl_type)
+{
+ int e, i;
+ int ae_id, ae_tag, ae_perm;
+ int entry_acl_type;
+ const char *ae_name;
+ aclent_t *aclent;
+ ace_t *ace;
+
+ (void)default_entry_acl_type;
+
+ if (acl->acl_cnt <= 0)
+ return (ARCHIVE_OK);
+
+ for (e = 0; e < acl->acl_cnt; e++) {
+ ae_name = NULL;
+ ae_tag = 0;
+ ae_perm = 0;
+
+ if (acl->acl_type == ACE_T) {
+ ace = &((ace_t *)acl->acl_aclp)[e];
+ ae_id = ace->a_who;
+
+ switch(ace->a_type) {
+ case ACE_ACCESS_ALLOWED_ACE_TYPE:
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
+ break;
+ case ACE_ACCESS_DENIED_ACE_TYPE:
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
+ break;
+ case ACE_SYSTEM_AUDIT_ACE_TYPE:
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ break;
+ case ACE_SYSTEM_ALARM_ACE_TYPE:
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALARM;
+ break;
+ default:
+ /* Unknown entry type, skip */
+ continue;
+ }
+
+ if ((ace->a_flags & ACE_OWNER) != 0)
+ ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ else if ((ace->a_flags & ACE_GROUP) != 0)
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ else if ((ace->a_flags & ACE_EVERYONE) != 0)
+ ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
+ else if ((ace->a_flags & ACE_IDENTIFIER_GROUP) != 0) {
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
+ ae_name = archive_read_disk_gname(&a->archive,
+ ae_id);
+ } else {
+ ae_tag = ARCHIVE_ENTRY_ACL_USER;
+ ae_name = archive_read_disk_uname(&a->archive,
+ ae_id);
+ }
+
+ for (i = 0; i < (int)(sizeof(acl_inherit_map) /
+ sizeof(acl_inherit_map[0])); ++i) {
+ if ((ace->a_flags &
+ acl_inherit_map[i].platform_inherit) != 0)
+ ae_perm |=
+ acl_inherit_map[i].archive_inherit;
+ }
+
+ for (i = 0; i < (int)(sizeof(acl_perm_map) /
+ sizeof(acl_perm_map[0])); ++i) {
+ if ((ace->a_access_mask &
+ acl_perm_map[i].platform_perm) != 0)
+ ae_perm |=
+ acl_perm_map[i].archive_perm;
+ }
+ } else {
+ aclent = &((aclent_t *)acl->acl_aclp)[e];
+ if ((aclent->a_type & ACL_DEFAULT) != 0)
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DEFAULT;
+ else
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
+ ae_id = aclent->a_id;
+
+ switch(aclent->a_type) {
+ case DEF_USER:
+ case USER:
+ ae_name = archive_read_disk_uname(&a->archive,
+ ae_id);
+ ae_tag = ARCHIVE_ENTRY_ACL_USER;
+ break;
+ case DEF_GROUP:
+ case GROUP:
+ ae_name = archive_read_disk_gname(&a->archive,
+ ae_id);
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
+ break;
+ case DEF_CLASS_OBJ:
+ case CLASS_OBJ:
+ ae_tag = ARCHIVE_ENTRY_ACL_MASK;
+ break;
+ case DEF_USER_OBJ:
+ case USER_OBJ:
+ ae_tag = ARCHIVE_ENTRY_ACL_USER_OBJ;
+ break;
+ case DEF_GROUP_OBJ:
+ case GROUP_OBJ:
+ ae_tag = ARCHIVE_ENTRY_ACL_GROUP_OBJ;
+ break;
+ case DEF_OTHER_OBJ:
+ case OTHER_OBJ:
+ ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
+ break;
+ default:
+ /* Unknown tag type, skip */
+ continue;
+ }
+
+ if ((aclent->a_perm & 1) != 0)
+ ae_perm |= ARCHIVE_ENTRY_ACL_EXECUTE;
+ if ((aclent->a_perm & 2) != 0)
+ ae_perm |= ARCHIVE_ENTRY_ACL_WRITE;
+ if ((aclent->a_perm & 4) != 0)
+ ae_perm |= ARCHIVE_ENTRY_ACL_READ;
+ } /* default_entry_acl_type != ARCHIVE_ENTRY_ACL_TYPE_NFS4 */
+
+ archive_entry_acl_add_entry(entry, entry_acl_type,
+ ae_perm, ae_tag, ae_id, ae_name);
+ }
+ return (ARCHIVE_OK);
+}
+#else /* !HAVE_SUN_ACL */
+/*
+ * Translate POSIX.1e (Linux), FreeBSD (both POSIX.1e and NFSv4) and
+ * MacOS (NFSv4 only) ACLs into libarchive internal structure
+ */
static int
translate_acl(struct archive_read_disk *a,
struct archive_entry *entry, acl_t acl, int default_entry_acl_type)
{
acl_tag_t acl_tag;
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4
acl_entry_type_t acl_type;
- acl_flagset_t acl_flagset;
int brand;
#endif
+#if HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL
+ acl_flagset_t acl_flagset;
+#endif
acl_entry_t acl_entry;
acl_permset_t acl_permset;
int i, entry_acl_type;
int r, s, ae_id, ae_tag, ae_perm;
+#if !HAVE_DARWIN_ACL
+ void *q;
+#endif
const char *ae_name;
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4
// FreeBSD "brands" ACLs as POSIX.1e or NFSv4
// Make sure the "brand" on this ACL is consistent
// with the default_entry_acl_type bits provided.
@@ -634,14 +1199,19 @@ translate_acl(struct archive_read_disk *a,
}
#endif
-
s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry);
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get first ACL entry");
return (ARCHIVE_WARN);
}
- while (s == 1) {
+
+#if HAVE_DARWIN_ACL
+ while (s == 0)
+#else /* FreeBSD, Linux */
+ while (s == 1)
+#endif
+ {
ae_id = -1;
ae_name = NULL;
ae_perm = 0;
@@ -652,14 +1222,25 @@ translate_acl(struct archive_read_disk *a,
return (ARCHIVE_WARN);
}
switch (acl_tag) {
+#if !HAVE_DARWIN_ACL /* FreeBSD, Linux */
case ACL_USER:
- ae_id = (int)*(uid_t *)acl_get_qualifier(acl_entry);
- ae_name = archive_read_disk_uname(&a->archive, ae_id);
+ q = acl_get_qualifier(acl_entry);
+ if (q != NULL) {
+ ae_id = (int)*(uid_t *)q;
+ acl_free(q);
+ ae_name = archive_read_disk_uname(&a->archive,
+ ae_id);
+ }
ae_tag = ARCHIVE_ENTRY_ACL_USER;
break;
case ACL_GROUP:
- ae_id = (int)*(gid_t *)acl_get_qualifier(acl_entry);
- ae_name = archive_read_disk_gname(&a->archive, ae_id);
+ q = acl_get_qualifier(acl_entry);
+ if (q != NULL) {
+ ae_id = (int)*(gid_t *)q;
+ acl_free(q);
+ ae_name = archive_read_disk_gname(&a->archive,
+ ae_id);
+ }
ae_tag = ARCHIVE_ENTRY_ACL_GROUP;
break;
case ACL_MASK:
@@ -674,21 +1255,44 @@ translate_acl(struct archive_read_disk *a,
case ACL_OTHER:
ae_tag = ARCHIVE_ENTRY_ACL_OTHER;
break;
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4
case ACL_EVERYONE:
ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE;
break;
#endif
+#else /* HAVE_DARWIN_ACL */
+ case ACL_EXTENDED_ALLOW:
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_ALLOW;
+ r = translate_guid(&a->archive, acl_entry, &ae_id,
+ &ae_tag, &ae_name);
+ break;
+ case ACL_EXTENDED_DENY:
+ entry_acl_type = ARCHIVE_ENTRY_ACL_TYPE_DENY;
+ r = translate_guid(&a->archive, acl_entry, &ae_id,
+ &ae_tag, &ae_name);
+ break;
+#endif /* HAVE_DARWIN_ACL */
default:
/* Skip types that libarchive can't support. */
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
continue;
}
+#if HAVE_DARWIN_ACL
+ /* Skip if translate_guid() above failed */
+ if (r != 0) {
+ s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
+ continue;
+ }
+#endif
+
+#if !HAVE_DARWIN_ACL
// XXX acl_type maps to allow/deny/audit/YYYY bits
entry_acl_type = default_entry_acl_type;
-#ifdef ACL_TYPE_NFS4
+#endif
+#if HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL
if (default_entry_acl_type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) {
+#if HAVE_ACL_TYPE_NFS4
/*
* acl_get_entry_type_np() fails with non-NFSv4 ACLs
*/
@@ -715,6 +1319,7 @@ translate_acl(struct archive_read_disk *a,
"Invalid NFSv4 ACL entry type");
return (ARCHIVE_WARN);
}
+#endif /* HAVE_ACL_TYPE_NFS4 */
/*
* Libarchive stores "flag" (NFSv4 inheritance bits)
@@ -727,7 +1332,7 @@ translate_acl(struct archive_read_disk *a,
"Failed to get flagset from a NFSv4 ACL entry");
return (ARCHIVE_WARN);
}
- for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
+ for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
r = acl_get_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit);
if (r == -1) {
@@ -737,9 +1342,9 @@ translate_acl(struct archive_read_disk *a,
return (ARCHIVE_WARN);
} else if (r)
ae_perm |= acl_inherit_map[i].archive_inherit;
- }
+ }
}
-#endif
+#endif /* HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL */
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(&a->archive, errno,
@@ -765,15 +1370,18 @@ translate_acl(struct archive_read_disk *a,
ae_id, ae_name);
s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry);
+#if !HAVE_DARWIN_ACL
if (s == -1) {
archive_set_error(&a->archive, errno,
"Failed to get next ACL entry");
return (ARCHIVE_WARN);
}
+#endif
}
return (ARCHIVE_OK);
}
-#else
+#endif /* !HAVE_SUN_ACL */
+#else /* !HAVE_POSIX_ACL && !HAVE_NFS4_ACL */
static int
setup_acls(struct archive_read_disk *a,
struct archive_entry *entry, int *fd)
@@ -783,7 +1391,7 @@ setup_acls(struct archive_read_disk *a,
(void)fd; /* UNUSED */
return (ARCHIVE_OK);
}
-#endif
+#endif /* !HAVE_POSIX_ACL && !HAVE_NFS4_ACL */
#if (HAVE_FGETXATTR && HAVE_FLISTXATTR && HAVE_LISTXATTR && \
HAVE_LLISTXATTR && HAVE_GETXATTR && HAVE_LGETXATTR) || \
diff --git a/contrib/libarchive/libarchive/archive_read_disk_posix.c b/contrib/libarchive/libarchive/archive_read_disk_posix.c
index bc7fad1..b893704 100644
--- a/contrib/libarchive/libarchive/archive_read_disk_posix.c
+++ b/contrib/libarchive/libarchive/archive_read_disk_posix.c
@@ -675,7 +675,7 @@ setup_suitable_read_buffer(struct archive_read_disk *a)
asize = cf->min_xfer_size;
/* Increase a buffer size up to 64K bytes in
- * a proper incremant size. */
+ * a proper increment size. */
while (asize < 1024*64)
asize += incr;
/* Take a margin to adjust to the filesystem
@@ -1656,7 +1656,7 @@ setup_current_filesystem(struct archive_read_disk *a)
archive_set_error(&a->archive, errno, "statvfs failed");
return (ARCHIVE_FAILED);
} else if (xr == 1) {
- /* Usuall come here unless NetBSD supports _PC_REC_XFER_ALIGN
+ /* Usually come here unless NetBSD supports _PC_REC_XFER_ALIGN
* for pathconf() function. */
t->current_filesystem->xfer_align = sfs.f_frsize;
t->current_filesystem->max_xfer_size = -1;
@@ -1944,7 +1944,7 @@ setup_current_filesystem(struct archive_read_disk *a)
if (nm == -1)
# endif /* _PC_NAME_MAX */
/*
- * Some sysmtes (HP-UX or others?) incorrectly defined
+ * Some systems (HP-UX or others?) incorrectly defined
* NAME_MAX macro to be a smaller value.
*/
# if defined(NAME_MAX) && NAME_MAX >= 255
diff --git a/contrib/libarchive/libarchive/archive_read_open_filename.c b/contrib/libarchive/libarchive/archive_read_open_filename.c
index b2d52aa..64b0179 100644
--- a/contrib/libarchive/libarchive/archive_read_open_filename.c
+++ b/contrib/libarchive/libarchive/archive_read_open_filename.c
@@ -222,7 +222,7 @@ file_open(struct archive *a, void *client_data)
void *buffer;
const char *filename = NULL;
const wchar_t *wfilename = NULL;
- int fd;
+ int fd = -1;
int is_disk_like = 0;
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
off_t mediasize = 0; /* FreeBSD-specific, so off_t okay here. */
@@ -277,7 +277,7 @@ file_open(struct archive *a, void *client_data)
#else
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unexpedted operation in archive_read_open_filename");
- return (ARCHIVE_FATAL);
+ goto fail;
#endif
}
if (fstat(fd, &st) != 0) {
@@ -287,7 +287,7 @@ file_open(struct archive *a, void *client_data)
else
archive_set_error(a, errno, "Can't stat '%s'",
filename);
- return (ARCHIVE_FATAL);
+ goto fail;
}
/*
@@ -356,11 +356,9 @@ file_open(struct archive *a, void *client_data)
mine->block_size = new_block_size;
}
buffer = malloc(mine->block_size);
- if (mine == NULL || buffer == NULL) {
+ if (buffer == NULL) {
archive_set_error(a, ENOMEM, "No memory");
- free(mine);
- free(buffer);
- return (ARCHIVE_FATAL);
+ goto fail;
}
mine->buffer = buffer;
mine->fd = fd;
@@ -372,6 +370,14 @@ file_open(struct archive *a, void *client_data)
mine->use_lseek = 1;
return (ARCHIVE_OK);
+fail:
+ /*
+ * Don't close file descriptors not opened or ones pointing referring
+ * to `FNT_STDIN`.
+ */
+ if (fd != -1 && fd != 0)
+ close(fd);
+ return (ARCHIVE_FATAL);
}
static ssize_t
diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c b/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c
index 37b2f59..663e2d3 100644
--- a/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c
+++ b/contrib/libarchive/libarchive/archive_read_support_filter_lz4.c
@@ -180,7 +180,7 @@ lz4_reader_bid(struct archive_read_filter_bidder *self,
return (0);
bits_checked += 8;
BD = buffer[5];
- /* A block maximum size shuld be more than 3. */
+ /* A block maximum size should be more than 3. */
if (((BD & 0x70) >> 4) < 4)
return (0);
/* Reserved bits must be "0". */
@@ -417,7 +417,7 @@ lz4_filter_read_descriptor(struct archive_read_filter *self)
/* Reserved bits must be zero. */
if (bd & 0x8f)
goto malformed_error;
- /* Get a maxinum block size. */
+ /* Get a maximum block size. */
switch (read_buf[1] >> 4) {
case 4: /* 64 KB */
state->flags.block_maximum_size = 64 * 1024;
@@ -627,7 +627,7 @@ lz4_filter_read_default_stream(struct archive_read_filter *self, const void **p)
if (state->stage == SELECT_STREAM) {
state->stage = READ_DEFAULT_STREAM;
- /* First, read a desciprtor. */
+ /* First, read a descriptor. */
if((ret = lz4_filter_read_descriptor(self)) != ARCHIVE_OK)
return (ret);
state->stage = READ_DEFAULT_BLOCK;
@@ -706,6 +706,11 @@ lz4_filter_read_legacy_stream(struct archive_read_filter *self, const void **p)
/* Make sure we have a whole block. */
read_buf = __archive_read_filter_ahead(self->upstream,
4 + compressed, NULL);
+ if (read_buf == NULL) {
+ archive_set_error(&(self->archive->archive),
+ ARCHIVE_ERRNO_MISC, "truncated lz4 input");
+ return (ARCHIVE_FATAL);
+ }
ret = LZ4_decompress_safe(read_buf + 4, state->out_block,
compressed, (int)state->out_block_size);
if (ret < 0) {
diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c b/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c
index 44ac9964..a1c392f 100644
--- a/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c
+++ b/contrib/libarchive/libarchive/archive_read_support_filter_lzop.c
@@ -436,7 +436,7 @@ lzop_filter_read(struct archive_read_filter *self, const void **p)
}
/*
- * Drive lzo uncompresison.
+ * Drive lzo uncompression.
*/
out_size = (lzo_uint)state->uncompressed_size;
r = lzo1x_decompress_safe(b, (lzo_uint)state->compressed_size,
diff --git a/contrib/libarchive/libarchive/archive_read_support_filter_program.c b/contrib/libarchive/libarchive/archive_read_support_filter_program.c
index 66dc2f4..b8bf128 100644
--- a/contrib/libarchive/libarchive/archive_read_support_filter_program.c
+++ b/contrib/libarchive/libarchive/archive_read_support_filter_program.c
@@ -430,6 +430,7 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd)
&state->child_stdout);
if (child == -1) {
free(state->out_buf);
+ archive_string_free(&state->description);
free(state);
archive_set_error(&self->archive->archive, EINVAL,
"Can't initialize filter; unable to run program \"%s\"",
@@ -441,6 +442,7 @@ __archive_read_program(struct archive_read_filter *self, const char *cmd)
if (state->child == NULL) {
child_stop(self, state);
free(state->out_buf);
+ archive_string_free(&state->description);
free(state);
archive_set_error(&self->archive->archive, EINVAL,
"Can't initialize filter; unable to run program \"%s\"",
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c
index f8d52fb..3387eaf 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_7zip.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_7zip.c
@@ -552,7 +552,7 @@ skip_sfx(struct archive_read *a, ssize_t bytes_avail)
/*
* If bytes_avail > SFX_MIN_ADDR we do not have to call
* __archive_read_seek() at this time since we have
- * alredy had enough data.
+ * already had enough data.
*/
if (bytes_avail > SFX_MIN_ADDR)
__archive_read_consume(a, SFX_MIN_ADDR);
@@ -760,7 +760,7 @@ archive_read_format_7zip_read_header(struct archive_read *a,
symsize += size;
}
if (symsize == 0) {
- /* If there is no synname, handle it as a regular
+ /* If there is no symname, handle it as a regular
* file. */
zip_entry->mode &= ~AE_IFMT;
zip_entry->mode |= AE_IFREG;
@@ -3288,7 +3288,7 @@ read_stream(struct archive_read *a, const void **buff, size_t size,
return (r);
/*
- * Skip the bytes we alrady has skipped in skip_stream().
+ * Skip the bytes we already has skipped in skip_stream().
*/
while (skip_bytes) {
ssize_t skipped;
@@ -3506,7 +3506,7 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder,
return (ARCHIVE_FATAL);
}
- /* Allocate memory for the decorded data of a sub
+ /* Allocate memory for the decoded data of a sub
* stream. */
b[i] = malloc((size_t)zip->folder_outbytes_remaining);
if (b[i] == NULL) {
@@ -3591,7 +3591,7 @@ skip_stream(struct archive_read *a, size_t skip_bytes)
if (zip->folder_index == 0) {
/*
* Optimization for a list mode.
- * Avoid unncecessary decoding operations.
+ * Avoid unnecessary decoding operations.
*/
zip->si.ci.folders[zip->entry->folderIndex].skipped_bytes
+= skip_bytes;
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cab.c b/contrib/libarchive/libarchive/archive_read_support_format_cab.c
index 2bdc1e2..e2f8c6b 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_cab.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_cab.c
@@ -1495,6 +1495,8 @@ cab_read_ahead_cfdata_deflate(struct archive_read *a, ssize_t *avail)
/* Cut out a tow-byte MSZIP signature(0x43, 0x4b). */
if (mszip > 0) {
+ if (bytes_avail <= 0)
+ goto nomszip;
if (bytes_avail <= mszip) {
if (mszip == 2) {
if (cab->stream.next_in[0] != 0x43)
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
index 2a5a829..43e6ff9 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_cpio.c
@@ -356,7 +356,7 @@ archive_read_format_cpio_read_header(struct archive_read *a,
struct archive_entry *entry)
{
struct cpio *cpio;
- const void *h;
+ const void *h, *hl;
struct archive_string_conv *sconv;
size_t namelength;
size_t name_pad;
@@ -406,11 +406,11 @@ archive_read_format_cpio_read_header(struct archive_read *a,
"Rejecting malformed cpio archive: symlink contents exceed 1 megabyte");
return (ARCHIVE_FATAL);
}
- h = __archive_read_ahead(a,
+ hl = __archive_read_ahead(a,
(size_t)cpio->entry_bytes_remaining, NULL);
- if (h == NULL)
+ if (hl == NULL)
return (ARCHIVE_FATAL);
- if (archive_entry_copy_symlink_l(entry, (const char *)h,
+ if (archive_entry_copy_symlink_l(entry, (const char *)hl,
(size_t)cpio->entry_bytes_remaining, sconv) != 0) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
@@ -434,7 +434,8 @@ archive_read_format_cpio_read_header(struct archive_read *a,
* header. XXX */
/* Compare name to "TRAILER!!!" to test for end-of-archive. */
- if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) {
+ if (namelength == 11 && strncmp((const char *)h, "TRAILER!!!",
+ 11) == 0) {
/* TODO: Store file location of start of block. */
archive_clear_error(&a->archive);
return (ARCHIVE_EOF);
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c b/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
index 3807abd..ebbfc2f 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_iso9660.c
@@ -322,7 +322,7 @@ struct iso9660 {
struct archive_string pathname;
char seenRockridge; /* Set true if RR extensions are used. */
- char seenSUSP; /* Set true if SUSP is beging used. */
+ char seenSUSP; /* Set true if SUSP is being used. */
char seenJoliet;
unsigned char suspOffset;
@@ -374,7 +374,7 @@ struct iso9660 {
size_t utf16be_path_len;
unsigned char *utf16be_previous_path;
size_t utf16be_previous_path_len;
- /* Null buufer used in bidder to improve its performance. */
+ /* Null buffer used in bidder to improve its performance. */
unsigned char null[2048];
};
@@ -1199,7 +1199,7 @@ archive_read_format_iso9660_read_header(struct archive_read *a,
archive_string_conversion_from_charset(
&(a->archive), "UTF-16BE", 1);
if (iso9660->sconv_utf16be == NULL)
- /* Coundn't allocate memory */
+ /* Couldn't allocate memory */
return (ARCHIVE_FATAL);
}
if (iso9660->utf16be_path == NULL) {
@@ -1864,7 +1864,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
if ((file->utf16be_name = malloc(name_len)) == NULL) {
archive_set_error(&a->archive, ENOMEM,
"No memory for file name");
- return (NULL);
+ goto fail;
}
memcpy(file->utf16be_name, p, name_len);
file->utf16be_bytes = name_len;
@@ -1943,10 +1943,8 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
file->symlink_continues = 0;
rr_start += iso9660->suspOffset;
r = parse_rockridge(a, file, rr_start, rr_end);
- if (r != ARCHIVE_OK) {
- free(file);
- return (NULL);
- }
+ if (r != ARCHIVE_OK)
+ goto fail;
/*
* A file size of symbolic link files in ISO images
* made by makefs is not zero and its location is
@@ -1990,7 +1988,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge RE");
- return (NULL);
+ goto fail;
}
/*
* Sanity check: file does not have "CL" extension.
@@ -1999,7 +1997,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge RE and CL");
- return (NULL);
+ goto fail;
}
/*
* Sanity check: The file type must be a directory.
@@ -2008,7 +2006,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge RE");
- return (NULL);
+ goto fail;
}
} else if (parent != NULL && parent->rr_moved)
file->rr_moved_has_re_only = 0;
@@ -2022,7 +2020,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge CL");
- return (NULL);
+ goto fail;
}
/*
* Sanity check: The file type must be a regular file.
@@ -2031,7 +2029,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge CL");
- return (NULL);
+ goto fail;
}
parent->subdirs++;
/* Overwrite an offset and a number of this "CL" entry
@@ -2049,7 +2047,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge CL");
- return (NULL);
+ goto fail;
}
}
if (file->cl_offset == file->offset ||
@@ -2057,7 +2055,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Invalid Rockridge CL");
- return (NULL);
+ goto fail;
}
}
}
@@ -2088,6 +2086,10 @@ parse_file_info(struct archive_read *a, struct file_info *parent,
#endif
register_file(iso9660, file);
return (file);
+fail:
+ archive_string_free(&file->name);
+ free(file);
+ return (NULL);
}
static int
@@ -2407,7 +2409,7 @@ read_CE(struct archive_read *a, struct iso9660 *iso9660)
return (ARCHIVE_FATAL);
} while (heap->cnt &&
heap->reqs[0].offset == iso9660->current_position);
- /* NOTE: Do not move this consume's code to fron of
+ /* NOTE: Do not move this consume's code to front of
* do-while loop. Registration of nested CE extension
* might cause error because of current position. */
__archive_read_consume(a, step);
@@ -2729,7 +2731,7 @@ next_cache_entry(struct archive_read *a, struct iso9660 *iso9660,
if (file == NULL) {
/*
* If directory entries all which are descendant of
- * rr_moved are stil remaning, expose their.
+ * rr_moved are still remaining, expose their.
*/
if (iso9660->re_files.first != NULL &&
iso9660->rr_moved != NULL &&
@@ -2852,7 +2854,7 @@ next_cache_entry(struct archive_read *a, struct iso9660 *iso9660,
empty_files.last = &empty_files.first;
/* Collect files which has the same file serial number.
* Peek pending_files so that file which number is different
- * is not put bak. */
+ * is not put back. */
while (iso9660->pending_files.used > 0 &&
(iso9660->pending_files.files[0]->number == -1 ||
iso9660->pending_files.files[0]->number == number)) {
@@ -2860,7 +2862,7 @@ next_cache_entry(struct archive_read *a, struct iso9660 *iso9660,
/* This file has the same offset
* but it's wrong offset which empty files
* and symlink files have.
- * NOTE: This wrong offse was recorded by
+ * NOTE: This wrong offset was recorded by
* old mkisofs utility. If ISO images is
* created by latest mkisofs, this does not
* happen.
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_lha.c b/contrib/libarchive/libarchive/archive_read_support_format_lha.c
index a7f1d8d..d77a7c2 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_lha.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_lha.c
@@ -924,6 +924,9 @@ lha_read_file_header_1(struct archive_read *a, struct lha *lha)
/* Get a real compressed file size. */
lha->compsize -= extdsize - 2;
+ if (lha->compsize < 0)
+ goto invalid; /* Invalid compressed file size */
+
if (sum_calculated != headersum) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"LHa header sum error");
@@ -1711,7 +1714,7 @@ lha_crc16(uint16_t crc, const void *pp, size_t len)
*/
for (;len >= 8; len -= 8) {
/* This if statement expects compiler optimization will
- * remove the stament which will not be executed. */
+ * remove the statement which will not be executed. */
#undef bswap16
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */
# define bswap16(x) _byteswap_ushort(x)
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
index 02c1251..eb695f8 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
@@ -715,13 +715,13 @@ detect_form(struct archive_read *a, int *is_form_d)
}
} else
break;
- } else if (strncmp(p, "/set", 4) == 0) {
+ } else if (len > 4 && strncmp(p, "/set", 4) == 0) {
if (bid_keyword_list(p+4, len-4, 0, 0) <= 0)
break;
/* This line continues. */
if (p[len-nl-1] == '\\')
multiline = 2;
- } else if (strncmp(p, "/unset", 6) == 0) {
+ } else if (len > 6 && strncmp(p, "/unset", 6) == 0) {
if (bid_keyword_list(p+6, len-6, 1, 0) <= 0)
break;
/* This line continues. */
@@ -1019,11 +1019,11 @@ read_mtree(struct archive_read *a, struct mtree *mtree)
if (*p != '/') {
r = process_add_entry(a, mtree, &global, p, len,
&last_entry, is_form_d);
- } else if (strncmp(p, "/set", 4) == 0) {
+ } else if (len > 4 && strncmp(p, "/set", 4) == 0) {
if (p[4] != ' ' && p[4] != '\t')
break;
r = process_global_set(a, &global, p);
- } else if (strncmp(p, "/unset", 6) == 0) {
+ } else if (len > 6 && strncmp(p, "/unset", 6) == 0) {
if (p[6] != ' ' && p[6] != '\t')
break;
r = process_global_unset(a, &global, p);
@@ -1608,8 +1608,11 @@ parse_keyword(struct archive_read *a, struct mtree *mtree,
if (*val == '.') {
++val;
ns = (long)mtree_atol10(&val);
- } else
- ns = 0;
+ if (ns < 0)
+ ns = 0;
+ else if (ns > 999999999)
+ ns = 999999999;
+ }
if (m > my_time_t_max)
m = my_time_t_max;
else if (m < my_time_t_min)
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_rar.c b/contrib/libarchive/libarchive/archive_read_support_format_rar.c
index 9c9f6f1..1e9849f 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_rar.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_rar.c
@@ -906,7 +906,7 @@ archive_read_format_rar_read_header(struct archive_read *a,
sizeof(rar->reserved2));
}
- /* Main header is password encrytped, so we cannot read any
+ /* Main header is password encrypted, so we cannot read any
file names or any other info about files from the header. */
if (rar->main_flags & MHD_PASSWORD)
{
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_tar.c b/contrib/libarchive/libarchive/archive_read_support_format_tar.c
index 4f69c6e..446d005 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_tar.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_tar.c
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* Copyright (c) 2011-2012 Michihiro NAKAJIMA
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -203,9 +204,14 @@ static int archive_read_format_tar_read_header(struct archive_read *,
struct archive_entry *);
static int checksum(struct archive_read *, const void *);
static int pax_attribute(struct archive_read *, struct tar *,
- struct archive_entry *, const char *key, const char *value);
+ struct archive_entry *, const char *key, const char *value,
+ size_t value_length);
+static int pax_attribute_acl(struct archive_read *, struct tar *,
+ struct archive_entry *, const char *, int);
+static int pax_attribute_xattr(struct archive_entry *, const char *,
+ const char *);
static int pax_header(struct archive_read *, struct tar *,
- struct archive_entry *, char *attr);
+ struct archive_entry *, struct archive_string *);
static void pax_time(const char *, int64_t *sec, long *nanos);
static ssize_t readline(struct archive_read *, struct tar *, const char **,
ssize_t limit, size_t *);
@@ -938,7 +944,7 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
{
const struct archive_entry_header_ustar *header;
size_t size;
- int err;
+ int err, acl_type;
int64_t type;
char *acl, *p;
@@ -983,11 +989,12 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
switch ((int)type & ~0777777) {
case 01000000:
/* POSIX.1e ACL */
+ acl_type = ARCHIVE_ENTRY_ACL_TYPE_ACCESS;
break;
case 03000000:
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Solaris NFSv4 ACLs not supported");
- return (ARCHIVE_WARN);
+ /* NFSv4 ACL */
+ acl_type = ARCHIVE_ENTRY_ACL_TYPE_NFS4;
+ break;
default:
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Malformed Solaris ACL attribute (unsupported type %o)",
@@ -1016,8 +1023,8 @@ header_Solaris_ACL(struct archive_read *a, struct tar *tar,
return (ARCHIVE_FATAL);
}
archive_strncpy(&(tar->localname), acl, p - acl);
- err = archive_acl_parse_l(archive_entry_acl(entry),
- tar->localname.s, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, tar->sconv_acl);
+ err = archive_acl_from_text_l(archive_entry_acl(entry),
+ tar->localname.s, acl_type, tar->sconv_acl);
if (err != ARCHIVE_OK) {
if (errno == ENOMEM) {
archive_set_error(&a->archive, ENOMEM,
@@ -1478,7 +1485,7 @@ header_pax_extensions(struct archive_read *a, struct tar *tar,
* and then skip any fields in the standard header that were
* defined in the pax header.
*/
- err2 = pax_header(a, tar, entry, tar->pax_header.s);
+ err2 = pax_header(a, tar, entry, &tar->pax_header);
err = err_combine(err, err2);
tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining);
return (err);
@@ -1559,16 +1566,17 @@ header_ustar(struct archive_read *a, struct tar *tar,
*/
static int
pax_header(struct archive_read *a, struct tar *tar,
- struct archive_entry *entry, char *attr)
+ struct archive_entry *entry, struct archive_string *in_as)
{
- size_t attr_length, l, line_length;
+ size_t attr_length, l, line_length, value_length;
char *p;
char *key, *value;
struct archive_string *as;
struct archive_string_conv *sconv;
int err, err2;
+ char *attr = in_as->s;
- attr_length = strlen(attr);
+ attr_length = in_as->length;
tar->pax_hdrcharset_binary = 0;
archive_string_empty(&(tar->entry_gname));
archive_string_empty(&(tar->entry_linkpath));
@@ -1633,11 +1641,13 @@ pax_header(struct archive_read *a, struct tar *tar,
}
*p = '\0';
- /* Identify null-terminated 'value' portion. */
value = p + 1;
+ /* Some values may be binary data */
+ value_length = attr + line_length - 1 - value;
+
/* Identify this attribute and set it in the entry. */
- err2 = pax_attribute(a, tar, entry, key, value);
+ err2 = pax_attribute(a, tar, entry, key, value, value_length);
if (err2 == ARCHIVE_FATAL)
return (err2);
err = err_combine(err, err2);
@@ -1758,6 +1768,66 @@ pax_attribute_xattr(struct archive_entry *entry,
return 0;
}
+static int
+pax_attribute_schily_xattr(struct archive_entry *entry,
+ const char *name, const char *value, size_t value_length)
+{
+ if (strlen(name) < 14 || (memcmp(name, "SCHILY.xattr.", 13)) != 0)
+ return 1;
+
+ name += 13;
+
+ archive_entry_xattr_add_entry(entry, name, value, value_length);
+
+ return 0;
+}
+
+static int
+pax_attribute_acl(struct archive_read *a, struct tar *tar,
+ struct archive_entry *entry, const char *value, int type)
+{
+ int r;
+ const char* errstr;
+
+ switch (type) {
+ case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
+ errstr = "SCHILY.acl.access";
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
+ errstr = "SCHILY.acl.default";
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_NFS4:
+ errstr = "SCHILY.acl.ace";
+ break;
+ default:
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
+ "Unknown ACL type: %d", type);
+ return(ARCHIVE_FATAL);
+ }
+
+ if (tar->sconv_acl == NULL) {
+ tar->sconv_acl =
+ archive_string_conversion_from_charset(
+ &(a->archive), "UTF-8", 1);
+ if (tar->sconv_acl == NULL)
+ return (ARCHIVE_FATAL);
+ }
+
+ r = archive_acl_from_text_l(archive_entry_acl(entry), value, type,
+ tar->sconv_acl);
+ if (r != ARCHIVE_OK) {
+ if (r == ARCHIVE_FATAL) {
+ archive_set_error(&a->archive, ENOMEM,
+ "%s %s", "Can't allocate memory for ",
+ errstr);
+ return (r);
+ }
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC, "%s %s", "Parse error: ", errstr);
+ }
+ return (r);
+}
+
/*
* Parse a single key=value attribute. key/value pointers are
* assumed to point into reasonably long-lived storage.
@@ -1773,7 +1843,7 @@ pax_attribute_xattr(struct archive_entry *entry,
*/
static int
pax_attribute(struct archive_read *a, struct tar *tar,
- struct archive_entry *entry, const char *key, const char *value)
+ struct archive_entry *entry, const char *key, const char *value, size_t value_length)
{
int64_t s;
long n;
@@ -1876,53 +1946,20 @@ pax_attribute(struct archive_read *a, struct tar *tar,
case 'S':
/* We support some keys used by the "star" archiver */
if (strcmp(key, "SCHILY.acl.access") == 0) {
- if (tar->sconv_acl == NULL) {
- tar->sconv_acl =
- archive_string_conversion_from_charset(
- &(a->archive), "UTF-8", 1);
- if (tar->sconv_acl == NULL)
- return (ARCHIVE_FATAL);
- }
-
- r = archive_acl_parse_l(archive_entry_acl(entry),
- value, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
- tar->sconv_acl);
- if (r != ARCHIVE_OK) {
- err = r;
- if (err == ARCHIVE_FATAL) {
- archive_set_error(&a->archive, ENOMEM,
- "Can't allocate memory for "
- "SCHILY.acl.access");
- return (err);
- }
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_MISC,
- "Parse error: SCHILY.acl.access");
- }
+ r = pax_attribute_acl(a, tar, entry, value,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
+ if (r == ARCHIVE_FATAL)
+ return (r);
} else if (strcmp(key, "SCHILY.acl.default") == 0) {
- if (tar->sconv_acl == NULL) {
- tar->sconv_acl =
- archive_string_conversion_from_charset(
- &(a->archive), "UTF-8", 1);
- if (tar->sconv_acl == NULL)
- return (ARCHIVE_FATAL);
- }
-
- r = archive_acl_parse_l(archive_entry_acl(entry),
- value, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT,
- tar->sconv_acl);
- if (r != ARCHIVE_OK) {
- err = r;
- if (err == ARCHIVE_FATAL) {
- archive_set_error(&a->archive, ENOMEM,
- "Can't allocate memory for "
- "SCHILY.acl.default");
- return (err);
- }
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_MISC,
- "Parse error: SCHILY.acl.default");
- }
+ r = pax_attribute_acl(a, tar, entry, value,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT);
+ if (r == ARCHIVE_FATAL)
+ return (r);
+ } else if (strcmp(key, "SCHILY.acl.ace") == 0) {
+ r = pax_attribute_acl(a, tar, entry, value,
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4);
+ if (r == ARCHIVE_FATAL)
+ return (r);
} else if (strcmp(key, "SCHILY.devmajor") == 0) {
archive_entry_set_rdevmajor(entry,
(dev_t)tar_atol10(value, strlen(value)));
@@ -1943,6 +1980,9 @@ pax_attribute(struct archive_read *a, struct tar *tar,
} else if (strcmp(key, "SCHILY.realsize") == 0) {
tar->realsize = tar_atol10(value, strlen(value));
archive_entry_set_size(entry, tar->realsize);
+ } else if (strncmp(key, "SCHILY.xattr.", 13) == 0) {
+ pax_attribute_schily_xattr(entry, key, value,
+ value_length);
} else if (strcmp(key, "SUN.holesdata") == 0) {
/* A Solaris extension for sparse. */
r = solaris_sparse_parse(a, tar, entry, value);
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_warc.c b/contrib/libarchive/libarchive/archive_read_support_format_warc.c
index a287fc2..5e22438 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_warc.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_warc.c
@@ -88,7 +88,7 @@ typedef enum {
WT_RVIS,
/* conversion, unsupported */
WT_CONV,
- /* continutation, unsupported at the moment */
+ /* continuation, unsupported at the moment */
WT_CONT,
/* invalid type */
LAST_WT
@@ -134,8 +134,8 @@ static ssize_t _warc_rdlen(const char *buf, size_t bsz);
static time_t _warc_rdrtm(const char *buf, size_t bsz);
static time_t _warc_rdmtm(const char *buf, size_t bsz);
static const char *_warc_find_eoh(const char *buf, size_t bsz);
+static const char *_warc_find_eol(const char *buf, size_t bsz);
-
int
archive_read_support_format_warc(struct archive *_a)
{
@@ -198,8 +198,8 @@ _warc_bid(struct archive_read *a, int best_bid)
/* otherwise snarf the record's version number */
ver = _warc_rdver(hdr, nrd);
- if (ver == 0U || ver > 10000U) {
- /* oh oh oh, best not to wager ... */
+ if (ver < 1200U || ver > 10000U) {
+ /* we only support WARC 0.12 to 1.0 */
return -1;
}
@@ -254,23 +254,32 @@ start_over:
&a->archive, ARCHIVE_ERRNO_MISC,
"Bad record header");
return (ARCHIVE_FATAL);
- } else if ((ver = _warc_rdver(buf, eoh - buf)) > 10000U) {
- /* nawww, I wish they promised backward compatibility
- * anyhoo, in their infinite wisdom the 28500 guys might
- * come up with something we can't possibly handle so
- * best end things here */
+ }
+ ver = _warc_rdver(buf, eoh - buf);
+ /* we currently support WARC 0.12 to 1.0 */
+ if (ver == 0U) {
archive_set_error(
&a->archive, ARCHIVE_ERRNO_MISC,
- "Unsupported record version");
+ "Invalid record version");
return (ARCHIVE_FATAL);
- } else if ((cntlen = _warc_rdlen(buf, eoh - buf)) < 0) {
+ } else if (ver < 1200U || ver > 10000U) {
+ archive_set_error(
+ &a->archive, ARCHIVE_ERRNO_MISC,
+ "Unsupported record version: %u.%u",
+ ver / 10000, (ver % 10000) / 100);
+ return (ARCHIVE_FATAL);
+ }
+ cntlen = _warc_rdlen(buf, eoh - buf);
+ if (cntlen < 0) {
/* nightmare! the specs say content-length is mandatory
* so I don't feel overly bad stopping the reader here */
archive_set_error(
&a->archive, EINVAL,
"Bad content length");
return (ARCHIVE_FATAL);
- } else if ((rtime = _warc_rdrtm(buf, eoh - buf)) == (time_t)-1) {
+ }
+ rtime = _warc_rdrtm(buf, eoh - buf);
+ if (rtime == (time_t)-1) {
/* record time is mandatory as per WARC/1.0,
* so just barf here, fast and loud */
archive_set_error(
@@ -284,7 +293,7 @@ start_over:
if (ver != w->pver) {
/* stringify this entry's version */
archive_string_sprintf(&w->sver,
- "WARC/%u.%u", ver / 10000, ver % 10000);
+ "WARC/%u.%u", ver / 10000, (ver % 10000) / 100);
/* remember the version */
w->pver = ver;
}
@@ -534,7 +543,7 @@ xstrpisotime(const char *s, char **endptr)
/* as a courtesy to our callers, and since this is a non-standard
* routine, we skip leading whitespace */
- while (isspace((unsigned char)*s))
+ while (isblank((unsigned char)*s))
++s;
/* read year */
@@ -562,7 +571,7 @@ xstrpisotime(const char *s, char **endptr)
goto out;
}
- /* massage TM to fulfill some of POSIX' contraints */
+ /* massage TM to fulfill some of POSIX' constraints */
tm.tm_year -= 1900;
tm.tm_mon--;
@@ -577,51 +586,41 @@ out:
}
static unsigned int
-_warc_rdver(const char buf[10], size_t bsz)
+_warc_rdver(const char *buf, size_t bsz)
{
static const char magic[] = "WARC/";
- unsigned int ver;
-
- (void)bsz; /* UNUSED */
+ unsigned int ver = 0U;
+ unsigned int end = 0U;
- if (memcmp(buf, magic, sizeof(magic) - 1U) != 0) {
- /* nope */
- return 99999U;
+ if (bsz < 12 || memcmp(buf, magic, sizeof(magic) - 1U) != 0) {
+ /* buffer too small or invalid magic */
+ return ver;
}
/* looks good so far, read the version number for a laugh */
buf += sizeof(magic) - 1U;
- /* most common case gets a quick-check here */
- if (memcmp(buf, "1.0\r\n", 5U) == 0) {
- ver = 10000U;
- } else {
- switch (*buf) {
- case '0':
- case '1':
- case '2':
- case '3':
- case '4':
- case '5':
- case '6':
- case '7':
- case '8':
- if (buf[1U] == '.') {
- char *on;
-
- /* set up major version */
- ver = (buf[0U] - '0') * 10000U;
- /* minor version, anyone? */
- ver += (strtol(buf + 2U, &on, 10)) * 100U;
- /* don't parse anything else */
- if (on > buf + 2U) {
- break;
- }
- }
- /* FALLTHROUGH */
- case '9':
- default:
- /* just make the version ridiculously high */
- ver = 999999U;
- break;
+
+ if (isdigit(buf[0U]) && (buf[1U] == '.') && isdigit(buf[2U])) {
+ /* we support a maximum of 2 digits in the minor version */
+ if (isdigit(buf[3U]))
+ end = 1U;
+ /* set up major version */
+ ver = (buf[0U] - '0') * 10000U;
+ /* set up minor version */
+ if (end == 1U) {
+ ver += (buf[2U] - '0') * 1000U;
+ ver += (buf[3U] - '0') * 100U;
+ } else
+ ver += (buf[2U] - '0') * 100U;
+ /*
+ * WARC below version 0.12 has a space-separated header
+ * WARC 0.12 and above terminates the version with a CRLF
+ */
+ if (ver >= 1200U) {
+ if (memcmp(buf + 3U + end, "\r\n", 2U) != 0)
+ ver = 0U;
+ } else if (ver < 1200U) {
+ if (!isblank(*(buf + 3U + end)))
+ ver = 0U;
}
}
return ver;
@@ -631,34 +630,27 @@ static unsigned int
_warc_rdtyp(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nWARC-Type:";
- const char *const eob = buf + bsz;
- const char *val;
+ const char *val, *eol;
if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) {
/* no bother */
return WT_NONE;
}
- /* overread whitespace */
val += sizeof(_key) - 1U;
- while (val < eob && isspace((unsigned char)*val))
+ if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) {
+ /* no end of line */
+ return WT_NONE;
+ }
+
+ /* overread whitespace */
+ while (val < eol && isblank((unsigned char)*val))
++val;
- if (val + 8U > eob) {
- ;
- } else if (memcmp(val, "resource", 8U) == 0) {
- return WT_RSRC;
- } else if (memcmp(val, "warcinfo", 8U) == 0) {
- return WT_INFO;
- } else if (memcmp(val, "metadata", 8U) == 0) {
- return WT_META;
- } else if (memcmp(val, "request", 7U) == 0) {
- return WT_REQ;
- } else if (memcmp(val, "response", 8U) == 0) {
- return WT_RSP;
- } else if (memcmp(val, "conversi", 8U) == 0) {
- return WT_CONV;
- } else if (memcmp(val, "continua", 8U) == 0) {
- return WT_CONT;
+ if (val + 8U == eol) {
+ if (memcmp(val, "resource", 8U) == 0)
+ return WT_RSRC;
+ else if (memcmp(val, "response", 8U) == 0)
+ return WT_RSP;
}
return WT_NONE;
}
@@ -667,10 +659,7 @@ static warc_string_t
_warc_rduri(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nWARC-Target-URI:";
- const char *const eob = buf + bsz;
- const char *val;
- const char *uri;
- const char *eol;
+ const char *val, *uri, *eol, *p;
warc_string_t res = {0U, NULL};
if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) {
@@ -679,25 +668,32 @@ _warc_rduri(const char *buf, size_t bsz)
}
/* overread whitespace */
val += sizeof(_key) - 1U;
- while (val < eob && isspace((unsigned char)*val))
+ if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) {
+ /* no end of line */
+ return res;
+ }
+
+ while (val < eol && isblank((unsigned char)*val))
++val;
/* overread URL designators */
- if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) {
+ if ((uri = xmemmem(val, eol - val, "://", 3U)) == NULL) {
/* not touching that! */
return res;
- } else if ((eol = memchr(uri, '\n', eob - uri)) == NULL) {
- /* no end of line? :O */
- return res;
}
- /* massage uri to point to after :// */
+ /* spaces inside uri are not allowed, CRLF should follow */
+ for (p = val; p < eol; p++) {
+ if (isspace(*p))
+ return res;
+ }
+
+ /* there must be at least space for ftp */
+ if (uri < (val + 3U))
+ return res;
+
+ /* move uri to point to after :// */
uri += 3U;
- /* also massage eol to point to the first whitespace
- * after the last non-whitespace character before
- * the end of the line */
- while (eol > uri && isspace((unsigned char)eol[-1]))
- --eol;
/* now then, inspect the URI */
if (memcmp(val, "file", 4U) == 0) {
@@ -720,7 +716,7 @@ static ssize_t
_warc_rdlen(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nContent-Length:";
- const char *val;
+ const char *val, *eol;
char *on = NULL;
long int len;
@@ -728,14 +724,24 @@ _warc_rdlen(const char *buf, size_t bsz)
/* no bother */
return -1;
}
-
- /* strtol kindly overreads whitespace for us, so use that */
val += sizeof(_key) - 1U;
+ if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL) {
+ /* no end of line */
+ return -1;
+ }
+
+ /* skip leading whitespace */
+ while (val < eol && isblank(*val))
+ val++;
+ /* there must be at least one digit */
+ if (!isdigit(*val))
+ return -1;
len = strtol(val, &on, 10);
- if (on == NULL || !isspace((unsigned char)*on)) {
- /* hm, can we trust that number? Best not. */
+ if (on != eol) {
+ /* line must end here */
return -1;
}
+
return (size_t)len;
}
@@ -743,7 +749,7 @@ static time_t
_warc_rdrtm(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nWARC-Date:";
- const char *val;
+ const char *val, *eol;
char *on = NULL;
time_t res;
@@ -751,13 +757,17 @@ _warc_rdrtm(const char *buf, size_t bsz)
/* no bother */
return (time_t)-1;
}
+ val += sizeof(_key) - 1U;
+ if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) {
+ /* no end of line */
+ return -1;
+ }
/* xstrpisotime() kindly overreads whitespace for us, so use that */
- val += sizeof(_key) - 1U;
res = xstrpisotime(val, &on);
- if (on == NULL || !isspace((unsigned char)*on)) {
- /* hm, can we trust that number? Best not. */
- return (time_t)-1;
+ if (on != eol) {
+ /* line must end here */
+ return -1;
}
return res;
}
@@ -766,7 +776,7 @@ static time_t
_warc_rdmtm(const char *buf, size_t bsz)
{
static const char _key[] = "\r\nLast-Modified:";
- const char *val;
+ const char *val, *eol;
char *on = NULL;
time_t res;
@@ -774,13 +784,17 @@ _warc_rdmtm(const char *buf, size_t bsz)
/* no bother */
return (time_t)-1;
}
+ val += sizeof(_key) - 1U;
+ if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) {
+ /* no end of line */
+ return -1;
+ }
/* xstrpisotime() kindly overreads whitespace for us, so use that */
- val += sizeof(_key) - 1U;
res = xstrpisotime(val, &on);
- if (on == NULL || !isspace((unsigned char)*on)) {
- /* hm, can we trust that number? Best not. */
- return (time_t)-1;
+ if (on != eol) {
+ /* line must end here */
+ return -1;
}
return res;
}
@@ -797,4 +811,12 @@ _warc_find_eoh(const char *buf, size_t bsz)
return hit;
}
+static const char*
+_warc_find_eol(const char *buf, size_t bsz)
+{
+ static const char _marker[] = "\r\n";
+ const char *hit = xmemmem(buf, bsz, _marker, sizeof(_marker) - 1U);
+
+ return hit;
+}
/* archive_read_support_format_warc.c ends here */
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_xar.c b/contrib/libarchive/libarchive/archive_read_support_format_xar.c
index 47ed064..7a22beb 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_xar.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_xar.c
@@ -394,6 +394,7 @@ static void checksum_update(struct archive_read *, const void *,
size_t, const void *, size_t);
static int checksum_final(struct archive_read *, const void *,
size_t, const void *, size_t);
+static void checksum_cleanup(struct archive_read *);
static int decompression_init(struct archive_read *, enum enctype);
static int decompress(struct archive_read *, const void **,
size_t *, const void *, size_t *);
@@ -923,6 +924,7 @@ xar_cleanup(struct archive_read *a)
int r;
xar = (struct xar *)(a->format->data);
+ checksum_cleanup(a);
r = decompression_cleanup(a);
hdlink = xar->hdlink_list;
while (hdlink != NULL) {
@@ -933,6 +935,7 @@ xar_cleanup(struct archive_read *a)
}
for (i = 0; i < xar->file_queue.used; i++)
file_free(xar->file_queue.files[i]);
+ free(xar->file_queue.files);
while (xar->unknowntags != NULL) {
struct unknown_tag *tag;
@@ -1719,6 +1722,16 @@ decompression_cleanup(struct archive_read *a)
}
static void
+checksum_cleanup(struct archive_read *a) {
+ struct xar *xar;
+
+ xar = (struct xar *)(a->format->data);
+
+ _checksum_final(&(xar->a_sumwrk), NULL, 0);
+ _checksum_final(&(xar->e_sumwrk), NULL, 0);
+}
+
+static void
xmlattr_cleanup(struct xmlattr_list *list)
{
struct xmlattr *attr, *next;
@@ -3047,7 +3060,7 @@ xml2_read_cb(void *context, char *buffer, int len)
struct xar *xar;
const void *d;
size_t outbytes;
- size_t used;
+ size_t used = 0;
int r;
a = (struct archive_read *)context;
@@ -3171,6 +3184,9 @@ expat_xmlattr_setup(struct archive_read *a,
value = strdup(atts[1]);
if (attr == NULL || name == NULL || value == NULL) {
archive_set_error(&a->archive, ENOMEM, "Out of memory");
+ free(attr);
+ free(name);
+ free(value);
return (ARCHIVE_FATAL);
}
attr->name = name;
diff --git a/contrib/libarchive/libarchive/archive_read_support_format_zip.c b/contrib/libarchive/libarchive/archive_read_support_format_zip.c
index 1aa7445..10dc14d 100644
--- a/contrib/libarchive/libarchive/archive_read_support_format_zip.c
+++ b/contrib/libarchive/libarchive/archive_read_support_format_zip.c
@@ -199,7 +199,7 @@ struct zip {
struct trad_enc_ctx tctx;
char tctx_valid;
- /* WinZip AES decyption. */
+ /* WinZip AES decryption. */
/* Contexts used for AES decryption. */
archive_crypto_ctx cctx;
char cctx_valid;
@@ -242,7 +242,7 @@ trad_enc_update_keys(struct trad_enc_ctx *ctx, uint8_t c)
}
static uint8_t
-trad_enc_decypt_byte(struct trad_enc_ctx *ctx)
+trad_enc_decrypt_byte(struct trad_enc_ctx *ctx)
{
unsigned temp = ctx->keys[2] | 2;
return (uint8_t)((temp * (temp ^ 1)) >> 8) & 0xff;
@@ -257,7 +257,7 @@ trad_enc_decrypt_update(struct trad_enc_ctx *ctx, const uint8_t *in,
max = (unsigned)((in_len < out_len)? in_len: out_len);
for (i = 0; i < max; i++) {
- uint8_t t = in[i] ^ trad_enc_decypt_byte(ctx);
+ uint8_t t = in[i] ^ trad_enc_decrypt_byte(ctx);
out[i] = t;
trad_enc_update_keys(ctx, t);
}
@@ -452,26 +452,38 @@ process_extra(struct archive_read *a, const char *p, size_t extra_length, struct
/* Zip64 extended information extra field. */
zip_entry->flags |= LA_USED_ZIP64;
if (zip_entry->uncompressed_size == 0xffffffff) {
- if (datasize < 8)
- break;
- zip_entry->uncompressed_size =
- archive_le64dec(p + offset);
+ uint64_t t = 0;
+ if (datasize < 8
+ || (t = archive_le64dec(p + offset)) > INT64_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed 64-bit uncompressed size");
+ return ARCHIVE_FAILED;
+ }
+ zip_entry->uncompressed_size = t;
offset += 8;
datasize -= 8;
}
if (zip_entry->compressed_size == 0xffffffff) {
- if (datasize < 8)
- break;
- zip_entry->compressed_size =
- archive_le64dec(p + offset);
+ uint64_t t = 0;
+ if (datasize < 8
+ || (t = archive_le64dec(p + offset)) > INT64_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed 64-bit compressed size");
+ return ARCHIVE_FAILED;
+ }
+ zip_entry->compressed_size = t;
offset += 8;
datasize -= 8;
}
if (zip_entry->local_header_offset == 0xffffffff) {
- if (datasize < 8)
- break;
- zip_entry->local_header_offset =
- archive_le64dec(p + offset);
+ uint64_t t = 0;
+ if (datasize < 8
+ || (t = archive_le64dec(p + offset)) > INT64_MAX) {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Malformed 64-bit local header offset");
+ return ARCHIVE_FAILED;
+ }
+ zip_entry->local_header_offset = t;
offset += 8;
datasize -= 8;
}
@@ -710,7 +722,7 @@ process_extra(struct archive_read *a, const char *p, size_t extra_length, struct
break;
}
case 0x9901:
- /* WinZIp AES extra data field. */
+ /* WinZip AES extra data field. */
if (p[offset + 2] == 'A' && p[offset + 3] == 'E') {
/* Vendor version. */
zip_entry->aes_extra.vendor =
@@ -905,6 +917,7 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry,
archive_wstrcat(&s, wp);
archive_wstrappend_wchar(&s, L'/');
archive_entry_copy_pathname_w(entry, s.s);
+ archive_wstring_free(&s);
}
} else {
cp = archive_entry_pathname(entry);
@@ -915,6 +928,7 @@ zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry,
archive_strcat(&s, cp);
archive_strappend_char(&s, '/');
archive_entry_set_pathname(entry, s.s);
+ archive_string_free(&s);
}
}
}
@@ -1154,11 +1168,18 @@ zip_read_data_none(struct archive_read *a, const void **_buff,
|| (zip->hctx_valid
&& zip->entry->aes_extra.vendor == AES_VENDOR_AE_2))) {
if (zip->entry->flags & LA_USED_ZIP64) {
+ uint64_t compressed, uncompressed;
zip->entry->crc32 = archive_le32dec(p + 4);
- zip->entry->compressed_size =
- archive_le64dec(p + 8);
- zip->entry->uncompressed_size =
- archive_le64dec(p + 16);
+ compressed = archive_le64dec(p + 8);
+ uncompressed = archive_le64dec(p + 16);
+ if (compressed > INT64_MAX || uncompressed > INT64_MAX) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Overflow of 64-bit file sizes");
+ return ARCHIVE_FAILED;
+ }
+ zip->entry->compressed_size = compressed;
+ zip->entry->uncompressed_size = uncompressed;
zip->unconsumed = 24;
} else {
zip->entry->crc32 = archive_le32dec(p + 4);
@@ -1435,9 +1456,18 @@ zip_read_data_deflate(struct archive_read *a, const void **buff,
zip->unconsumed = 4;
}
if (zip->entry->flags & LA_USED_ZIP64) {
+ uint64_t compressed, uncompressed;
zip->entry->crc32 = archive_le32dec(p);
- zip->entry->compressed_size = archive_le64dec(p + 4);
- zip->entry->uncompressed_size = archive_le64dec(p + 12);
+ compressed = archive_le64dec(p + 4);
+ uncompressed = archive_le64dec(p + 12);
+ if (compressed > INT64_MAX || uncompressed > INT64_MAX) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT,
+ "Overflow of 64-bit file sizes");
+ return ARCHIVE_FAILED;
+ }
+ zip->entry->compressed_size = compressed;
+ zip->entry->uncompressed_size = uncompressed;
zip->unconsumed += 20;
} else {
zip->entry->crc32 = archive_le32dec(p);
@@ -1518,7 +1548,7 @@ read_decryption_header(struct archive_read *a)
case 0x6720:/* Blowfish */
case 0x6721:/* Twofish */
case 0x6801:/* RC4 */
- /* Suuported encryption algorithm. */
+ /* Supported encryption algorithm. */
break;
default:
archive_set_error(&a->archive,
@@ -1627,7 +1657,7 @@ read_decryption_header(struct archive_read *a)
__archive_read_consume(a, 4);
/*return (ARCHIVE_OK);
- * This is not fully implemnted yet.*/
+ * This is not fully implemented yet.*/
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Encrypted file is unsupported");
return (ARCHIVE_FAILED);
@@ -1709,7 +1739,7 @@ init_traditional_PKWARE_decryption(struct archive_read *a)
}
/*
- * Initialize ctx for Traditional PKWARE Decyption.
+ * Initialize ctx for Traditional PKWARE Decryption.
*/
r = trad_enc_init(&zip->tctx, passphrase, strlen(passphrase),
p, ENC_HEADER_SIZE, &crcchk);
diff --git a/contrib/libarchive/libarchive/archive_string.c b/contrib/libarchive/libarchive/archive_string.c
index cf10f09..f738c54 100644
--- a/contrib/libarchive/libarchive/archive_string.c
+++ b/contrib/libarchive/libarchive/archive_string.c
@@ -219,6 +219,12 @@ archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s)
return (as);
}
+struct archive_string *
+archive_array_append(struct archive_string *as, const char *p, size_t s)
+{
+ return archive_string_append(as, p, s);
+}
+
void
archive_string_concat(struct archive_string *dest, struct archive_string *src)
{
@@ -597,7 +603,7 @@ archive_wstring_append_from_mbs(struct archive_wstring *dest,
wcs = dest->s + dest->length;
/*
* We cannot use mbsrtowcs/mbstowcs here because those may convert
- * extra MBS when strlen(p) > len and one wide character consis of
+ * extra MBS when strlen(p) > len and one wide character consists of
* multi bytes.
*/
while (*mbs && mbs_length > 0) {
@@ -1248,7 +1254,7 @@ create_sconv_object(const char *fc, const char *tc,
sc->cd = iconv_open(tc, fc);
if (sc->cd == (iconv_t)-1 && (sc->flag & SCONV_BEST_EFFORT)) {
/*
- * Unfortunaly, all of iconv implements do support
+ * Unfortunately, all of iconv implements do support
* "CP932" character-set, so we should use "SJIS"
* instead if iconv_open failed.
*/
@@ -1261,7 +1267,7 @@ create_sconv_object(const char *fc, const char *tc,
/*
* archive_mstring on Windows directly convert multi-bytes
* into archive_wstring in order not to depend on locale
- * so that you can do a I18N programing. This will be
+ * so that you can do a I18N programming. This will be
* used only in archive_mstring_copy_mbs_len_l so far.
*/
if (flag & SCONV_FROM_CHARSET) {
@@ -1726,7 +1732,7 @@ archive_string_conversion_from_charset(struct archive *a, const char *charset,
* in tar or zip files. But mbstowcs/wcstombs(CRT) usually use CP_ACP
* unless you use setlocale(LC_ALL, ".OCP")(specify CP_OEMCP).
* So we should make a string conversion between CP_ACP and CP_OEMCP
- * for compatibillty.
+ * for compatibility.
*/
#if defined(_WIN32) && !defined(__CYGWIN__)
struct archive_string_conv *
@@ -2220,7 +2226,7 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p,
/*
* If a character is ASCII, this just copies it. If not, this
- * assigns '?' charater instead but in UTF-8 locale this assigns
+ * assigns '?' character instead but in UTF-8 locale this assigns
* byte sequence 0xEF 0xBD 0xBD, which are code point U+FFFD,
* a Replacement Character in Unicode.
*/
@@ -2554,7 +2560,7 @@ utf16_to_unicode(uint32_t *pwc, const char *s, size_t n, int be)
/*
* Surrogate pair values(0xd800 through 0xdfff) are only
- * used by UTF-16, so, after above culculation, the code
+ * used by UTF-16, so, after above calculation, the code
* must not be surrogate values, and Unicode has no codes
* larger than 0x10ffff. Thus, those are not legal Unicode
* values.
@@ -2903,7 +2909,7 @@ get_nfc(uint32_t uc, uint32_t uc2)
/*
* Normalize UTF-8/UTF-16BE characters to Form C and copy the result.
*
- * TODO: Convert composition exclusions,which are never converted
+ * TODO: Convert composition exclusions, which are never converted
* from NFC,NFD,NFKC and NFKD, to Form C.
*/
static int
@@ -3437,7 +3443,7 @@ strncat_from_utf8_libarchive2(struct archive_string *as,
}
/*
- * As libarchie 2.x, translates the UTF-8 characters into
+ * As libarchive 2.x, translates the UTF-8 characters into
* wide-characters in the assumption that WCS is Unicode.
*/
if (n < 0) {
@@ -3947,7 +3953,7 @@ archive_mstring_get_mbs_l(struct archive_mstring *aes,
#if defined(_WIN32) && !defined(__CYGWIN__)
/*
- * Internationalization programing on Windows must use Wide
+ * Internationalization programming on Windows must use Wide
* characters because Windows platform cannot make locale UTF-8.
*/
if (sc != NULL && (aes->aes_set & AES_SET_WCS) != 0) {
@@ -4079,7 +4085,7 @@ archive_mstring_copy_mbs_len_l(struct archive_mstring *aes,
archive_string_empty(&(aes->aes_utf8));
#if defined(_WIN32) && !defined(__CYGWIN__)
/*
- * Internationalization programing on Windows must use Wide
+ * Internationalization programming on Windows must use Wide
* characters because Windows platform cannot make locale UTF-8.
*/
if (sc == NULL) {
diff --git a/contrib/libarchive/libarchive/archive_string.h b/contrib/libarchive/libarchive/archive_string.h
index 60ebf0e..f5953d0 100644
--- a/contrib/libarchive/libarchive/archive_string.h
+++ b/contrib/libarchive/libarchive/archive_string.h
@@ -81,6 +81,10 @@ archive_strappend_char(struct archive_string *, char);
struct archive_wstring *
archive_wstrappend_wchar(struct archive_wstring *, wchar_t);
+/* Append a raw array to an archive_string, resizing as necessary */
+struct archive_string *
+archive_array_append(struct archive_string *, const char *, size_t);
+
/* Convert a Unicode string to current locale and append the result. */
/* Returns -1 if conversion fails. */
int
diff --git a/contrib/libarchive/libarchive/archive_string_composition.h b/contrib/libarchive/libarchive/archive_string_composition.h
index be41e33..8902ac1 100644
--- a/contrib/libarchive/libarchive/archive_string_composition.h
+++ b/contrib/libarchive/libarchive/archive_string_composition.h
@@ -1009,7 +1009,7 @@ static const char u_decomposable_blocks[0x1D2+1] = {
(((uc) > 0x1D244)?0:\
ccc_val[ccc_val_index[ccc_index[(uc)>>8]][((uc)>>4)&0x0F]][(uc)&0x0F])
-/* The table of the value of Canonical Cimbining Class */
+/* The table of the value of Canonical Combining Class */
static const unsigned char ccc_val[][16] = {
/* idx=0: XXXX0 - XXXXF */
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
diff --git a/contrib/libarchive/libarchive/archive_write.c b/contrib/libarchive/libarchive/archive_write.c
index f5a9f61..e441dbe 100644
--- a/contrib/libarchive/libarchive/archive_write.c
+++ b/contrib/libarchive/libarchive/archive_write.c
@@ -231,7 +231,7 @@ __archive_write_filter(struct archive_write_filter *f,
if (length == 0)
return(ARCHIVE_OK);
if (f->write == NULL)
- /* If unset, a fatal error has already ocuured, so this filter
+ /* If unset, a fatal error has already occurred, so this filter
* didn't open. We cannot write anything. */
return(ARCHIVE_FATAL);
r = (f->write)(f, buff, length);
diff --git a/contrib/libarchive/libarchive/archive_write_add_filter_program.c b/contrib/libarchive/libarchive/archive_write_add_filter_program.c
index 31a1b6f..55b5e8e 100644
--- a/contrib/libarchive/libarchive/archive_write_add_filter_program.c
+++ b/contrib/libarchive/libarchive/archive_write_add_filter_program.c
@@ -200,6 +200,7 @@ __archive_write_program_free(struct archive_write_program_data *data)
if (data->child)
CloseHandle(data->child);
#endif
+ free(data->program_name);
free(data->child_buf);
free(data);
}
diff --git a/contrib/libarchive/libarchive/archive_write_add_filter_xz.c b/contrib/libarchive/libarchive/archive_write_add_filter_xz.c
index 46a6c38..b0f25a6 100644
--- a/contrib/libarchive/libarchive/archive_write_add_filter_xz.c
+++ b/contrib/libarchive/libarchive/archive_write_add_filter_xz.c
@@ -233,7 +233,7 @@ archive_compressor_xz_init_stream(struct archive_write_filter *f,
if (f->code == ARCHIVE_FILTER_XZ) {
#ifdef HAVE_LZMA_STREAM_ENCODER_MT
if (data->threads != 1) {
- bzero(&mt_options, sizeof(mt_options));
+ memset(&mt_options, 0, sizeof(mt_options));
mt_options.threads = data->threads;
mt_options.timeout = 300;
mt_options.filters = data->lzmafilters;
diff --git a/contrib/libarchive/libarchive/archive_write_disk_acl.c b/contrib/libarchive/libarchive/archive_write_disk_acl.c
index e47384a..144ab7e 100644
--- a/contrib/libarchive/libarchive/archive_write_disk_acl.c
+++ b/contrib/libarchive/libarchive/archive_write_disk_acl.c
@@ -34,6 +34,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_disk.c 201159 2009-12-29 0
#define _ACL_PRIVATE /* For debugging */
#include <sys/acl.h>
#endif
+#if HAVE_DARWIN_ACL
+#include <membership.h>
+#endif
#ifdef HAVE_ERRNO_H
#include <errno.h>
#endif
@@ -43,7 +46,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_disk.c 201159 2009-12-29 0
#include "archive_acl_private.h"
#include "archive_write_disk_private.h"
-#ifndef HAVE_POSIX_ACL
+#if !HAVE_POSIX_ACL && !HAVE_NFS4_ACL
/* Default empty function body to satisfy mainline code. */
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
@@ -56,47 +59,111 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
return (ARCHIVE_OK);
}
-#else
+#else /* HAVE_POSIX_ACL || HAVE_NFS4_ACL */
+
+#if HAVE_SUN_ACL
+#define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACE_T
+#elif HAVE_DARWIN_ACL
+#define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_EXTENDED
+#elif HAVE_ACL_TYPE_NFS4
+#define ARCHIVE_PLATFORM_ACL_TYPE_NFS4 ACL_TYPE_NFS4
+#endif
static int set_acl(struct archive *, int fd, const char *,
struct archive_acl *,
acl_type_t, int archive_entry_acl_type, const char *tn);
-/*
- * XXX TODO: What about ACL types other than ACCESS and DEFAULT?
- */
int
archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl)
{
- int ret;
+ int ret = ARCHIVE_OK;
- if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) > 0) {
- ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_ACCESS,
- ARCHIVE_ENTRY_ACL_TYPE_ACCESS, "access");
- if (ret != ARCHIVE_OK)
- return (ret);
- ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_DEFAULT,
- ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default");
+#if !HAVE_DARWIN_ACL
+ if ((archive_acl_types(abstract_acl)
+ & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) != 0) {
+#if HAVE_SUN_ACL
+ /* Solaris writes POSIX.1e access and default ACLs together */
+ ret = set_acl(a, fd, name, abstract_acl, ACLENT_T,
+ ARCHIVE_ENTRY_ACL_TYPE_POSIX1E, "posix1e");
+#else /* HAVE_POSIX_ACL */
+ if ((archive_acl_types(abstract_acl)
+ & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) {
+ ret = set_acl(a, fd, name, abstract_acl,
+ ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+ "access");
+ if (ret != ARCHIVE_OK)
+ return (ret);
+ }
+ if ((archive_acl_types(abstract_acl)
+ & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
+ ret = set_acl(a, fd, name, abstract_acl,
+ ACL_TYPE_DEFAULT, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT,
+ "default");
+#endif /* !HAVE_SUN_ACL */
+ /* Simultaneous POSIX.1e and NFSv4 is not supported */
return (ret);
-#ifdef ACL_TYPE_NFS4
- } else if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4) > 0) {
- ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_NFS4,
+ }
+#endif /* !HAVE_DARWIN_ACL */
+#if HAVE_NFS4_ACL
+ if ((archive_acl_types(abstract_acl) &
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ ret = set_acl(a, fd, name, abstract_acl,
+ ARCHIVE_PLATFORM_ACL_TYPE_NFS4,
ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4");
- return (ret);
-#endif
- } else
- return ARCHIVE_OK;
+ }
+#endif /* HAVE_NFS4_ACL */
+ return (ret);
}
-static struct {
- int archive_perm;
- int platform_perm;
+/*
+ * Translate system ACL permissions into libarchive internal structure
+ */
+static const struct {
+ const int archive_perm;
+ const int platform_perm;
} acl_perm_map[] = {
+#if HAVE_SUN_ACL /* Solaris NFSv4 ACL permissions */
+ {ARCHIVE_ENTRY_ACL_EXECUTE, ACE_EXECUTE},
+ {ARCHIVE_ENTRY_ACL_READ_DATA, ACE_READ_DATA},
+ {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACE_LIST_DIRECTORY},
+ {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACE_WRITE_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_FILE, ACE_ADD_FILE},
+ {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACE_APPEND_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACE_ADD_SUBDIRECTORY},
+ {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACE_READ_NAMED_ATTRS},
+ {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACE_WRITE_NAMED_ATTRS},
+ {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACE_DELETE_CHILD},
+ {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACE_READ_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACE_WRITE_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_DELETE, ACE_DELETE},
+ {ARCHIVE_ENTRY_ACL_READ_ACL, ACE_READ_ACL},
+ {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACE_WRITE_ACL},
+ {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACE_WRITE_OWNER},
+ {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACE_SYNCHRONIZE}
+#elif HAVE_DARWIN_ACL /* MacOS ACL permissions */
+ {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
+ {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
+ {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_FILE, ACL_ADD_FILE},
+ {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
+ {ARCHIVE_ENTRY_ACL_DELETE, ACL_DELETE},
+ {ARCHIVE_ENTRY_ACL_APPEND_DATA, ACL_APPEND_DATA},
+ {ARCHIVE_ENTRY_ACL_ADD_SUBDIRECTORY, ACL_ADD_SUBDIRECTORY},
+ {ARCHIVE_ENTRY_ACL_DELETE_CHILD, ACL_DELETE_CHILD},
+ {ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES, ACL_READ_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES, ACL_WRITE_ATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS, ACL_READ_EXTATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS, ACL_WRITE_EXTATTRIBUTES},
+ {ARCHIVE_ENTRY_ACL_READ_ACL, ACL_READ_SECURITY},
+ {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_SECURITY},
+ {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_CHANGE_OWNER},
+ {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
+#else /* POSIX.1e ACL permissions */
{ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE},
{ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE},
{ARCHIVE_ENTRY_ACL_READ, ACL_READ},
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4 /* FreeBSD NFSv4 ACL permissions */
{ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA},
{ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY},
{ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA},
@@ -114,34 +181,69 @@ static struct {
{ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER},
{ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE}
#endif
+#endif /* !HAVE_SUN_ACL && !HAVE_DARWIN_ACL */
};
-#ifdef ACL_TYPE_NFS4
-static struct {
- int archive_inherit;
- int platform_inherit;
+#if HAVE_NFS4_ACL
+/*
+ * Translate system NFSv4 inheritance flags into libarchive internal structure
+ */
+static const struct {
+ const int archive_inherit;
+ const int platform_inherit;
} acl_inherit_map[] = {
+#if HAVE_SUN_ACL /* Solaris NFSv4 inheritance flags */
+ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACE_FILE_INHERIT_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACE_DIRECTORY_INHERIT_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACE_NO_PROPAGATE_INHERIT_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACE_INHERIT_ONLY_ACE},
+ {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACE_SUCCESSFUL_ACCESS_ACE_FLAG},
+ {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACE_FAILED_ACCESS_ACE_FLAG},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACE_INHERITED_ACE}
+#elif HAVE_DARWIN_ACL /* MacOS NFSv4 inheritance flags */
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED},
+ {ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
+ {ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
+ {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_LIMIT_INHERIT},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_ONLY_INHERIT}
+#else /* FreeBSD NFSv4 ACL inheritance flags */
{ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT, ACL_ENTRY_FILE_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT, ACL_ENTRY_DIRECTORY_INHERIT},
{ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT},
- {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY}
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY},
+ {ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS, ACL_ENTRY_SUCCESSFUL_ACCESS},
+ {ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS, ACL_ENTRY_FAILED_ACCESS},
+ {ARCHIVE_ENTRY_ACL_ENTRY_INHERITED, ACL_ENTRY_INHERITED}
+#endif /* !HAVE_SUN_ACL && !HAVE_DARWIN_ACL */
};
-#endif
+#endif /* HAVE_NFS4_ACL */
static int
set_acl(struct archive *a, int fd, const char *name,
struct archive_acl *abstract_acl,
acl_type_t acl_type, int ae_requested_type, const char *tname)
{
+#if HAVE_SUN_ACL
+ aclent_t *aclent;
+ ace_t *ace;
+ int e, r;
+ acl_t *acl;
+#else
acl_t acl;
acl_entry_t acl_entry;
acl_permset_t acl_permset;
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4 || HAVE_DARWIN_ACL
acl_flagset_t acl_flagset;
- int r;
+#endif
+#endif /* HAVE_SUN_ACL */
+#if HAVE_ACL_TYPE_NFS4
+ int r;
#endif
int ret;
int ae_type, ae_permset, ae_tag, ae_id;
+#if HAVE_DARWIN_ACL
+ uuid_t ae_uuid;
+#endif
uid_t ae_uid;
gid_t ae_gid;
const char *ae_name;
@@ -152,32 +254,165 @@ set_acl(struct archive *a, int fd, const char *name,
entries = archive_acl_reset(abstract_acl, ae_requested_type);
if (entries == 0)
return (ARCHIVE_OK);
+
+#if HAVE_SUN_ACL
+ acl = NULL;
+ acl = malloc(sizeof(acl_t));
+ if (acl == NULL) {
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
+ "Invalid ACL type");
+ return (ARCHIVE_FAILED);
+ }
+ if (acl_type == ACE_T)
+ acl->acl_entry_size = sizeof(ace_t);
+ else if (acl_type == ACLENT_T)
+ acl->acl_entry_size = sizeof(aclent_t);
+ else {
+ archive_set_error(a, ARCHIVE_ERRNO_MISC,
+ "Invalid ACL type");
+ acl_free(acl);
+ return (ARCHIVE_FAILED);
+ }
+ acl->acl_type = acl_type;
+ acl->acl_cnt = entries;
+
+ acl->acl_aclp = malloc(entries * acl->acl_entry_size);
+ if (acl->acl_aclp == NULL) {
+ archive_set_error(a, errno,
+ "Can't allocate memory for acl buffer");
+ acl_free(acl);
+ return (ARCHIVE_FAILED);
+ }
+#else /* !HAVE_SUN_ACL */
acl = acl_init(entries);
if (acl == (acl_t)NULL) {
archive_set_error(a, errno,
"Failed to initialize ACL working storage");
return (ARCHIVE_FAILED);
}
+#endif /* !HAVE_SUN_ACL */
+#if HAVE_SUN_ACL
+ e = 0;
+#endif
while (archive_acl_next(a, abstract_acl, ae_requested_type, &ae_type,
&ae_permset, &ae_tag, &ae_id, &ae_name) == ARCHIVE_OK) {
+#if HAVE_SUN_ACL
+ ace = NULL;
+ aclent = NULL;
+ if (acl->acl_type == ACE_T) {
+ ace = &((ace_t *)acl->acl_aclp)[e];
+ ace->a_who = -1;
+ ace->a_access_mask = 0;
+ ace->a_flags = 0;
+ } else {
+ aclent = &((aclent_t *)acl->acl_aclp)[e];
+ aclent->a_id = -1;
+ aclent->a_type = 0;
+ aclent->a_perm = 0;
+ }
+#else /* !HAVE_SUN_ACL */
+#if HAVE_DARWIN_ACL
+ /*
+ * Mac OS doesn't support NFSv4 ACLs for
+ * owner@, group@ and everyone@.
+ * We skip any of these ACLs found.
+ */
+ if (ae_tag == ARCHIVE_ENTRY_ACL_USER_OBJ ||
+ ae_tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ ||
+ ae_tag == ARCHIVE_ENTRY_ACL_EVERYONE)
+ continue;
+#endif
if (acl_create_entry(&acl, &acl_entry) != 0) {
archive_set_error(a, errno,
"Failed to create a new ACL entry");
ret = ARCHIVE_FAILED;
goto exit_free;
}
-
+#endif /* !HAVE_SUN_ACL */
+#if HAVE_DARWIN_ACL
+ switch (ae_type) {
+ case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
+ acl_set_tag_type(acl_entry, ACL_EXTENDED_ALLOW);
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_DENY:
+ acl_set_tag_type(acl_entry, ACL_EXTENDED_DENY);
+ break;
+ default:
+ /* We don't support any other types on MacOS */
+ continue;
+ }
+#endif
switch (ae_tag) {
+#if HAVE_SUN_ACL
case ARCHIVE_ENTRY_ACL_USER:
- acl_set_tag_type(acl_entry, ACL_USER);
ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
+ if (acl->acl_type == ACE_T)
+ ace->a_who = ae_uid;
+ else {
+ aclent->a_id = ae_uid;
+ aclent->a_type |= USER;
+ }
+ break;
+ case ARCHIVE_ENTRY_ACL_GROUP:
+ ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
+ if (acl->acl_type == ACE_T) {
+ ace->a_who = ae_gid;
+ ace->a_flags |= ACE_IDENTIFIER_GROUP;
+ } else {
+ aclent->a_id = ae_gid;
+ aclent->a_type |= GROUP;
+ }
+ break;
+ case ARCHIVE_ENTRY_ACL_USER_OBJ:
+ if (acl->acl_type == ACE_T)
+ ace->a_flags |= ACE_OWNER;
+ else
+ aclent->a_type |= USER_OBJ;
+ break;
+ case ARCHIVE_ENTRY_ACL_GROUP_OBJ:
+ if (acl->acl_type == ACE_T) {
+ ace->a_flags |= ACE_GROUP;
+ ace->a_flags |= ACE_IDENTIFIER_GROUP;
+ } else
+ aclent->a_type |= GROUP_OBJ;
+ break;
+ case ARCHIVE_ENTRY_ACL_MASK:
+ aclent->a_type |= CLASS_OBJ;
+ break;
+ case ARCHIVE_ENTRY_ACL_OTHER:
+ aclent->a_type |= OTHER_OBJ;
+ break;
+ case ARCHIVE_ENTRY_ACL_EVERYONE:
+ ace->a_flags |= ACE_EVERYONE;
+ break;
+#else /* !HAVE_SUN_ACL */
+ case ARCHIVE_ENTRY_ACL_USER:
+ ae_uid = archive_write_disk_uid(a, ae_name, ae_id);
+#if !HAVE_DARWIN_ACL /* FreeBSD, Linux */
+ acl_set_tag_type(acl_entry, ACL_USER);
acl_set_qualifier(acl_entry, &ae_uid);
+#else /* MacOS */
+ if (mbr_identifier_to_uuid(ID_TYPE_UID, &ae_uid,
+ sizeof(uid_t), ae_uuid) != 0)
+ continue;
+ if (acl_set_qualifier(acl_entry, &ae_uuid) != 0)
+ continue;
+#endif /* HAVE_DARWIN_ACL */
break;
case ARCHIVE_ENTRY_ACL_GROUP:
- acl_set_tag_type(acl_entry, ACL_GROUP);
ae_gid = archive_write_disk_gid(a, ae_name, ae_id);
+#if !HAVE_DARWIN_ACL /* FreeBSD, Linux */
+ acl_set_tag_type(acl_entry, ACL_GROUP);
acl_set_qualifier(acl_entry, &ae_gid);
+#else /* MacOS */
+ if (mbr_identifier_to_uuid(ID_TYPE_GID, &ae_gid,
+ sizeof(gid_t), ae_uuid) != 0)
+ continue;
+ if (acl_set_qualifier(acl_entry, &ae_uuid) != 0)
+ continue;
+#endif /* HAVE_DARWIN_ACL */
break;
+#if !HAVE_DARWIN_ACL /* FreeBSD, Linux */
case ARCHIVE_ENTRY_ACL_USER_OBJ:
acl_set_tag_type(acl_entry, ACL_USER_OBJ);
break;
@@ -190,11 +425,13 @@ set_acl(struct archive *a, int fd, const char *name,
case ARCHIVE_ENTRY_ACL_OTHER:
acl_set_tag_type(acl_entry, ACL_OTHER);
break;
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4 /* FreeBSD only */
case ARCHIVE_ENTRY_ACL_EVERYONE:
acl_set_tag_type(acl_entry, ACL_EVERYONE);
break;
#endif
+#endif /* !HAVE_DARWIN_ACL */
+#endif /* !HAVE_SUN_ACL */
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown ACL tag");
@@ -202,9 +439,45 @@ set_acl(struct archive *a, int fd, const char *name,
goto exit_free;
}
-#ifdef ACL_TYPE_NFS4
+#if HAVE_ACL_TYPE_NFS4 || HAVE_SUN_ACL
r = 0;
switch (ae_type) {
+#if HAVE_SUN_ACL
+ case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
+ if (ace != NULL)
+ ace->a_type = ACE_ACCESS_ALLOWED_ACE_TYPE;
+ else
+ r = -1;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_DENY:
+ if (ace != NULL)
+ ace->a_type = ACE_ACCESS_DENIED_ACE_TYPE;
+ else
+ r = -1;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_AUDIT:
+ if (ace != NULL)
+ ace->a_type = ACE_SYSTEM_AUDIT_ACE_TYPE;
+ else
+ r = -1;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_ALARM:
+ if (ace != NULL)
+ ace->a_type = ACE_SYSTEM_ALARM_ACE_TYPE;
+ else
+ r = -1;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_ACCESS:
+ if (aclent == NULL)
+ r = -1;
+ break;
+ case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
+ if (aclent != NULL)
+ aclent->a_type |= ACL_DEFAULT;
+ else
+ r = -1;
+ break;
+#else /* !HAVE_SUN_ACL */
case ARCHIVE_ENTRY_ACL_TYPE_ALLOW:
r = acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW);
break;
@@ -221,20 +494,35 @@ set_acl(struct archive *a, int fd, const char *name,
case ARCHIVE_ENTRY_ACL_TYPE_DEFAULT:
// These don't translate directly into the system ACL.
break;
+#endif /* !HAVE_SUN_ACL */
default:
archive_set_error(a, ARCHIVE_ERRNO_MISC,
"Unknown ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
+
if (r != 0) {
+#if HAVE_SUN_ACL
+ errno = EINVAL;
+#endif
archive_set_error(a, errno,
"Failed to set ACL entry type");
ret = ARCHIVE_FAILED;
goto exit_free;
}
-#endif
+#endif /* HAVE_ACL_TYPE_NFS4 || HAVE_SUN_ACL */
+#if HAVE_SUN_ACL
+ if (acl->acl_type == ACLENT_T) {
+ if (ae_permset & ARCHIVE_ENTRY_ACL_EXECUTE)
+ aclent->a_perm |= 1;
+ if (ae_permset & ARCHIVE_ENTRY_ACL_WRITE)
+ aclent->a_perm |= 2;
+ if (ae_permset & ARCHIVE_ENTRY_ACL_READ)
+ aclent->a_perm |= 4;
+ } else
+#else
if (acl_get_permset(acl_entry, &acl_permset) != 0) {
archive_set_error(a, errno,
"Failed to get ACL permission set");
@@ -247,9 +535,13 @@ set_acl(struct archive *a, int fd, const char *name,
ret = ARCHIVE_FAILED;
goto exit_free;
}
-
+#endif /* !HAVE_SUN_ACL */
for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) {
- if (ae_permset & acl_perm_map[i].archive_perm)
+ if (ae_permset & acl_perm_map[i].archive_perm) {
+#if HAVE_SUN_ACL
+ ace->a_access_mask |=
+ acl_perm_map[i].platform_perm;
+#else
if (acl_add_perm(acl_permset,
acl_perm_map[i].platform_perm) != 0) {
archive_set_error(a, errno,
@@ -257,10 +549,20 @@ set_acl(struct archive *a, int fd, const char *name,
ret = ARCHIVE_FAILED;
goto exit_free;
}
+#endif
+ }
}
-#ifdef ACL_TYPE_NFS4
- if (acl_type == ACL_TYPE_NFS4) {
+#if HAVE_NFS4_ACL
+#if HAVE_SUN_ACL
+ if (acl_type == ACE_T)
+#elif HAVE_DARWIN_ACL
+ if (acl_type == ACL_TYPE_EXTENDED)
+#else /* FreeBSD */
+ if (acl_type == ACL_TYPE_NFS4)
+#endif
+ {
+#if HAVE_POSIX_ACL || HAVE_DARWIN_ACL
/*
* acl_get_flagset_np() fails with non-NFSv4 ACLs
*/
@@ -276,8 +578,13 @@ set_acl(struct archive *a, int fd, const char *name,
ret = ARCHIVE_FAILED;
goto exit_free;
}
- for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) {
+#endif /* HAVE_POSIX_ACL || HAVE_DARWIN_ACL */
+ for (i = 0; i < (int)(sizeof(acl_inherit_map) /sizeof(acl_inherit_map[0])); ++i) {
if (ae_permset & acl_inherit_map[i].archive_inherit) {
+#if HAVE_SUN_ACL
+ ace->a_flags |=
+ acl_inherit_map[i].platform_inherit;
+#else /* !HAVE_SUN_ACL */
if (acl_add_flag_np(acl_flagset,
acl_inherit_map[i].platform_inherit) != 0) {
archive_set_error(a, errno,
@@ -285,38 +592,63 @@ set_acl(struct archive *a, int fd, const char *name,
ret = ARCHIVE_FAILED;
goto exit_free;
}
+#endif /* HAVE_SUN_ACL */
}
}
}
+#endif /* HAVE_NFS4_ACL */
+#if HAVE_SUN_ACL
+ e++;
#endif
}
+#if HAVE_ACL_SET_FD_NP || HAVE_ACL_SET_FD || HAVE_SUN_ACL
/* Try restoring the ACL through 'fd' if we can. */
-#if HAVE_ACL_SET_FD
- if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
- ret = ARCHIVE_OK;
- else
-#else
-#if HAVE_ACL_SET_FD_NP
- if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
- ret = ARCHIVE_OK;
- else
+#if HAVE_SUN_ACL || HAVE_ACL_SET_FD_NP
+ if (fd >= 0)
+#else /* !HAVE_SUN_ACL && !HAVE_ACL_SET_FD_NP */
+ if (fd >= 0 && acl_type == ACL_TYPE_ACCESS)
#endif
+ {
+#if HAVE_SUN_ACL
+ if (facl_set(fd, acl) == 0)
+#elif HAVE_ACL_SET_FD_NP
+ if (acl_set_fd_np(fd, acl, acl_type) == 0)
+#else /* !HAVE_SUN_ACL && !HAVE_ACL_SET_FD_NP */
+ if (acl_set_fd(fd, acl) == 0)
#endif
-#if HAVE_ACL_SET_LINK_NP
- if (acl_set_link_np(name, acl_type, acl) != 0) {
- archive_set_error(a, errno, "Failed to set %s acl", tname);
- ret = ARCHIVE_WARN;
- }
+ ret = ARCHIVE_OK;
+ else {
+ if (errno == EOPNOTSUPP) {
+ /* Filesystem doesn't support ACLs */
+ ret = ARCHIVE_OK;
+ } else {
+ archive_set_error(a, errno,
+ "Failed to set %s acl on fd", tname);
+ }
+ }
+ } else
+#endif /* HAVE_ACL_SET_FD_NP || HAVE_ACL_SET_FD || HAVE_SUN_ACL */
+#if HAVE_SUN_ACL
+ if (acl_set(name, acl) != 0)
+#elif HAVE_ACL_SET_LINK_NP
+ if (acl_set_link_np(name, acl_type, acl) != 0)
#else
/* TODO: Skip this if 'name' is a symlink. */
- if (acl_set_file(name, acl_type, acl) != 0) {
- archive_set_error(a, errno, "Failed to set %s acl", tname);
- ret = ARCHIVE_WARN;
- }
+ if (acl_set_file(name, acl_type, acl) != 0)
#endif
+ {
+ if (errno == EOPNOTSUPP) {
+ /* Filesystem doesn't support ACLs */
+ ret = ARCHIVE_OK;
+ } else {
+ archive_set_error(a, errno, "Failed to set %s acl",
+ tname);
+ ret = ARCHIVE_WARN;
+ }
+ }
exit_free:
acl_free(acl);
return (ret);
}
-#endif
+#endif /* HAVE_POSIX_ACL || HAVE_NFS4_ACL */
diff --git a/contrib/libarchive/libarchive/archive_write_disk_posix.c b/contrib/libarchive/libarchive/archive_write_disk_posix.c
index c05059a..a799524 100644
--- a/contrib/libarchive/libarchive/archive_write_disk_posix.c
+++ b/contrib/libarchive/libarchive/archive_write_disk_posix.c
@@ -110,6 +110,18 @@ __FBSDID("$FreeBSD$");
#include <sys/fcntl1.h>
#endif
+/*
+ * Macro to cast st_mtime and time_t to an int64 so that 2 numbers can reliably be compared.
+ *
+ * It assumes that the input is an integer type of no more than 64 bits.
+ * If the number is less than zero, t must be a signed type, so it fits in
+ * int64_t. Otherwise, it's a nonnegative value so we can cast it to uint64_t
+ * without loss. But it could be a large unsigned value, so we have to clip it
+ * to INT64_MAX.*
+ */
+#define to_int64_time(t) \
+ ((t) < 0 ? (int64_t)(t) : (uint64_t)(t) > (uint64_t)INT64_MAX ? INT64_MAX : (int64_t)(t))
+
#if __APPLE__
#include <TargetConditionals.h>
#if TARGET_OS_MAC && !TARGET_OS_EMBEDDED && HAVE_QUARANTINE_H
@@ -308,7 +320,7 @@ struct archive_write_disk {
#define MAXIMUM_DIR_MODE 0775
/*
- * Maxinum uncompressed size of a decmpfs block.
+ * Maximum uncompressed size of a decmpfs block.
*/
#define MAX_DECMPFS_BLOCK_SIZE (64 * 1024)
/*
@@ -323,7 +335,7 @@ struct archive_write_disk {
#define RSRC_F_SIZE 50 /* Size of Resource fork footer. */
/* Size to write compressed data to resource fork. */
#define COMPRESSED_W_SIZE (64 * 1024)
-/* decmpfs difinitions. */
+/* decmpfs definitions. */
#define MAX_DECMPFS_XATTR_SIZE 3802
#ifndef DECMPFS_XATTR_NAME
#define DECMPFS_XATTR_NAME "com.apple.decmpfs"
@@ -632,9 +644,9 @@ _archive_write_disk_header(struct archive *_a, struct archive_entry *entry)
/*
* NOTE: UF_COMPRESSED is ignored even if the filesystem
* supports HFS+ Compression because the file should
- * have at least an extended attriute "com.apple.decmpfs"
+ * have at least an extended attribute "com.apple.decmpfs"
* before the flag is set to indicate that the file have
- * been compressed. If hte filesystem does not support
+ * been compressed. If the filesystem does not support
* HFS+ Compression the system call will fail.
*/
if (a->fd < 0 || fchflags(a->fd, UF_COMPRESSED) != 0)
@@ -1247,7 +1259,7 @@ hfs_drive_compressor(struct archive_write_disk *a, const char *buff,
ret = hfs_write_compressed_data(a, bytes_used + rsrc_size);
a->compressed_buffer_remaining = a->compressed_buffer_size;
- /* If the compressed size is not enouph smaller than
+ /* If the compressed size is not enough smaller than
* the uncompressed size. cancel HFS+ compression.
* TODO: study a behavior of ditto utility and improve
* the condition to fall back into no HFS+ compression. */
@@ -1352,7 +1364,7 @@ hfs_write_decmpfs_block(struct archive_write_disk *a, const char *buff,
(uint32_t *)(a->resource_fork + RSRC_H_SIZE);
/* Set the block count to the resource fork. */
archive_le32enc(a->decmpfs_block_info++, block_count);
- /* Get the position where we are goint to set compressed
+ /* Get the position where we are going to set compressed
* data. */
a->compressed_rsrc_position =
RSRC_H_SIZE + 4 + (block_count * 8);
@@ -1425,7 +1437,7 @@ hfs_write_data_block(struct archive_write_disk *a, const char *buff,
bytes_to_write = size;
/* Seek if necessary to the specified offset. */
if (a->offset < a->fd_offset) {
- /* Can't support backword move. */
+ /* Can't support backward move. */
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Seek failed");
return (ARCHIVE_FATAL);
@@ -1690,10 +1702,25 @@ _archive_write_disk_finish_entry(struct archive *_a)
* ACLs that prevent attribute changes (including time).
*/
if (a->todo & TODO_ACLS) {
- int r2 = archive_write_disk_set_acls(&a->archive, a->fd,
- archive_entry_pathname(a->entry),
- archive_entry_acl(a->entry));
+ int r2;
+#ifdef HAVE_DARWIN_ACL
+ /*
+ * On Mac OS, platform ACLs are stored also in mac_metadata by
+ * the operating system. If mac_metadata is present it takes
+ * precedence and we skip extracting libarchive NFSv4 ACLs
+ */
+ const void *metadata;
+ size_t metadata_size;
+ metadata = archive_entry_mac_metadata(a->entry, &metadata_size);
+ if (metadata == NULL || metadata_size == 0) {
+#endif
+ r2 = archive_write_disk_set_acls(&a->archive, a->fd,
+ archive_entry_pathname(a->entry),
+ archive_entry_acl(a->entry));
if (r2 < ret) ret = r2;
+#ifdef HAVE_DARWIN_ACL
+ }
+#endif
}
finish_metadata:
@@ -2065,6 +2092,7 @@ create_filesystem_object(struct archive_write_disk *a)
archive_set_error(&a->archive, error_number, "%s",
error_string.s);
free(linkname_copy);
+ archive_string_free(&error_string);
/*
* EPERM is more appropriate than error_number for our
* callers
@@ -2077,6 +2105,7 @@ create_filesystem_object(struct archive_write_disk *a)
archive_set_error(&a->archive, error_number, "%s",
error_string.s);
free(linkname_copy);
+ archive_string_free(&error_string);
/*
* EPERM is more appropriate than error_number for our
* callers
@@ -2084,6 +2113,7 @@ create_filesystem_object(struct archive_write_disk *a)
return (EPERM);
}
free(linkname_copy);
+ archive_string_free(&error_string);
r = link(linkname, a->name) ? errno : 0;
/*
* New cpio and pax formats allow hardlink entries
@@ -2252,8 +2282,12 @@ _archive_write_disk_close(struct archive *_a)
if (p->fixup & TODO_MODE_BASE)
chmod(p->name, p->mode);
if (p->fixup & TODO_ACLS)
- archive_write_disk_set_acls(&a->archive,
- -1, p->name, &p->acl);
+#ifdef HAVE_DARWIN_ACL
+ if (p->mac_metadata == NULL ||
+ p->mac_metadata_size == 0)
+#endif
+ archive_write_disk_set_acls(&a->archive,
+ -1, p->name, &p->acl);
if (p->fixup & TODO_FFLAGS)
set_fflags_platform(a, -1, p->name,
p->mode, p->fflags_set, 0);
@@ -4125,10 +4159,10 @@ older(struct stat *st, struct archive_entry *entry)
{
/* First, test the seconds and return if we have a definite answer. */
/* Definitely older. */
- if (st->st_mtime < archive_entry_mtime(entry))
+ if (to_int64_time(st->st_mtime) < to_int64_time(archive_entry_mtime(entry)))
return (1);
/* Definitely younger. */
- if (st->st_mtime > archive_entry_mtime(entry))
+ if (to_int64_time(st->st_mtime) > to_int64_time(archive_entry_mtime(entry)))
return (0);
/* If this platform supports fractional seconds, try those. */
#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC
diff --git a/contrib/libarchive/libarchive/archive_write_open.3 b/contrib/libarchive/libarchive/archive_write_open.3
index a52959b..457873e 100644
--- a/contrib/libarchive/libarchive/archive_write_open.3
+++ b/contrib/libarchive/libarchive/archive_write_open.3
@@ -66,6 +66,7 @@ Freeze the settings, open the archive, and prepare for writing entries.
This is the most generic form of this function, which accepts
pointers to three callback functions which will be invoked by
the compression layer to write the constructed archive.
+This does not alter the default archive padding.
.It Fn archive_write_open_fd
A convenience form of
.Fn archive_write_open
@@ -123,12 +124,21 @@ is currently in use.
You should be careful to ensure that this variable
remains allocated until after the archive is
closed.
+This function will disable padding unless you
+have specifically set the block size.
.El
More information about the
.Va struct archive
object and the overall design of the library can be found in the
.Xr libarchive 3
overview.
+.Pp
+Note that the convenience forms above vary in how
+they block the output.
+See
+.Xr archive_write_blocksize 3
+if you need to control the block size used for writes
+or the end-of-file padding behavior.
.\"
.Sh CLIENT CALLBACKS
To use this library, you will need to define and register
@@ -226,6 +236,7 @@ functions.
.Xr tar 1 ,
.Xr libarchive 3 ,
.Xr archive_write 3 ,
+.Xr archive_write_blocksize 3 ,
.Xr archive_write_filter 3 ,
.Xr archive_write_format 3 ,
.Xr archive_write_new 3 ,
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_7zip.c b/contrib/libarchive/libarchive/archive_write_set_format_7zip.c
index abd521a..41ed74d 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_7zip.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_7zip.c
@@ -1358,7 +1358,7 @@ make_header(struct archive_write *a, uint64_t offset, uint64_t pack_size,
if (r < 0)
return (r);
- /* Write Nume size. */
+ /* Write Name size. */
r = enc_uint64(a, zip->total_bytes_entry_name+1);
if (r < 0)
return (r);
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c b/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c
index a9c4123..2d858c9 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c
@@ -478,15 +478,15 @@ archive_write_gnutar_header(struct archive_write *a,
archive_entry_set_pathname(temp, "././@LongLink");
archive_entry_set_size(temp, length);
ret = archive_format_gnutar_header(a, buff, temp, 'K');
+ archive_entry_free(temp);
if (ret < ARCHIVE_WARN)
goto exit_write_header;
ret = __archive_write_output(a, buff, 512);
- if(ret < ARCHIVE_WARN)
+ if (ret < ARCHIVE_WARN)
goto exit_write_header;
- archive_entry_free(temp);
/* Write name and trailing null byte. */
ret = __archive_write_output(a, gnutar->linkname, length);
- if(ret < ARCHIVE_WARN)
+ if (ret < ARCHIVE_WARN)
goto exit_write_header;
/* Pad to 512 bytes */
ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
@@ -508,12 +508,12 @@ archive_write_gnutar_header(struct archive_write *a,
archive_entry_set_pathname(temp, "././@LongLink");
archive_entry_set_size(temp, length);
ret = archive_format_gnutar_header(a, buff, temp, 'L');
+ archive_entry_free(temp);
if (ret < ARCHIVE_WARN)
goto exit_write_header;
ret = __archive_write_output(a, buff, 512);
if(ret < ARCHIVE_WARN)
goto exit_write_header;
- archive_entry_free(temp);
/* Write pathname + trailing null byte. */
ret = __archive_write_output(a, pathname, length);
if(ret < ARCHIVE_WARN)
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c b/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
index bf69c3e..4e91097 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
@@ -161,7 +161,7 @@ struct isofile {
/* Used for managing struct isofile list. */
struct isofile *allnext;
struct isofile *datanext;
- /* Used for managing a hardlined struct isofile list. */
+ /* Used for managing a hardlinked struct isofile list. */
struct isofile *hlnext;
struct isofile *hardlink_target;
@@ -528,7 +528,7 @@ struct iso_option {
* - allow more then 8 depths of directory trees;
* - disable a version number to a File Name;
* - disable a forced period to the tail of a File Name;
- * - the maxinum length of files and directories is raised to 193.
+ * - the maximum length of files and directories is raised to 193.
* if rockridge option is disabled, raised to 207.
*/
unsigned int iso_level:3;
@@ -626,7 +626,7 @@ struct iso_option {
* : NOTE Our rockridge=useful option does not set a zero
* : to uid and gid, you should use application
* : option such as --gid,--gname,--uid and --uname
- * : badtar options instead.
+ * : bsdtar options instead.
* Type : boolean/string
* Default: Enabled as rockridge=useful
* COMPAT : mkisofs -r / -R
@@ -660,7 +660,7 @@ struct iso_option {
* : for making zisofs.
* : When the file size is less than one Logical Block
* : size, that file will not zisofs'ed since it does
- * : reduece an ISO-image size.
+ * : reduce an ISO-image size.
* :
* : When you specify option 'boot=<boot-image>', that
* : 'boot-image' file won't be converted to zisofs file.
@@ -703,7 +703,7 @@ struct iso9660 {
} all_file_list;
/* A list of struct isofile entries which have its
- * contents and are not a directory, a hardlined file
+ * contents and are not a directory, a hardlinked file
* and a symlink file. */
struct {
struct isofile *first;
@@ -1907,9 +1907,9 @@ iso9660_close(struct archive_write *a)
iso9660->primary.rootent);
if (ret < 0)
return (ret);
- /* Make sure we have UTF-16BE convertors.
- * if there is no file entry, convertors are still
- * uninitilized. */
+ /* Make sure we have UTF-16BE converters.
+ * if there is no file entry, converters are still
+ * uninitialized. */
if (iso9660->sconv_to_utf16be == NULL) {
iso9660->sconv_to_utf16be =
archive_string_conversion_to_charset(
@@ -2524,7 +2524,8 @@ get_tmfromtime(struct tm *tm, time_t *t)
tzset();
localtime_r(t, tm);
#elif HAVE__LOCALTIME64_S
- _localtime64_s(tm, t);
+ __time64_t tmp_t = (__time64_t) *t; //time_t may be shorter than 64 bits
+ _localtime64_s(tm, &tmp_t);
#else
memcpy(tm, localtime(t), sizeof(*tm));
#endif
@@ -2553,7 +2554,7 @@ set_date_time(unsigned char *p, time_t t)
static void
set_date_time_null(unsigned char *p)
{
- memset(p, '0', 16);
+ memset(p, (int)'0', 16);
p[16] = 0;
}
@@ -2959,7 +2960,7 @@ set_directory_record_rr(unsigned char *bp, int dr_len,
gid = archive_entry_gid(file->entry);
if (iso9660->opt.rr == OPT_RR_USEFUL) {
/*
- * This action is simular mkisofs -r option
+ * This action is similar to mkisofs -r option
* but our rockridge=useful option does not
* set a zero to uid and gid.
*/
@@ -3108,7 +3109,7 @@ set_directory_record_rr(unsigned char *bp, int dr_len,
/*
* flg len
* +----+----+
- * | 02 | 00 | CURREENT component.
+ * | 02 | 00 | CURRENT component.
* +----+----+ (".")
*/
if (nc != NULL) {
@@ -3947,7 +3948,7 @@ write_VD(struct archive_write *a, struct vdd *vdd)
"Abstract File", 0, D_CHAR);
if (r != ARCHIVE_OK)
return (r);
- /* Bibliongraphic File Identifier */
+ /* Bibliographic File Identifier */
r = set_file_identifier(bp, 777, 813, vdc, a, vdd,
&(iso9660->bibliographic_file_identifier),
"Bibliongraphic File", 0, D_CHAR);
@@ -4073,7 +4074,8 @@ write_information_block(struct archive_write *a)
memset(info.s, 0, info_size);
opt = 0;
#if defined(HAVE__CTIME64_S)
- _ctime64_s(buf, sizeof(buf), &(iso9660->birth_time));
+ __time64_t iso9660_birth_time_tmp = (__time64_t) iso9660->birth_time; //time_t may be shorter than 64 bits
+ _ctime64_s(buf, sizeof(buf), &(iso9660_birth_time_tmp));
#elif defined(HAVE_CTIME_R)
ctime_r(&(iso9660->birth_time), buf);
#else
@@ -6135,7 +6137,7 @@ isoent_gen_iso9660_identifier(struct archive_write *a, struct isoent *isoent,
off = ffmax - extlen;
if (off == 0) {
/* A dot('.') character
- * does't place to the first
+ * doesn't place to the first
* byte of identifier. */
off ++;
extlen --;
@@ -7149,7 +7151,7 @@ isoent_create_boot_catalog(struct archive_write *a, struct isoent *rootent)
iso9660->el_torito.catalog = isoent;
/*
- * Get a boot medai type.
+ * Get a boot media type.
*/
switch (iso9660->opt.boot_type) {
default:
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_pax.c b/contrib/libarchive/libarchive/archive_write_set_format_pax.c
index 786eec4..da4fe97 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_pax.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_pax.c
@@ -1,6 +1,7 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* Copyright (c) 2010-2012 Michihiro NAKAJIMA
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -61,15 +62,24 @@ struct pax {
struct sparse_block *sparse_tail;
struct archive_string_conv *sconv_utf8;
int opt_binary;
+
+ unsigned flags;
+#define WRITE_SCHILY_XATTR (1 << 0)
+#define WRITE_LIBARCHIVE_XATTR (1 << 1)
};
static void add_pax_attr(struct archive_string *, const char *key,
const char *value);
+static void add_pax_attr_binary(struct archive_string *,
+ const char *key,
+ const char *value, size_t value_len);
static void add_pax_attr_int(struct archive_string *,
const char *key, int64_t value);
static void add_pax_attr_time(struct archive_string *,
const char *key, int64_t sec,
unsigned long nanos);
+static int add_pax_acl(struct archive_write *,
+ struct archive_entry *, struct pax *, int);
static ssize_t archive_write_pax_data(struct archive_write *,
const void *, size_t);
static int archive_write_pax_close(struct archive_write *);
@@ -133,6 +143,8 @@ archive_write_set_format_pax(struct archive *_a)
"Can't allocate pax data");
return (ARCHIVE_FATAL);
}
+ pax->flags = WRITE_LIBARCHIVE_XATTR | WRITE_SCHILY_XATTR;
+
a->format_data = pax;
a->format_name = "pax";
a->format_options = archive_write_pax_options;
@@ -272,6 +284,17 @@ add_pax_attr_int(struct archive_string *as, const char *key, int64_t value)
static void
add_pax_attr(struct archive_string *as, const char *key, const char *value)
{
+ add_pax_attr_binary(as, key, value, strlen(value));
+}
+
+/*
+ * Add a key/value attribute to the pax header. This function handles
+ * binary values.
+ */
+static void
+add_pax_attr_binary(struct archive_string *as, const char *key,
+ const char *value, size_t value_len)
+{
int digits, i, len, next_ten;
char tmp[1 + 3 * sizeof(int)]; /* < 3 base-10 digits per byte */
@@ -279,7 +302,7 @@ add_pax_attr(struct archive_string *as, const char *key, const char *value)
* PAX attributes have the following layout:
* <len> <space> <key> <=> <value> <nl>
*/
- len = 1 + (int)strlen(key) + 1 + (int)strlen(value) + 1;
+ len = 1 + (int)strlen(key) + 1 + (int)value_len + 1;
/*
* The <len> field includes the length of the <len> field, so
@@ -310,21 +333,47 @@ add_pax_attr(struct archive_string *as, const char *key, const char *value)
archive_strappend_char(as, ' ');
archive_strcat(as, key);
archive_strappend_char(as, '=');
- archive_strcat(as, value);
+ archive_array_append(as, value, value_len);
archive_strappend_char(as, '\n');
}
+static void
+archive_write_pax_header_xattr(struct pax *pax, const char *encoded_name,
+ const void *value, size_t value_len)
+{
+ struct archive_string s;
+ char *encoded_value;
+
+ if (pax->flags & WRITE_LIBARCHIVE_XATTR) {
+ encoded_value = base64_encode((const char *)value, value_len);
+
+ if (encoded_name != NULL && encoded_value != NULL) {
+ archive_string_init(&s);
+ archive_strcpy(&s, "LIBARCHIVE.xattr.");
+ archive_strcat(&s, encoded_name);
+ add_pax_attr(&(pax->pax_header), s.s, encoded_value);
+ archive_string_free(&s);
+ }
+ free(encoded_value);
+ }
+ if (pax->flags & WRITE_SCHILY_XATTR) {
+ archive_string_init(&s);
+ archive_strcpy(&s, "SCHILY.xattr.");
+ archive_strcat(&s, encoded_name);
+ add_pax_attr_binary(&(pax->pax_header), s.s, value, value_len);
+ archive_string_free(&s);
+ }
+}
+
static int
archive_write_pax_header_xattrs(struct archive_write *a,
struct pax *pax, struct archive_entry *entry)
{
- struct archive_string s;
int i = archive_entry_xattr_reset(entry);
while (i--) {
const char *name;
const void *value;
- char *encoded_value;
char *url_encoded_name = NULL, *encoded_name = NULL;
size_t size;
int r;
@@ -345,16 +394,9 @@ archive_write_pax_header_xattrs(struct archive_write *a,
}
}
- encoded_value = base64_encode((const char *)value, size);
+ archive_write_pax_header_xattr(pax, encoded_name,
+ value, size);
- if (encoded_name != NULL && encoded_value != NULL) {
- archive_string_init(&s);
- archive_strcpy(&s, "LIBARCHIVE.xattr.");
- archive_strcat(&s, encoded_name);
- add_pax_attr(&(pax->pax_header), s.s, encoded_value);
- archive_string_free(&s);
- }
- free(encoded_value);
}
return (ARCHIVE_OK);
}
@@ -449,6 +491,45 @@ get_entry_symlink(struct archive_write *a, struct archive_entry *entry,
return (ARCHIVE_OK);
}
+/* Add ACL to pax header */
+static int
+add_pax_acl(struct archive_write *a,
+ struct archive_entry *entry, struct pax *pax, int flags)
+{
+ char *p;
+ const char *attr;
+ int acl_types;
+
+ acl_types = archive_entry_acl_types(entry);
+
+ if ((acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0)
+ attr = "SCHILY.acl.ace";
+ else if ((flags & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)
+ attr = "SCHILY.acl.access";
+ else if ((flags & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) != 0)
+ attr = "SCHILY.acl.default";
+ else
+ return (ARCHIVE_FATAL);
+
+ p = archive_entry_acl_to_text_l(entry, NULL, flags, pax->sconv_utf8);
+ if (p == NULL) {
+ if (errno == ENOMEM) {
+ archive_set_error(&a->archive, ENOMEM, "%s %s",
+ "Can't allocate memory for ", attr);
+ return (ARCHIVE_FATAL);
+ }
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_FILE_FORMAT, "%s %s %s",
+ "Can't translate ", attr, " to UTF-8");
+ return(ARCHIVE_WARN);
+ } else if (*p != '\0') {
+ add_pax_attr(&(pax->pax_header),
+ attr, p);
+ free(p);
+ }
+ return(ARCHIVE_OK);
+}
+
/*
* TODO: Consider adding 'comment' and 'charset' fields to
* archive_entry so that clients can specify them. Also, consider
@@ -465,6 +546,7 @@ archive_write_pax_header(struct archive_write *a,
const char *p;
const char *suffix;
int need_extension, r, ret;
+ int acl_types;
int sparse_count;
uint64_t sparse_total, real_size;
struct pax *pax;
@@ -1016,16 +1098,6 @@ archive_write_pax_header(struct archive_write *a,
if (!need_extension && p != NULL && *p != '\0')
need_extension = 1;
- /* If there are non-trivial ACL entries, we need an extension. */
- if (!need_extension && archive_entry_acl_count(entry_original,
- ARCHIVE_ENTRY_ACL_TYPE_ACCESS) > 0)
- need_extension = 1;
-
- /* If there are non-trivial ACL entries, we need an extension. */
- if (!need_extension && archive_entry_acl_count(entry_original,
- ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) > 0)
- need_extension = 1;
-
/* If there are extended attributes, we need an extension */
if (!need_extension && archive_entry_xattr_count(entry_original) > 0)
need_extension = 1;
@@ -1034,6 +1106,12 @@ archive_write_pax_header(struct archive_write *a,
if (!need_extension && sparse_count > 0)
need_extension = 1;
+ acl_types = archive_entry_acl_types(entry_original);
+
+ /* If there are any ACL entries, we need an extension */
+ if (!need_extension && acl_types != 0)
+ need_extension = 1;
+
/*
* Libarchive used to include these in extended headers for
* restricted pax format, but that confused people who
@@ -1085,43 +1163,29 @@ archive_write_pax_header(struct archive_write *a,
add_pax_attr(&(pax->pax_header), "SCHILY.fflags", p);
/* I use star-compatible ACL attributes. */
- r = archive_entry_acl_text_l(entry_original,
- ARCHIVE_ENTRY_ACL_TYPE_ACCESS |
- ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID,
- &p, NULL, pax->sconv_utf8);
- if (r != 0) {
- if (errno == ENOMEM) {
- archive_set_error(&a->archive, ENOMEM,
- "Can't allocate memory for "
- "ACL.access");
+ if ((acl_types & ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0) {
+ ret = add_pax_acl(a, entry_original, pax,
+ ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
+ ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA |
+ ARCHIVE_ENTRY_ACL_STYLE_COMPACT);
+ if (ret == ARCHIVE_FATAL)
return (ARCHIVE_FATAL);
- }
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "Can't translate ACL.access to UTF-8");
- ret = ARCHIVE_WARN;
- } else if (p != NULL && *p != '\0') {
- add_pax_attr(&(pax->pax_header),
- "SCHILY.acl.access", p);
}
- r = archive_entry_acl_text_l(entry_original,
- ARCHIVE_ENTRY_ACL_TYPE_DEFAULT |
- ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID,
- &p, NULL, pax->sconv_utf8);
- if (r != 0) {
- if (errno == ENOMEM) {
- archive_set_error(&a->archive, ENOMEM,
- "Can't allocate memory for "
- "ACL.default");
+ if (acl_types & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) {
+ ret = add_pax_acl(a, entry_original, pax,
+ ARCHIVE_ENTRY_ACL_TYPE_ACCESS |
+ ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
+ ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA);
+ if (ret == ARCHIVE_FATAL)
+ return (ARCHIVE_FATAL);
+ }
+ if (acl_types & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) {
+ ret = add_pax_acl(a, entry_original, pax,
+ ARCHIVE_ENTRY_ACL_TYPE_DEFAULT |
+ ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
+ ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA);
+ if (ret == ARCHIVE_FATAL)
return (ARCHIVE_FATAL);
- }
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "Can't translate ACL.default to UTF-8");
- ret = ARCHIVE_WARN;
- } else if (p != NULL && *p != '\0') {
- add_pax_attr(&(pax->pax_header),
- "SCHILY.acl.default", p);
}
/* We use GNU-tar-compatible sparse attributes. */
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_warc.c b/contrib/libarchive/libarchive/archive_write_set_format_warc.c
index ea66929..8b6daf9 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_warc.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_warc.c
@@ -79,7 +79,7 @@ typedef enum {
WT_RVIS,
/* conversion, unsupported */
WT_CONV,
- /* continutation, unsupported at the moment */
+ /* continuation, unsupported at the moment */
WT_CONT,
/* invalid type */
LAST_WT
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_xar.c b/contrib/libarchive/libarchive/archive_write_set_format_xar.c
index da6daac..495f0d4 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_xar.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_xar.c
@@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$");
* - When writing an XML element <link type="<file-type>">, <file-type>
* which is a file type a symbolic link is referencing is always marked
* as "broken". Xar utility uses stat(2) to get the file type, but, in
- * libarcive format writer, we should not use it; if it is needed, we
+ * libarchive format writer, we should not use it; if it is needed, we
* should get about it at archive_read_disk.c.
* - It is possible to appear both <flags> and <ext2> elements.
* Xar utility generates <flags> on BSD platform and <ext2> on Linux
@@ -1227,7 +1227,7 @@ make_file_entry(struct archive_write *a, xmlTextWriterPtr writer,
case AE_IFLNK:
/*
* xar utility has checked a file type, which
- * a symblic-link file has referenced.
+ * a symbolic-link file has referenced.
* For example:
* <link type="directory">../ref/</link>
* The symlink target file is "../ref/" and its
@@ -1237,8 +1237,8 @@ make_file_entry(struct archive_write *a, xmlTextWriterPtr writer,
* The symlink target file is "../f" and its
* file type is a regular file.
*
- * But our implemention cannot do it, and then we
- * always record that a attribute "type" is "borken",
+ * But our implementation cannot do it, and then we
+ * always record that a attribute "type" is "broken",
* for example:
* <link type="broken">foo/bar</link>
* It means "foo/bar" is not reachable.
@@ -1544,7 +1544,7 @@ make_toc(struct archive_write *a)
}
/*
- * Start recoding TOC
+ * Start recording TOC
*/
r = xmlTextWriterStartElement(writer, BAD_CAST("xar"));
if (r < 0) {
@@ -1961,6 +1961,7 @@ file_free(struct file *file)
archive_string_free(&(file->basename));
archive_string_free(&(file->symlink));
archive_string_free(&(file->script));
+ archive_entry_free(file->entry);
free(file);
}
@@ -2484,7 +2485,7 @@ file_connect_hardlink_files(struct xar *xar)
archive_entry_set_nlink(target->entry, hl->nlink);
if (hl->nlink > 1)
/* It means this file is a hardlink
- * targe itself. */
+ * target itself. */
target->hardlink_target = target;
for (nf = target->hlnext;
nf != NULL; nf = nf->hlnext) {
@@ -2913,7 +2914,7 @@ compression_init_encoder_xz(struct archive *a,
*strm = lzma_init_data;
#ifdef HAVE_LZMA_STREAM_ENCODER_MT
if (threads > 1) {
- bzero(&mt_options, sizeof(mt_options));
+ memset(&mt_options, 0, sizeof(mt_options));
mt_options.threads = threads;
mt_options.timeout = 300;
mt_options.filters = lzmafilters;
diff --git a/contrib/libarchive/libarchive/archive_write_set_format_zip.c b/contrib/libarchive/libarchive/archive_write_set_format_zip.c
index a69ce20..38a9abf 100644
--- a/contrib/libarchive/libarchive/archive_write_set_format_zip.c
+++ b/contrib/libarchive/libarchive/archive_write_set_format_zip.c
@@ -878,7 +878,7 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
|| zip->entry_encryption == ENCRYPTION_WINZIP_AES256)) {
memcpy(e, "\001\231\007\000\001\000AE", 8);
- /* AES vendoer version AE-2 does not store a CRC.
+ /* AES vendor version AE-2 does not store a CRC.
* WinZip 11 uses AE-1, which does store the CRC,
* but it does not store the CRC when the file size
* is less than 20 bytes. So we simulate what
@@ -1013,7 +1013,7 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s)
if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) {
switch (zip->entry_encryption) {
case ENCRYPTION_TRADITIONAL:
- /* Initialize traditoinal PKWARE encryption context. */
+ /* Initialize traditional PKWARE encryption context. */
if (!zip->tctx_valid) {
ret = init_traditional_pkware_encryption(a);
if (ret != ARCHIVE_OK)
@@ -1499,7 +1499,7 @@ trad_enc_update_keys(struct trad_enc_ctx *ctx, uint8_t c)
}
static uint8_t
-trad_enc_decypt_byte(struct trad_enc_ctx *ctx)
+trad_enc_decrypt_byte(struct trad_enc_ctx *ctx)
{
unsigned temp = ctx->keys[2] | 2;
return (uint8_t)((temp * (temp ^ 1)) >> 8) & 0xff;
@@ -1515,7 +1515,7 @@ trad_enc_encrypt_update(struct trad_enc_ctx *ctx, const uint8_t *in,
for (i = 0; i < max; i++) {
uint8_t t = in[i];
- out[i] = t ^ trad_enc_decypt_byte(ctx);
+ out[i] = t ^ trad_enc_decrypt_byte(ctx);
trad_enc_update_keys(ctx, t);
}
return i;
@@ -1626,7 +1626,7 @@ init_winzip_aes_encryption(struct archive_write *a)
return (ARCHIVE_FAILED);
}
- /* Set a passowrd verification value after the 'salt'. */
+ /* Set a password verification value after the 'salt'. */
salt[salt_len] = derived_key[key_len * 2];
salt[salt_len + 1] = derived_key[key_len * 2 + 1];
diff --git a/contrib/libarchive/libarchive/libarchive-formats.5 b/contrib/libarchive/libarchive/libarchive-formats.5
index 9cec760..62359dd 100644
--- a/contrib/libarchive/libarchive/libarchive-formats.5
+++ b/contrib/libarchive/libarchive/libarchive-formats.5
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd March 18, 2012
+.Dd December 27, 2016
.Dt LIBARCHIVE-FORMATS 5
.Os
.Sh NAME
@@ -191,8 +191,6 @@ and device numbers.
.It Solaris extensions
Libarchive recognizes ACL and extended attribute records written
by Solaris tar.
-Currently, libarchive only has support for old-style ACLs; the
-newer NFSv4 ACLs are recognized but discarded.
.El
.Pp
The first tar program appeared in Seventh Edition Unix in 1979.
diff --git a/contrib/libarchive/libarchive/tar.5 b/contrib/libarchive/libarchive/tar.5
index 6e6f0c0..30b837dc 100644
--- a/contrib/libarchive/libarchive/tar.5
+++ b/contrib/libarchive/libarchive/tar.5
@@ -1,4 +1,5 @@
.\" Copyright (c) 2003-2009 Tim Kientzle
+.\" Copyright (c) 2016 Martin Matuska
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
@@ -24,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 23, 2011
+.Dd December 27, 2016
.Dt TAR 5
.Os
.Sh NAME
@@ -440,11 +441,11 @@ archives to store files much larger than the historic 8GB limit.
Vendor-specific attributes used by Joerg Schilling's
.Nm star
implementation.
-.It Cm SCHILY.acl.access , Cm SCHILY.acl.default
-Stores the access and default ACLs as textual strings in a format
+.It Cm SCHILY.acl.access , Cm SCHILY.acl.default, Cm SCHILY.acl.ace
+Stores the access, default and NFSv4 ACLs as textual strings in a format
that is an extension of the format specified by POSIX.1e draft 17.
-In particular, each user or group access specification can include a fourth
-colon-separated field with the numeric UID or GID.
+In particular, each user or group access specification can include
+an additional colon-separated field with the numeric UID or GID.
This allows ACLs to be restored on systems that may not have complete
user or group information available (such as when NIS/YP or LDAP services
are temporarily unavailable).
diff --git a/contrib/libarchive/libarchive/test/main.c b/contrib/libarchive/libarchive/test/main.c
index 4f3cdac..d75f1ab 100644
--- a/contrib/libarchive/libarchive/test/main.c
+++ b/contrib/libarchive/libarchive/test/main.c
@@ -216,6 +216,12 @@ invalid_parameter_handler(const wchar_t * expression,
unsigned int line, uintptr_t pReserved)
{
/* nop */
+ // Silence unused-parameter compiler warnings.
+ (void)expression;
+ (void)function;
+ (void)file;
+ (void)line;
+ (void)pReserved;
}
#endif
@@ -1412,6 +1418,8 @@ assertion_file_mode(const char *file, int line, const char *pathname, int expect
failure_start(file, line, "assertFileMode not yet implemented for Windows");
(void)mode; /* UNUSED */
(void)r; /* UNUSED */
+ (void)pathname; /* UNUSED */
+ (void)expected_mode; /* UNUSED */
#else
{
struct stat st;
@@ -2421,6 +2429,132 @@ extract_reference_files(const char **names)
extract_reference_file(*names++);
}
+/* Set ACLs */
+void
+archive_test_set_acls(struct archive_entry *ae,
+ struct archive_test_acl_t *acls, int n)
+{
+ int i;
+
+ archive_entry_acl_clear(ae);
+ for (i = 0; i < n; i++) {
+ failure("type=%#010x, permset=%#010x, tag=%d, qual=%d name=%s",
+ acls[i].type, acls[i].permset, acls[i].tag,
+ acls[i].qual, acls[i].name);
+ assertEqualInt(ARCHIVE_OK,
+ archive_entry_acl_add_entry(ae,
+ acls[i].type, acls[i].permset, acls[i].tag,
+ acls[i].qual, acls[i].name));
+ }
+}
+
+static int
+archive_test_acl_match(struct archive_test_acl_t *acl, int type, int permset,
+ int tag, int qual, const char *name)
+{
+ if (type != acl->type)
+ return (0);
+ if (permset != acl->permset)
+ return (0);
+ if (tag != acl->tag)
+ return (0);
+ if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_EVERYONE)
+ return (1);
+ if (tag == ARCHIVE_ENTRY_ACL_OTHER)
+ return (1);
+ if (qual != acl->qual)
+ return (0);
+ if (name == NULL) {
+ if (acl->name == NULL || acl->name[0] == '\0')
+ return (1);
+ return (0);
+ }
+ if (acl->name == NULL) {
+ if (name[0] == '\0')
+ return (1);
+ return (0);
+ }
+ return (0 == strcmp(name, acl->name));
+}
+
+/* Compare ACLs */
+void
+archive_test_compare_acls(struct archive_entry *ae,
+ struct archive_test_acl_t *acls, int cnt, int want_type, int mode)
+{
+ int *marker;
+ int i, r, n;
+ int type, permset, tag, qual;
+ int matched;
+ const char *name;
+
+ n = 0;
+ marker = malloc(sizeof(marker[0]) * cnt);
+
+ for (i = 0; i < cnt; i++) {
+ if ((acls[i].type & want_type) != 0) {
+ marker[n] = i;
+ n++;
+ }
+ }
+
+ failure("No ACL's to compare, type mask: %d", want_type);
+ assert(n > 0);
+ if (n == 0)
+ return;
+
+ while (0 == (r = archive_entry_acl_next(ae, want_type,
+ &type, &permset, &tag, &qual, &name))) {
+ for (i = 0, matched = 0; i < n && !matched; i++) {
+ if (archive_test_acl_match(&acls[marker[i]], type,
+ permset, tag, qual, name)) {
+ /* We found a match; remove it. */
+ marker[i] = marker[n - 1];
+ n--;
+ matched = 1;
+ }
+ }
+ if (type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS
+ && tag == ARCHIVE_ENTRY_ACL_USER_OBJ) {
+ if (!matched) printf("No match for user_obj perm\n");
+ failure("USER_OBJ permset (%02o) != user mode (%02o)",
+ permset, 07 & (mode >> 6));
+ assert((permset << 6) == (mode & 0700));
+ } else if (type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS
+ && tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ) {
+ if (!matched) printf("No match for group_obj perm\n");
+ failure("GROUP_OBJ permset %02o != group mode %02o",
+ permset, 07 & (mode >> 3));
+ assert((permset << 3) == (mode & 0070));
+ } else if (type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS
+ && tag == ARCHIVE_ENTRY_ACL_OTHER) {
+ if (!matched) printf("No match for other perm\n");
+ failure("OTHER permset (%02o) != other mode (%02o)",
+ permset, mode & 07);
+ assert((permset << 0) == (mode & 0007));
+ } else {
+ failure("Could not find match for ACL "
+ "(type=%#010x,permset=%#010x,tag=%d,qual=%d,"
+ "name=``%s'')", type, permset, tag, qual, name);
+ assert(matched == 1);
+ }
+ }
+ assertEqualInt(ARCHIVE_EOF, r);
+ if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0)
+ assert((mode_t)(mode & 0777) == (archive_entry_mode(ae)
+ & 0777));
+ failure("Could not find match for ACL "
+ "(type=%#010x,permset=%#010x,tag=%d,qual=%d,name=``%s'')",
+ acls[marker[0]].type, acls[marker[0]].permset,
+ acls[marker[0]].tag, acls[marker[0]].qual, acls[marker[0]].name);
+ assert(n == 0); /* Number of ACLs not matched should == 0 */
+ free(marker);
+}
+
/*
*
* TEST management
diff --git a/contrib/libarchive/libarchive/test/test.h b/contrib/libarchive/libarchive/test/test.h
index f7ec59f..dc3f590 100644
--- a/contrib/libarchive/libarchive/test/test.h
+++ b/contrib/libarchive/libarchive/test/test.h
@@ -121,6 +121,32 @@
#endif
/*
+ * If this platform has <sys/acl.h>, acl_create(), acl_init(),
+ * acl_set_file(), and ACL_USER, we assume it has the rest of the
+ * POSIX.1e draft functions used in archive_read_extract.c.
+ */
+#if HAVE_SYS_ACL_H && HAVE_ACL_CREATE_ENTRY && HAVE_ACL_INIT && HAVE_ACL_SET_FILE
+#if HAVE_ACL_USER
+#define HAVE_POSIX_ACL 1
+#elif HAVE_ACL_TYPE_EXTENDED
+#define HAVE_DARWIN_ACL 1
+#endif
+#endif
+
+/*
+ * If this platform has <sys/acl.h>, acl_get(), facl_get(), acl_set(),
+ * facl_set() and types aclent_t and ace_t it uses Solaris-style ACL functions
+ */
+#if HAVE_SYS_ACL_H && HAVE_ACL_GET && HAVE_FACL_GET && HAVE_ACL_SET && HAVE_FACL_SET && HAVE_ACLENT_T && HAVE_ACE_T
+#define HAVE_SUN_ACL 1
+#endif
+
+/* Define if platform supports NFSv4 ACLs */
+#if (HAVE_POSIX_ACL && HAVE_ACL_TYPE_NFS4) || HAVE_SUN_ACL || HAVE_DARWIN_ACL
+#define HAVE_NFS4_ACL 1
+#endif
+
+/*
* Redefine DEFINE_TEST for use in defining the test functions.
*/
#undef DEFINE_TEST
@@ -346,6 +372,23 @@ extern const char *testworkdir;
#include "archive.h"
#include "archive_entry.h"
+/* ACL structure */
+struct archive_test_acl_t {
+ int type; /* Type of ACL */
+ int permset; /* Permissions for this class of users. */
+ int tag; /* Owner, User, Owning group, group, other, etc. */
+ int qual; /* GID or UID of user/group, depending on tag. */
+ const char *name; /* Name of user/group, depending on tag. */
+};
+
+/* Set ACLs */
+void archive_test_set_acls(struct archive_entry *, struct archive_test_acl_t *,
+ int);
+
+/* Compare ACLs */
+void archive_test_compare_acls(struct archive_entry *,
+ struct archive_test_acl_t *, int, int, int);
+
/* Special customized read-from-memory interface. */
int read_open_memory(struct archive *, const void *, size_t, size_t);
/* _minimal version exercises a slightly different set of libarchive APIs. */
diff --git a/contrib/libarchive/libarchive/test/test_acl_nfs4.c b/contrib/libarchive/libarchive/test/test_acl_nfs4.c
index c8f5937..f4e66f5 100644
--- a/contrib/libarchive/libarchive/test/test_acl_nfs4.c
+++ b/contrib/libarchive/libarchive/test/test_acl_nfs4.c
@@ -33,15 +33,7 @@ __FBSDID("$FreeBSD$");
* filesystems support ACLs or not.
*/
-struct acl_t {
- int type; /* Type of entry: "allow" or "deny" */
- int permset; /* Permissions for this class of users. */
- int tag; /* Owner, User, Owning group, group, everyone, etc. */
- int qual; /* GID or UID of user/group, depending on tag. */
- const char *name; /* Name of user/group, depending on tag. */
-};
-
-static struct acl_t acls1[] = {
+static struct archive_test_acl_t acls1[] = {
{ ARCHIVE_ENTRY_ACL_TYPE_ALLOW, ARCHIVE_ENTRY_ACL_EXECUTE,
ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
{ ARCHIVE_ENTRY_ACL_TYPE_DENY, ARCHIVE_ENTRY_ACL_READ_DATA,
@@ -52,7 +44,7 @@ static struct acl_t acls1[] = {
ARCHIVE_ENTRY_ACL_EVERYONE, -1, "" },
};
-static struct acl_t acls2[] = {
+static struct archive_test_acl_t acls2[] = {
/* An entry for each type. */
{ ARCHIVE_ENTRY_ACL_TYPE_ALLOW, 0,
ARCHIVE_ENTRY_ACL_USER, 108, "user108" },
@@ -136,7 +128,7 @@ static struct acl_t acls2[] = {
* Entries that should be rejected when we attempt to set them
* on an ACL that already has NFS4 entries.
*/
-static struct acl_t acls_bad[] = {
+static struct archive_test_acl_t acls_bad[] = {
/* POSIX.1e ACL types */
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
ARCHIVE_ENTRY_ACL_USER, 78, "" },
@@ -156,95 +148,6 @@ static struct acl_t acls_bad[] = {
ARCHIVE_ENTRY_ACL_EVERYONE, -1, "" },
};
-static void
-set_acls(struct archive_entry *ae, struct acl_t *acls, int n)
-{
- int i;
-
- archive_entry_acl_clear(ae);
- for (i = 0; i < n; i++) {
- failure("type=%d, permset=%d, tag=%d, qual=%d name=%s",
- acls[i].type, acls[i].permset, acls[i].tag,
- acls[i].qual, acls[i].name);
- assertEqualInt(ARCHIVE_OK,
- archive_entry_acl_add_entry(ae,
- acls[i].type, acls[i].permset, acls[i].tag,
- acls[i].qual, acls[i].name));
- }
-}
-
-static int
-acl_match(struct acl_t *acl, int type, int permset, int tag, int qual,
- const char *name)
-{
- if (acl == NULL)
- return (0);
- if (type != acl->type)
- return (0);
- if (permset != acl->permset)
- return (0);
- if (tag != acl->tag)
- return (0);
- if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
- return (1);
- if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ)
- return (1);
- if (tag == ARCHIVE_ENTRY_ACL_EVERYONE)
- return (1);
- if (qual != acl->qual)
- return (0);
- if (name == NULL) {
- if (acl->name == NULL || acl->name[0] == '\0')
- return (1);
- return (0);
- }
- if (acl->name == NULL) {
- if (name[0] == '\0')
- return (1);
- return (0);
- }
- return (0 == strcmp(name, acl->name));
-}
-
-static void
-compare_acls(struct archive_entry *ae, struct acl_t *acls, int n)
-{
- int *marker = malloc(sizeof(marker[0]) * n);
- int i;
- int r;
- int type, permset, tag, qual;
- int matched;
- const char *name;
-
- for (i = 0; i < n; i++)
- marker[i] = i;
-
- while (0 == (r = archive_entry_acl_next(ae,
- ARCHIVE_ENTRY_ACL_TYPE_NFS4,
- &type, &permset, &tag, &qual, &name))) {
- for (i = 0, matched = 0; i < n && !matched; i++) {
- if (acl_match(&acls[marker[i]], type, permset,
- tag, qual, name)) {
- /* We found a match; remove it. */
- marker[i] = marker[n - 1];
- n--;
- matched = 1;
- }
- }
- failure("Could not find match for ACL "
- "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
- type, permset, tag, qual, name);
- assertEqualInt(1, matched);
- }
- assertEqualInt(ARCHIVE_EOF, r);
- failure("Could not find match for ACL "
- "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
- acls[marker[0]].type, acls[marker[0]].permset,
- acls[marker[0]].tag, acls[marker[0]].qual, acls[marker[0]].name);
- assertEqualInt(0, n); /* Number of ACLs not matched should == 0 */
- free(marker);
-}
-
DEFINE_TEST(test_acl_nfs4)
{
struct archive_entry *ae;
@@ -256,22 +159,31 @@ DEFINE_TEST(test_acl_nfs4)
archive_entry_set_mode(ae, S_IFREG | 0777);
/* Store and read back some basic ACL entries. */
- set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+ archive_test_set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+
+ /* Check that entry contains only NFSv4 types */
+ assert((archive_entry_acl_types(ae) &
+ ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) == 0);
+ assert((archive_entry_acl_types(ae) &
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4) != 0);
+
assertEqualInt(4,
archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_NFS4));
- compare_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+ archive_test_compare_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]),
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4, 0);
/* A more extensive set of ACLs. */
- set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
+ archive_test_set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
assertEqualInt(32,
archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_NFS4));
- compare_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
+ archive_test_compare_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]),
+ ARCHIVE_ENTRY_ACL_TYPE_NFS4, 0);
/*
* Check that clearing ACLs gets rid of them all by repeating
* the first test.
*/
- set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+ archive_test_set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
failure("Basic ACLs shouldn't be stored as extended ACLs");
assertEqualInt(4,
archive_entry_acl_reset(ae, ARCHIVE_ENTRY_ACL_TYPE_NFS4));
@@ -280,9 +192,9 @@ DEFINE_TEST(test_acl_nfs4)
* Different types of malformed ACL entries that should
* fail when added to existing NFS4 ACLs.
*/
- set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
+ archive_test_set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
for (i = 0; i < (int)(sizeof(acls_bad)/sizeof(acls_bad[0])); ++i) {
- struct acl_t *p = &acls_bad[i];
+ struct archive_test_acl_t *p = &acls_bad[i];
failure("Malformed ACL test #%d", i);
assertEqualInt(ARCHIVE_FAILED,
archive_entry_acl_add_entry(ae,
diff --git a/contrib/libarchive/libarchive/test/test_acl_pax.c b/contrib/libarchive/libarchive/test/test_acl_pax.c
index 5fcf61b..8dfa0e0 100644
--- a/contrib/libarchive/libarchive/test/test_acl_pax.c
+++ b/contrib/libarchive/libarchive/test/test_acl_pax.c
@@ -1,5 +1,6 @@
/*-
* Copyright (c) 2003-2007 Tim Kientzle
+ * Copyright (c) 2016 Martin Matuska
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -27,7 +28,7 @@ __FBSDID("$FreeBSD$");
/*
* Exercise the system-independent portion of the ACL support.
- * Check that pax archive can save and restore ACL data.
+ * Check that pax archive can save and restore POSIX.1e ACL data.
*
* This should work on all systems, regardless of whether local
* filesystems support ACLs or not.
@@ -35,15 +36,7 @@ __FBSDID("$FreeBSD$");
static unsigned char buff[16384];
-struct acl_t {
- int type; /* Type of ACL: "access" or "default" */
- int permset; /* Permissions for this class of users. */
- int tag; /* Owner, User, Owning group, group, other, etc. */
- int qual; /* GID or UID of user/group, depending on tag. */
- const char *name; /* Name of user/group, depending on tag. */
-};
-
-static struct acl_t acls0[] = {
+static struct archive_test_acl_t acls0[] = {
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
@@ -52,7 +45,7 @@ static struct acl_t acls0[] = {
ARCHIVE_ENTRY_ACL_OTHER, 0, "" },
};
-static struct acl_t acls1[] = {
+static struct archive_test_acl_t acls1[] = {
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
@@ -63,7 +56,7 @@ static struct acl_t acls1[] = {
ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
};
-static struct acl_t acls2[] = {
+static struct archive_test_acl_t acls2[] = {
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ,
ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
@@ -78,101 +71,149 @@ static struct acl_t acls2[] = {
ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
};
-static void
-set_acls(struct archive_entry *ae, struct acl_t *acls, int n)
-{
- int i;
-
- archive_entry_acl_clear(ae);
- for (i = 0; i < n; i++) {
- archive_entry_acl_add_entry(ae,
- acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual,
- acls[i].name);
- }
-}
+static struct archive_test_acl_t acls3[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_EXECUTE |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_OWNER |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_EVERYONE, 0, "" },
+};
-static int
-acl_match(struct acl_t *acl, int type, int permset, int tag, int qual, const char *name)
-{
- if (type != acl->type)
- return (0);
- if (permset != acl->permset)
- return (0);
- if (tag != acl->tag)
- return (0);
- if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ)
- return (1);
- if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ)
- return (1);
- if (tag == ARCHIVE_ENTRY_ACL_OTHER)
- return (1);
- if (qual != acl->qual)
- return (0);
- if (name == NULL)
- return (acl->name == NULL || acl->name[0] == '\0');
- if (acl->name == NULL)
- return (name == NULL || name[0] == '\0');
- return (0 == strcmp(name, acl->name));
-}
+static struct archive_test_acl_t acls4[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_OWNER |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE |
+ ARCHIVE_ENTRY_ACL_ENTRY_INHERITED,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_DENY,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_EXECUTE,
+ ARCHIVE_ENTRY_ACL_USER, 78, "user78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_DENY,
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_WRITE_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_OWNER,
+ ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_EVERYONE, 0, "" },
+};
-static void
-compare_acls(struct archive_entry *ae, struct acl_t *acls, int n, int mode)
-{
- int *marker = malloc(sizeof(marker[0]) * n);
- int i;
- int r;
- int type, permset, tag, qual;
- int matched;
- const char *name;
-
- for (i = 0; i < n; i++)
- marker[i] = i;
-
- while (0 == (r = archive_entry_acl_next(ae,
- ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
- &type, &permset, &tag, &qual, &name))) {
- for (i = 0, matched = 0; i < n && !matched; i++) {
- if (acl_match(&acls[marker[i]], type, permset,
- tag, qual, name)) {
- /* We found a match; remove it. */
- marker[i] = marker[n - 1];
- n--;
- matched = 1;
- }
- }
- if (tag == ARCHIVE_ENTRY_ACL_USER_OBJ) {
- if (!matched) printf("No match for user_obj perm\n");
- failure("USER_OBJ permset (%02o) != user mode (%02o)",
- permset, 07 & (mode >> 6));
- assert((permset << 6) == (mode & 0700));
- } else if (tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ) {
- if (!matched) printf("No match for group_obj perm\n");
- failure("GROUP_OBJ permset %02o != group mode %02o",
- permset, 07 & (mode >> 3));
- assert((permset << 3) == (mode & 0070));
- } else if (tag == ARCHIVE_ENTRY_ACL_OTHER) {
- if (!matched) printf("No match for other perm\n");
- failure("OTHER permset (%02o) != other mode (%02o)",
- permset, mode & 07);
- assert((permset << 0) == (mode & 0007));
- } else {
- failure("Could not find match for ACL "
- "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
- type, permset, tag, qual, name);
- assert(matched == 1);
- }
- }
- assertEqualInt(ARCHIVE_EOF, r);
- assert((mode_t)(mode & 0777) == (archive_entry_mode(ae) & 0777));
- failure("Could not find match for ACL "
- "(type=%d,permset=%d,tag=%d,qual=%d,name=``%s'')",
- acls[marker[0]].type, acls[marker[0]].permset,
- acls[marker[0]].tag, acls[marker[0]].qual, acls[marker[0]].name);
- assert(n == 0); /* Number of ACLs not matched should == 0 */
- free(marker);
-}
+static struct archive_test_acl_t acls5[] = {
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_EXECUTE |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_WRITE_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_WRITE_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_OWNER |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_WRITE_OWNER |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_AUDIT,
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS,
+ ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_WRITE_DATA |
+ ARCHIVE_ENTRY_ACL_APPEND_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_GROUP_OBJ, 0, "" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALARM,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS,
+ ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" },
+ { ARCHIVE_ENTRY_ACL_TYPE_ALLOW,
+ ARCHIVE_ENTRY_ACL_READ_DATA |
+ ARCHIVE_ENTRY_ACL_READ_ATTRIBUTES |
+ ARCHIVE_ENTRY_ACL_READ_NAMED_ATTRS |
+ ARCHIVE_ENTRY_ACL_READ_ACL |
+ ARCHIVE_ENTRY_ACL_SYNCHRONIZE,
+ ARCHIVE_ENTRY_ACL_EVERYONE, 0, "" },
+};
-DEFINE_TEST(test_acl_pax)
+DEFINE_TEST(test_acl_pax_posix1e)
{
struct archive *a;
struct archive_entry *ae;
@@ -197,23 +238,23 @@ DEFINE_TEST(test_acl_pax)
archive_entry_set_mode(ae, S_IFREG | 0777);
/* Basic owner/owning group should just update mode bits. */
- set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
+ archive_test_set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
assertA(0 == archive_write_header(a, ae));
/* With any extended ACL entry, we should read back a full set. */
- set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
+ archive_test_set_acls(ae, acls1, sizeof(acls1)/sizeof(acls1[0]));
assertA(0 == archive_write_header(a, ae));
/* A more extensive set of ACLs. */
- set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
+ archive_test_set_acls(ae, acls2, sizeof(acls2)/sizeof(acls2[0]));
assertA(0 == archive_write_header(a, ae));
/*
* Check that clearing ACLs gets rid of them all by repeating
* the first test.
*/
- set_acls(ae, acls0, sizeof(acls0)/sizeof(acls0[0]));
+ archive_tes