]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/selinux-util.h
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
6 #include <sys/socket.h>
10 #include "label-util.h"
13 #include <selinux/selinux.h>
15 DEFINE_TRIVIAL_CLEANUP_FUNC_FULL(char*, freecon
, NULL
);
16 #define _cleanup_freecon_ _cleanup_(freeconp)
19 bool mac_selinux_use(void);
20 void mac_selinux_retest(void);
21 bool mac_selinux_enforcing(void);
23 int mac_selinux_init(void);
24 int mac_selinux_init_lazy(void);
25 void mac_selinux_maybe_reload(void);
26 void mac_selinux_finish(void);
28 int mac_selinux_fix_full(int atfd
, const char *inode_path
, const char *label_path
, LabelFixFlags flags
);
30 int mac_selinux_apply(const char *path
, const char *label
);
31 int mac_selinux_apply_fd(int fd
, const char *path
, const char *label
);
33 int mac_selinux_get_create_label_from_exe(const char *exe
, char **label
);
34 int mac_selinux_get_our_label(char **label
);
35 int mac_selinux_get_child_mls_label(int socket_fd
, const char *exe
, const char *exec_label
, char **label
);
36 char* mac_selinux_free(char *label
);
38 int mac_selinux_create_file_prepare_at(int dirfd
, const char *path
, mode_t mode
);
39 static inline int mac_selinux_create_file_prepare(const char *path
, mode_t mode
) {
40 return mac_selinux_create_file_prepare_at(AT_FDCWD
, path
, mode
);
42 int mac_selinux_create_file_prepare_label(const char *path
, const char *label
);
43 void mac_selinux_create_file_clear(void);
45 int mac_selinux_create_socket_prepare(const char *label
);
46 void mac_selinux_create_socket_clear(void);
48 int mac_selinux_bind(int fd
, const struct sockaddr
*addr
, socklen_t addrlen
);
50 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free
);