acl_to_text.c (75185) | acl_to_text.c (75928) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000, 20001 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, 20001 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_to_text.c 75185 2001-04-04 18:00:52Z tmm $ | 26 * $FreeBSD: head/lib/libc/posix1e/acl_to_text.c 75928 2001-04-24 22:45:41Z jedgar $ |
27 */ 28/* 29 * acl_to_text - return a text string with a text representation of the acl 30 * in it. 31 */ 32 33#include <sys/types.h> 34#include "namespace.h" --- 12 unchanged lines hidden (view full) --- 47 * spec says nothing about output ordering, so leave in acl order 48 * 49 * This function will not produce nice results if it is called with 50 * a non-POSIX.1e semantics ACL. 51 */ 52char * 53acl_to_text(acl_t acl, ssize_t *len_p) 54{ | 27 */ 28/* 29 * acl_to_text - return a text string with a text representation of the acl 30 * in it. 31 */ 32 33#include <sys/types.h> 34#include "namespace.h" --- 12 unchanged lines hidden (view full) --- 47 * spec says nothing about output ordering, so leave in acl order 48 * 49 * This function will not produce nice results if it is called with 50 * a non-POSIX.1e semantics ACL. 51 */ 52char * 53acl_to_text(acl_t acl, ssize_t *len_p) 54{ |
55 char *buf, *tmpbuf; 56 char name_buf[UT_NAMESIZE+1]; 57 char perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1], 58 effective_perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1]; 59 int i, error, len; 60 uid_t ae_id; 61 acl_tag_t ae_tag; 62 acl_perm_t ae_perm, effective_perm, mask_perm; | 55 struct acl *acl_int; 56 char *buf, *tmpbuf; 57 char name_buf[UT_NAMESIZE+1]; 58 char perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1], 59 effective_perm_buf[_POSIX1E_ACL_STRING_PERM_MAXSIZE+1]; 60 int i, error, len; 61 uid_t ae_id; 62 acl_tag_t ae_tag; 63 acl_perm_t ae_perm, effective_perm, mask_perm; |
63 64 buf = strdup(""); 65 if (!buf) 66 return(NULL); 67 | 64 65 buf = strdup(""); 66 if (!buf) 67 return(NULL); 68 |
69 acl_int = &acl->ats_acl; 70 |
|
68 mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */ | 71 mask_perm = ACL_PERM_BITS; /* effective is regular if no mask */ |
69 for (i = 0; i < acl->acl_cnt; i++) 70 if (acl->acl_entry[i].ae_tag == ACL_MASK) 71 mask_perm = acl->acl_entry[i].ae_perm; | 72 for (i = 0; i < acl_int->acl_cnt; i++) 73 if (acl_int->acl_entry[i].ae_tag == ACL_MASK) 74 mask_perm = acl_int->acl_entry[i].ae_perm; |
72 | 75 |
73 for (i = 0; i < acl->acl_cnt; i++) { 74 ae_tag = acl->acl_entry[i].ae_tag; 75 ae_id = acl->acl_entry[i].ae_id; 76 ae_perm = acl->acl_entry[i].ae_perm; | 76 for (i = 0; i < acl_int->acl_cnt; i++) { 77 ae_tag = acl_int->acl_entry[i].ae_tag; 78 ae_id = acl_int->acl_entry[i].ae_id; 79 ae_perm = acl_int->acl_entry[i].ae_perm; |
77 78 switch(ae_tag) { 79 case ACL_USER_OBJ: 80 error = _posix1e_acl_perm_to_string(ae_perm, 81 _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); 82 if (error) 83 goto error_label; 84 len = asprintf(&tmpbuf, "%suser::%s\n", buf, --- 143 unchanged lines hidden --- | 80 81 switch(ae_tag) { 82 case ACL_USER_OBJ: 83 error = _posix1e_acl_perm_to_string(ae_perm, 84 _POSIX1E_ACL_STRING_PERM_MAXSIZE+1, perm_buf); 85 if (error) 86 goto error_label; 87 len = asprintf(&tmpbuf, "%suser::%s\n", buf, --- 143 unchanged lines hidden --- |