1 '\" te
   2 .\" Copyright (c) 2001, Sun Microsystems, Inc.
   3 .\" 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.
   4 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
   5 .\" 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]
   6 .TH ACLCHECK 3SEC "Dec 10, 2001"
   7 .SH NAME
   8 aclcheck \- check the validity of an ACL
   9 .SH SYNOPSIS
  10 .nf
  11 \fBcc\fR [ \fIflag\fR... ] \fIfile\fR... \fB-lsec\fR [ \fIlibrary\fR... ]
  12 #include <sys/acl.h>
  13 
  14 \fBint\fR \fBaclcheck\fR(\fBaclent_t *\fR\fIaclbufp\fR, \fBint\fR \fInentries\fR, \fBint *\fR\fIwhich\fR);
  15 .fi
  16 
  17 .SH DESCRIPTION
  18 The \fBaclcheck()\fR function checks the validity of an \fBACL\fR pointed to by
  19 \fIaclbufp.\fR The \fInentries\fR argument is the number of entries contained
  20 in the buffer. The \fIwhich\fR parameter returns the index of the first entry
  21 that is invalid.
  22 .sp
  23 .LP
  24 The function verifies that an \fBACL\fR pointed to by \fIaclbufp\fR is valid
  25 according to the following rules:
  26 .RS +4
  27 .TP
  28 .ie t \(bu
  29 .el o
  30 There must be exactly one \fBGROUP_OBJ\fR \fBACL\fR entry.
  31 .RE
  32 .RS +4
  33 .TP
  34 .ie t \(bu
  35 .el o
  36 There must be exactly one \fBUSER_OBJ\fR \fBACL\fR entry.
  37 .RE
  38 .RS +4
  39 .TP
  40 .ie t \(bu
  41 .el o
  42 There must be exactly one \fBOTHER_OBJ\fR \fBACL\fR entry.
  43 .RE
  44 .RS +4
  45 .TP
  46 .ie t \(bu
  47 .el o
  48 If there are any \fBGROUP\fR \fBACL\fR entries, then the group \fBID\fR in each
  49 group \fBACL\fR entry must be unique.
  50 .RE
  51 .RS +4
  52 .TP
  53 .ie t \(bu
  54 .el o
  55 If there are any \fBUSER\fR \fBACL\fR entries, then the user \fBID\fR in each
  56 user \fBACL\fR entry must be unique.
  57 .RE
  58 .RS +4
  59 .TP
  60 .ie t \(bu
  61 .el o
  62 If there are any \fBGROUP\fR or \fBUSER\fR \fBACL\fR entries, then there must
  63 be exactly one \fBCLASS_OBJ\fR (\fBACL\fR mask) entry.
  64 .RE
  65 .RS +4
  66 .TP
  67 .ie t \(bu
  68 .el o
  69 If there are any default \fBACL\fR entries, then the following apply:
  70 .RS +4
  71 .TP
  72 .ie t \(bu
  73 .el o
  74 There must be exactly one default \fBGROUP_OBJ\fR \fBACL\fR entry.
  75 .RE
  76 .RS +4
  77 .TP
  78 .ie t \(bu
  79 .el o
  80 There must be exactly one default \fBOTHER_OBJ\fR \fBACL\fR entry.
  81 .RE
  82 .RS +4
  83 .TP
  84 .ie t \(bu
  85 .el o
  86 There must be exactly one default \fBUSER_OBJ\fR \fBACL\fR entry.
  87 .RE
  88 .RS +4
  89 .TP
  90 .ie t \(bu
  91 .el o
  92 If there are any \fBDEF_GROUP\fR entries, then the group \fBID\fR in each
  93 \fBDEF_GROUP\fR \fBACL\fR entry must be unique.
  94 .RE
  95 .RS +4
  96 .TP
  97 .ie t \(bu
  98 .el o
  99 If there are any \fBDEF_USER\fR entries, then the user \fBID\fR in each
 100 \fBDEF_USER\fR \fBACL\fR entry must be unique.
 101 .RE
 102 .RS +4
 103 .TP
 104 .ie t \(bu
 105 .el o
 106 If there are any \fBDEF_GROUP\fR or \fBDEF_USER\fR entries, then there must be
 107 exactly one \fBDEF_CLASS_OBJ\fR (default \fBACL\fR mask) entry.
 108 .RE
 109 .RE
 110 .RS +4
 111 .TP
 112 .ie t \(bu
 113 .el o
 114 If any of the above rules are violated, then the function fails with
 115 \fBerrno\fR set to \fBEINVAL\fR.
 116 .RE
 117 .SH RETURN VALUES
 118 If the \fBACL\fR is valid, \fBaclcheck()\fR will return \fB0\fR. Otherwise
 119 \fBerrno\fR is set to \fBEINVAL\fR and \fBaclcheck()\fR will return one of the
 120 following:
 121 .sp
 122 .ne 2
 123 .na
 124 \fB\fBGRP_ERROR\fR\fR
 125 .ad
 126 .RS 19n
 127 There is more than one \fBGROUP_OBJ\fR or \fBDEF_GROUP_OBJ\fR \fBACL\fR entry.
 128 .RE
 129 
 130 .sp
 131 .ne 2
 132 .na
 133 \fB\fBUSER_ERROR\fR\fR
 134 .ad
 135 .RS 19n
 136 There is more than one \fBUSER_OBJ\fR or \fBDEF_USER_OBJ\fR \fBACL\fR entry.
 137 .RE
 138 
 139 .sp
 140 .ne 2
 141 .na
 142 \fB\fBCLASS_ERROR\fR\fR
 143 .ad
 144 .RS 19n
 145 There is more than one \fBCLASS_OBJ\fR (\fBACL\fR mask) or \fBDEF_CLASS_OBJ\fR
 146 (default \fBACL\fR mask) entry.
 147 .RE
 148 
 149 .sp
 150 .ne 2
 151 .na
 152 \fB\fBOTHER_ERROR\fR\fR
 153 .ad
 154 .RS 19n
 155 There is more than one \fBOTHER_OBJ\fR or \fBDEF_OTHER_OBJ\fR \fBACL\fR entry.
 156 .RE
 157 
 158 .sp
 159 .ne 2
 160 .na
 161 \fB\fBDUPLICATE_ERROR\fR\fR
 162 .ad
 163 .RS 19n
 164 Duplicate entries of \fBUSER\fR, \fBGROUP\fR, \fBDEF_USER\fR, or
 165 \fBDEF_GROUP\fR.
 166 .RE
 167 
 168 .sp
 169 .ne 2
 170 .na
 171 \fB\fBENTRY_ERROR\fR\fR
 172 .ad
 173 .RS 19n
 174 The entry type is invalid.
 175 .RE
 176 
 177 .sp
 178 .ne 2
 179 .na
 180 \fB\fBMISS_ERROR\fR\fR
 181 .ad
 182 .RS 19n
 183 Missing an entry. The \fIwhich\fR parameter returns \fB\(mi1\fR in this case.
 184 .RE
 185 
 186 .sp
 187 .ne 2
 188 .na
 189 \fB\fBMEM_ERROR\fR\fR
 190 .ad
 191 .RS 19n
 192 The system cannot allocate any memory. The \fBwhich\fR parameter returns
 193 \fB\(mi1\fR in this case.
 194 .RE
 195 
 196 .SH ATTRIBUTES
 197 See \fBattributes\fR(5) for descriptions of the following attributes:
 198 .sp
 199 
 200 .sp
 201 .TS
 202 box;
 203 c | c
 204 l | l .
 205 ATTRIBUTE TYPE  ATTRIBUTE VALUE
 206 _
 207 Interface Stability     Evolving
 208 _
 209 MT-Level        Unsafe
 210 .TE
 211 
 212 .SH SEE ALSO
 213 \fBacl\fR(2), \fBaclsort\fR(3SEC), \fBattributes\fR(5)