1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2012 Dan Walsh
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 void selinux_access_free(void);
28 int selinux_access_check(DBusConnection *connection, DBusMessage *message, const char *path, const char *permission, DBusError *error);
32 #define SELINUX_ACCESS_CHECK(connection, message, permission) \
36 DBusConnection *_c = (connection); \
37 DBusMessage *_m = (message); \
38 dbus_error_init(&_error); \
39 _r = selinux_access_check(_c, _m, NULL, (permission), &_error); \
41 return bus_send_error_reply(_c, _m, &_error, _r); \
44 #define SELINUX_UNIT_ACCESS_CHECK(unit, connection, message, permission) \
48 DBusConnection *_c = (connection); \
49 DBusMessage *_m = (message); \
51 dbus_error_init(&_error); \
52 _r = selinux_access_check(_c, _m, _u->source_path ?: _u->fragment_path, (permission), &_error); \
54 return bus_send_error_reply(_c, _m, &_error, _r); \
59 #define SELINUX_ACCESS_CHECK(connection, message, permission) do { } while (false)
60 #define SELINUX_UNIT_ACCESS_CHECK(unit, connection, message, permission) do { } while (false)