acl.c revision fa9e4066f08beec538e775443c5be79dd423fcab
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (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 2005 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Portions of this source code were derived from Berkeley 4.3 BSD
* under license from the Regents of the University of California.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/isa_defs.h>
#include <sys/sysmacros.h>
#include <sys/pathname.h>
#include <acl/acl_common.h>
/*
*/
int
{
int error;
int rv = 0;
/* Sanity check arguments */
if (error) {
goto lookup;
}
if (error) {
goto lookup;
}
return (rv);
}
/*
*/
int
{
int error;
int rv = 0;
#ifdef C2_AUDIT
}
#endif /* C2_AUDIT */
if (error)
return (rv);
}
/*
* Common code for acl() and facl().
*/
static int
{
int error;
int aclbsize; /* size of acl list in bytes */
int dfaclbsize; /* size of default acl list in bytes */
int numacls;
switch (cmd) {
case ACE_GETACLCNT:
case GETACLCNT:
else
return (error);
}
}
break;
case GETACL:
/*
* Minimum ACL size is three entries so might as well
* bail out here.
*/
if (nentries < 3)
return (EINVAL);
/*
* NULL output buffer is also a pretty easy bail out.
*/
return (EFAULT);
return (error);
/* Check user's buffer is big enough */
goto errout;
}
/* Sort the acl & default acl lists */
/* Copy out acl's */
if (aclbsize > 0) { /* bug #1262490 */
goto errout;
}
}
/* Copy out default acl's */
if (dfaclbsize > 0) {
uaddrp, dfaclbsize)) {
goto errout;
}
}
if (vsecattr.vsa_aclcnt) {
}
if (vsecattr.vsa_dfaclcnt) {
}
break;
case ACE_GETACL:
return (EFAULT);
return (error);
goto errout;
}
if (aclbsize > 0) {
goto errout;
}
}
if (vsecattr.vsa_aclcnt) {
}
break;
case SETACL:
/*
* Minimum ACL size is three entries so might as well
* bail out here. Also limit request size to prevent user
* from allocating too much kernel memory. Maximum size
* is MAX_ACL_ENTRIES for the ACL part and MAX_ACL_ENTRIES
* for the default ACL part. (bug 4058667)
*/
return (EINVAL);
/*
* NULL output buffer is also an easy bail out.
*/
return (EFAULT);
return (EFAULT);
}
/* Sort the acl list */
/* Break into acl and default acl lists */
break;
}
/* Find where defaults start (if any) */
}
/* Adjust if they're all defaults */
if (vsecattr.vsa_aclcnt == 0) {
}
/* Only directories can have defaults */
return (ENOTDIR);
}
return (error);
}
/*
* Should return 0 upon success according to the man page
* and SVR4 semantics. (Bug #1214399: SETACL returns wrong rc)
*/
*rv = 0;
break;
case ACE_SETACL:
if (nentries > (MAX_ACL_ENTRIES))
return (EINVAL);
return (EFAULT);
return (EFAULT);
}
return (error);
}
*rv = 0;
break;
default:
return (EINVAL);
}
return (0);
return (error);
}