]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/selinux-util.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / basic / selinux-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
cad45ba1
LP
2#pragma once
3
4/***
5 This file is part of systemd.
6
7 Copyright 2010 Lennart Poettering
8
9 systemd is free software; you can redistribute it and/or modify it
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
22
23#include <stdbool.h>
71d35b6b 24#include <sys/socket.h>
11c3a366 25#include <sys/types.h>
cad45ba1 26
710a6b50
LP
27#include "macro.h"
28
6baa7db0
LP
29bool mac_selinux_use(void);
30void mac_selinux_retest(void);
66b6d9d5 31
c3dacc8b 32int mac_selinux_init(void);
cc56fafe 33void mac_selinux_finish(void);
66b6d9d5 34
6baa7db0 35int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
ecabcf8b 36int mac_selinux_apply(const char *path, const char *label);
66b6d9d5 37
cc56fafe
WC
38int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
39int mac_selinux_get_our_label(char **label);
9008e1ac 40int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label);
710a6b50 41char* mac_selinux_free(char *label);
66b6d9d5 42
ecabcf8b
LP
43int mac_selinux_create_file_prepare(const char *path, mode_t mode);
44void mac_selinux_create_file_clear(void);
66b6d9d5 45
ecabcf8b
LP
46int mac_selinux_create_socket_prepare(const char *label);
47void mac_selinux_create_socket_clear(void);
48
ecabcf8b 49int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
710a6b50
LP
50
51DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free);