2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2013-10-10 16:35:44 +02:00
|
|
|
|
2015-12-03 21:13:37 +01:00
|
|
|
#include <stddef.h>
|
|
|
|
|
2015-10-27 03:01:06 +01:00
|
|
|
#include "alloc-util.h"
|
2013-10-10 16:35:44 +02:00
|
|
|
#include "apparmor-util.h"
|
2015-10-26 16:18:16 +01:00
|
|
|
#include "fileio.h"
|
|
|
|
#include "parse-util.h"
|
2013-10-10 16:35:44 +02:00
|
|
|
|
2014-10-23 17:34:30 +02:00
|
|
|
bool mac_apparmor_use(void) {
|
|
|
|
static int cached_use = -1;
|
2013-10-10 16:35:44 +02:00
|
|
|
|
2014-10-23 17:34:30 +02:00
|
|
|
if (cached_use < 0) {
|
2013-10-10 16:35:44 +02:00
|
|
|
_cleanup_free_ char *p = NULL;
|
|
|
|
|
2014-10-23 17:34:30 +02:00
|
|
|
cached_use =
|
2013-10-10 16:35:44 +02:00
|
|
|
read_one_line_file("/sys/module/apparmor/parameters/enabled", &p) >= 0 &&
|
|
|
|
parse_boolean(p) > 0;
|
|
|
|
}
|
|
|
|
|
2014-10-23 17:34:30 +02:00
|
|
|
return cached_use;
|
2013-10-10 16:35:44 +02:00
|
|
|
}
|