]> git.saurik.com Git - apple/libc.git/blame - posix1e/acl.c
Libc-391.2.10.tar.gz
[apple/libc.git] / posix1e / acl.c
CommitLineData
3d9156a7
A
1/*
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24#include <sys/appleapiopts.h>
25#include <sys/types.h>
26#include <sys/acl.h>
27#include <errno.h>
28#include <stdlib.h>
29#include <string.h>
30
31#include "aclvar.h"
32
33acl_t
34acl_dup(acl_t acl)
35{
36 struct _acl *ap;
37
38 if (!_ACL_VALID_ACL(acl)) {
39 errno = EINVAL;
40 return(NULL);
41 }
42
43 if ((ap = malloc(sizeof(*ap))) != NULL)
44 bcopy(acl, ap, sizeof(*ap));
45 return(ap);
46}
47
48int
49acl_free(void *obj)
50{
51 /*
52 * Without tracking the addresses of text buffers and qualifiers,
53 * we can't validate the obj argument here at all.
54 */
55 free(obj);
56 return(0);
57}
58
59acl_t
60acl_init(int count)
61{
62 struct _acl *ap;
63
64 /* validate count */
65 if (count < 0) {
66 errno = EINVAL;
67 return(NULL);
68 }
69 if (count > ACL_MAX_ENTRIES) {
70 errno = ENOMEM;
71 return(NULL);
72 }
73
74 if ((ap = malloc(sizeof (*ap))) != NULL) {
75 bzero(ap, sizeof(*ap));
76 ap->a_magic = _ACL_ACL_MAGIC;
77 ap->a_last_get = -1;
78 }
79 return(ap);
80}
81
82int
83acl_valid(acl_t acl)
84{
85 _ACL_VALIDATE_ACL(acl);
86
87 /* XXX */
88 return(0);
89}
90
91int
92acl_valid_fd_np(int fd, acl_type_t type, acl_t acl)
93{
94 errno = ENOTSUP; /* XXX */
95 return(-1);
96}
97
98int
99acl_valid_file_np(const char *path, acl_type_t type, acl_t acl)
100{
101 errno = ENOTSUP; /* XXX */
102 return(-1);
103}
104
105int
106acl_valid_link(const char *path, acl_type_t type, acl_t acl)
107{
108 errno = ENOTSUP; /* XXX */
109 return(-1);
110}
111
112/*
113 * Not applicable; not supportedl
114 */
115int
116acl_calc_mask(__unused acl_t *acl_p)
117{
118 errno = ENOTSUP;
119 return(-1);
120}