]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/acl-util.h
build-sys: use #if Y instead of #ifdef Y everywhere
[thirdparty/systemd.git] / src / shared / acl-util.h
1 #pragma once
2
3 /***
4 This file is part of systemd.
5
6 Copyright 2011 Lennart Poettering
7
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
12
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
17
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
20 ***/
21
22 #if HAVE_ACL
23
24 #include <acl/libacl.h>
25 #include <stdbool.h>
26 #include <sys/acl.h>
27
28 #include "macro.h"
29
30 int acl_find_uid(acl_t acl, uid_t uid, acl_entry_t *entry);
31 int calc_acl_mask_if_needed(acl_t *acl_p);
32 int add_base_acls_if_needed(acl_t *acl_p, const char *path);
33 int acl_search_groups(const char* path, char ***ret_groups);
34 int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask);
35 int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl);
36 int add_acls_for_user(int fd, uid_t uid);
37
38 /* acl_free takes multiple argument types.
39 * Multiple cleanup functions are necessary. */
40 DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free);
41 #define acl_free_charp acl_free
42 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp);
43 #define acl_free_uid_tp acl_free
44 DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp);
45 #define acl_free_gid_tp acl_free
46 DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp);
47
48 #endif