chacl.c revision bd7c6f51f14365fc31d408903b38c02177384d3d
/*
* 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
* 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 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* (just for testing - not installed)
*
* Works like chmod(1), but only supporting A=... forms.
*
* Some more test cases:
* A=user:2147483649:rwxpdDaARWcCos::allow,
* user:2147483653:raRcs::allow,
* everyone@:raRcs::allow
*/
#include <sys/acl_impl.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <aclutils.h>
#include <netsmb/smbfs_acl.h>
char *progname;
int Vflag;
static const char Usage[] =
"Usage: %s [-v] [-u UID] [-g GID] A=ACL... file ...\n"
"\twhere A=ACL is like chmod(1)\n";
void
usage(void)
{
exit(1);
}
int
{
char *acl_arg;
int c, error;
switch (c) {
case 'v':
Vflag++;
break;
case 'u':
if (tl == 0)
goto badopt;
break;
case 'g':
if (tl == 0)
goto badopt;
break;
case ':':
progname, c);
usage();
break;
default:
progname, c);
usage();
break;
}
}
usage();
/*
* Ask libsec to parse the ACL arg.
*/
usage();
if (error) {
exit(1);
}
exit(1);
}
/*
* Which parts of the SD are being modified?
*/
selector = 0;
if (acl)
usage();
done:
return (0);
}
void
{
/*
* OK, try setting the ACL (via ioctl). Open
* read-only because we're NOT writing data.
* The driver will re-open with the necessary
* access rights to set the ACL.
*/
if (fd < 0) {
exit(1);
}
/*
* If not setting owner or group, we need the
* current owner and group for translating
* references via owner@ or group@ ACEs.
*/
exit(1);
}
}
/*
* Convert the ZFS ACL to an NT SD.
*/
if (error) {
exit(1);
}
if (Vflag) {
/*
* Print the SD in ZFS form.
*/
printf("Solaris security data:\n");
printf("owner: -1\n");
else
printf("group: -1\n");
else
printf("\n");
/*
* Print the SD in Windows form.
*/
printf("CIFS security data:\n");
printf("\n");
}
if (error) {
exit(1);
}
}