diff --git a/common/Make.rules b/common/Make.rules index 357bdec85..ecc6181ab 100644 --- a/common/Make.rules +++ b/common/Make.rules @@ -74,19 +74,6 @@ endif pod_clean: -rm -f ${MANPAGES} *.[0-9].gz ${HTMLMANPAGES} pod2htm*.tmp -# ===================== -# generate list of capabilities based on -# /usr/include/linux/capabilities.h for use in multiple locations in -# the source tree -# ===================== - -# emits defined capabilities in a simple list, e.g. "CAP_NAME CAP_NAME2" -CAPABILITIES=$(shell echo "\#include " | cpp -dM | LC_ALL=C sed -n -e '/CAP_EMPTY_SET/d' -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$$/CAP_\1/p' | LC_ALL=C sort) - -.PHONY: list_capabilities -list_capabilities: /usr/include/linux/capability.h - @echo "$(CAPABILITIES)" - # ===================== # manpages # ===================== diff --git a/common/list_capabilities.sh b/common/list_capabilities.sh new file mode 100755 index 000000000..4e37cda73 --- /dev/null +++ b/common/list_capabilities.sh @@ -0,0 +1,14 @@ +#!/bin/bash -e + +# ===================== +# generate list of capabilities based on +# /usr/include/linux/capabilities.h for use in multiple locations in +# the source tree +# ===================== + +echo "#include " | \ + cpp -dM | \ + LC_ALL=C sed -n \ + -e '/CAP_EMPTY_SET/d' \ + -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$/CAP_\1/p' | \ + LC_ALL=C sort diff --git a/parser/Makefile b/parser/Makefile index 2d40b06f5..a71b5788c 100644 --- a/parser/Makefile +++ b/parser/Makefile @@ -284,7 +284,7 @@ af_names.h: ../common/list_af_names.sh # cat $@ cap_names.h: /usr/include/linux/capability.h - echo "$(CAPABILITIES)" | LC_ALL=C sed -n -e "s/[ \\t]\\?CAP_\\([A-Z0-9_]\\+\\)/\{\"\\L\\1\", \\UCAP_\\1\},\\n/pg" > $@ + ../common/list_capabilities.sh | LC_ALL=C sed -n -e "s/[ \\t]\\?CAP_\\([A-Z0-9_]\\+\\)/\{\"\\L\\1\", \\UCAP_\\1\},\\n/pg" > $@ tst_lib: lib.c parser.h $(filter-out lib.o, ${TEST_OBJECTS}) $(CXX) $(TEST_CFLAGS) -o $@ $< $(filter-out $(<:.c=.o), ${TEST_OBJECTS}) $(TEST_LDFLAGS) $(TEST_LDLIBS) diff --git a/utils/Makefile b/utils/Makefile index 8fae738de..80990004a 100644 --- a/utils/Makefile +++ b/utils/Makefile @@ -79,7 +79,7 @@ clean: pod_clean .SILENT: check_severity_db check_severity_db: /usr/include/linux/capability.h severity.db # The sed statement is based on the one in the parser's makefile - RC=0 ; for cap in ${CAPABILITIES} ; do \ + RC=0 ; for cap in $(shell ../common/list_capabilities.sh) ; do \ if ! grep -q -w $${cap} severity.db ; then \ echo "Warning! capability $${cap} not found in severity.db" ; \ RC=1 ; \ diff --git a/utils/vim/create-apparmor.vim.py b/utils/vim/create-apparmor.vim.py index fea134f67..6a5f02a2f 100644 --- a/utils/vim/create-apparmor.vim.py +++ b/utils/vim/create-apparmor.vim.py @@ -45,7 +45,7 @@ def cmd(command, input=None, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, s return [sp.returncode, out + outerr] # get capabilities list -(rc, output) = cmd(['make', '-s', '--no-print-directory', 'list_capabilities']) +(rc, output) = cmd(['../../common/list_capabilities.sh']) if rc != 0: sys.stderr.write("make list_capabilities failed: " + output) exit(rc)