1d97fcfceSRobert Watson /* 2d97fcfceSRobert Watson * Copyright (c) 1999, 2000, 2001, 2002 Robert N. M. Watson 3d97fcfceSRobert Watson * All rights reserved. 4d97fcfceSRobert Watson * 5d97fcfceSRobert Watson * This software was developed by Robert Watson for the TrustedBSD Project. 6d97fcfceSRobert Watson * 7d97fcfceSRobert Watson * Redistribution and use in source and binary forms, with or without 8d97fcfceSRobert Watson * modification, are permitted provided that the following conditions 9d97fcfceSRobert Watson * are met: 10d97fcfceSRobert Watson * 1. Redistributions of source code must retain the above copyright 11d97fcfceSRobert Watson * notice, this list of conditions and the following disclaimer. 12d97fcfceSRobert Watson * 2. Redistributions in binary form must reproduce the above copyright 13d97fcfceSRobert Watson * notice, this list of conditions and the following disclaimer in the 14d97fcfceSRobert Watson * documentation and/or other materials provided with the distribution. 15d97fcfceSRobert Watson * 3. The names of the authors may not be used to endorse or promote 16d97fcfceSRobert Watson * products derived from this software without specific prior written 17d97fcfceSRobert Watson * permission. 18d97fcfceSRobert Watson * 19d97fcfceSRobert Watson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20d97fcfceSRobert Watson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21d97fcfceSRobert Watson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22d97fcfceSRobert Watson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23d97fcfceSRobert Watson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24d97fcfceSRobert Watson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25d97fcfceSRobert Watson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26d97fcfceSRobert Watson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27d97fcfceSRobert Watson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28d97fcfceSRobert Watson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29d97fcfceSRobert Watson * SUCH DAMAGE. 30d97fcfceSRobert Watson * 31d97fcfceSRobert Watson * $FreeBSD$ 32d97fcfceSRobert Watson */ 33d97fcfceSRobert Watson 34d97fcfceSRobert Watson #include <sys/types.h> 35d97fcfceSRobert Watson #include <sys/mac.h> 36d97fcfceSRobert Watson 37d97fcfceSRobert Watson #include <errno.h> 38d97fcfceSRobert Watson #include <stdlib.h> 39d97fcfceSRobert Watson 40e0554a53SJacques Vidrine extern int __mac_get_fd(int fd, struct mac *mac_p); 41e0554a53SJacques Vidrine extern int __mac_get_file(const char *path_p, struct mac *mac_p); 42e0554a53SJacques Vidrine extern int __mac_get_link(const char *path_p, struct mac *mac_p); 43e0554a53SJacques Vidrine extern int __mac_get_pid(pid_t pid, struct mac *mac_p); 44e0554a53SJacques Vidrine extern int __mac_get_proc(struct mac *mac_p); 45e0554a53SJacques Vidrine 46391b1d75SRobert Watson int 47391b1d75SRobert Watson mac_get_fd(int fd, struct mac *label) 48d97fcfceSRobert Watson { 49d97fcfceSRobert Watson 50391b1d75SRobert Watson return (__mac_get_fd(fd, label)); 51d97fcfceSRobert Watson } 52d97fcfceSRobert Watson 53391b1d75SRobert Watson int 54391b1d75SRobert Watson mac_get_file(const char *path, struct mac *label) 55d97fcfceSRobert Watson { 56d97fcfceSRobert Watson 57391b1d75SRobert Watson return (__mac_get_file(path, label)); 58d97fcfceSRobert Watson } 59d97fcfceSRobert Watson 60391b1d75SRobert Watson int 61391b1d75SRobert Watson mac_get_link(const char *path, struct mac *label) 62d97fcfceSRobert Watson { 63d97fcfceSRobert Watson 64391b1d75SRobert Watson return (__mac_get_link(path, label)); 65d97fcfceSRobert Watson } 66d97fcfceSRobert Watson 67391b1d75SRobert Watson int 68391b1d75SRobert Watson mac_get_pid(pid_t pid, struct mac *label) 69391b1d75SRobert Watson { 70391b1d75SRobert Watson 71391b1d75SRobert Watson return (__mac_get_pid(pid, label)); 72d97fcfceSRobert Watson } 73d97fcfceSRobert Watson 74391b1d75SRobert Watson int 75391b1d75SRobert Watson mac_get_proc(struct mac *label) 76391b1d75SRobert Watson { 77391b1d75SRobert Watson 78391b1d75SRobert Watson return (__mac_get_proc(label)); 79d97fcfceSRobert Watson } 80