]>
Commit | Line | Data |
---|---|---|
a032b68d | 1 | /* SPDX-License-Identifier: LGPL-2.1-or-later */ |
663996b3 MS |
2 | #pragma once |
3 | ||
a032b68d MB |
4 | #include <errno.h> |
5 | #include <unistd.h> | |
e735f4d4 | 6 | |
a032b68d | 7 | #if HAVE_ACL |
4c89c718 | 8 | #include <acl/libacl.h> |
663996b3 | 9 | #include <stdbool.h> |
e735f4d4 | 10 | #include <sys/acl.h> |
e735f4d4 MP |
11 | |
12 | #include "macro.h" | |
663996b3 MS |
13 | |
14 | int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry); | |
14228c0d | 15 | int calc_acl_mask_if_needed(acl_t *acl_p); |
e735f4d4 | 16 | int add_base_acls_if_needed(acl_t *acl_p, const char *path); |
e3bff60a | 17 | int acl_search_groups(const char* path, char ***ret_groups); |
86f210e9 | 18 | int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask); |
e735f4d4 | 19 | int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl); |
a032b68d | 20 | int fd_add_uid_acl_permission(int fd, uid_t uid, unsigned mask); |
e842803a | 21 | |
e735f4d4 MP |
22 | /* acl_free takes multiple argument types. |
23 | * Multiple cleanup functions are necessary. */ | |
3a6ce677 | 24 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(acl_t, acl_free, NULL); |
e735f4d4 | 25 | #define acl_free_charp acl_free |
3a6ce677 | 26 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, acl_free_charp, NULL); |
e3bff60a | 27 | #define acl_free_uid_tp acl_free |
3a6ce677 | 28 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(uid_t*, acl_free_uid_tp, NULL); |
e3bff60a | 29 | #define acl_free_gid_tp acl_free |
3a6ce677 | 30 | DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gid_t*, acl_free_gid_tp, NULL); |
e842803a | 31 | |
a032b68d MB |
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 | } | |
e735f4d4 | 40 | #endif |