xref: /titanic_44/usr/src/lib/libsec/common/aclutils.h (revision ebd1706e95186ddae1d4c0d63c47544cf33832ee)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _ACLUTILS_H
28 #define	_ACLUTILS_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #define	ACL_REMOVE_ALL		0x0
39 #define	ACL_REMOVE_FIRST	0x1
40 
41 /*
42  * Hint for whether acl_totext() should use
43  * mneumonics:
44  * read_data/list_directory
45  * write_data/add_file or
46  * append_data/add_subdirectory
47  * when object of ACL is known.
48  */
49 #define	ACL_IS_DIR	0x2
50 
51 typedef enum acl_type {
52 	ACLENT_T = 0,
53 	ACE_T = 1
54 } acl_type_t;
55 
56 /*
57  * acl flags
58  */
59 #define	ACL_IS_TRIVIAL	0x1
60 
61 struct acl_info {
62 	acl_type_t acl_type;		/* style of acl */
63 	int acl_cnt;			/* number of acl entries */
64 	int acl_entry_size;		/* sizeof acl entry */
65 	int acl_flags;			/* special flags about acl */
66 	void *acl_aclp;			/* the acl */
67 };
68 
69 
70 extern int acl_addentries(acl_t *, acl_t *, int);
71 extern int acl_removeentries(acl_t *, acl_t *, int, int);
72 extern int acl_modifyentries(acl_t *, acl_t *, int);
73 extern void acl_printacl(acl_t *, int);
74 extern char *acl_strerror(int);
75 extern acl_t *acl_dup(acl_t *);
76 extern int acl_type(acl_t *);
77 extern int acl_cnt(acl_t *);
78 extern int acl_flags(acl_t *);
79 extern void *acl_data(acl_t *);
80 
81 #ifdef	__cplusplus
82 }
83 #endif
84 
85 #endif /* _ACLUTILS_H */
86