chiark / gitweb /
80546986d2ded5379232be291fd1a2a455969902
[elogind.git] / src / shared / selinux-util.h
1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3 #pragma once
4
5 /***
6   This file is part of systemd.
7
8   Copyright 2010 Lennart Poettering
9
10   systemd is free software; you can redistribute it and/or modify it
11   under the terms of the GNU Lesser General Public License as published by
12   the Free Software Foundation; either version 2.1 of the License, or
13   (at your option) any later version.
14
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   Lesser General Public License for more details.
19
20   You should have received a copy of the GNU Lesser General Public License
21   along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 ***/
23
24 #include <sys/socket.h>
25 #include <stdio.h>
26 #include <stdbool.h>
27
28 bool mac_selinux_use(void);
29 void mac_selinux_retest(void);
30
31 int mac_selinux_init(const char *prefix);
32 void mac_selinux_finish(void);
33
34 int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
35
36 int mac_selinux_socket_set(const char *label);
37 void mac_selinux_socket_clear(void);
38
39 int mac_selinux_context_set(const char *path, mode_t mode);
40 void mac_selinux_context_clear(void);
41
42 int mac_selinux_mkdir(const char *path, mode_t mode);
43
44 int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
45 int mac_selinux_get_our_label(char **label);
46 int mac_selinux_get_child_mls_label(int socket_fd, const char *exec, char **label);
47 void mac_selinux_free(const char *label);
48
49 int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
50
51 int mac_selinux_apply(const char *path, const char *label);