Blame nscd/selinux.h

Packit 6c4009
/* Header for nscd SELinux access controls.
Packit 6c4009
   Copyright (C) 2004-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
   Contributed by Matthew Rickard <mjricka@epoch.ncsc.mil>, 2004.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#ifndef _SELINUX_H
Packit 6c4009
#define _SELINUX_H 1
Packit 6c4009
Packit 6c4009
#include "nscd.h"
Packit 6c4009
#ifdef HAVE_LIBCAP
Packit 6c4009
# include <sys/capability.h>
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
#ifdef HAVE_SELINUX
Packit 6c4009
/* Global variable to tell if the kernel has SELinux support.  */
Packit 6c4009
extern int selinux_enabled;
Packit 6c4009
Packit 6c4009
/* Define this for AVC stat usage.  */
Packit 6c4009
struct avc_cache_stats;
Packit 6c4009
Packit 6c4009
/* Initialize the userspace AVC.  */
Packit 6c4009
extern void nscd_avc_init (void);
Packit 6c4009
/* Determine if we are running on an SELinux kernel.  */
Packit 6c4009
extern void nscd_selinux_enabled (int *selinux_enabled);
Packit 6c4009
/* Check if the client has permission for the request type.  */
Packit 6c4009
extern int nscd_request_avc_has_perm (int fd, request_type req);
Packit 6c4009
/* Initialize AVC statistic information.  */
Packit 6c4009
extern void nscd_avc_cache_stats (struct avc_cache_stats *cstats);
Packit 6c4009
/* Display statistics on AVC usage.  */
Packit 6c4009
extern void nscd_avc_print_stats (struct avc_cache_stats *cstats);
Packit 6c4009
Packit 6c4009
# ifdef HAVE_LIBCAP
Packit 6c4009
/* Preserve capabilities to connect to the audit daemon. */
Packit 6c4009
extern cap_t preserve_capabilities (void);
Packit 6c4009
/* Install final capabilities.  */
Packit 6c4009
extern void install_real_capabilities (cap_t new_caps);
Packit 6c4009
# endif
Packit 6c4009
#else
Packit 6c4009
# define selinux_enabled 0
Packit 6c4009
# define nscd_avc_init() (void) 0
Packit 6c4009
# define nscd_selinux_enabled(selinux_enabled) (void) 0
Packit 6c4009
# define nscd_request_avc_has_perm(fd, req) 0
Packit 6c4009
# define nscd_avc_cache_stats(cstats) (void) 0
Packit 6c4009
# define nscd_avc_print_stats(cstats) (void) 0
Packit 6c4009
#endif /* HAVE_SELINUX */
Packit 6c4009
Packit 6c4009
#endif /* _SELINUX_H */