diff options
author | Jim Meyering <meyering@redhat.com> | 2009-10-07 19:00:42 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2009-10-09 10:07:11 +0200 |
commit | f4dc80620e25623a69aa852bec5a52e150cedd4a (patch) | |
tree | 81f595ad8d8632cdbb960043b16c59e28c389db9 /m4/selinux-selinux-h.m4 | |
parent | d984c0bca01a92fb06e2a0bca2042240953e7808 (diff) | |
download | gnulib-f4dc80620e25623a69aa852bec5a52e150cedd4a.tar.gz |
selinux-h: always use getfilecon wrappers
* lib/getfilecon.c: New file.
* lib/se-selinux.in.h: Use a better inclusion guard symbol name.
[HAVE_SELINUX_SELINUX_H]: Include-next <selinux/selinux.h>.
[!HAVE_SELINUX_SELINUX_H]: Use better parameter names.
(fgetfilecon): Provide a stub.
* m4/selinux-selinux-h.m4 (gl_HEADERS_SELINUX_SELINUX_H): Don't
AC_SUBST SELINUX_SELINUX_H, since now we're generating that
file unconditionally.
When <selinux/selinux.h> is found, arrange to use wrappers.
* modules/selinux-h (Files): Add getfilecon.c.
(Makefile.am): Substitute include-next-related bits
into the now-always-generated selinux/selinux.h file.
* doc/glibc-functions/getfilecon.texi: New file.
* doc/glibc-functions/lgetfilecon.texi: New file.
* doc/glibc-functions/fgetfilecon.texi: New file.
* doc/glibc-functions/getfilecon-desc.texi: New file.
* doc/gnulib.texi (Glibc selinux/selinux.h): New section, by
which to pull in the new files.
* MODULES.html.sh (Misc): Add selinux-h.
Diffstat (limited to 'm4/selinux-selinux-h.m4')
-rw-r--r-- | m4/selinux-selinux-h.m4 | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/m4/selinux-selinux-h.m4 b/m4/selinux-selinux-h.m4 index 20dc77c436..767c4f7f1b 100644 --- a/m4/selinux-selinux-h.m4 +++ b/m4/selinux-selinux-h.m4 @@ -6,14 +6,26 @@ # From Jim Meyering # Provide <selinux/selinux.h>, if necessary. +# If it is already present, provide wrapper functions to guard against +# misbehavior from getfilecon, lgetfilecon, and fgetfilecon. AC_DEFUN([gl_HEADERS_SELINUX_SELINUX_H], [ AC_REQUIRE([gl_LIBSELINUX]) - AC_CHECK_HEADERS([selinux/selinux.h], - [SELINUX_SELINUX_H=], - [SELINUX_SELINUX_H=selinux/selinux.h]) - AC_SUBST([SELINUX_SELINUX_H]) + AC_CHECK_HEADERS([selinux/selinux.h]) + + if test "$ac_cv_header_selinux_selinux_h" = yes; then + # We do have <selinux/selinux.h>, so do compile getfilecon.c + # and arrange to use its wrappers. + AC_LIBOBJ([getfilecon]) + gl_CHECK_NEXT_HEADERS([selinux/selinux.h]) + AC_DEFINE([getfilecon], [rpl_getfilecon], + [Always use our getfilecon wrapper.]) + AC_DEFINE([lgetfilecon], [rpl_lgetfilecon], + [Always use our lgetfilecon wrapper.]) + AC_DEFINE([fgetfilecon], [rpl_fgetfilecon], + [Always use our fgetfilecon wrapper.]) + fi case "$ac_cv_search_setfilecon:$ac_cv_header_selinux_selinux_h" in no:*) # already warned |