summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe MacDonald <joe_macdonald@mentor.com>2015-02-20 21:31:25 -0500
committerJoe MacDonald <joe_macdonald@mentor.com>2015-02-20 21:31:25 -0500
commita1185c46b8e142f1e9847579861231105bcf1461 (patch)
treee2733c5abd40fe01637a5ff171a3b9f88485c402
parentd382d54f0a9a913791fca1d7f61e87fcfd32842b (diff)
downloadmeta-selinux-a1185c46b8e142f1e9847579861231105bcf1461.tar.gz
policycoreutils: address QA issues
Both the fixfiles and sandbox utilities had dependencies on bash when they didn't really need to. Update sandbox and patch fixfiles. ifgen is python script, so ensure that python is listed as a runtime dependency. Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
-rw-r--r--recipes-security/selinux/policycoreutils.inc7
-rw-r--r--recipes-security/selinux/policycoreutils/policycoreutils-fixfiles-de-bashify.patch92
-rw-r--r--recipes-security/selinux/policycoreutils/policycoreutils-sandbox-de-bashify.patch39
3 files changed, 136 insertions, 2 deletions
diff --git a/recipes-security/selinux/policycoreutils.inc b/recipes-security/selinux/policycoreutils.inc
index 44a5861..4846683 100644
--- a/recipes-security/selinux/policycoreutils.inc
+++ b/recipes-security/selinux/policycoreutils.inc
@@ -7,7 +7,10 @@ context."
7SECTION = "base" 7SECTION = "base"
8LICENSE = "GPLv2+" 8LICENSE = "GPLv2+"
9 9
10SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)}" 10SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
11 file://policycoreutils-fixfiles-de-bashify.patch \
12 file://policycoreutils-sandbox-de-bashify.patch \
13 "
11 14
12PAM_SRC_URI = "file://pam.d/newrole \ 15PAM_SRC_URI = "file://pam.d/newrole \
13 file://pam.d/run_init \ 16 file://pam.d/run_init \
@@ -97,7 +100,7 @@ RDEPENDS_${BPN}-sepolicy += "\
97" 100"
98# static link to libsepol 101# static link to libsepol
99DEPENDS_${BPN}-sepolgen-ifgen += "libsepol" 102DEPENDS_${BPN}-sepolgen-ifgen += "libsepol"
100RDEPENDS_${BPN}-sepolgen-ifgen += "libselinux-python" 103RDEPENDS_${BPN}-sepolgen-ifgen += "python libselinux-python"
101RDEPENDS_${BPN}-sestatus += "libselinux" 104RDEPENDS_${BPN}-sestatus += "libselinux"
102RDEPENDS_${BPN}-setfiles += "\ 105RDEPENDS_${BPN}-setfiles += "\
103 libselinux \ 106 libselinux \
diff --git a/recipes-security/selinux/policycoreutils/policycoreutils-fixfiles-de-bashify.patch b/recipes-security/selinux/policycoreutils/policycoreutils-fixfiles-de-bashify.patch
new file mode 100644
index 0000000..44d7525
--- /dev/null
+++ b/recipes-security/selinux/policycoreutils/policycoreutils-fixfiles-de-bashify.patch
@@ -0,0 +1,92 @@
1From 25ca94680f2fe20f49b80e8b5b180a0dbb903f17 Mon Sep 17 00:00:00 2001
2From: Joe MacDonald <joe_macdonald@mentor.com>
3Date: Fri, 20 Feb 2015 17:00:19 -0500
4Subject: [PATCH] fixfiles: de-bashify
5
6Most of the bashisms in fixfiles are pretty easy to work around, the only
7complex one is the use of PIPESTATUS. The common solution to this is to
8use fifos but considering the action this script is performing, that's not
9necessarily the best option here. Introducing a second invocation of rpm
10is minimal overhead on an operation that should happen very infrequently,
11so we'll try that instead.
12
13Upstream-Status: Pending
14
15Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
16---
17 scripts/fixfiles | 26 +++++++++++++++-----------
18 1 file changed, 15 insertions(+), 11 deletions(-)
19
20diff --git a/scripts/fixfiles b/scripts/fixfiles
21index 5c29eb9..10a5078 100755
22--- a/scripts/fixfiles
23+++ b/scripts/fixfiles
24@@ -1,4 +1,4 @@
25-#!/bin/bash
26+#!/bin/sh
27 # fixfiles
28 #
29 # Script to restore labels on a SELinux box
30@@ -25,7 +25,7 @@
31 # number if the current kernel version is greater than 2.6.30, a negative
32 # number if the current is less than 2.6.30 and 0 if they are the same.
33 #
34-function useseclabel {
35+useseclabel() {
36 VER=`uname -r`
37 SUP=2.6.30
38 expr '(' "$VER" : '\([^.]*\)' ')' '-' '(' "$SUP" : '\([^.]*\)' ')' '|' \
39@@ -91,9 +91,9 @@ exclude_dirs_from_relabelling() {
40 # skip not absolute path
41 # skip not directory
42 [ -z "${i}" ] && continue
43- [[ "${i}" =~ "^[[:blank:]]*#" ]] && continue
44- [[ ! "${i}" =~ ^/.* ]] && continue
45- [[ ! -d "${i}" ]] && continue
46+ echo "${i}" | egrep -q '^[[:space:]]*#' && continue
47+ echo "${i}" | egrep -v '^/.*' && continue
48+ [ ! -d "${i}" ] && continue
49 exclude_from_relabelling="$exclude_from_relabelling -e $i"
50 logit "skipping the directory $i"
51 done < /etc/selinux/fixfiles_exclude_dirs
52@@ -205,8 +205,12 @@ fi
53 }
54
55 rpmlist() {
56-rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" | grep '^0 ' | cut -f2- -d ' '
57-[ ${PIPESTATUS[0]} != 0 ] && echo "$1 not found" >/dev/stderr
58+ if rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" >/dev/null
59+ then
60+ rpm -q --qf '[%{FILESTATES} %{FILENAMES}\n]' "$1" | grep '^0 ' | cut -f2- -d ' '
61+ else
62+ echo "$1 not found" >/dev/stderr
63+ fi
64 }
65
66 #
67@@ -233,10 +237,10 @@ if [ -n "${exclude_dirs}" ]
68 then
69 TEMPFCFILE=`mktemp ${FC}.XXXXXXXXXX`
70 test -z "$TEMPFCFILE" && exit
71- /bin/cp -p ${FC} ${TEMPFCFILE} &>/dev/null || exit
72- tmpdirs=${tempdirs//-e/}
73- for p in ${tmpdirs}
74+ /bin/cp -p ${FC} ${TEMPFCFILE} >/dev/null 2>&1 || exit
75+ for p in ${tempdirs}
76 do
77+ [ ${p} = "-e" ] && continue
78 p="${p%/}"
79 p1="${p}(/.*)? -- <<none>>"
80 echo "${p1}" >> $TEMPFCFILE
81@@ -288,7 +292,7 @@ relabel() {
82 restore Relabel
83 fi
84
85- if [ $fullFlag == 1 ]; then
86+ if [ $fullFlag = 1 ]; then
87 fullrelabel
88 fi
89
90--
911.9.1
92
diff --git a/recipes-security/selinux/policycoreutils/policycoreutils-sandbox-de-bashify.patch b/recipes-security/selinux/policycoreutils/policycoreutils-sandbox-de-bashify.patch
new file mode 100644
index 0000000..c078ef6
--- /dev/null
+++ b/recipes-security/selinux/policycoreutils/policycoreutils-sandbox-de-bashify.patch
@@ -0,0 +1,39 @@
1From d3e778e0062ca441c80e2a3ef2b508f5566e1f70 Mon Sep 17 00:00:00 2001
2From: Joe MacDonald <joe_macdonald@mentor.com>
3Date: Fri, 20 Feb 2015 21:07:47 -0500
4Subject: [PATCH] sandbox: de-bashify
5
6There's no bashisms apparent in either the sandbox initscript nor the
7sandboxX script, so point them at /bin/sh instead.
8
9Upstream-Status: Pending
10
11Signed-off-by: Joe MacDonald <joe_macdonald@mentor.com>
12---
13 sandbox/sandbox.init | 2 +-
14 sandbox/sandboxX.sh | 2 +-
15 2 files changed, 2 insertions(+), 2 deletions(-)
16
17diff --git a/sandbox/sandbox.init b/sandbox/sandbox.init
18index b3979bf..1893dc8 100644
19--- a/sandbox/sandbox.init
20+++ b/sandbox/sandbox.init
21@@ -1,4 +1,4 @@
22-#!/bin/bash
23+#!/bin/sh
24 ## BEGIN INIT INFO
25 # Provides: sandbox
26 # Default-Start: 3 4 5
27diff --git a/sandbox/sandboxX.sh b/sandbox/sandboxX.sh
28index eaa500d..8755d75 100644
29--- a/sandbox/sandboxX.sh
30+++ b/sandbox/sandboxX.sh
31@@ -1,4 +1,4 @@
32-#!/bin/bash
33+#!/bin/sh
34 trap "" TERM
35 context=`id -Z | secon -t -l -P`
36 export TITLE="Sandbox $context -- `grep ^#TITLE: ~/.sandboxrc | /usr/bin/cut -b8-80`"
37--
381.9.1
39