]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/acl-util.h
2164017de3c6c979c20f20220cfb649e897e4397
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
6 int fd_acl_make_read_only_fallback(int fd
);
7 int fd_acl_make_writable_fallback(int fd
);
10 #include <acl/libacl.h> /* IWYU pragma: export */
11 #include <sys/acl.h> /* IWYU pragma: export */
13 int calc_acl_mask_if_needed(acl_t
*acl_p
);
14 int add_base_acls_if_needed(acl_t
*acl_p
, const char *path
);
15 int acl_search_groups(const char* path
, char ***ret_groups
);
18 acl_t
*ret_acl_access
,
19 acl_t
*ret_acl_access_exec
,
20 acl_t
*ret_acl_default
,
22 int acls_for_file(const char *path
, acl_type_t type
, acl_t
new, acl_t
*ret
);
23 int fd_add_uid_acl_permission(int fd
, uid_t uid
, unsigned mask
);
25 int fd_acl_make_read_only(int fd
);
26 int fd_acl_make_writable(int fd
);
28 /* acl_free takes multiple argument types.
29 * Multiple cleanup functions are necessary. */
30 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(acl_t
, acl_free
, NULL
);
31 #define acl_free_charp acl_free
32 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, acl_free_charp
, NULL
);
33 #define acl_free_uid_tp acl_free
34 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(uid_t
*, acl_free_uid_tp
, NULL
);
35 #define acl_free_gid_tp acl_free
36 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(gid_t
*, acl_free_gid_tp
, NULL
);
40 #define ACL_WRITE 0x02
41 #define ACL_EXECUTE 0x01
43 static inline int fd_add_uid_acl_permission(int fd
, uid_t uid
, unsigned mask
) {
47 static inline int fd_acl_make_read_only(int fd
) {
48 return fd_acl_make_read_only_fallback(fd
);
51 static inline int fd_acl_make_writable(int fd
) {
52 return fd_acl_make_writable_fallback(fd
);