]>
git.ipfire.org Git - thirdparty/systemd.git/blob - src/basic/selinux-util.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 #include <sys/socket.h>
12 #include <selinux/selinux.h>
14 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, freecon
);
15 #define _cleanup_freecon_ _cleanup_(freeconp)
18 bool mac_selinux_use(void);
19 void mac_selinux_retest(void);
20 bool mac_selinux_enforcing(void);
22 int mac_selinux_init(void);
23 void mac_selinux_maybe_reload(void);
24 void mac_selinux_finish(void);
26 int mac_selinux_fix_container(const char *path
, const char *inside_path
, LabelFixFlags flags
);
27 static inline int mac_selinux_fix(const char *path
, LabelFixFlags flags
) {
28 return mac_selinux_fix_container(path
, path
, flags
);
31 int mac_selinux_fix_container_fd(int fd
, const char *path
, const char *inside_path
, LabelFixFlags flags
);
32 static inline int mac_selinux_fix_fd(int fd
, const char *path
, LabelFixFlags flags
) {
33 return mac_selinux_fix_container_fd(fd
, path
, path
, flags
);
36 int mac_selinux_apply(const char *path
, const char *label
);
37 int mac_selinux_apply_fd(int fd
, const char *path
, const char *label
);
39 int mac_selinux_get_create_label_from_exe(const char *exe
, char **label
);
40 int mac_selinux_get_our_label(char **label
);
41 int mac_selinux_get_child_mls_label(int socket_fd
, const char *exe
, const char *exec_label
, char **label
);
42 char* mac_selinux_free(char *label
);
44 int mac_selinux_create_file_prepare(const char *path
, mode_t mode
);
45 int mac_selinux_create_file_prepare_at(int dirfd
, const char *path
, mode_t mode
);
46 void mac_selinux_create_file_clear(void);
48 int mac_selinux_create_socket_prepare(const char *label
);
49 void mac_selinux_create_socket_clear(void);
51 int mac_selinux_bind(int fd
, const struct sockaddr
*addr
, socklen_t addrlen
);
53 DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free
);