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