bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * CDDL HEADER START
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * The contents of this file are subject to the terms of the
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Common Development and Distribution License (the "License").
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * You may not use this file except in compliance with the License.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * See the License for the specific language governing permissions
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * and limitations under the License.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * When distributing Covered Code, include this CDDL HEADER in each
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * If applicable, add the following below this CDDL HEADER, with the
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * fields enclosed by brackets "[]" replaced with your own identifying
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * information: Portions Copyright [yyyy] [name of copyright owner]
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * CDDL HEADER END
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Use is subject to license terms.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * This is the smbfs/chacl command.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * (just for testing - not installed)
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Works like chmod(1), but only supporting A=... forms.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * i.e. chacl A=everyone@:full_set:fd:allow /mnt/foo
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Some more test cases:
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * A=user:2147483649:rwxpdDaARWcCos::allow,
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * user:2147483653:raRcs::allow,
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * everyone@:raRcs::allow
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Rossvoid chacl(char *, uint32_t, uid_t, gid_t, acl_t *);
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross "Usage: %s [-v] [-u UID] [-g GID] A=ACL... file ...\n"
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross "\twhere A=ACL is like chmod(1)\n";
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross while ((c = getopt(argc, argv, "vu:g:")) != -1) {
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross switch (c) {
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Ask libsec to parse the ACL arg.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Which parts of the SD are being modified?
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Rosschacl(char *file, uint32_t selector, uid_t uid, gid_t gid, acl_t *acl)
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * OK, try setting the ACL (via ioctl). Open
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * read-only because we're NOT writing data.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * The driver will re-open with the necessary
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * access rights to set the ACL.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * If not setting owner or group, we need the
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * current owner and group for translating
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * references via owner@ or group@ ACEs.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Convert the ZFS ACL to an NT SD.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross error = smbfs_acl_zfs2sd(acl, uid, gid, selector, &sd);
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross fprintf(stderr, "%s: failed to convert ACL\n", progname);
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Print the SD in ZFS form.
bd7c6f51f14365fc31d408903b38c02177384d3dGordon Ross * Print the SD in Windows form.