Christian Boltz
eb47f5e85c
- fix build with make 4.3 by backporting some commits from upstream master (boo#1167953): - make-4.3-capabilities.diff - make-4.3-capabilities-vim.diff - make-4.3-network.diff - make-4.3-fix-utils-network-test.diff Also fix a wrong patch filename in the previous .changes entry. The correct message about the refreshed patch is: - refresh usr-etc-abstractions-base-nameservice.diff OBS-URL: https://build.opensuse.org/request/show/789397 OBS-URL: https://build.opensuse.org/package/show/security:apparmor/apparmor?expand=0&rev=262
95 lines
3.6 KiB
Diff
95 lines
3.6 KiB
Diff
commit e92da079ca12e776991bd36524430bd67c1cb72a
|
|
Author: allgdante <allan.garret@gmail.com>
|
|
Date: Mon Mar 23 15:09:15 2020 +0000
|
|
|
|
Generate CAPABILITIES in a script due to make 4.3
|
|
|
|
This way we could generate the capabilities in a way that works with
|
|
every version of make.
|
|
Changes to list_capabilities are intended to exactly replicate the old
|
|
behavior.
|
|
|
|
diff --git a/common/Make.rules b/common/Make.rules
|
|
index 357bdec8..ecc6181a 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 <linux/capability.h>" | 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 00000000..4e37cda7
|
|
--- /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 <linux/capability.h>" | \
|
|
+ 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 2d40b06f..a71b5788 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 8fae738d..80990004 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 fea134f6..6a5f02a2 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)
|