chiark / gitweb /
683119128aa62133348d14a823fdff6dc35ea1e7
[elogind.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 #if 0 /// UNNEEDED by elogind
18 int calc_acl_mask_if_needed(acl_t *acl_p);
19 int add_base_acls_if_needed(acl_t *acl_p, const char *path);
20 int acl_search_groups(const char* path, char ***ret_groups);
21 int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask);
22 int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl);
23 int add_acls_for_user(int fd, uid_t uid);
24 #endif // 0
25
26 /* acl_free takes multiple argument types.
27  * Multiple cleanup functions are necessary. */
28 DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free);
29 #define acl_free_charp acl_free
30 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp);
31 #define acl_free_uid_tp acl_free
32 DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp);
33 #define acl_free_gid_tp acl_free
34 DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp);
35
36 #endif