]>
Commit | Line | Data |
---|---|---|
74a30a58 | 1 | /* Header for nscd SELinux access controls. |
dff8da6b | 2 | Copyright (C) 2004-2024 Free Software Foundation, Inc. |
74a30a58 | 3 | This file is part of the GNU C Library. |
74a30a58 UD |
4 | |
5 | The GNU C Library is free software; you can redistribute it and/or | |
6 | modify it under the terms of the GNU Lesser General Public | |
7 | License as published by the Free Software Foundation; either | |
8 | version 2.1 of the License, or (at your option) any later version. | |
9 | ||
10 | The GNU C Library is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | Lesser General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU Lesser General Public | |
59ba27a6 | 16 | License along with the GNU C Library; if not, see |
5a82c748 | 17 | <https://www.gnu.org/licenses/>. */ |
74a30a58 UD |
18 | |
19 | #ifndef _SELINUX_H | |
20 | #define _SELINUX_H 1 | |
21 | ||
22 | #include "nscd.h" | |
1f063dca | 23 | #ifdef HAVE_LIBCAP |
e1f0c5bc | 24 | # include <sys/capability.h> |
1f063dca | 25 | #endif |
74a30a58 UD |
26 | |
27 | #ifdef HAVE_SELINUX | |
28 | /* Global variable to tell if the kernel has SELinux support. */ | |
29 | extern int selinux_enabled; | |
30 | ||
31 | /* Define this for AVC stat usage. */ | |
32 | struct avc_cache_stats; | |
33 | ||
34 | /* Initialize the userspace AVC. */ | |
35 | extern void nscd_avc_init (void); | |
74a30a58 UD |
36 | /* Determine if we are running on an SELinux kernel. */ |
37 | extern void nscd_selinux_enabled (int *selinux_enabled); | |
38 | /* Check if the client has permission for the request type. */ | |
39 | extern int nscd_request_avc_has_perm (int fd, request_type req); | |
40 | /* Initialize AVC statistic information. */ | |
41 | extern void nscd_avc_cache_stats (struct avc_cache_stats *cstats); | |
42 | /* Display statistics on AVC usage. */ | |
43 | extern void nscd_avc_print_stats (struct avc_cache_stats *cstats); | |
1f063dca UD |
44 | |
45 | # ifdef HAVE_LIBCAP | |
795934a6 | 46 | /* Preserve capabilities to connect to the audit daemon. */ |
1f063dca UD |
47 | extern cap_t preserve_capabilities (void); |
48 | /* Install final capabilities. */ | |
49 | extern void install_real_capabilities (cap_t new_caps); | |
50 | # endif | |
74a30a58 UD |
51 | #else |
52 | # define selinux_enabled 0 | |
53 | # define nscd_avc_init() (void) 0 | |
74a30a58 UD |
54 | # define nscd_selinux_enabled(selinux_enabled) (void) 0 |
55 | # define nscd_request_avc_has_perm(fd, req) 0 | |
56 | # define nscd_avc_cache_stats(cstats) (void) 0 | |
57 | # define nscd_avc_print_stats(cstats) (void) 0 | |
58 | #endif /* HAVE_SELINUX */ | |
59 | ||
60 | #endif /* _SELINUX_H */ |