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
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.
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]
23 * Copyright 1994,2001-2003 Sun Microsystems, Inc.
24 * All rights reserved.
25 * Use is subject to license terms.
29 * ident "%Z%%M% %I% %E% SMI"
32 const NFS_ACL_MAX_ENTRIES = 1024;
35 typedef unsigned short o_mode;
38 * This is the format of an ACL which is passed over the network.
47 * The values for the type element of the aclent structure.
49 const NA_USER_OBJ = 0x1; /* object owner */
50 const NA_USER = 0x2; /* additional users */
51 const NA_GROUP_OBJ = 0x4; /* owning group of the object */
52 const NA_GROUP = 0x8; /* additional groups */
53 const NA_CLASS_OBJ = 0x10; /* file group class and mask entry */
54 const NA_OTHER_OBJ = 0x20; /* other entry for the object */
55 const NA_ACL_DEFAULT = 0x1000; /* default flag */
58 * The bit field values for the perm element of the aclent
59 * structure. The three values can be combined to form any
60 * of the 8 combinations.
62 const NA_READ = 0x4; /* read permission */
63 const NA_WRITE = 0x2; /* write permission */
64 const NA_EXEC = 0x1; /* exec permission */
67 * This is the structure which contains the ACL entries for a
68 * particular entity. It contains the ACL entries which apply
69 * to this object plus any default ACL entries which are
70 * inherited by its children.
72 * The values for the mask field are defined below.
77 aclent aclent<NFS_ACL_MAX_ENTRIES>;
79 aclent dfaclent<NFS_ACL_MAX_ENTRIES>;
83 * The values for the mask element of the secattr struct as well
84 * as for the mask element in the arguments in the GETACL2 and
87 const NA_ACL = 0x1; /* aclent contains a valid list */
88 const NA_ACLCNT = 0x2; /* the number of entries in the aclent list */
89 const NA_DFACL = 0x4; /* dfaclent contains a valid list */
90 const NA_DFACLCNT = 0x8; /* the number of entries in the dfaclent list */
93 * This the definition for the GETACL procedure which applies to
101 struct GETACL2resok {
102 struct nfsfattr attr;
106 union GETACL2res switch (enum nfsstat status) {
114 * This is the definition for the SETACL procedure which applies
122 struct SETACL2resok {
123 struct nfsfattr attr;
126 union SETACL2res switch (enum nfsstat status) {
134 * This is the definition for the GETATTR procedure which can be
135 * used as an alternative to the GETATTR in NFS Version 2. The
136 * main difference between this GETATTR and the NFS GETATTR is
137 * that this GETATTR returns the mode of the file without it being
138 * changed to match the min/max permissions mapping that the NFS
139 * Version 2 server does.
141 struct GETATTR2args {
145 struct GETATTR2resok {
146 struct nfsfattr attr;
149 union GETATTR2res switch (enum nfsstat status) {
157 * This is the definition for the ACCESS procedure which applies
166 * The following access permissions may be requested:
168 const ACCESS2_READ = 0x1; /* read data or readdir a directory */
169 const ACCESS2_LOOKUP = 0x2; /* lookup a name in a directory */
170 const ACCESS2_MODIFY = 0x4; /* rewrite existing file data or */
171 /* modify existing directory entries */
172 const ACCESS2_EXTEND = 0x8; /* write new data or add directory entries */
173 const ACCESS2_DELETE = 0x10; /* delete existing directory entry */
174 const ACCESS2_EXECUTE = 0x20; /* execute file (no meaning for a directory) */
176 struct ACCESS2resok {
177 struct nfsfattr attr;
181 union ACCESS2res switch (enum nfsstat status) {
189 * This is the definition for the GETXATTRDIR procedure which applies
190 * to NFS Version 2 files.
192 struct GETXATTRDIR2args {
197 struct GETXATTRDIR2resok {
199 struct nfsfattr attr;
202 union GETXATTRDIR2res switch (enum nfsstat status) {
204 GETXATTRDIR2resok resok;
210 * This is the definition for the GETACL procedure which applies
211 * to NFS Version 3 files.
218 struct GETACL3resok {
223 struct GETACL3resfail {
227 union GETACL3res switch (nfsstat3 status) {
231 GETACL3resfail resfail;
235 * This is the definition for the SETACL procedure which applies
236 * to NFS Version 3 files.
243 struct SETACL3resok {
247 struct SETACL3resfail {
251 union SETACL3res switch (nfsstat3 status) {
255 SETACL3resfail resfail;
259 * This is the definition for the GETXATTRDIR procedure which applies
260 * to NFS Version 3 files.
262 struct GETXATTRDIR3args {
267 struct GETXATTRDIR3resok {
272 union GETXATTRDIR3res switch (nfsstat3 status) {
274 GETXATTRDIR3resok resok;
281 * This is a transitional interface to enable Solaris NFSv4
282 * clients to manipulate ACLs on Solaris servers until the
283 * spec is complete enough to implement this inside the
284 * NFSv4 protocol itself. NFSv4 does handle extended
285 * attributes in-band.
289 * This is the definition for the GETACL procedure which applies
290 * to NFS Version 4 files.
297 struct GETACL4resok {
302 struct GETACL4resfail {
306 union GETACL4res switch (nfsstat3 status) {
310 GETACL4resfail resfail;
314 * This is the definition for the SETACL procedure which applies
315 * to NFS Version 4 files.
322 struct SETACL4resok {
326 struct SETACL4resfail {
330 union SETACL4res switch (nfsstat3 status) {
334 SETACL4resfail resfail;
340 * Share the port with the NFS service. NFS has to be running
341 * in order for this service to be useful anyway.
343 const NFS_ACL_PORT = 2049;
346 * This is the definition for the ACL network protocol which is used
347 * to provide support for Solaris ACLs for files which are accessed
348 * via NFS Version 2 and NFS Version 3.
350 program NFS_ACL_PROGRAM {
353 ACLPROC2_NULL(void) = 0;
355 ACLPROC2_GETACL(GETACL2args) = 1;
357 ACLPROC2_SETACL(SETACL2args) = 2;
359 ACLPROC2_GETATTR(GETATTR2args) = 3;
361 ACLPROC2_ACCESS(ACCESS2args) = 4;
363 ACLPROC2_GETXATTRDIR(GETXATTRDIR2args) = 5;
367 ACLPROC3_NULL(void) = 0;
369 ACLPROC3_GETACL(GETACL3args) = 1;
371 ACLPROC3_SETACL(SETACL3args) = 2;
373 ACLPROC3_GETXATTRDIR(GETXATTRDIR3args) = 3;
377 ACLPROC4_NULL(void) = 0;
379 ACLPROC4_GETACL(GETACL4args) = 1;
381 ACLPROC4_SETACL(SETACL4args) = 2;