cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#pragma once
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh/***
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh This file is part of systemd.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh Copyright 2012 Dan Walsh
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh systemd is free software; you can redistribute it and/or modify it
03e22642617f360a6b55cb853bcf59604754ea5dKay Sievers under the terms of the GNU Lesser General Public License as published by
03e22642617f360a6b55cb853bcf59604754ea5dKay Sievers the Free Software Foundation; either version 2.1 of the License, or
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh (at your option) any later version.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh systemd is distributed in the hope that it will be useful, but
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh WITHOUT ANY WARRANTY; without even the implied warranty of
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
03e22642617f360a6b55cb853bcf59604754ea5dKay Sievers Lesser General Public License for more details.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh
03e22642617f360a6b55cb853bcf59604754ea5dKay Sievers You should have received a copy of the GNU Lesser General Public License
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh along with systemd; If not, see <http://www.gnu.org/licenses/>.
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh***/
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh
718db96199eb307751264e4163555662c9a389faLennart Poettering#include "sd-bus.h"
71d35b6b5563817dfbe757ab9e3b9f018b2db491Thomas Hindoe Paaboel Andersen
718db96199eb307751264e4163555662c9a389faLennart Poettering#include "bus-util.h"
e94937df954451eb4aa63573f0d7404ed2db987eLukas Nykryn#include "manager.h"
ffc227c9568eb0a12dc750761d1e5d68ea125aadLennart Poettering
8a188de9e0ea41509beda12084126d7a75ebe86eWaLyong Choint mac_selinux_generic_access_check(sd_bus_message *message, const char *path, const char *permission, sd_bus_error *error);
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#ifdef HAVE_SELINUX
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering
8a188de9e0ea41509beda12084126d7a75ebe86eWaLyong Cho#define mac_selinux_access_check(message, permission, error) \
8a188de9e0ea41509beda12084126d7a75ebe86eWaLyong Cho mac_selinux_generic_access_check((message), NULL, (permission), (error))
4f4f70361a64957c45a2d8f40bfb04c77b454697Lennart Poettering
8a188de9e0ea41509beda12084126d7a75ebe86eWaLyong Cho#define mac_selinux_unit_access_check(unit, message, permission, error) \
4f4f70361a64957c45a2d8f40bfb04c77b454697Lennart Poettering ({ \
4f4f70361a64957c45a2d8f40bfb04c77b454697Lennart Poettering Unit *_unit = (unit); \
1e648011b20c8126412d3cf2699d575d9ba9e0feLukas Nykryn mac_selinux_generic_access_check((message), _unit->source_path ?: _unit->fragment_path, (permission), (error)); \
4f4f70361a64957c45a2d8f40bfb04c77b454697Lennart Poettering })
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering#else
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering
8a188de9e0ea41509beda12084126d7a75ebe86eWaLyong Cho#define mac_selinux_access_check(message, permission, error) 0
8a188de9e0ea41509beda12084126d7a75ebe86eWaLyong Cho#define mac_selinux_unit_access_check(unit, message, permission, error) 0
cad45ba11ec3572296361f53f5852ffb97a97fa3Lennart Poettering
e2417e4143bb892e4599b01de7b031763421bb64Daniel J Walsh#endif