2017-11-18 17:09:20 +01:00
|
|
|
/* SPDX-License-Identifier: LGPL-2.1+ */
|
2012-10-02 23:07:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2015-11-18 22:46:33 +01:00
|
|
|
#include <sys/socket.h>
|
2015-11-30 21:43:37 +01:00
|
|
|
#include <sys/types.h>
|
2012-10-02 23:07:00 +02:00
|
|
|
|
2015-09-23 19:55:49 +02:00
|
|
|
#include "macro.h"
|
2018-03-27 07:38:26 +02:00
|
|
|
#include "label.h"
|
2015-09-23 19:55:49 +02:00
|
|
|
|
2014-10-23 17:34:30 +02:00
|
|
|
bool mac_selinux_use(void);
|
|
|
|
void mac_selinux_retest(void);
|
2014-10-23 10:23:45 +02:00
|
|
|
|
2016-03-02 02:35:55 +01:00
|
|
|
int mac_selinux_init(void);
|
2014-10-23 10:23:46 +02:00
|
|
|
void mac_selinux_finish(void);
|
2014-10-23 10:23:45 +02:00
|
|
|
|
2018-03-27 07:38:26 +02:00
|
|
|
int mac_selinux_fix(const char *path, LabelFixFlags flags);
|
2014-10-23 19:41:27 +02:00
|
|
|
int mac_selinux_apply(const char *path, const char *label);
|
2014-10-23 10:23:45 +02:00
|
|
|
|
2014-10-23 10:23:46 +02:00
|
|
|
int mac_selinux_get_create_label_from_exe(const char *exe, char **label);
|
|
|
|
int mac_selinux_get_our_label(char **label);
|
2014-11-12 13:53:27 +01:00
|
|
|
int mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label);
|
2015-09-23 19:55:49 +02:00
|
|
|
char* mac_selinux_free(char *label);
|
2014-10-23 10:23:45 +02:00
|
|
|
|
2014-10-23 19:41:27 +02:00
|
|
|
int mac_selinux_create_file_prepare(const char *path, mode_t mode);
|
2018-07-02 10:22:56 +02:00
|
|
|
int mac_selinux_create_file_prepare_at(int dirfd, const char *path, mode_t mode);
|
2014-10-23 19:41:27 +02:00
|
|
|
void mac_selinux_create_file_clear(void);
|
2014-10-23 10:23:45 +02:00
|
|
|
|
2014-10-23 19:41:27 +02:00
|
|
|
int mac_selinux_create_socket_prepare(const char *label);
|
|
|
|
void mac_selinux_create_socket_clear(void);
|
|
|
|
|
|
|
|
int mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
|
2015-09-23 19:55:49 +02:00
|
|
|
|
|
|
|
DEFINE_TRIVIAL_CLEANUP_FUNC(char*, mac_selinux_free);
|