Date: Wed, 18 Jul 2012 08:12:05 +0000 (UTC) From: Martin Matuska <mm@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r238567 - in vendor-sys/opensolaris/dist: . common common/acl common/atomic common/atomic/amd64 common/atomic/i386 common/atomic/sparc common/avl common/list common/nvpair common/unicod... Message-ID: <201207180812.q6I8C5vK044224@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mm Date: Wed Jul 18 08:12:04 2012 New Revision: 238567 URL: http://svn.freebsd.org/changeset/base/238567 Log: Update vendor-sys/opensolaris to last OpenSolaris state (13149:b23a4dab3d50) Add ZFS bits to vendor-sys/opensolaris Obtained from: https://hg.openindiana.org/upstream/oracle/onnv-gate Added: vendor-sys/opensolaris/dist/OPENSOLARIS.LICENSE vendor-sys/opensolaris/dist/common/ vendor-sys/opensolaris/dist/common/acl/ vendor-sys/opensolaris/dist/common/acl/acl_common.c vendor-sys/opensolaris/dist/common/acl/acl_common.h vendor-sys/opensolaris/dist/common/atomic/ vendor-sys/opensolaris/dist/common/atomic/amd64/ vendor-sys/opensolaris/dist/common/atomic/amd64/atomic.s vendor-sys/opensolaris/dist/common/atomic/i386/ vendor-sys/opensolaris/dist/common/atomic/i386/atomic.s vendor-sys/opensolaris/dist/common/atomic/sparc/ vendor-sys/opensolaris/dist/common/atomic/sparc/atomic.s vendor-sys/opensolaris/dist/common/avl/ vendor-sys/opensolaris/dist/common/avl/avl.c vendor-sys/opensolaris/dist/common/list/ vendor-sys/opensolaris/dist/common/list/list.c vendor-sys/opensolaris/dist/common/nvpair/ vendor-sys/opensolaris/dist/common/nvpair/nvpair.c vendor-sys/opensolaris/dist/common/nvpair/nvpair_alloc_fixed.c vendor-sys/opensolaris/dist/common/unicode/ vendor-sys/opensolaris/dist/common/unicode/u8_textprep.c vendor-sys/opensolaris/dist/common/zfs/ vendor-sys/opensolaris/dist/common/zfs/zfs_comutil.c vendor-sys/opensolaris/dist/common/zfs/zfs_comutil.h vendor-sys/opensolaris/dist/common/zfs/zfs_deleg.c vendor-sys/opensolaris/dist/common/zfs/zfs_deleg.h vendor-sys/opensolaris/dist/common/zfs/zfs_fletcher.c vendor-sys/opensolaris/dist/common/zfs/zfs_fletcher.h vendor-sys/opensolaris/dist/common/zfs/zfs_namecheck.c vendor-sys/opensolaris/dist/common/zfs/zfs_namecheck.h vendor-sys/opensolaris/dist/common/zfs/zfs_prop.c vendor-sys/opensolaris/dist/common/zfs/zfs_prop.h vendor-sys/opensolaris/dist/common/zfs/zpool_prop.c vendor-sys/opensolaris/dist/common/zfs/zprop_common.c vendor-sys/opensolaris/dist/uts/common/Makefile.files vendor-sys/opensolaris/dist/uts/common/fs/ vendor-sys/opensolaris/dist/uts/common/fs/gfs.c vendor-sys/opensolaris/dist/uts/common/fs/vnode.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/ vendor-sys/opensolaris/dist/uts/common/fs/zfs/arc.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/bplist.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/bpobj.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dbuf.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/ddt.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/ddt_zap.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_diff.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_object.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_objset.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_send.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_traverse.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_tx.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dmu_zfetch.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dnode.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dnode_sync.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_dataset.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_deadlist.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_deleg.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_dir.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_pool.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_prop.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_scan.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/dsl_synctask.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/gzip.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/lzjb.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/metaslab.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/refcount.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/rrwlock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/sa.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/sha256.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_config.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_errlog.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_history.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/spa_misc.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/space_map.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/ vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/arc.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/bplist.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/bpobj.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dbuf.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/ddt.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_objset.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_traverse.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_tx.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dmu_zfetch.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dnode.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_dataset.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_deadlist.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_deleg.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_dir.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_pool.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_prop.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_scan.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/dsl_synctask.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/metaslab.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/metaslab_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/refcount.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/rrwlock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/sa.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/sa_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/spa.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/spa_boot.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/spa_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/space_map.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/txg.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/txg_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/uberblock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/uberblock_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/unique.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev_disk.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev_file.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/vdev_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zap.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zap_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zap_leaf.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_acl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_context.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_ctldir.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_debug.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_dir.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_fuid.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_ioctl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_onexit.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_rlock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_sa.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_stat.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_vfsops.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zfs_znode.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zil.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zil_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio_checksum.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio_compress.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zio_impl.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zrlock.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/sys/zvol.h vendor-sys/opensolaris/dist/uts/common/fs/zfs/txg.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/uberblock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/unique.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_cache.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_disk.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_file.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_label.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_mirror.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_missing.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_queue.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_raidz.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/vdev_root.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zap.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zap_leaf.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zap_micro.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs.conf vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_acl.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_byteswap.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_ctldir.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_debug.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_dir.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_fm.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_fuid.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_ioctl.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_log.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_onexit.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_replay.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_rlock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_sa.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_vfsops.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_vnops.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zfs_znode.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zil.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio_checksum.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio_compress.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zio_inject.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zle.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zrlock.c vendor-sys/opensolaris/dist/uts/common/fs/zfs/zvol.c vendor-sys/opensolaris/dist/uts/common/os/ vendor-sys/opensolaris/dist/uts/common/os/callb.c vendor-sys/opensolaris/dist/uts/common/os/fm.c vendor-sys/opensolaris/dist/uts/common/os/nvpair_alloc_system.c vendor-sys/opensolaris/dist/uts/common/sys/acl.h vendor-sys/opensolaris/dist/uts/common/sys/acl_impl.h vendor-sys/opensolaris/dist/uts/common/sys/avl.h vendor-sys/opensolaris/dist/uts/common/sys/avl_impl.h vendor-sys/opensolaris/dist/uts/common/sys/bitmap.h vendor-sys/opensolaris/dist/uts/common/sys/callb.h vendor-sys/opensolaris/dist/uts/common/sys/ccompile.h vendor-sys/opensolaris/dist/uts/common/sys/compress.h vendor-sys/opensolaris/dist/uts/common/sys/cred.h vendor-sys/opensolaris/dist/uts/common/sys/debug.h vendor-sys/opensolaris/dist/uts/common/sys/errorq.h vendor-sys/opensolaris/dist/uts/common/sys/extdirent.h vendor-sys/opensolaris/dist/uts/common/sys/feature_tests.h vendor-sys/opensolaris/dist/uts/common/sys/fm/ vendor-sys/opensolaris/dist/uts/common/sys/fm/fs/ vendor-sys/opensolaris/dist/uts/common/sys/fm/fs/zfs.h vendor-sys/opensolaris/dist/uts/common/sys/fm/protocol.h vendor-sys/opensolaris/dist/uts/common/sys/fm/util.h vendor-sys/opensolaris/dist/uts/common/sys/fs/ vendor-sys/opensolaris/dist/uts/common/sys/fs/zfs.h vendor-sys/opensolaris/dist/uts/common/sys/fs/zut.h vendor-sys/opensolaris/dist/uts/common/sys/gfs.h vendor-sys/opensolaris/dist/uts/common/sys/idmap.h vendor-sys/opensolaris/dist/uts/common/sys/isa_defs.h vendor-sys/opensolaris/dist/uts/common/sys/list.h vendor-sys/opensolaris/dist/uts/common/sys/list_impl.h vendor-sys/opensolaris/dist/uts/common/sys/note.h vendor-sys/opensolaris/dist/uts/common/sys/nvpair.h vendor-sys/opensolaris/dist/uts/common/sys/nvpair_impl.h vendor-sys/opensolaris/dist/uts/common/sys/processor.h vendor-sys/opensolaris/dist/uts/common/sys/procset.h vendor-sys/opensolaris/dist/uts/common/sys/synch.h vendor-sys/opensolaris/dist/uts/common/sys/sysevent/ vendor-sys/opensolaris/dist/uts/common/sys/sysevent.h vendor-sys/opensolaris/dist/uts/common/sys/sysevent/dev.h vendor-sys/opensolaris/dist/uts/common/sys/sysevent/eventdefs.h vendor-sys/opensolaris/dist/uts/common/sys/sysmacros.h vendor-sys/opensolaris/dist/uts/common/sys/taskq.h vendor-sys/opensolaris/dist/uts/common/sys/u8_textprep.h vendor-sys/opensolaris/dist/uts/common/sys/u8_textprep_data.h vendor-sys/opensolaris/dist/uts/common/sys/vnode.h vendor-sys/opensolaris/dist/uts/common/sys/zmod.h vendor-sys/opensolaris/dist/uts/common/zmod/ vendor-sys/opensolaris/dist/uts/common/zmod/adler32.c vendor-sys/opensolaris/dist/uts/common/zmod/crc32.c vendor-sys/opensolaris/dist/uts/common/zmod/crc32.h vendor-sys/opensolaris/dist/uts/common/zmod/deflate.c vendor-sys/opensolaris/dist/uts/common/zmod/deflate.h vendor-sys/opensolaris/dist/uts/common/zmod/inffast.c vendor-sys/opensolaris/dist/uts/common/zmod/inffast.h vendor-sys/opensolaris/dist/uts/common/zmod/inffixed.h vendor-sys/opensolaris/dist/uts/common/zmod/inflate.c vendor-sys/opensolaris/dist/uts/common/zmod/inflate.h vendor-sys/opensolaris/dist/uts/common/zmod/inftrees.c vendor-sys/opensolaris/dist/uts/common/zmod/inftrees.h vendor-sys/opensolaris/dist/uts/common/zmod/trees.c vendor-sys/opensolaris/dist/uts/common/zmod/zconf.h vendor-sys/opensolaris/dist/uts/common/zmod/zlib.h vendor-sys/opensolaris/dist/uts/common/zmod/zmod.c vendor-sys/opensolaris/dist/uts/common/zmod/zmod_subr.c vendor-sys/opensolaris/dist/uts/common/zmod/zutil.c vendor-sys/opensolaris/dist/uts/common/zmod/zutil.h Modified: vendor-sys/opensolaris/dist/uts/common/dtrace/dtrace.c vendor-sys/opensolaris/dist/uts/common/dtrace/fasttrap.c vendor-sys/opensolaris/dist/uts/common/dtrace/lockstat.c vendor-sys/opensolaris/dist/uts/common/dtrace/profile.c vendor-sys/opensolaris/dist/uts/common/dtrace/sdt_subr.c vendor-sys/opensolaris/dist/uts/common/dtrace/systrace.c vendor-sys/opensolaris/dist/uts/common/sys/cpupart.h vendor-sys/opensolaris/dist/uts/common/sys/cpuvar.h vendor-sys/opensolaris/dist/uts/common/sys/dtrace.h Added: vendor-sys/opensolaris/dist/OPENSOLARIS.LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/opensolaris/dist/OPENSOLARIS.LICENSE Wed Jul 18 08:12:04 2012 (r238567) @@ -0,0 +1,384 @@ +Unless otherwise noted, all files in this distribution are released +under the Common Development and Distribution License (CDDL). +Exceptions are noted within the associated source files. + +-------------------------------------------------------------------- + + +COMMON DEVELOPMENT AND DISTRIBUTION LICENSE Version 1.0 + +1. Definitions. + + 1.1. "Contributor" means each individual or entity that creates + or contributes to the creation of Modifications. + + 1.2. "Contributor Version" means the combination of the Original + Software, prior Modifications used by a Contributor (if any), + and the Modifications made by that particular Contributor. + + 1.3. "Covered Software" means (a) the Original Software, or (b) + Modifications, or (c) the combination of files containing + Original Software with files containing Modifications, in + each case including portions thereof. + + 1.4. "Executable" means the Covered Software in any form other + than Source Code. + + 1.5. "Initial Developer" means the individual or entity that first + makes Original Software available under this License. + + 1.6. "Larger Work" means a work which combines Covered Software or + portions thereof with code not governed by the terms of this + License. + + 1.7. "License" means this document. + + 1.8. "Licensable" means having the right to grant, to the maximum + extent possible, whether at the time of the initial grant or + subsequently acquired, any and all of the rights conveyed + herein. + + 1.9. "Modifications" means the Source Code and Executable form of + any of the following: + + A. Any file that results from an addition to, deletion from or + modification of the contents of a file containing Original + Software or previous Modifications; + + B. Any new file that contains any part of the Original + Software or previous Modifications; or + + C. Any new file that is contributed or otherwise made + available under the terms of this License. + + 1.10. "Original Software" means the Source Code and Executable + form of computer software code that is originally released + under this License. + + 1.11. "Patent Claims" means any patent claim(s), now owned or + hereafter acquired, including without limitation, method, + process, and apparatus claims, in any patent Licensable by + grantor. + + 1.12. "Source Code" means (a) the common form of computer software + code in which modifications are made and (b) associated + documentation included in or with such code. + + 1.13. "You" (or "Your") means an individual or a legal entity + exercising rights under, and complying with all of the terms + of, this License. For legal entities, "You" includes any + entity which controls, is controlled by, or is under common + control with You. For purposes of this definition, + "control" means (a) the power, direct or indirect, to cause + the direction or management of such entity, whether by + contract or otherwise, or (b) ownership of more than fifty + percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants. + + 2.1. The Initial Developer Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, the Initial + Developer hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Initial Developer, to use, + reproduce, modify, display, perform, sublicense and + distribute the Original Software (or portions thereof), + with or without Modifications, and/or as part of a Larger + Work; and + + (b) under Patent Claims infringed by the making, using or + selling of Original Software, to make, have made, use, + practice, sell, and offer for sale, and/or otherwise + dispose of the Original Software (or portions thereof). + + (c) The licenses granted in Sections 2.1(a) and (b) are + effective on the date Initial Developer first distributes + or otherwise makes the Original Software available to a + third party under the terms of this License. + + (d) Notwithstanding Section 2.1(b) above, no patent license is + granted: (1) for code that You delete from the Original + Software, or (2) for infringements caused by: (i) the + modification of the Original Software, or (ii) the + combination of the Original Software with other software + or devices. + + 2.2. Contributor Grant. + + Conditioned upon Your compliance with Section 3.1 below and + subject to third party intellectual property claims, each + Contributor hereby grants You a world-wide, royalty-free, + non-exclusive license: + + (a) under intellectual property rights (other than patent or + trademark) Licensable by Contributor to use, reproduce, + modify, display, perform, sublicense and distribute the + Modifications created by such Contributor (or portions + thereof), either on an unmodified basis, with other + Modifications, as Covered Software and/or as part of a + Larger Work; and + + (b) under Patent Claims infringed by the making, using, or + selling of Modifications made by that Contributor either + alone and/or in combination with its Contributor Version + (or portions of such combination), to make, use, sell, + offer for sale, have made, and/or otherwise dispose of: + (1) Modifications made by that Contributor (or portions + thereof); and (2) the combination of Modifications made by + that Contributor with its Contributor Version (or portions + of such combination). + + (c) The licenses granted in Sections 2.2(a) and 2.2(b) are + effective on the date Contributor first distributes or + otherwise makes the Modifications available to a third + party. + + (d) Notwithstanding Section 2.2(b) above, no patent license is + granted: (1) for any code that Contributor has deleted + from the Contributor Version; (2) for infringements caused + by: (i) third party modifications of Contributor Version, + or (ii) the combination of Modifications made by that + Contributor with other software (except as part of the + Contributor Version) or other devices; or (3) under Patent + Claims infringed by Covered Software in the absence of + Modifications made by that Contributor. + +3. Distribution Obligations. + + 3.1. Availability of Source Code. + + Any Covered Software that You distribute or otherwise make + available in Executable form must also be made available in Source + Code form and that Source Code form must be distributed only under + the terms of this License. You must include a copy of this + License with every copy of the Source Code form of the Covered + Software You distribute or otherwise make available. You must + inform recipients of any such Covered Software in Executable form + as to how they can obtain such Covered Software in Source Code + form in a reasonable manner on or through a medium customarily + used for software exchange. + + 3.2. Modifications. + + The Modifications that You create or to which You contribute are + governed by the terms of this License. You represent that You + believe Your Modifications are Your original creation(s) and/or + You have sufficient rights to grant the rights conveyed by this + License. + + 3.3. Required Notices. + + You must include a notice in each of Your Modifications that + identifies You as the Contributor of the Modification. You may + not remove or alter any copyright, patent or trademark notices + contained within the Covered Software, or any notices of licensing + or any descriptive text giving attribution to any Contributor or + the Initial Developer. + + 3.4. Application of Additional Terms. + + You may not offer or impose any terms on any Covered Software in + Source Code form that alters or restricts the applicable version + of this License or the recipients' rights hereunder. You may + choose to offer, and to charge a fee for, warranty, support, + indemnity or liability obligations to one or more recipients of + Covered Software. However, you may do so only on Your own behalf, + and not on behalf of the Initial Developer or any Contributor. + You must make it absolutely clear that any such warranty, support, + indemnity or liability obligation is offered by You alone, and You + hereby agree to indemnify the Initial Developer and every + Contributor for any liability incurred by the Initial Developer or + such Contributor as a result of warranty, support, indemnity or + liability terms You offer. + + 3.5. Distribution of Executable Versions. + + You may distribute the Executable form of the Covered Software + under the terms of this License or under the terms of a license of + Your choice, which may contain terms different from this License, + provided that You are in compliance with the terms of this License + and that the license for the Executable form does not attempt to + limit or alter the recipient's rights in the Source Code form from + the rights set forth in this License. If You distribute the + Covered Software in Executable form under a different license, You + must make it absolutely clear that any terms which differ from + this License are offered by You alone, not by the Initial + Developer or Contributor. You hereby agree to indemnify the + Initial Developer and every Contributor for any liability incurred + by the Initial Developer or such Contributor as a result of any + such terms You offer. + + 3.6. Larger Works. + + You may create a Larger Work by combining Covered Software with + other code not governed by the terms of this License and + distribute the Larger Work as a single product. In such a case, + You must make sure the requirements of this License are fulfilled + for the Covered Software. + +4. Versions of the License. + + 4.1. New Versions. + + Sun Microsystems, Inc. is the initial license steward and may + publish revised and/or new versions of this License from time to + time. Each version will be given a distinguishing version number. + Except as provided in Section 4.3, no one other than the license + steward has the right to modify this License. + + 4.2. Effect of New Versions. + + You may always continue to use, distribute or otherwise make the + Covered Software available under the terms of the version of the + License under which You originally received the Covered Software. + If the Initial Developer includes a notice in the Original + Software prohibiting it from being distributed or otherwise made + available under any subsequent version of the License, You must + distribute and make the Covered Software available under the terms + of the version of the License under which You originally received + the Covered Software. Otherwise, You may also choose to use, + distribute or otherwise make the Covered Software available under + the terms of any subsequent version of the License published by + the license steward. + + 4.3. Modified Versions. + + When You are an Initial Developer and You want to create a new + license for Your Original Software, You may create and use a + modified version of this License if You: (a) rename the license + and remove any references to the name of the license steward + (except to note that the license differs from this License); and + (b) otherwise make it clear that the license contains terms which + differ from this License. + +5. DISCLAIMER OF WARRANTY. + + COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" + BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, + INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED + SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR + PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND + PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY + COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE + INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY + NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF + WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF + ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS + DISCLAIMER. + +6. TERMINATION. + + 6.1. This License and the rights granted hereunder will terminate + automatically if You fail to comply with terms herein and fail to + cure such breach within 30 days of becoming aware of the breach. + Provisions which, by their nature, must remain in effect beyond + the termination of this License shall survive. + + 6.2. If You assert a patent infringement claim (excluding + declaratory judgment actions) against Initial Developer or a + Contributor (the Initial Developer or Contributor against whom You + assert such claim is referred to as "Participant") alleging that + the Participant Software (meaning the Contributor Version where + the Participant is a Contributor or the Original Software where + the Participant is the Initial Developer) directly or indirectly + infringes any patent, then any and all rights granted directly or + indirectly to You by such Participant, the Initial Developer (if + the Initial Developer is not the Participant) and all Contributors + under Sections 2.1 and/or 2.2 of this License shall, upon 60 days + notice from Participant terminate prospectively and automatically + at the expiration of such 60 day notice period, unless if within + such 60 day period You withdraw Your claim with respect to the + Participant Software against such Participant either unilaterally + or pursuant to a written agreement with Participant. + + 6.3. In the event of termination under Sections 6.1 or 6.2 above, + all end user licenses that have been validly granted by You or any + distributor hereunder prior to termination (excluding licenses + granted to You by any distributor) shall survive termination. + +7. LIMITATION OF LIABILITY. + + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE + INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF + COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE + LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR + CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT + LIMITATION, DAMAGES FOR LOST PROFITS, LOSS OF GOODWILL, WORK + STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL + INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT + APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO + NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR + CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT + APPLY TO YOU. + +8. U.S. GOVERNMENT END USERS. + + The Covered Software is a "commercial item," as that term is + defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial + computer software" (as that term is defined at 48 + C.F.R. 252.227-7014(a)(1)) and "commercial computer software + documentation" as such terms are used in 48 C.F.R. 12.212 + (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 + C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all + U.S. Government End Users acquire Covered Software with only those + rights set forth herein. This U.S. Government Rights clause is in + lieu of, and supersedes, any other FAR, DFAR, or other clause or + provision that addresses Government rights in computer software + under this License. + +9. MISCELLANEOUS. + + This License represents the complete agreement concerning subject + matter hereof. If any provision of this License is held to be + unenforceable, such provision shall be reformed only to the extent + necessary to make it enforceable. This License shall be governed + by the law of the jurisdiction specified in a notice contained + within the Original Software (except to the extent applicable law, + if any, provides otherwise), excluding such jurisdiction's + conflict-of-law provisions. Any litigation relating to this + License shall be subject to the jurisdiction of the courts located + in the jurisdiction and venue specified in a notice contained + within the Original Software, with the losing party responsible + for costs, including, without limitation, court costs and + reasonable attorneys' fees and expenses. The application of the + United Nations Convention on Contracts for the International Sale + of Goods is expressly excluded. Any law or regulation which + provides that the language of a contract shall be construed + against the drafter shall not apply to this License. You agree + that You alone are responsible for compliance with the United + States export administration regulations (and the export control + laws and regulation of any other countries) when You use, + distribute or otherwise make available any Covered Software. + +10. RESPONSIBILITY FOR CLAIMS. + + As between Initial Developer and the Contributors, each party is + responsible for claims and damages arising, directly or + indirectly, out of its utilization of rights under this License + and You agree to work with Initial Developer and Contributors to + distribute such responsibility on an equitable basis. Nothing + herein is intended or shall be deemed to constitute any admission + of liability. + +-------------------------------------------------------------------- + +NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND +DISTRIBUTION LICENSE (CDDL) + +For Covered Software in this distribution, this License shall +be governed by the laws of the State of California (excluding +conflict-of-law provisions). + +Any litigation relating to this License shall be subject to the +jurisdiction of the Federal Courts of the Northern District of +California and the state courts of the State of California, with +venue lying in Santa Clara County, California. Added: vendor-sys/opensolaris/dist/common/acl/acl_common.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor-sys/opensolaris/dist/common/acl/acl_common.c Wed Jul 18 08:12:04 2012 (r238567) @@ -0,0 +1,1755 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ +/* + * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. + */ + +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/avl.h> +#if defined(_KERNEL) +#include <sys/systm.h> +#include <sys/sysmacros.h> +#include <acl/acl_common.h> +#else +#include <errno.h> +#include <stdlib.h> +#include <stddef.h> +#include <strings.h> +#include <unistd.h> +#include <assert.h> +#include <grp.h> +#include <pwd.h> +#include <acl_common.h> +#define ASSERT assert +#endif + +#define ACE_POSIX_SUPPORTED_BITS (ACE_READ_DATA | \ + ACE_WRITE_DATA | ACE_APPEND_DATA | ACE_EXECUTE | \ + ACE_READ_ATTRIBUTES | ACE_READ_ACL | ACE_WRITE_ACL) + + +#define ACL_SYNCHRONIZE_SET_DENY 0x0000001 +#define ACL_SYNCHRONIZE_SET_ALLOW 0x0000002 +#define ACL_SYNCHRONIZE_ERR_DENY 0x0000004 +#define ACL_SYNCHRONIZE_ERR_ALLOW 0x0000008 + +#define ACL_WRITE_OWNER_SET_DENY 0x0000010 +#define ACL_WRITE_OWNER_SET_ALLOW 0x0000020 +#define ACL_WRITE_OWNER_ERR_DENY 0x0000040 +#define ACL_WRITE_OWNER_ERR_ALLOW 0x0000080 + +#define ACL_DELETE_SET_DENY 0x0000100 +#define ACL_DELETE_SET_ALLOW 0x0000200 +#define ACL_DELETE_ERR_DENY 0x0000400 +#define ACL_DELETE_ERR_ALLOW 0x0000800 + +#define ACL_WRITE_ATTRS_OWNER_SET_DENY 0x0001000 +#define ACL_WRITE_ATTRS_OWNER_SET_ALLOW 0x0002000 +#define ACL_WRITE_ATTRS_OWNER_ERR_DENY 0x0004000 +#define ACL_WRITE_ATTRS_OWNER_ERR_ALLOW 0x0008000 + +#define ACL_WRITE_ATTRS_WRITER_SET_DENY 0x0010000 +#define ACL_WRITE_ATTRS_WRITER_SET_ALLOW 0x0020000 +#define ACL_WRITE_ATTRS_WRITER_ERR_DENY 0x0040000 +#define ACL_WRITE_ATTRS_WRITER_ERR_ALLOW 0x0080000 + +#define ACL_WRITE_NAMED_WRITER_SET_DENY 0x0100000 +#define ACL_WRITE_NAMED_WRITER_SET_ALLOW 0x0200000 +#define ACL_WRITE_NAMED_WRITER_ERR_DENY 0x0400000 +#define ACL_WRITE_NAMED_WRITER_ERR_ALLOW 0x0800000 + +#define ACL_READ_NAMED_READER_SET_DENY 0x1000000 +#define ACL_READ_NAMED_READER_SET_ALLOW 0x2000000 +#define ACL_READ_NAMED_READER_ERR_DENY 0x4000000 +#define ACL_READ_NAMED_READER_ERR_ALLOW 0x8000000 + + +#define ACE_VALID_MASK_BITS (\ + ACE_READ_DATA | \ + ACE_LIST_DIRECTORY | \ + ACE_WRITE_DATA | \ + ACE_ADD_FILE | \ + ACE_APPEND_DATA | \ + ACE_ADD_SUBDIRECTORY | \ + ACE_READ_NAMED_ATTRS | \ + ACE_WRITE_NAMED_ATTRS | \ + ACE_EXECUTE | \ + ACE_DELETE_CHILD | \ + ACE_READ_ATTRIBUTES | \ + ACE_WRITE_ATTRIBUTES | \ + ACE_DELETE | \ + ACE_READ_ACL | \ + ACE_WRITE_ACL | \ + ACE_WRITE_OWNER | \ + ACE_SYNCHRONIZE) + +#define ACE_MASK_UNDEFINED 0x80000000 + +#define ACE_VALID_FLAG_BITS (ACE_FILE_INHERIT_ACE | \ + ACE_DIRECTORY_INHERIT_ACE | \ + ACE_NO_PROPAGATE_INHERIT_ACE | ACE_INHERIT_ONLY_ACE | \ + ACE_SUCCESSFUL_ACCESS_ACE_FLAG | ACE_FAILED_ACCESS_ACE_FLAG | \ + ACE_IDENTIFIER_GROUP | ACE_OWNER | ACE_GROUP | ACE_EVERYONE) + +/* + * ACL conversion helpers + */ + +typedef enum { + ace_unused, + ace_user_obj, + ace_user, + ace_group, /* includes GROUP and GROUP_OBJ */ + ace_other_obj +} ace_to_aent_state_t; + +typedef struct acevals { + uid_t key; + avl_node_t avl; + uint32_t mask; + uint32_t allowed; + uint32_t denied; + int aent_type; +} acevals_t; + +typedef struct ace_list { + acevals_t user_obj; + avl_tree_t user; + int numusers; + acevals_t group_obj; + avl_tree_t group; + int numgroups; + acevals_t other_obj; + uint32_t acl_mask; + int hasmask; + int dfacl_flag; + ace_to_aent_state_t state; + int seen; /* bitmask of all aclent_t a_type values seen */ +} ace_list_t; + +/* + * Generic shellsort, from K&R (1st ed, p 58.), somewhat modified. + * v = Ptr to array/vector of objs + * n = # objs in the array + * s = size of each obj (must be multiples of a word size) + * f = ptr to function to compare two objs + * returns (-1 = less than, 0 = equal, 1 = greater than + */ +void +ksort(caddr_t v, int n, int s, int (*f)()) +{ + int g, i, j, ii; + unsigned int *p1, *p2; + unsigned int tmp; + + /* No work to do */ + if (v == NULL || n <= 1) + return; + + /* Sanity check on arguments */ + ASSERT(((uintptr_t)v & 0x3) == 0 && (s & 0x3) == 0); + ASSERT(s > 0); + for (g = n / 2; g > 0; g /= 2) { + for (i = g; i < n; i++) { + for (j = i - g; j >= 0 && + (*f)(v + j * s, v + (j + g) * s) == 1; + j -= g) { + p1 = (void *)(v + j * s); + p2 = (void *)(v + (j + g) * s); + for (ii = 0; ii < s / 4; ii++) { + tmp = *p1; + *p1++ = *p2; + *p2++ = tmp; + } + } + } + } +} + +/* + * Compare two acls, all fields. Returns: + * -1 (less than) + * 0 (equal) + * +1 (greater than) + */ +int +cmp2acls(void *a, void *b) +{ + aclent_t *x = (aclent_t *)a; + aclent_t *y = (aclent_t *)b; + + /* Compare types */ + if (x->a_type < y->a_type) + return (-1); + if (x->a_type > y->a_type) + return (1); + /* Equal types; compare id's */ + if (x->a_id < y->a_id) + return (-1); + if (x->a_id > y->a_id) + return (1); + /* Equal ids; compare perms */ + if (x->a_perm < y->a_perm) + return (-1); + if (x->a_perm > y->a_perm) + return (1); + /* Totally equal */ + return (0); +} + +/*ARGSUSED*/ +static void * +cacl_realloc(void *ptr, size_t size, size_t new_size) +{ +#if defined(_KERNEL) + void *tmp; + + tmp = kmem_alloc(new_size, KM_SLEEP); + (void) memcpy(tmp, ptr, (size < new_size) ? size : new_size); + kmem_free(ptr, size); + return (tmp); +#else + return (realloc(ptr, new_size)); +#endif +} + +static int +cacl_malloc(void **ptr, size_t size) +{ +#if defined(_KERNEL) + *ptr = kmem_zalloc(size, KM_SLEEP); + return (0); +#else + *ptr = calloc(1, size); + if (*ptr == NULL) + return (errno); + + return (0); +#endif +} + +/*ARGSUSED*/ +static void +cacl_free(void *ptr, size_t size) +{ +#if defined(_KERNEL) + kmem_free(ptr, size); +#else + free(ptr); +#endif +} + +acl_t * +acl_alloc(enum acl_type type) +{ + acl_t *aclp; + + if (cacl_malloc((void **)&aclp, sizeof (acl_t)) != 0) + return (NULL); + + aclp->acl_aclp = NULL; + aclp->acl_cnt = 0; + + switch (type) { + case ACE_T: + aclp->acl_type = ACE_T; + aclp->acl_entry_size = sizeof (ace_t); + break; + case ACLENT_T: + aclp->acl_type = ACLENT_T; + aclp->acl_entry_size = sizeof (aclent_t); + break; + default: + acl_free(aclp); + aclp = NULL; + } + return (aclp); +} + +/* + * Free acl_t structure + */ +void +acl_free(acl_t *aclp) +{ + int acl_size; + + if (aclp == NULL) + return; + + if (aclp->acl_aclp) { + acl_size = aclp->acl_cnt * aclp->acl_entry_size; + cacl_free(aclp->acl_aclp, acl_size); + } + + cacl_free(aclp, sizeof (acl_t)); +} + +static uint32_t +access_mask_set(int haswriteperm, int hasreadperm, int isowner, int isallow) +{ + uint32_t access_mask = 0; + int acl_produce; + int synchronize_set = 0, write_owner_set = 0; + int delete_set = 0, write_attrs_set = 0; + int read_named_set = 0, write_named_set = 0; + + acl_produce = (ACL_SYNCHRONIZE_SET_ALLOW | + ACL_WRITE_ATTRS_OWNER_SET_ALLOW | + ACL_WRITE_ATTRS_WRITER_SET_DENY); + + if (isallow) { + synchronize_set = ACL_SYNCHRONIZE_SET_ALLOW; + write_owner_set = ACL_WRITE_OWNER_SET_ALLOW; + delete_set = ACL_DELETE_SET_ALLOW; + if (hasreadperm) + read_named_set = ACL_READ_NAMED_READER_SET_ALLOW; + if (haswriteperm) + write_named_set = ACL_WRITE_NAMED_WRITER_SET_ALLOW; + if (isowner) + write_attrs_set = ACL_WRITE_ATTRS_OWNER_SET_ALLOW; + else if (haswriteperm) + write_attrs_set = ACL_WRITE_ATTRS_WRITER_SET_ALLOW; + } else { + + synchronize_set = ACL_SYNCHRONIZE_SET_DENY; + write_owner_set = ACL_WRITE_OWNER_SET_DENY; + delete_set = ACL_DELETE_SET_DENY; + if (hasreadperm) + read_named_set = ACL_READ_NAMED_READER_SET_DENY; + if (haswriteperm) + write_named_set = ACL_WRITE_NAMED_WRITER_SET_DENY; + if (isowner) + write_attrs_set = ACL_WRITE_ATTRS_OWNER_SET_DENY; + else if (haswriteperm) + write_attrs_set = ACL_WRITE_ATTRS_WRITER_SET_DENY; + else + /* + * If the entity is not the owner and does not + * have write permissions ACE_WRITE_ATTRIBUTES will + * always go in the DENY ACE. + */ + access_mask |= ACE_WRITE_ATTRIBUTES; + } + + if (acl_produce & synchronize_set) + access_mask |= ACE_SYNCHRONIZE; + if (acl_produce & write_owner_set) + access_mask |= ACE_WRITE_OWNER; + if (acl_produce & delete_set) + access_mask |= ACE_DELETE; + if (acl_produce & write_attrs_set) + access_mask |= ACE_WRITE_ATTRIBUTES; + if (acl_produce & read_named_set) + access_mask |= ACE_READ_NAMED_ATTRS; + if (acl_produce & write_named_set) + access_mask |= ACE_WRITE_NAMED_ATTRS; + + return (access_mask); +} + +/* + * Given an mode_t, convert it into an access_mask as used + * by nfsace, assuming aclent_t -> nfsace semantics. + */ +static uint32_t +mode_to_ace_access(mode_t mode, int isdir, int isowner, int isallow) +{ + uint32_t access = 0; + int haswriteperm = 0; + int hasreadperm = 0; + + if (isallow) { + haswriteperm = (mode & S_IWOTH); + hasreadperm = (mode & S_IROTH); + } else { + haswriteperm = !(mode & S_IWOTH); + hasreadperm = !(mode & S_IROTH); + } + + /* + * The following call takes care of correctly setting the following + * mask bits in the access_mask: + * ACE_SYNCHRONIZE, ACE_WRITE_OWNER, ACE_DELETE, + * ACE_WRITE_ATTRIBUTES, ACE_WRITE_NAMED_ATTRS, ACE_READ_NAMED_ATTRS + */ + access = access_mask_set(haswriteperm, hasreadperm, isowner, isallow); + + if (isallow) { + access |= ACE_READ_ACL | ACE_READ_ATTRIBUTES; + if (isowner) + access |= ACE_WRITE_ACL; + } else { + if (! isowner) + access |= ACE_WRITE_ACL; + } + + /* read */ + if (mode & S_IROTH) { + access |= ACE_READ_DATA; + } + /* write */ + if (mode & S_IWOTH) { + access |= ACE_WRITE_DATA | + ACE_APPEND_DATA; + if (isdir) + access |= ACE_DELETE_CHILD; + } + /* exec */ + if (mode & 01) { + access |= ACE_EXECUTE; + } + + return (access); +} + +/* + * Given an nfsace (presumably an ALLOW entry), make a + * corresponding DENY entry at the address given. + */ +static void +ace_make_deny(ace_t *allow, ace_t *deny, int isdir, int isowner) +{ + (void) memcpy(deny, allow, sizeof (ace_t)); + + deny->a_who = allow->a_who; + + deny->a_type = ACE_ACCESS_DENIED_ACE_TYPE; + deny->a_access_mask ^= ACE_POSIX_SUPPORTED_BITS; + if (isdir) + deny->a_access_mask ^= ACE_DELETE_CHILD; + + deny->a_access_mask &= ~(ACE_SYNCHRONIZE | ACE_WRITE_OWNER | + ACE_DELETE | ACE_WRITE_ATTRIBUTES | ACE_READ_NAMED_ATTRS | + ACE_WRITE_NAMED_ATTRS); + deny->a_access_mask |= access_mask_set((allow->a_access_mask & + ACE_WRITE_DATA), (allow->a_access_mask & ACE_READ_DATA), isowner, + B_FALSE); +} +/* + * Make an initial pass over an array of aclent_t's. Gather + * information such as an ACL_MASK (if any), number of users, + * number of groups, and whether the array needs to be sorted. + */ +static int +ln_aent_preprocess(aclent_t *aclent, int n, + int *hasmask, mode_t *mask, + int *numuser, int *numgroup, int *needsort) +{ + int error = 0; + int i; + int curtype = 0; + + *hasmask = 0; + *mask = 07; + *needsort = 0; + *numuser = 0; + *numgroup = 0; + + for (i = 0; i < n; i++) { + if (aclent[i].a_type < curtype) + *needsort = 1; + else if (aclent[i].a_type > curtype) + curtype = aclent[i].a_type; + if (aclent[i].a_type & USER) + (*numuser)++; + if (aclent[i].a_type & (GROUP | GROUP_OBJ)) + (*numgroup)++; + if (aclent[i].a_type & CLASS_OBJ) { + if (*hasmask) { + error = EINVAL; + goto out; + } else { + *hasmask = 1; + *mask = aclent[i].a_perm; + } + } + } + + if ((! *hasmask) && (*numuser + *numgroup > 1)) { + error = EINVAL; + goto out; + } + +out: + return (error); +} + +/* + * Convert an array of aclent_t into an array of nfsace entries, + * following POSIX draft -> nfsv4 conversion semantics as outlined in + * the IETF draft. + */ +static int +ln_aent_to_ace(aclent_t *aclent, int n, ace_t **acepp, int *rescount, int isdir) +{ + int error = 0; + mode_t mask; + int numuser, numgroup, needsort; + int resultsize = 0; + int i, groupi = 0, skip; + ace_t *acep, *result = NULL; + int hasmask; + + error = ln_aent_preprocess(aclent, n, &hasmask, &mask, + &numuser, &numgroup, &needsort); + if (error != 0) + goto out; + + /* allow + deny for each aclent */ + resultsize = n * 2; + if (hasmask) { + /* + * stick extra deny on the group_obj and on each + * user|group for the mask (the group_obj was added + * into the count for numgroup) + */ + resultsize += numuser + numgroup; + /* ... and don't count the mask itself */ + resultsize -= 2; + } + + /* sort the source if necessary */ + if (needsort) + ksort((caddr_t)aclent, n, sizeof (aclent_t), cmp2acls); + + if (cacl_malloc((void **)&result, resultsize * sizeof (ace_t)) != 0) + goto out; + + acep = result; + + for (i = 0; i < n; i++) { + /* + * don't process CLASS_OBJ (mask); mask was grabbed in + * ln_aent_preprocess() + */ + if (aclent[i].a_type & CLASS_OBJ) + continue; + + /* If we need an ACL_MASK emulator, prepend it now */ + if ((hasmask) && + (aclent[i].a_type & (USER | GROUP | GROUP_OBJ))) { + acep->a_type = ACE_ACCESS_DENIED_ACE_TYPE; + acep->a_flags = 0; + if (aclent[i].a_type & GROUP_OBJ) { + acep->a_who = (uid_t)-1; + acep->a_flags |= + (ACE_IDENTIFIER_GROUP|ACE_GROUP); + } else if (aclent[i].a_type & USER) { + acep->a_who = aclent[i].a_id; + } else { + acep->a_who = aclent[i].a_id; + acep->a_flags |= ACE_IDENTIFIER_GROUP; + } + if (aclent[i].a_type & ACL_DEFAULT) { + acep->a_flags |= ACE_INHERIT_ONLY_ACE | + ACE_FILE_INHERIT_ACE | + ACE_DIRECTORY_INHERIT_ACE; + } + /* + * Set the access mask for the prepended deny + * ace. To do this, we invert the mask (found + * in ln_aent_preprocess()) then convert it to an + * DENY ace access_mask. + */ + acep->a_access_mask = mode_to_ace_access((mask ^ 07), + isdir, 0, 0); + acep += 1; + } + + /* handle a_perm -> access_mask */ + acep->a_access_mask = mode_to_ace_access(aclent[i].a_perm, + isdir, aclent[i].a_type & USER_OBJ, 1); + + /* emulate a default aclent */ + if (aclent[i].a_type & ACL_DEFAULT) { + acep->a_flags |= ACE_INHERIT_ONLY_ACE | + ACE_FILE_INHERIT_ACE | + ACE_DIRECTORY_INHERIT_ACE; + } + + /* + * handle a_perm and a_id + * + * this must be done last, since it involves the + * corresponding deny aces, which are handled + * differently for each different a_type. + */ + if (aclent[i].a_type & USER_OBJ) { + acep->a_who = (uid_t)-1; + acep->a_flags |= ACE_OWNER; + ace_make_deny(acep, acep + 1, isdir, B_TRUE); + acep += 2; + } else if (aclent[i].a_type & USER) { + acep->a_who = aclent[i].a_id; + ace_make_deny(acep, acep + 1, isdir, B_FALSE); + acep += 2; + } else if (aclent[i].a_type & (GROUP_OBJ | GROUP)) { + if (aclent[i].a_type & GROUP_OBJ) { + acep->a_who = (uid_t)-1; + acep->a_flags |= ACE_GROUP; + } else { *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207180812.q6I8C5vK044224>