xref: /third_party/eudev/src/shared/selinux-util.h (revision 99ca880a)
199ca880aSopenharmony_ci/***
299ca880aSopenharmony_ci  This file is part of eudev, forked from systemd.
399ca880aSopenharmony_ci
499ca880aSopenharmony_ci  Copyright 2010 Lennart Poettering
599ca880aSopenharmony_ci
699ca880aSopenharmony_ci  systemd is free software; you can redistribute it and/or modify it
799ca880aSopenharmony_ci  under the terms of the GNU Lesser General Public License as published by
899ca880aSopenharmony_ci  the Free Software Foundation; either version 2.1 of the License, or
999ca880aSopenharmony_ci  (at your option) any later version.
1099ca880aSopenharmony_ci
1199ca880aSopenharmony_ci  systemd is distributed in the hope that it will be useful, but
1299ca880aSopenharmony_ci  WITHOUT ANY WARRANTY; without even the implied warranty of
1399ca880aSopenharmony_ci  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1499ca880aSopenharmony_ci  Lesser General Public License for more details.
1599ca880aSopenharmony_ci
1699ca880aSopenharmony_ci  You should have received a copy of the GNU Lesser General Public License
1799ca880aSopenharmony_ci  along with systemd; If not, see <http://www.gnu.org/licenses/>.
1899ca880aSopenharmony_ci***/
1999ca880aSopenharmony_ci
2099ca880aSopenharmony_ci#pragma once
2199ca880aSopenharmony_ci
2299ca880aSopenharmony_ci#include <sys/socket.h>
2399ca880aSopenharmony_ci#include <stdio.h>
2499ca880aSopenharmony_ci#include <stdbool.h>
2599ca880aSopenharmony_ci#include <fcntl.h>
2699ca880aSopenharmony_ci
2799ca880aSopenharmony_cibool mac_selinux_use(void);
2899ca880aSopenharmony_civoid mac_selinux_retest(void);
2999ca880aSopenharmony_ci
3099ca880aSopenharmony_ciint mac_selinux_init(const char *prefix);
3199ca880aSopenharmony_civoid mac_selinux_finish(void);
3299ca880aSopenharmony_ci
3399ca880aSopenharmony_ciint mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
3499ca880aSopenharmony_ciint mac_selinux_apply(const char *path, const char *label);
3599ca880aSopenharmony_ci
3699ca880aSopenharmony_ciint mac_selinux_get_create_label_from_exe(const char *exe, char **label);
3799ca880aSopenharmony_ciint mac_selinux_get_our_label(char **label);
3899ca880aSopenharmony_ciint mac_selinux_get_child_mls_label(int socket_fd, const char *exe, const char *exec_label, char **label);
3999ca880aSopenharmony_civoid mac_selinux_free(char *label);
4099ca880aSopenharmony_ci
4199ca880aSopenharmony_ciint mac_selinux_create_file_prepare(const char *path, mode_t mode);
4299ca880aSopenharmony_civoid mac_selinux_create_file_clear(void);
4399ca880aSopenharmony_ci
4499ca880aSopenharmony_ciint mac_selinux_create_socket_prepare(const char *label);
4599ca880aSopenharmony_civoid mac_selinux_create_socket_clear(void);
4699ca880aSopenharmony_ci
4799ca880aSopenharmony_ciint mac_selinux_mkdir(const char *path, mode_t mode);
4899ca880aSopenharmony_ciint mac_selinux_bind(int fd, const struct sockaddr *addr, socklen_t addrlen);
49