]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/acl-util.h
221266c3877588efeb73494f4dd8fcfb44cfc2a2
[thirdparty/systemd.git] / src / shared / acl-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright 2011 Lennart Poettering
6 ***/
7
8 #if HAVE_ACL
9
10 #include <acl/libacl.h>
11 #include <stdbool.h>
12 #include <sys/acl.h>
13
14 #include "macro.h"
15
16 int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
17 int calc_acl_mask_if_needed(acl_t *acl_p);
18 int add_base_acls_if_needed(acl_t *acl_p, const char *path);
19 int acl_search_groups(const char* path, char ***ret_groups);
20 int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask);
21 int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl);
22 int add_acls_for_user(int fd, uid_t uid);
23
24 /* acl_free takes multiple argument types.
25 * Multiple cleanup functions are necessary. */
26 DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free);
27 #define acl_free_charp acl_free
28 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp);
29 #define acl_free_uid_tp acl_free
30 DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp);
31 #define acl_free_gid_tp acl_free
32 DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp);
33
34 #endif