/*
* 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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*LINTLIBRARY*/
/*
* aclcheck(): check validity of an ACL
* A valid ACL is defined as follows:
* There must be exactly one USER_OBJ, GROUP_OBJ, and OTHER_OBJ entry.
* If there are any USER entries, then the user id must be unique.
* If there are any GROUP entries, then the group id must be unique.
* If there are any GROUP or USER entries, there must be exactly one
* CLASS_OBJ entry.
* The same rules apply to default ACL entries.
*/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <aclutils.h>
struct entry {
int count;
};
struct entry_stat {
};
static void free_mem(struct entry_stat *);
static int
{
int cnt;
*which = -1;
case USER_OBJ:
/* check uniqueness */
return (EACL_USER_ERROR);
}
break;
case GROUP_OBJ:
/* check uniqueness */
return (EACL_GRP_ERROR);
}
break;
case OTHER_OBJ:
/* check uniqueness */
return (EACL_OTHER_ERROR);
}
break;
case CLASS_OBJ:
/* check uniqueness */
return (EACL_CLASS_ERROR);
}
break;
case USER:
case GROUP:
case DEF_USER:
case DEF_GROUP:
/* check duplicate */
} else {
}
if (cnt == 0) {
return (EACL_MEM_ERROR);
} else {
&tally) == -1) {
return (EACL_DUPLICATE_ERROR);
}
}
break;
case DEF_USER_OBJ:
/* check uniqueness */
return (EACL_USER_ERROR);
}
break;
case DEF_GROUP_OBJ:
/* check uniqueness */
return (EACL_GRP_ERROR);
}
break;
case DEF_OTHER_OBJ:
/* check uniqueness */
return (EACL_OTHER_ERROR);
}
break;
case DEF_CLASS_OBJ:
/* check uniqueness */
return (EACL_CLASS_ERROR);
}
break;
default:
return (EACL_ENTRY_ERROR);
}
}
/* If there are group or user entries, there must be one class entry */
return (EACL_MISS_ERROR);
}
/* same is true for default entries */
return (EACL_MISS_ERROR);
}
/* there must be exactly one user_obj, group_obj, and other_obj entry */
return (EACL_MISS_ERROR);
}
/* has default? same rules apply to default entries */
/*
* Can't have default ACL's on non-directories
*/
if (isdir == 0) {
return (EACL_INHERIT_NOTDIR);
}
return (EACL_MISS_ERROR);
}
}
return (0);
}
int
{
}
static void
{
}
static int
{
int i;
for (i = 0; i < count; i++) {
return (-1);
}
}
return (0);
}
static int
{
int i;
int error = 0;
/*
* step through all valid flags.
*/
return (EACL_COUNT_ERROR);
case 0:
case ACE_OWNER:
case ACE_EVERYONE:
case ACE_IDENTIFIER_GROUP:
break;
default:
return (EACL_FLAGS_ERROR);
}
/*
* INHERIT_ONLY/NO_PROPAGATE need a to INHERIT_FILE
* or INHERIT_DIR also
*/
ACE_DIRECTORY_INHERIT_ACE)) == 0) {
return (EACL_INHERIT_ERROR);
}
break;
}
break;
default:
return (EACL_ENTRY_ERROR);
}
return (EACL_PERM_MASK_ERROR);
}
}
return (0);
}
int
{
int error;
int where;
case ACLENT_T:
break;
case ACE_T:
break;
default:
}
return (error);
}