]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
c2f1db8f | 2 | #pragma once |
f4b47811 | 3 | |
567aeb58 ZJS |
4 | #include <errno.h> |
5 | #include <unistd.h> | |
f8eeeaf9 | 6 | |
567aeb58 | 7 | #if HAVE_ACL |
71d35b6b | 8 | #include <acl/libacl.h> |
478c8269 | 9 | #include <stdbool.h> |
f8eeeaf9 | 10 | #include <sys/acl.h> |
f8eeeaf9 ZJS |
11 | |
12 | #include "macro.h" | |
478c8269 | 13 | |
f4b47811 | 14 | int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry); |
23ad4dd8 | 15 | int calc_acl_mask_if_needed(acl_t *acl_p); |
dd4105b0 | 16 | int add_base_acls_if_needed(acl_t *acl_p, const char *path); |
e346512c | 17 | int acl_search_groups(const char* path, char ***ret_groups); |
e738c945 | 18 | int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask); |
50d9e46d | 19 | int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl); |
567aeb58 | 20 | int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask); |
34c10968 | 21 | |
f8eeeaf9 ZJS |
22 | /* acl_free takes multiple argument types. |
23 | * Multiple cleanup functions are necessary. */ | |
24 | DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free); | |
25 | #define acl_free_charp acl_free | |
26 | DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp); | |
1c73f3bc ZJS |
27 | #define acl_free_uid_tp acl_free |
28 | DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp); | |
29 | #define acl_free_gid_tp acl_free | |
30 | DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp); | |
34c10968 | 31 | |
567aeb58 ZJS |
32 | #else |
33 | #define ACL_READ 0x04 | |
34 | #define ACL_WRITE 0x02 | |
35 | #define ACL_EXECUTE 0x01 | |
36 | ||
37 | static inline int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask) { | |
38 | return -EOPNOTSUPP; | |
39 | } | |
f8eeeaf9 | 40 | #endif |