acl_set.c (91033) | acl_set.c (91034) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 1999, 2000, 2001 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/lib/libc/posix1e/acl_set.c 91033 2002-02-21 23:13:06Z jedgar $ | 26 * $FreeBSD: head/lib/libc/posix1e/acl_set.c 91034 2002-02-21 23:17:19Z jedgar $ |
27 */ 28/* 29 * acl_set_file -- set a file/directory ACL by name 30 */ 31 32#include <sys/types.h> 33#include "namespace.h" 34#include <sys/acl.h> --- 72 unchanged lines hidden (view full) --- 107 * with the permissions in permset_d 108 */ 109int 110acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d) 111{ 112 113 if (!entry_d) { 114 errno = EINVAL; | 27 */ 28/* 29 * acl_set_file -- set a file/directory ACL by name 30 */ 31 32#include <sys/types.h> 33#include "namespace.h" 34#include <sys/acl.h> --- 72 unchanged lines hidden (view full) --- 107 * with the permissions in permset_d 108 */ 109int 110acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d) 111{ 112 113 if (!entry_d) { 114 errno = EINVAL; |
115 return -1; | 115 return (-1); |
116 } 117 118 entry_d->ae_perm = *permset_d; 119 | 116 } 117 118 entry_d->ae_perm = *permset_d; 119 |
120 return 0; | 120 return (0); |
121} 122 123/* 124 * acl_set_qualifier() sets the qualifier (ae_id) of the tag for 125 * ACL entry entry_d to the value referred to by tag_qualifier_p 126 */ 127int 128acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p) 129{ 130 if (!entry_d || !tag_qualifier_p) { 131 errno = EINVAL; | 121} 122 123/* 124 * acl_set_qualifier() sets the qualifier (ae_id) of the tag for 125 * ACL entry entry_d to the value referred to by tag_qualifier_p 126 */ 127int 128acl_set_qualifier(acl_entry_t entry_d, const void *tag_qualifier_p) 129{ 130 if (!entry_d || !tag_qualifier_p) { 131 errno = EINVAL; |
132 return -1; | 132 return (-1); |
133 } 134 135 switch(entry_d->ae_tag) { 136 case ACL_USER: 137 case ACL_GROUP: 138 entry_d->ae_id = *(uid_t *)tag_qualifier_p; 139 break; 140 default: 141 errno = EINVAL; | 133 } 134 135 switch(entry_d->ae_tag) { 136 case ACL_USER: 137 case ACL_GROUP: 138 entry_d->ae_id = *(uid_t *)tag_qualifier_p; 139 break; 140 default: 141 errno = EINVAL; |
142 return -1; | 142 return (-1); |
143 } 144 | 143 } 144 |
145 return 0; | 145 return (0); |
146} 147 148/* 149 * acl_set_tag_type() sets the tag type for ACL entry entry_d to the 150 * value of tag_type 151 */ 152int 153acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type) 154{ 155 | 146} 147 148/* 149 * acl_set_tag_type() sets the tag type for ACL entry entry_d to the 150 * value of tag_type 151 */ 152int 153acl_set_tag_type(acl_entry_t entry_d, acl_tag_t tag_type) 154{ 155 |
156 if (!entry_d) { | 156 if (entry_d == NULL) { |
157 errno = EINVAL; | 157 errno = EINVAL; |
158 return -1; | 158 return (-1); |
159 } 160 161 switch(tag_type) { 162 case ACL_USER_OBJ: 163 case ACL_USER: 164 case ACL_GROUP_OBJ: 165 case ACL_GROUP: 166 case ACL_MASK: 167 case ACL_OTHER: 168 entry_d->ae_tag = tag_type; | 159 } 160 161 switch(tag_type) { 162 case ACL_USER_OBJ: 163 case ACL_USER: 164 case ACL_GROUP_OBJ: 165 case ACL_GROUP: 166 case ACL_MASK: 167 case ACL_OTHER: 168 entry_d->ae_tag = tag_type; |
169 return 0; | 169 return (0); |
170 } 171 172 errno = EINVAL; | 170 } 171 172 errno = EINVAL; |
173 return -1; | 173 return (-1); |
174} | 174} |