]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/selinux-util.h
selinux: cache enforced status and treat retrieve failure as enforced mode
[thirdparty/systemd.git] / src / basic / selinux-util.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
cad45ba1
LP
2#pragma once
3
cad45ba1 4#include <stdbool.h>
71d35b6b 5#include <sys/socket.h>
11c3a366 6#include <sys/types.h>
cad45ba1 7
710a6b50 8#include "macro.h"
08c84981 9#include "label.h"
710a6b50 10
d7887449
ZJS
11#if HAVE_SELINUX
12#include <selinux/selinux.h>
13
14DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon);
15#define _cleanup_freecon_ _cleanup_(freeconp)
16#endif
17
6baa7db0 18bool mac_selinux_use(void);
257188f8 19bool mac_selinux_enforcing(void);
6baa7db0 20void mac_selinux_retest(void);
66b6d9d5 21
c3dacc8b 22int mac_selinux_init(void);
cc56fafe 23void mac_selinux_finish(void);
66b6d9d5 24
aeac9dd6 25int mac_selinux_fix(const char *path, LabelFixFlags flags);
ecabcf8b 26int mac_selinux_apply(const char *path, const char *label);
66b6d9d5 27
cc56fafe
WC
28int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
29int mac_selinux_get_our_label(char **label);
9008e1ac 30int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label);
710a6b50 31char* mac_selinux_free(char *label);
66b6d9d5 32
ecabcf8b 33int mac_selinux_create_file_prepare(const char *path, mode_t mode);
7e531a52 34int mac_selinux_create_file_prepare_at(int dirfd, const char *path, mode_t mode);
ecabcf8b 35void mac_selinux_create_file_clear(void);
66b6d9d5 36
ecabcf8b
LP
37int mac_selinux_create_socket_prepare(const char *label);
38void mac_selinux_create_socket_clear(void);
39
ecabcf8b 40int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
710a6b50
LP
41
42DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free);