xref: /freebsd/lib/libveriexec/libveriexec.h (revision 1554ba03b651319ab0e1cde8492ea4516afc648b)
188a3358eSStephen J. Kiernan /*-
288a3358eSStephen J. Kiernan  * SPDX-License-Identifier: BSD-2-Clause
3b6b5dcf2SStephen J. Kiernan  *
4*1554ba03SSimon J. Gerraty  * Copyright (c) 2011-2023, Juniper Networks, Inc.
5b6b5dcf2SStephen J. Kiernan  * All rights reserved.
6b6b5dcf2SStephen J. Kiernan  *
7b6b5dcf2SStephen J. Kiernan  * Redistribution and use in source and binary forms, with or without
8b6b5dcf2SStephen J. Kiernan  * modification, are permitted provided that the following conditions
9b6b5dcf2SStephen J. Kiernan  * are met:
10b6b5dcf2SStephen J. Kiernan  * 1. Redistributions of source code must retain the above copyright
11b6b5dcf2SStephen J. Kiernan  *    notice, this list of conditions and the following disclaimer.
12b6b5dcf2SStephen J. Kiernan  * 2. Redistributions in binary form must reproduce the above copyright
13b6b5dcf2SStephen J. Kiernan  *    notice, this list of conditions and the following disclaimer in the
14b6b5dcf2SStephen J. Kiernan  *    documentation and/or other materials provided with the distribution.
15b6b5dcf2SStephen J. Kiernan  *
16b6b5dcf2SStephen J. Kiernan  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17b6b5dcf2SStephen J. Kiernan  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18b6b5dcf2SStephen J. Kiernan  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19b6b5dcf2SStephen J. Kiernan  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20b6b5dcf2SStephen J. Kiernan  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21b6b5dcf2SStephen J. Kiernan  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22b6b5dcf2SStephen J. Kiernan  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23b6b5dcf2SStephen J. Kiernan  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24b6b5dcf2SStephen J. Kiernan  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25b6b5dcf2SStephen J. Kiernan  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26b6b5dcf2SStephen J. Kiernan  * SUCH DAMAGE.
27b6b5dcf2SStephen J. Kiernan  */
28b6b5dcf2SStephen J. Kiernan 
29b6b5dcf2SStephen J. Kiernan #ifndef __LIBVERIEXEC_H__
30b6b5dcf2SStephen J. Kiernan #define __LIBVERIEXEC_H__
31b6b5dcf2SStephen J. Kiernan 
328512d82eSSteve Kiernan struct mac_veriexec_syscall_params;
338512d82eSSteve Kiernan 
34b6b5dcf2SStephen J. Kiernan int	veriexec_check_fd_mode(int, unsigned int);
35b6b5dcf2SStephen J. Kiernan int	veriexec_check_path_mode(const char *, unsigned int);
36b6b5dcf2SStephen J. Kiernan int	veriexec_check_fd(int);
37b6b5dcf2SStephen J. Kiernan int	veriexec_check_path(const char *);
388512d82eSSteve Kiernan int	veriexec_get_pid_params(pid_t, struct mac_veriexec_syscall_params *);
398512d82eSSteve Kiernan int	veriexec_get_path_params(const char *,
408512d82eSSteve Kiernan 	    struct mac_veriexec_syscall_params *);
419bc96108SSteve Kiernan int	veriexec_check_path_label(const char *, const char *);
428512d82eSSteve Kiernan int	veriexec_check_pid_label(pid_t, const char *);
43*1554ba03SSimon J. Gerraty char *	veriexec_get_path_label(const char *, char *, size_t);
44*1554ba03SSimon J. Gerraty char *	veriexec_get_pid_label(pid_t, char *, size_t);
45*1554ba03SSimon J. Gerraty unsigned int gbl_check_path(const char *);
46*1554ba03SSimon J. Gerraty unsigned int gbl_check_pid(pid_t);
47*1554ba03SSimon J. Gerraty int	execv_script(const char *, char * const *);
488512d82eSSteve Kiernan 
49*1554ba03SSimon J. Gerraty #define HAVE_GBL_CHECK_PID 1
50*1554ba03SSimon J. Gerraty #define HAVE_VERIEXEC_CHECK_PATH_LABEL 1
518512d82eSSteve Kiernan #define HAVE_VERIEXEC_CHECK_PID_LABEL 1
52*1554ba03SSimon J. Gerraty #define HAVE_VERIEXEC_GET_PATH_LABEL 1
53*1554ba03SSimon J. Gerraty #define HAVE_VERIEXEC_GET_PID_LABEL 1
54b6b5dcf2SStephen J. Kiernan 
55b6b5dcf2SStephen J. Kiernan #endif  /* __LIBVERIEXEC_H__ */
56