Back to index

glibc  2.9
selinux.h
Go to the documentation of this file.
00001 /* Header for nscd SELinux access controls.
00002    Copyright (C) 2004, 2006, 2007 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004    Contributed by Matthew Rickard <mjricka@epoch.ncsc.mil>, 2004.
00005 
00006    The GNU C Library is free software; you can redistribute it and/or
00007    modify it under the terms of the GNU Lesser General Public
00008    License as published by the Free Software Foundation; either
00009    version 2.1 of the License, or (at your option) any later version.
00010 
00011    The GNU C Library is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014    Lesser General Public License for more details.
00015 
00016    You should have received a copy of the GNU Lesser General Public
00017    License along with the GNU C Library; if not, write to the Free
00018    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00019    02111-1307 USA.  */
00020 
00021 #ifndef _SELINUX_H
00022 #define _SELINUX_H 1
00023 
00024 #include "nscd.h"
00025 #ifdef HAVE_LIBCAP
00026 # include <sys/capability.h>
00027 #endif
00028 
00029 #ifdef HAVE_SELINUX
00030 /* Global variable to tell if the kernel has SELinux support.  */
00031 extern int selinux_enabled;
00032 
00033 /* Define this for AVC stat usage.  */
00034 struct avc_cache_stats;
00035 
00036 /* Initialize the userspace AVC.  */
00037 extern void nscd_avc_init (void);
00038 /* Destroy the userspace AVC.  */
00039 extern void nscd_avc_destroy (void);
00040 /* Determine if we are running on an SELinux kernel.  */
00041 extern void nscd_selinux_enabled (int *selinux_enabled);
00042 /* Check if the client has permission for the request type.  */
00043 extern int nscd_request_avc_has_perm (int fd, request_type req);
00044 /* Initialize AVC statistic information.  */
00045 extern void nscd_avc_cache_stats (struct avc_cache_stats *cstats);
00046 /* Display statistics on AVC usage.  */
00047 extern void nscd_avc_print_stats (struct avc_cache_stats *cstats);
00048 
00049 # ifdef HAVE_LIBCAP
00050 /* Preserve capabilities to connect to connnect to the audit daemon.  */
00051 extern cap_t preserve_capabilities (void);
00052 /* Install final capabilities.  */
00053 extern void install_real_capabilities (cap_t new_caps);
00054 # endif
00055 #else
00056 # define selinux_enabled 0
00057 # define nscd_avc_init() (void) 0
00058 # define nscd_avc_destroy() (void) 0
00059 # define nscd_selinux_enabled(selinux_enabled) (void) 0
00060 # define nscd_request_avc_has_perm(fd, req) 0
00061 # define nscd_avc_cache_stats(cstats) (void) 0
00062 # define nscd_avc_print_stats(cstats) (void) 0
00063 #endif /* HAVE_SELINUX */
00064 
00065 #endif /* _SELINUX_H */