]>
Commit | Line | Data |
---|---|---|
fe4de9a6 DE |
1 | /* |
2 | * lxc: linux Container library | |
3 | * | |
4 | * Copyright © 2013 Oracle. | |
5 | * | |
6 | * Authors: | |
7 | * Dwight Engen <dwight.engen@oracle.com> | |
8 | * | |
9 | * This library is free software; you can redistribute it and/or | |
10 | * modify it under the terms of the GNU Lesser General Public | |
11 | * License as published by the Free Software Foundation; either | |
12 | * version 2.1 of the License, or (at your option) any later version. | |
13 | * | |
14 | * This library is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
17 | * Lesser General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU Lesser General Public | |
20 | * License along with this library; if not, write to the Free Software | |
21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
22 | */ | |
23 | ||
24 | #ifndef __lxc_lsm_h | |
25 | #define __lxc_lsm_h | |
26 | ||
27 | struct lxc_conf; | |
28 | ||
29 | #include <sys/types.h> | |
30 | ||
31 | struct lsm_drv { | |
32 | const char *name; | |
33 | ||
9e4bf8b1 | 34 | int (*enabled)(void); |
fe4de9a6 | 35 | char *(*process_label_get)(pid_t pid); |
72863294 DE |
36 | int (*process_label_set)(const char *label, int use_default, |
37 | int on_exec); | |
fe4de9a6 DE |
38 | }; |
39 | ||
40 | #if HAVE_APPARMOR || HAVE_SELINUX | |
41ca8908 DE |
41 | void lsm_init(void); |
42 | int lsm_enabled(void); | |
43 | const char *lsm_name(void); | |
44 | char *lsm_process_label_get(pid_t pid); | |
72863294 | 45 | int lsm_process_label_set(const char *label, int use_default, int on_exec); |
fe4de9a6 | 46 | #else |
41ca8908 DE |
47 | static inline void lsm_init(void) { } |
48 | static inline int lsm_enabled(void) { return 0; } | |
49 | static inline const char *lsm_name(void) { return "none"; } | |
50 | static inline char *lsm_process_label_get(pid_t pid) { return NULL; } | |
6c1b2b1d | 51 | static inline int lsm_process_label_set(const char *label, int use_default, int on_exec) { return 0; } |
fe4de9a6 DE |
52 | #endif |
53 | ||
54 | #endif |