From a8269e99d349a8598d4f405af787139285475702 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 21 Nov 2020 12:54:22 -0800 Subject: selinux-h: add stubs for selabel_open etc. Coreutils with --enable-gcc-warnings does not build on Ubuntu 20.10 because matchpathcon is deprecated in favor of selabel_open etc., so this patch adds stubs for these functions. * lib/se-label.c, lib/se-label.in.h, m4/selinux-label-h.m4: New files. * lib/se-selinux.in.h (struct selinux_opt): Add incomplete decl, as it is needed for selabel_open and selinux/selinux.h declares this type here. * modules/selinux-h (Files): Add the new files. (configure.ac): Add gl_HEADERS_SELINUX_LABEL_H. (lib_SOURCES): Add se-label.in.h, se-label.c. (BUILT_SOURCES): Add $(SELINUX_LABEL_H). (selinux/label.h): New rule, mimicking selinux/context.h. (MOSTLYCLEANFILES): Add selinux/label.h, selinux/label.h-t. (Include): Add selinux/label.h. --- modules/selinux-h | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'modules/selinux-h') diff --git a/modules/selinux-h b/modules/selinux-h index e074e673f3..26face8a78 100644 --- a/modules/selinux-h +++ b/modules/selinux-h @@ -4,10 +4,13 @@ SELinux-related headers for systems that lack them. Files: lib/getfilecon.c lib/se-context.in.h +lib/se-label.in.h lib/se-selinux.in.h lib/se-context.c +lib/se-label.c lib/se-selinux.c m4/selinux-context-h.m4 +m4/selinux-label-h.m4 m4/selinux-selinux-h.m4 Depends-on: @@ -18,12 +21,14 @@ snippet/unused-parameter configure.ac: gl_HEADERS_SELINUX_SELINUX_H gl_HEADERS_SELINUX_CONTEXT_H +gl_HEADERS_SELINUX_LABEL_H if test "$with_selinux" != no && test "$ac_cv_header_selinux_selinux_h" = yes; then AC_LIBOBJ([getfilecon]) fi Makefile.am: -lib_SOURCES += se-context.in.h se-selinux.in.h se-context.c se-selinux.c +lib_SOURCES += se-context.in.h se-label.in.h se-selinux.in.h \ + se-context.c se-label.c se-selinux.c BUILT_SOURCES += selinux/selinux.h selinux/selinux.h: se-selinux.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H) @@ -58,11 +63,30 @@ selinux/context.h: $(top_builddir)/config.status rm -f $@ endif MOSTLYCLEANFILES += selinux/context.h selinux/context.h-t + +BUILT_SOURCES += $(SELINUX_LABEL_H) +if GL_GENERATE_SELINUX_LABEL_H +selinux/label.h: se-label.in.h $(top_builddir)/config.status $(UNUSED_PARAMETER_H) + $(AM_V_at)$(MKDIR_P) selinux + $(AM_V_GEN)rm -f $@-t $@ && \ + { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ + sed -e '/definition of _GL_UNUSED_PARAMETER/r $(UNUSED_PARAMETER_H)' \ + < $(srcdir)/se-label.in.h; \ + } > $@-t && \ + chmod a-x $@-t && \ + mv $@-t $@ +else +selinux/label.h: $(top_builddir)/config.status + rm -f $@ +endif +MOSTLYCLEANFILES += selinux/label.h selinux/label.h-t + MOSTLYCLEANDIRS += selinux Include: + Link: $(LIB_SELINUX) -- cgit v1.2.1