Debian Codegraph @

src/util/selinux.h

raw
1 #pragma once
2
3 /*
4 * Bus SELinux Helpers
5 */
6
7 #include <c-stdaux.h>
8 #include <stdlib.h>
9
10 typedef struct BusSELinuxRegistry BusSELinuxRegistry;
11 typedef struct Log Log;
12
13 enum {
14 _SELINUX_E_SUCCESS,
15
16 SELINUX_E_DENIED,
17 };
18
19 bool bus_selinux_is_enabled(void);
20 bool bus_selinux_is_enforcing(void);
21 const char *bus_selinux_policy_root(void);
22
23 int bus_selinux_registry_new(BusSELinuxRegistry **registryp, const char *fallback_context);
24 BusSELinuxRegistry *bus_selinux_registry_ref(BusSELinuxRegistry *registry);
25 BusSELinuxRegistry *bus_selinux_registry_unref(BusSELinuxRegistry *registry);
26
27 C_DEFINE_CLEANUP(BusSELinuxRegistry *, bus_selinux_registry_unref);
28
29 int bus_selinux_registry_add_name(BusSELinuxRegistry *registry, const char *name, const char *context);
30
31 int bus_selinux_check_own(BusSELinuxRegistry *registry,
32 const char *context_owner,
33 const char *name);
34 int bus_selinux_check_send(BusSELinuxRegistry *registry,
35 const char *context_sender,
36 const char *context_receiver);
37
38 int bus_selinux_init_global(Log *log);
39 void bus_selinux_deinit_global(void);