| 162 | } |
| 163 | |
| 164 | static int |
| 165 | acl_copyout(const struct acl *kernel_acl, void *user_acl, acl_type_t type) |
| 166 | { |
| 167 | uint32_t am; |
| 168 | int error; |
| 169 | struct oldacl old; |
| 170 | |
| 171 | switch (type) { |
| 172 | case ACL_TYPE_ACCESS_OLD: |
| 173 | case ACL_TYPE_DEFAULT_OLD: |
| 174 | error = acl_copy_acl_into_oldacl(kernel_acl, &old); |
| 175 | if (error != 0) |
| 176 | break; |
| 177 | |
| 178 | error = copyout(&old, user_acl, sizeof(old)); |
| 179 | break; |
| 180 | |
| 181 | default: |
| 182 | error = fueword32((char *)user_acl + |
| 183 | offsetof(struct acl, acl_maxcnt), &am); |
| 184 | if (error == -1) |
| 185 | return (EFAULT); |
| 186 | if (am != ACL_MAX_ENTRIES) |
| 187 | return (EINVAL); |
| 188 | |
| 189 | error = copyout(kernel_acl, user_acl, sizeof(*kernel_acl)); |
| 190 | } |
| 191 | |
| 192 | return (error); |
| 193 | } |
| 194 | |
| 195 | /* |
| 196 | * Convert "old" type - ACL_TYPE_{ACCESS,DEFAULT}_OLD - into its "new" |
no test coverage detected