]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
d682b3a7 LP |
2 | /*** |
3 | This file is part of systemd. | |
4 | ||
5 | Copyright 2013 Lennart Poettering | |
6 | ||
7 | systemd is free software; you can redistribute it and/or modify it | |
8 | under the terms of the GNU Lesser General Public License as published by | |
9 | the Free Software Foundation; either version 2.1 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | systemd is distributed in the hope that it will be useful, but | |
13 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
15 | Lesser General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU Lesser General Public License | |
18 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
19 | ***/ | |
20 | ||
a8fbdf54 TA |
21 | #include <stddef.h> |
22 | ||
b5efdb8a | 23 | #include "alloc-util.h" |
d682b3a7 | 24 | #include "apparmor-util.h" |
6bedfcbb LP |
25 | #include "fileio.h" |
26 | #include "parse-util.h" | |
d682b3a7 | 27 | |
6baa7db0 LP |
28 | bool mac_apparmor_use(void) { |
29 | static int cached_use = -1; | |
d682b3a7 | 30 | |
6baa7db0 | 31 | if (cached_use < 0) { |
d682b3a7 LP |
32 | _cleanup_free_ char *p = NULL; |
33 | ||
6baa7db0 | 34 | cached_use = |
d682b3a7 LP |
35 | read_one_line_file("/sys/module/apparmor/parameters/enabled", &p) >= 0 && |
36 | parse_boolean(p) > 0; | |
37 | } | |
38 | ||
6baa7db0 | 39 | return cached_use; |
d682b3a7 | 40 | } |