diff options
author | Shawn Landden <slandden@gmail.com> | 2017-11-07 17:12:36 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2017-11-07 17:12:36 +0100 |
commit | ed440f6be935faeea3192c9509ef262fddb3fc33 (patch) | |
tree | be536fa8aa42930c75f401253ad57ccc0d5399bb /src/shared/tomoyo-util.c | |
parent | test: switch to using ext4 instead of ext3 as default fallback fs (#7265) (diff) | |
download | systemd-ed440f6be935faeea3192c9509ef262fddb3fc33.tar.xz systemd-ed440f6be935faeea3192c9509ef262fddb3fc33.zip |
condition: detect TOMOYO MAC (#7249)
TOMOYO is a Mandatory Access Control security module for Linux.
Rather than ship rules, TOMOYO features a learning mode.
http://tomoyo.osdn.jp/
http://tomoyo.osdn.jp/2.5/index.html.en
Diffstat (limited to 'src/shared/tomoyo-util.c')
-rw-r--r-- | src/shared/tomoyo-util.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/shared/tomoyo-util.c b/src/shared/tomoyo-util.c new file mode 100644 index 0000000000..f5b07888a4 --- /dev/null +++ b/src/shared/tomoyo-util.c @@ -0,0 +1,32 @@ +/*** + This file is part of systemd. + + Copyright 2017 Shawn Landden + + systemd is free software; you can redistribute it and/or modify it + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or + (at your option) any later version. + + systemd is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with systemd; If not, see <http://www.gnu.org/licenses/>. +***/ + +#include <unistd.h> + +#include "tomoyo-util.h" + +bool mac_tomoyo_use(void) { + static int cached_use = -1; + + if (cached_use < 0) + cached_use = (access("/sys/kernel/security/tomoyo/version", + F_OK) == 0); + + return cached_use; +} |