acl_calc_mask.c (184607) | acl_calc_mask.c (194955) |
---|---|
1/* 2 * Copyright (c) 2001-2002 Chris D. Faulhaber 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 1/* 2 * Copyright (c) 2001-2002 Chris D. Faulhaber 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/lib/libc/posix1e/acl_calc_mask.c 184607 2008-11-04 00:20:43Z imp $"); | 28__FBSDID("$FreeBSD: head/lib/libc/posix1e/acl_calc_mask.c 194955 2009-06-25 12:46:59Z trasz $"); |
29 30#include <sys/types.h> 31#include "namespace.h" 32#include <sys/acl.h> 33#include "un-namespace.h" 34 35#include <errno.h> 36#include <stdio.h> 37 | 29 30#include <sys/types.h> 31#include "namespace.h" 32#include <sys/acl.h> 33#include "un-namespace.h" 34 35#include <errno.h> 36#include <stdio.h> 37 |
38#include "acl_support.h" 39 |
|
38/* 39 * acl_calc_mask() (23.4.2): calculate and set the permissions 40 * associated with the ACL_MASK ACL entry. If the ACL already 41 * contains an ACL_MASK entry, its permissions shall be 42 * overwritten; if not, one shall be added. 43 */ 44int 45acl_calc_mask(acl_t *acl_p) 46{ 47 struct acl *acl_int, *acl_int_new; 48 acl_t acl_new; 49 int i, mask_mode, mask_num; 50 | 40/* 41 * acl_calc_mask() (23.4.2): calculate and set the permissions 42 * associated with the ACL_MASK ACL entry. If the ACL already 43 * contains an ACL_MASK entry, its permissions shall be 44 * overwritten; if not, one shall be added. 45 */ 46int 47acl_calc_mask(acl_t *acl_p) 48{ 49 struct acl *acl_int, *acl_int_new; 50 acl_t acl_new; 51 int i, mask_mode, mask_num; 52 |
53 if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { 54 errno = EINVAL; 55 return (-1); 56 } 57 _acl_brand_as(*acl_p, ACL_BRAND_POSIX); 58 |
|
51 /* 52 * (23.4.2.4) requires acl_p to point to a pointer to a valid ACL. 53 * Since one of the primary reasons to use this function would be 54 * to calculate the appropriate mask to obtain a valid ACL, we only 55 * perform sanity checks here and validate the ACL prior to 56 * returning. 57 */ 58 if (acl_p == NULL || *acl_p == NULL) { --- 61 unchanged lines hidden --- | 59 /* 60 * (23.4.2.4) requires acl_p to point to a pointer to a valid ACL. 61 * Since one of the primary reasons to use this function would be 62 * to calculate the appropriate mask to obtain a valid ACL, we only 63 * perform sanity checks here and validate the ACL prior to 64 * returning. 65 */ 66 if (acl_p == NULL || *acl_p == NULL) { --- 61 unchanged lines hidden --- |