1789Sahrens /*
2789Sahrens  * CDDL HEADER START
3789Sahrens  *
4789Sahrens  * The contents of this file are subject to the terms of the
51953Smarks  * Common Development and Distribution License (the "License").
61953Smarks  * You may not use this file except in compliance with the License.
7789Sahrens  *
8789Sahrens  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9789Sahrens  * or http://www.opensolaris.org/os/licensing.
10789Sahrens  * See the License for the specific language governing permissions
11789Sahrens  * and limitations under the License.
12789Sahrens  *
13789Sahrens  * When distributing Covered Code, include this CDDL HEADER in each
14789Sahrens  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15789Sahrens  * If applicable, add the following below this CDDL HEADER, with the
16789Sahrens  * fields enclosed by brackets "[]" replaced with your own identifying
17789Sahrens  * information: Portions Copyright [yyyy] [name of copyright owner]
18789Sahrens  *
19789Sahrens  * CDDL HEADER END
20789Sahrens  */
21789Sahrens /*
22*5331Samw  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
23789Sahrens  * Use is subject to license terms.
24789Sahrens  */
25789Sahrens 
26789Sahrens #ifndef _ACLUTILS_H
27789Sahrens #define	_ACLUTILS_H
28789Sahrens 
29789Sahrens #pragma ident	"%Z%%M%	%I%	%E% SMI"
30789Sahrens 
31789Sahrens #include <sys/types.h>
32*5331Samw #include <sys/acl.h>
331420Smarks #include <strings.h>
341420Smarks #include <locale.h>
351420Smarks #include <ctype.h>
361420Smarks #include <grp.h>
371420Smarks #include <pwd.h>
38789Sahrens 
39789Sahrens #ifdef	__cplusplus
40789Sahrens extern "C" {
41789Sahrens #endif
42789Sahrens 
43789Sahrens #define	ACL_REMOVE_ALL		0x0
44789Sahrens #define	ACL_REMOVE_FIRST	0x1
45789Sahrens 
46789Sahrens /*
47789Sahrens  * Hint for whether acl_totext() should use
482097Ssjelinek  * mnemonics:
49789Sahrens  * read_data/list_directory
50789Sahrens  * write_data/add_file or
51789Sahrens  * append_data/add_subdirectory
52789Sahrens  * when object of ACL is known.
53789Sahrens  */
54789Sahrens 
551420Smarks #define	PERM_TYPE_ACE		0x1	/* permissions are of ACE type */
561420Smarks #define	PERM_TYPE_UNKNOWN	0x2	/* permission type not yet known */
571420Smarks #define	PERM_TYPE_EMPTY		0x4	/* no permissions are specified */
581420Smarks 
591420Smarks struct acl_perm_type {
601420Smarks 	int		perm_style;	/* type of perm style, see above */
611420Smarks 	char		*perm_str;	/* string value being returned */
621420Smarks 	uint32_t	perm_val;	/* numeric value being returned */
631420Smarks };
641420Smarks 
651420Smarks extern char *yybuf;
661420Smarks extern acl_t *yyacl;
671420Smarks 
681420Smarks extern int yyerror(const char *);
691420Smarks extern int get_id(int entry_type, char *name, int *id);
701420Smarks extern int ace_entry_type(int entry_type);
711420Smarks extern int aclent_entry_type(int type, int owning, int *ret);
721420Smarks extern int ace_perm_mask(struct acl_perm_type *, uint32_t *mask);
731420Smarks extern int compute_aclent_perms(char *str, o_mode_t *mask);
741420Smarks extern int compute_ace_inherit(char *str, uint32_t *imask);
75789Sahrens extern int acl_addentries(acl_t *, acl_t *, int);
76789Sahrens extern int acl_removeentries(acl_t *, acl_t *, int, int);
77789Sahrens extern int acl_modifyentries(acl_t *, acl_t *, int);
781420Smarks extern void acl_printacl(acl_t *, int, int);
79789Sahrens extern char *acl_strerror(int);
80789Sahrens extern acl_t *acl_dup(acl_t *);
81789Sahrens extern int acl_type(acl_t *);
82789Sahrens extern int acl_cnt(acl_t *);
83789Sahrens extern int acl_flags(acl_t *);
84789Sahrens extern void *acl_data(acl_t *);
851420Smarks extern void acl_error(const char *, ...);
861420Smarks extern int acl_parse(const char *, acl_t **);
871420Smarks extern int yyparse(void);
881420Smarks extern void yyreset(void);
891953Smarks extern acl_t *acl_to_aclp(enum acl_type, void *, int);
90789Sahrens 
91789Sahrens #ifdef	__cplusplus
92789Sahrens }
93789Sahrens #endif
94789Sahrens 
95789Sahrens #endif /* _ACLUTILS_H */
96