chiark / gitweb /
path-util: add a function to peek into a container and guess elogind version
[elogind.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 #ifdef 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 #if 0 /// UNNEEDED by elogind
32 int calc_acl_mask_if_needed(acl_t *acl_p);
33 int add_base_acls_if_needed(acl_t *acl_p, const char *path);
34 int acl_search_groups(const char* path, char ***ret_groups);
35 int parse_acl(const char *text, acl_t *acl_access, acl_t *acl_default, bool want_mask);
36 int acls_for_file(const char *path, acl_type_t type, acl_t new, acl_t *acl);
37 int add_acls_for_user(int fd, uid_t uid);
38 #endif // 0
39
40 /* acl_free takes multiple argument types.
41  * Multiple cleanup functions are necessary. */
42 DEFINE_TRIVIAL_CLEANUP_FUNC(acl_t, acl_free);
43 #define acl_free_charp acl_free
44 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, acl_free_charp);
45 #define acl_free_uid_tp acl_free
46 DEFINE_TRIVIAL_CLEANUP_FUNC(uid_t*, acl_free_uid_tp);
47 #define acl_free_gid_tp acl_free
48 DEFINE_TRIVIAL_CLEANUP_FUNC(gid_t*, acl_free_gid_tp);
49
50 #endif