xref: /illumos-gate/usr/src/test/libsec-tests/cmd/acl_canned.c (revision 606d76de63f7f3335e75e7f3eb3fba75c8998690)
1 /*
2  * This file and its contents are supplied under the terms of the
3  * Common Development and Distribution License ("CDDL"), version 1.0.
4  * You may only use this file in accordance with the terms of version
5  * 1.0 of the CDDL.
6  *
7  * A full copy of the text of the CDDL should have accompanied this
8  * source.  A copy of the CDDL is also available via the Internet at
9  * http://www.illumos.org/license/CDDL.
10  */
11 
12 /*
13  * Copyright 2024 RackTop Systems, Inc.
14  */
15 
16 /*
17  * ACL data for libsec tests
18  */
19 
20 #include <sys/types.h>
21 #include <sys/acl.h>
22 
23 #define	AF_U	ACE_FILE_INHERIT_ACE | ACE_DIRECTORY_INHERIT_ACE
24 #define	AF_G	ACE_FILE_INHERIT_ACE | ACE_DIRECTORY_INHERIT_ACE |\
25 		ACE_IDENTIFIER_GROUP
26 
27 /*
28  * This ACL contains a wide variety of users and groups,
29  * some without names, or SIDs, etc. for test coverage.
30  * See known users and groups in lib_stubs.c
31  */
32 ace_t aces_canned[] = {
33 	{
34 		.a_who = -1,
35 		.a_access_mask = ACE_ALL_PERMS,
36 		.a_flags = AF_U | ACE_OWNER,
37 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
38 	},
39 	{
40 		.a_who = -1,
41 		.a_access_mask = ACE_WRITE_PERMS,
42 		.a_flags = AF_G | ACE_GROUP,
43 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
44 	},
45 	{
46 		.a_who = -1,
47 		.a_access_mask = ACE_WRITE_PERMS,
48 		.a_flags = ACE_EVERYONE,
49 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
50 	},
51 	{
52 		.a_who = 501,
53 		.a_access_mask = ACE_ALL_PERMS,
54 		.a_flags = AF_U,
55 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
56 	},
57 	{
58 		.a_who = 502,
59 		.a_access_mask = ACE_WRITE_PERMS,
60 		.a_flags = AF_G,
61 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
62 	},
63 	{
64 		.a_who = 0x80000001,
65 		.a_access_mask = ACE_ALL_PERMS,
66 		.a_flags = AF_U,
67 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
68 	},
69 	{
70 		.a_who = 0x80000002,
71 		.a_access_mask = ACE_WRITE_PERMS,
72 		.a_flags = AF_G,
73 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
74 	},
75 	{
76 		.a_who = 0x80000003,
77 		.a_access_mask = ACE_READ_PERMS,
78 		.a_flags = AF_G,
79 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
80 	},
81 	{
82 		.a_who = 0x80000004,
83 		.a_access_mask = ACE_READ_PERMS,
84 		.a_flags = AF_G,
85 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
86 	},
87 	{
88 		.a_who = 0x80000005,
89 		.a_access_mask = ACE_READ_PERMS,
90 		.a_flags = AF_G,
91 		.a_type = ACE_ACCESS_ALLOWED_ACE_TYPE
92 	}
93 };
94 
95 acl_t acl_canned = {
96 	.acl_type = ACE_T,
97 	.acl_cnt = sizeof (aces_canned) / sizeof (aces_canned[0]),
98 	.acl_entry_size = sizeof (ace_t),
99 	.acl_flags = 0,
100 	.acl_aclp = aces_canned
101 };
102