]>
Commit | Line | Data |
---|---|---|
db9ecf05 | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
c2f1db8f | 2 | #pragma once |
f4b47811 | 3 | |
69a283c5 | 4 | #include "forward.h" |
f8eeeaf9 | 5 | |
f76ce81b LP |
6 | int fd_acl_make_read_only_fallback(int fd); |
7 | int fd_acl_make_writable_fallback(int fd); | |
8 | ||
567aeb58 | 9 | #if HAVE_ACL |
69a283c5 DDM |
10 | #include <acl/libacl.h> /* IWYU pragma: export */ |
11 | #include <sys/acl.h> /* IWYU pragma: export */ | |
478c8269 | 12 | |
23ad4dd8 | 13 | int calc_acl_mask_if_needed(acl_t *acl_p); |
dd4105b0 | 14 | int add_base_acls_if_needed(acl_t *acl_p, const char *path); |
e346512c | 15 | int acl_search_groups(const char* path, char ***ret_groups); |
26d98cdd MY |
16 | int parse_acl( |
17 | const char *text, | |
18 | acl_t *ret_acl_access, | |
19 | acl_t *ret_acl_access_exec, | |
20 | acl_t *ret_acl_default, | |
21 | bool want_mask); | |
cfef0734 | 22 | int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *ret); |
567aeb58 | 23 | int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask); |
34c10968 | 24 | |
f76ce81b LP |
25 | int fd_acl_make_read_only(int fd); |
26 | int fd_acl_make_writable(int fd); | |
27 | ||
f8eeeaf9 ZJS |
28 | /* acl_free takes multiple argument types. |
29 | * Multiple cleanup functions are necessary. */ | |
fd421c4a | 30 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(acl_t, acl_free, NULL); |
f8eeeaf9 | 31 | #define acl_free_charp acl_free |
fd421c4a | 32 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, acl_free_charp, NULL); |
1c73f3bc | 33 | #define acl_free_uid_tp acl_free |
fd421c4a | 34 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(uid_t*, acl_free_uid_tp, NULL); |
1c73f3bc | 35 | #define acl_free_gid_tp acl_free |
fd421c4a | 36 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gid_t*, acl_free_gid_tp, NULL); |
34c10968 | 37 | |
567aeb58 ZJS |
38 | #else |
39 | #define ACL_READ 0x04 | |
40 | #define ACL_WRITE 0x02 | |
41 | #define ACL_EXECUTE 0x01 | |
42 | ||
43 | static inline int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask) { | |
44 | return -EOPNOTSUPP; | |
45 | } | |
f76ce81b LP |
46 | |
47 | static inline int fd_acl_make_read_only(int fd) { | |
48 | return fd_acl_make_read_only_fallback(fd); | |
49 | } | |
50 | ||
51 | static inline int fd_acl_make_writable(int fd) { | |
52 | return fd_acl_make_writable_fallback(fd); | |
53 | } | |
54 | ||
f8eeeaf9 | 55 | #endif |