acl_get.c (192586) | acl_get.c (194955) |
---|---|
1/*- 2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * This software was developed by Robert Watson for the TrustedBSD Project. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 25 unchanged lines hidden (view full) --- 34 * acl_get_perm_np() checks if a permission is in the specified 35 * permset (non-POSIX) 36 * acl_get_permset() returns the permission set in the ACL entry 37 * acl_get_qualifier() retrieves the qualifier of the tag from the ACL entry 38 * acl_get_tag_type() returns the tag type for the ACL entry entry_d 39 */ 40 41#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson 3 * All rights reserved. 4 * 5 * This software was developed by Robert Watson for the TrustedBSD Project. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 25 unchanged lines hidden (view full) --- 34 * acl_get_perm_np() checks if a permission is in the specified 35 * permset (non-POSIX) 36 * acl_get_permset() returns the permission set in the ACL entry 37 * acl_get_qualifier() retrieves the qualifier of the tag from the ACL entry 38 * acl_get_tag_type() returns the tag type for the ACL entry entry_d 39 */ 40 41#include <sys/cdefs.h> |
42__FBSDID("$FreeBSD: head/lib/libc/posix1e/acl_get.c 192586 2009-05-22 15:56:43Z trasz $"); | 42__FBSDID("$FreeBSD: head/lib/libc/posix1e/acl_get.c 194955 2009-06-25 12:46:59Z trasz $"); |
43 44#include <sys/types.h> 45#include "namespace.h" 46#include <sys/acl.h> 47#include "un-namespace.h" 48 49#include <errno.h> 50#include <stdlib.h> 51#include <string.h> | 43 44#include <sys/types.h> 45#include "namespace.h" 46#include <sys/acl.h> 47#include "un-namespace.h" 48 49#include <errno.h> 50#include <stdlib.h> 51#include <string.h> |
52#include <unistd.h> |
|
52 53#include "acl_support.h" 54 55acl_t 56acl_get_file(const char *path_p, acl_type_t type) 57{ 58 acl_t aclp; 59 int error; --- 4 unchanged lines hidden (view full) --- 64 65 type = _acl_type_unold(type); 66 error = __acl_get_file(path_p, type, &aclp->ats_acl); 67 if (error) { 68 acl_free(aclp); 69 return (NULL); 70 } 71 | 53 54#include "acl_support.h" 55 56acl_t 57acl_get_file(const char *path_p, acl_type_t type) 58{ 59 acl_t aclp; 60 int error; --- 4 unchanged lines hidden (view full) --- 65 66 type = _acl_type_unold(type); 67 error = __acl_get_file(path_p, type, &aclp->ats_acl); 68 if (error) { 69 acl_free(aclp); 70 return (NULL); 71 } 72 |
73 aclp->ats_acl.acl_maxcnt = ACL_MAX_ENTRIES; 74 _acl_brand_from_type(aclp, type); 75 |
|
72 return (aclp); 73} 74 75acl_t 76acl_get_link_np(const char *path_p, acl_type_t type) 77{ 78 acl_t aclp; 79 int error; --- 4 unchanged lines hidden (view full) --- 84 85 type = _acl_type_unold(type); 86 error = __acl_get_link(path_p, type, &aclp->ats_acl); 87 if (error) { 88 acl_free(aclp); 89 return (NULL); 90 } 91 | 76 return (aclp); 77} 78 79acl_t 80acl_get_link_np(const char *path_p, acl_type_t type) 81{ 82 acl_t aclp; 83 int error; --- 4 unchanged lines hidden (view full) --- 88 89 type = _acl_type_unold(type); 90 error = __acl_get_link(path_p, type, &aclp->ats_acl); 91 if (error) { 92 acl_free(aclp); 93 return (NULL); 94 } 95 |
96 aclp->ats_acl.acl_maxcnt = ACL_MAX_ENTRIES; 97 _acl_brand_from_type(aclp, type); 98 |
|
92 return (aclp); 93} 94 95acl_t 96acl_get_fd(int fd) 97{ | 99 return (aclp); 100} 101 102acl_t 103acl_get_fd(int fd) 104{ |
98 acl_t aclp; 99 int error; | 105 if (fpathconf(fd, _PC_ACL_NFS4)) 106 return (acl_get_fd_np(fd, ACL_TYPE_NFS4)); |
100 | 107 |
101 aclp = acl_init(ACL_MAX_ENTRIES); 102 if (aclp == NULL) 103 return (NULL); 104 105 error = ___acl_get_fd(fd, ACL_TYPE_ACCESS, &aclp->ats_acl); 106 if (error) { 107 acl_free(aclp); 108 return (NULL); 109 } 110 111 return (aclp); | 108 return (acl_get_fd_np(fd, ACL_TYPE_ACCESS)); |
112} 113 114acl_t 115acl_get_fd_np(int fd, acl_type_t type) 116{ 117 acl_t aclp; 118 int error; 119 120 aclp = acl_init(ACL_MAX_ENTRIES); 121 if (aclp == NULL) 122 return (NULL); 123 124 type = _acl_type_unold(type); 125 error = ___acl_get_fd(fd, type, &aclp->ats_acl); 126 if (error) { 127 acl_free(aclp); 128 return (NULL); 129 } 130 | 109} 110 111acl_t 112acl_get_fd_np(int fd, acl_type_t type) 113{ 114 acl_t aclp; 115 int error; 116 117 aclp = acl_init(ACL_MAX_ENTRIES); 118 if (aclp == NULL) 119 return (NULL); 120 121 type = _acl_type_unold(type); 122 error = ___acl_get_fd(fd, type, &aclp->ats_acl); 123 if (error) { 124 acl_free(aclp); 125 return (NULL); 126 } 127 |
128 aclp->ats_acl.acl_maxcnt = ACL_MAX_ENTRIES; 129 _acl_brand_from_type(aclp, type); 130 |
|
131 return (aclp); 132} 133 134int 135acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm) 136{ 137 138 if (permset_d == NULL) { --- 74 unchanged lines hidden (view full) --- 213 errno = EINVAL; 214 return (-1); 215 } 216 217 *tag_type_p = entry_d->ae_tag; 218 219 return (0); 220} | 131 return (aclp); 132} 133 134int 135acl_get_perm_np(acl_permset_t permset_d, acl_perm_t perm) 136{ 137 138 if (permset_d == NULL) { --- 74 unchanged lines hidden (view full) --- 213 errno = EINVAL; 214 return (-1); 215 } 216 217 *tag_type_p = entry_d->ae_tag; 218 219 return (0); 220} |
221 222int 223acl_get_entry_type_np(acl_entry_t entry_d, acl_entry_type_t *entry_type_p) 224{ 225 226 if (entry_d == NULL || entry_type_p == NULL) { 227 errno = EINVAL; 228 return (-1); 229 } 230 231 if (!_entry_brand_may_be(entry_d, ACL_BRAND_NFS4)) { 232 errno = EINVAL; 233 return (-1); 234 } 235 236 *entry_type_p = entry_d->ae_entry_type; 237 238 return (0); 239} |
|