Skip to contentSkip to conversation

selinux: uprev include file to 20170804

PATCH Superseded [email protected] 3 participants 29 messages Sep 5, 2017 – Sep 18, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/21 selinux: uprev include file to 20170804

From: Wenzong Fan <[email protected]>

---
 recipes-security/selinux/{selinux_20161014.inc => selinux_20170804.inc} | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename recipes-security/selinux/{selinux_20161014.inc => selinux_20170804.inc} (84%)
recipes-security/selinux/selinux_20170804.inc renamed from recipes-security/selinux/selinux_20161014.inc +1 -1
similarity index 84%
rename from recipes-security/selinux/selinux_20161014.inc
rename to recipes-security/selinux/selinux_20170804.inc
index c97e35b..1c11208 100644
@@ -1,4 +1,4 @@
-SELINUX_RELEASE = "20161014"
+SELINUX_RELEASE = "20170804"
 
 SRC_URI = "https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/${SELINUX_RELEASE}/${BPN}-${PV}.tar.gz"
 
Signature · 1 line
2.13.0
#1 lore raw

PATCH 2/21 libsepol: uprev to 2.7 (20170804)

From: Wenzong Fan <[email protected]>

---
 recipes-security/selinux/{libsepol_2.6.bb => libsepol_2.7.bb} | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 rename recipes-security/selinux/{libsepol_2.6.bb => libsepol_2.7.bb} (49%)
recipes-security/selinux/libsepol_2.7.bb renamed from recipes-security/selinux/libsepol_2.6.bb +3 -3
similarity index 49%
rename from recipes-security/selinux/libsepol_2.6.bb
rename to recipes-security/selinux/libsepol_2.7.bb
index e593fe9..f38f7ba 100644
@@ -1,9 +1,9 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343"
 
-SRC_URI[md5sum] = "dc1dfd31aea4c6e4b521f3aa2bddf7de"
-SRC_URI[sha256sum] = "d856d6506054f52abeaa3543ea2f2344595a3dc05d0d873ed7f724f7a16b1874"
+SRC_URI[md5sum] = "9424b93fd6efd853b9360f29265c5aa3"
+SRC_URI[sha256sum] = "d69d3bd8ec901a3bd5adf2be2fb47fb1a685ed73066ab482e7e505371a48f9e7"
 
 SRC_URI += "file://0001-src-Makefile-fix-includedir-in-libsepol.pc.patch"
Signature · 1 line
2.13.0
#2 lore raw

PATCH 3/21 libselinux: uprev to 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Specify LIBSEPOLA to fix build error:
make[1]: *** No rule to make target /usr/lib/libsepol.a', needed by python-2.7audit2why.so'. Stop.

Add python-importlib to RDEPENDS_${PN}-python.

---
 recipes-security/selinux/libselinux.inc                           | 3 ++-
 recipes-security/selinux/{libselinux_2.6.bb => libselinux_2.7.bb} | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)
 rename recipes-security/selinux/{libselinux_2.6.bb => libselinux_2.7.bb} (72%)
recipes-security/selinux/libselinux.inc +2 -1
index ad00d10..bd5ce8d 100644
@@ -8,6 +8,7 @@ LICENSE = "PD"
 inherit lib_package pythonnative
 
 DEPENDS += "libsepol python libpcre swig-native"
+RDEPENDS_${PN}-python += "python-importlib"
 
 PACKAGES += "${PN}-python"
 FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*"
@@ -21,7 +22,7 @@ def get_policyconfigarch(d):
     return "ARCH=%s" % (target)
 EXTRA_OEMAKE += "${@get_policyconfigarch(d)}"
 
-EXTRA_OEMAKE += "LDFLAGS='${LDFLAGS} -lpcre'"
+EXTRA_OEMAKE += "LDFLAGS='${LDFLAGS} -lpcre' LIBSEPOLA='${STAGING_LIBDIR}/libsepol.a'"
 
 do_compile_append() {
     oe_runmake pywrap -j1 \
recipes-security/selinux/libselinux_2.7.bb renamed from recipes-security/selinux/libselinux_2.6.bb +3 -3
similarity index 72%
rename from recipes-security/selinux/libselinux_2.6.bb
rename to recipes-security/selinux/libselinux_2.7.bb
index b9ad231..e0d01fc 100644
@@ -1,10 +1,10 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://LICENSE;md5=84b4d2c6ef954a2d4081e775a270d0d0"
 
-SRC_URI[md5sum] = "0e066ba6d6e590ba4b53eed64905d901"
-SRC_URI[sha256sum] = "4ea2dde50665c202253ba5caac7738370ea0337c47b251ba981c60d24e1a118a"
+SRC_URI[md5sum] = "1d48ee4e9fadd76794d70c806b69ba7d"
+SRC_URI[sha256sum] = "d0fec0769b3ad60aa7baf9b9a4b7a056827769dc2dadda0dc0eb59b3d1c18c57"
 
 SRC_URI += "\
         file://libselinux-drop-Wno-unused-but-set-variable.patch \
Signature · 1 line
2.13.0
#3 lore raw

PATCH 4/21 libsemanage: uprev to 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Remove patches that included by new version:
- 0001-libsemanage-simplify-string-utilities-functions.patch
- 0002-libsemanage-add-semanage_str_replace-utility-functio.patch
- 0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
- 0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
- libsemanage-fix-path-len-limit.patch

Rebase patch:
- libsemanage-allow-to-disable-audit-support.patch

Set PYCEXT and PYSITEDIR to generate the _semanage.so and install it to ${libdir}/python${PYTHON_BASEVERSION}/site-packages.

---
 recipes-security/selinux/libsemanage.inc           |   2 +
 ...anage-simplify-string-utilities-functions.patch | 115 --------
 ...-add-semanage_str_replace-utility-functio.patch | 164 -----------
 ...manage-genhomedircon-drop-ustr-dependency.patch | 323 ---------------------
 ...-remove-ustr-library-from-Makefiles-READM.patch |  61 ----
 ...ibsemanage-allow-to-disable-audit-support.patch |  68 +++--
 .../libsemanage-fix-path-len-limit.patch           |  28 --
 .../{libsemanage_2.6.bb => libsemanage_2.7.bb}     |  11 +-
 8 files changed, 42 insertions(+), 730 deletions(-)
 delete mode 100644 recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch
 delete mode 100644 recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch
 delete mode 100644 recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
 delete mode 100644 recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
 delete mode 100644 recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch
 rename recipes-security/selinux/{libsemanage_2.6.bb => libsemanage_2.7.bb} (50%)
recipes-security/selinux/libsemanage.inc +2 -0
index 504101d..9b238c8 100644
@@ -40,6 +40,8 @@ do_install() {
 
     oe_runmake install-pywrap swigify \
             DESTDIR=${D} \
+            PYCEXT='.so' \
+            PYSITEDIR='${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages' \
             PYLIBVER='python${PYTHON_BASEVERSION}' \
             PYLIBDIR='${D}/${libdir}/$(PYLIBVER)'
 
recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch deleted +0 -115

115 lines not on this page · raw message

recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch deleted +0 -164

164 lines not on this page · raw message

recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch deleted +0 -323

323 lines not on this page · raw message

recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch deleted +0 -61

61 lines not on this page · raw message

recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch +37 -31

123 lines not on this page · raw message

recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch deleted +0 -28
deleted file mode 100644
index c98f3fc..0000000
@@ -1,28 +0,0 @@
-Subject: [meta-selinux][PATCH] libsemanage: fix path length limit
-
-semanage_remove_directory uses NAME_MAX(255) as the max length of
-file pathes, this will cause failures when the path length>255.
-
-Upstream-Status: pending
-
-Signed-off-by: Xin Ouyang <[email protected]>
----
- src/semanage_store.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/semanage_store.c b/src/semanage_store.c
-index 3fd4996..251a2d6 100644
---- a/src/semanage_store.c
-+++ b/src/semanage_store.c
-@@ -580,7 +580,7 @@ int semanage_remove_directory(const char *path)
- 		return -1;
- 	}
- 	for (i = 0; i < num_entries; i++) {
--		char s[NAME_MAX];
-+		char s[PATH_MAX];
- 		struct stat buf;
- 		snprintf(s, sizeof(s), "%s/%s", path, namelist[i]->d_name);
- 		if (stat(s, &buf) == -1) {
--- 
-1.7.9.5
-
recipes-security/selinux/libsemanage_2.7.bb renamed from recipes-security/selinux/libsemanage_2.6.bb +3 -8
similarity index 50%
rename from recipes-security/selinux/libsemanage_2.6.bb
rename to recipes-security/selinux/libsemanage_2.7.bb
index 5e24c9d..d7b5312 100644
@@ -1,23 +1,18 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343"
 
-SRC_URI[md5sum] = "666a48c4058c07f2b07ede9eaf210c5f"
-SRC_URI[sha256sum] = "4f81541047290b751f2ffb926fcd381c186f22db18d9fe671b0b4a6a54e8cfce"
+SRC_URI[md5sum] = "a6b5c451fbe45ff9e3e0e65f2db0ae1d"
+SRC_URI[sha256sum] = "07e9477714ce6a4557a1fe924ea4cb06501b62d0fa0e3c0dc32a2cf47cb8d476"
 
 SRC_URI += "\
 	file://libsemanage-Fix-execve-segfaults-on-Ubuntu.patch \
-	file://libsemanage-fix-path-len-limit.patch \
 	file://libsemanage-fix-path-nologin.patch \
 	file://libsemanage-drop-Wno-unused-but-set-variable.patch \
 	file://libsemanage-define-FD_CLOEXEC-as-necessary.patch;striplevel=2 \
 	file://libsemanage-allow-to-disable-audit-support.patch \
 	file://libsemanage-disable-expand-check-on-policy-load.patch \
 	file://0001-src-Makefile-fix-includedir-in-libselinux.pc.patch \
-	file://0001-libsemanage-simplify-string-utilities-functions.patch;striplevel=2 \
-	file://0002-libsemanage-add-semanage_str_replace-utility-functio.patch;striplevel=2 \
-	file://0003-libsemanage-genhomedircon-drop-ustr-dependency.patch;striplevel=2 \
-	file://0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch;striplevel=2 \
 	"
 FILES_${PN} += "/usr/libexec"
Signature · 1 line
2.13.0
#4 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Best Regards,
Chanho Park

Quoted 1,051 lines · On Tue, 5 Sep 2017 at 3:05 PM <[email protected]> wrote:

From: Wenzong Fan <[email protected]>

Remove patches that included by new version:
- 0001-libsemanage-simplify-string-utilities-functions.patch
- 0002-libsemanage-add-semanage_str_replace-utility-functio.patch
- 0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
- 0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
- libsemanage-fix-path-len-limit.patch

Rebase patch:
- libsemanage-allow-to-disable-audit-support.patch

Set PYCEXT and PYSITEDIR to generate the _semanage.so and install it to ${libdir}/python${PYTHON_BASEVERSION}/site-packages.

---
 recipes-security/selinux/libsemanage.inc           |   2 +
 ...anage-simplify-string-utilities-functions.patch | 115 --------
 ...-add-semanage_str_replace-utility-functio.patch | 164 -----------
 ...manage-genhomedircon-drop-ustr-dependency.patch | 323
---------------------
 ...-remove-ustr-library-from-Makefiles-READM.patch |  61 ----
 ...ibsemanage-allow-to-disable-audit-support.patch |  68 +++--
 .../libsemanage-fix-path-len-limit.patch           |  28 --
 .../{libsemanage_2.6.bb => libsemanage_2.7.bb}     |  11 +-
 8 files changed, 42 insertions(+), 730 deletions(-)
 delete mode 100644
recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch
 delete mode 100644
recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch
 delete mode 100644
recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
 delete mode 100644
recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
 delete mode 100644
recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch
 rename recipes-security/selinux/{libsemanage_2.6.bb => libsemanage_2.7.bb}

(50%)

recipes-security/selinux/libsemanage.inc +2 -0
index 504101d..9b238c8 100644
@@ -40,6 +40,8 @@ do_install() {
 
     oe_runmake install-pywrap swigify \
             DESTDIR=${D} \
+            PYCEXT='.so' \
+
 PYSITEDIR='${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages' \
             PYLIBVER='python${PYTHON_BASEVERSION}' \
             PYLIBDIR='${D}/${libdir}/$(PYLIBVER)'

diff --git a/recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch b/recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch deleted file mode 100644
index fd478d0..0000000
---
a/recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch +++ /dev/null

recipes-security/selinux/libsemanage.inc +0 -4
@@ -1,115 +0,0 @@
-From 514a5df959ea0e13db4e87f73c2ac5edcceebd52 Mon Sep 17 00:00:00 2001
-From: Nicolas Iooss <[email protected]>
-Date: Wed, 21 Dec 2016 19:21:01 +0100
-Subject: [meta-selinux][PATCH 1/4] libsemanage: simplify string utilities

functions

recipes-security/selinux/libsemanage.inc +1 -85
-
-Use string functions from C standard library instead of ustr. This makes
-the code simpler and make utilities.c no longer depend on ustr library.
-
-This changes how semanage_split() behaves when delim is not empty (NULL
-or "") and the input string contains several successive delimiters:
-semanage_split("foo::::bar", ":") returned "bar" and now returns ":bar".
-This would not have any impact in the current code as semanage_split()
-is only called with delim="=" (through semanage_findval(), in
-libsemanage/src/genhomedircon.c), in order to split a "key=value"
-statement.
-
-Signed-off-by: Nicolas Iooss <[email protected]>
-(cherry picked from commit a228bb3736c5957d41ad9e01eb1283fc6883a6e5)
----
- libsemanage/src/utilities.c | 59
++++++++++-----------------------------------
- 1 file changed, 13 insertions(+), 46 deletions(-)
-
-diff --git a/libsemanage/src/utilities.c b/libsemanage/src/utilities.c
-index f48ffa4..fa86cc7 100644
---- a/libsemanage/src/utilities.c
-+++ b/libsemanage/src/utilities.c
-@@ -26,7 +26,6 @@
- #include <string.h>
- #include <sys/types.h>
- #include <assert.h>
--#include <ustr.h>
-
- #define TRUE 1
- #define FALSE 0
-@@ -74,64 +73,32 @@ char *semanage_split_on_space(const char *str)
- {
-       /* as per the man page, these are the isspace() chars */
-       const char *seps = "\f\n\r\t\v ";
--      size_t slen = strlen(seps);
--      size_t off = 0, rside_len = 0;
--      char *retval = NULL;
--      Ustr *ustr = USTR_NULL, *temp = USTR_NULL;
-+      size_t off = 0;
-
-       if (!str)
--              goto done;
--      if (!(ustr = ustr_dup_cstr(str)))
--              goto done;
--      temp =
--          ustr_split_spn_chrs(ustr, &off, seps, slen, USTR_NULL,
--                              USTR_FLAG_SPLIT_DEF);
--      if (!temp)
--              goto done;
--      /* throw away the left hand side */
--      ustr_sc_free(&temp);
--
--      rside_len = ustr_len(ustr) - off;
--      temp = ustr_dup_subustr(ustr, off + 1, rside_len);
--      if (!temp)
--              goto done;
--      retval = strdup(ustr_cstr(temp));
--      ustr_sc_free(&temp);
-+              return NULL;
-
--      done:
--      ustr_sc_free(&ustr);
--      return retval;
-+      /* skip one token and the spaces before and after it */
-+      off = strspn(str, seps);
-+      off += strcspn(str + off, seps);
-+      off += strspn(str + off, seps);
-+      return strdup(str + off);
- }
-
- char *semanage_split(const char *str, const char *delim)
- {
--      Ustr *ustr = USTR_NULL, *temp = USTR_NULL;
--      size_t off = 0, rside_len = 0;
--      char *retval = NULL;
-+      char *retval;
-
-       if (!str)
--              goto done;
-+              return NULL;
-       if (!delim || !(*delim))
-               return semanage_split_on_space(str);
--      ustr = ustr_dup_cstr(str);
--      temp =
--          ustr_split_cstr(ustr, &off, delim, USTR_NULL,

USTR_FLAG_SPLIT_DEF);
-- if (!temp)
-- goto done;
-- /* throw away the left hand side */
-- ustr_sc_free(&temp);
--
-- rside_len = ustr_len(ustr) - off;

recipes-security/selinux/libsemanage.inc +0 -20
-
--      temp = ustr_dup_subustr(ustr, off + 1, rside_len);
--      if (!temp)
--              goto done;
--      retval = strdup(ustr_cstr(temp));
--      ustr_sc_free(&temp);
-+      retval = strstr(str, delim);
-+      if (retval == NULL)
-+              return NULL;
-
--      done:
--      ustr_sc_free(&ustr);
--      return retval;
-+      return strdup(retval + strlen(delim));
- }
-
- int semanage_list_push(semanage_list_t ** list, const char *data)
---
-2.10.2
-

diff --git a/recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch b/recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch deleted file mode 100644
index ed32785..0000000
---
a/recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch +++ /dev/null

recipes-security/selinux/libsemanage.inc +0 -4
@@ -1,164 +0,0 @@
-From de8b13baf3773b41367f265e7dd06c013816ba0a Mon Sep 17 00:00:00 2001
-From: Nicolas Iooss <[email protected]>
-Date: Wed, 21 Dec 2016 19:21:02 +0100
-Subject: [meta-selinux][PATCH 2/4] libsemanage: add

semanage_str_replace() utility function

recipes-security/selinux/libsemanage.inc +1 -34
-
-This function will be used in the next commit.
-
-Signed-off-by: Nicolas Iooss <[email protected]>
-(cherry picked from commit 57a3b1b4b0a50a1d14f825d2933339063ced4fec)
----
- libsemanage/src/utilities.c        | 55
++++++++++++++++++++++++++++++++++++++
- libsemanage/src/utilities.h        | 10 +++++++
- libsemanage/tests/test_utilities.c | 34 +++++++++++++++++++++++
- 3 files changed, 99 insertions(+)
-
-diff --git a/libsemanage/src/utilities.c b/libsemanage/src/utilities.c
-index fa86cc7..0d50d99 100644
---- a/libsemanage/src/utilities.c
-+++ b/libsemanage/src/utilities.c
-@@ -230,6 +230,61 @@ void semanage_rtrim(char *str, char trim_to)
-       }
- }
-
-+char *semanage_str_replace(const char *search, const char *replace,
-+                         const char *src, size_t lim)
-+{
-+      size_t count = 0, slen, rlen, newsize;
-+      char *p, *pres, *result;
-+      const char *psrc;
-+
-+      slen = strlen(search);
-+      rlen = strlen(replace);
-+
-+      /* Do not support empty search strings */
-+      if (slen == 0)
-+              return NULL;
-+
-+      /* Count the occurences of search in src and compute the new size

*/
-+ for (p = strstr(src, search); p != NULL; p = strstr(p + slen,
search)) {
-+ count++;
-+ if (lim && count >= lim)
-+ break;
-+ }
-+ if (!count)
-+ return strdup(src);
-+

-+      /* Allocate the result string */
-+      newsize = strlen(src) + 1 + count * (rlen - slen);
-+      result = malloc(newsize);
-+      if (!result)
-+              return NULL;
-+
-+      /* Fill the result */
-+      psrc = src;
-+      pres = result;
-+      for (p = strstr(src, search); p != NULL; p = strstr(psrc, search))
{
-+              /* Copy the part which has not been modified */
-+              if (p != psrc) {
-+                      size_t length = (size_t)(p - psrc);
-+                      memcpy(pres, psrc, length);
-+                      pres += length;
-+              }
-+              /* Copy the replacement part */
-+              if (rlen != 0) {
-+                      memcpy(pres, replace, rlen);
-+                      pres += rlen;
-+              }
-+              psrc = p + slen;
-+              count--;
-+              if (!count)
-+                      break;
-+      }
-+      /* Copy the last part, after doing a sanity check */
-+      assert(pres + strlen(psrc) + 1 == result + newsize);
-+      strcpy(pres, psrc);
-+      return result;

-+}
-+
- /* list_addafter_controlmem does *NOT* duplicate the data argument

recipes-security/selinux/libsemanage.inc +0 -22
-  * use at your own risk, I am building a list out of malloc'd memory and
-  * it is only going to get stored into this list, thus when I destroy it
-diff --git a/libsemanage/src/utilities.h b/libsemanage/src/utilities.h
-index 5fa15ef..f2ff31f 100644
---- a/libsemanage/src/utilities.h
-+++ b/libsemanage/src/utilities.h
-@@ -116,6 +116,16 @@ int semanage_str_count(char *data, char what);
- void semanage_rtrim(char *str, char trim_to);
-
- /**
-+ * @param      value being searched for
-+ * @param      replacement value that replaces found search values
-+ * @param      string being searched and replaced on
-+ * @param      maximum number of value occurences (zero for unlimited)
-+ * @return     newly-allocated string with the replaced values
-+ */
-+char *semanage_str_replace(const char *search, const char *replace,
-+                         const char *src, size_t lim);
-+
-+/**
-  * @param data    some string
-  * @return  modifies the string such that the first whitespace char

becomes

recipes-security/selinux/libsemanage.inc +0 -2
-  *        '\0', ending the string.
-diff --git a/libsemanage/tests/test_utilities.c

b/libsemanage/tests/test_utilities.c

recipes-security/selinux/libsemanage.inc +0 -13
-index 32cc33c..cdfed0c 100644
---- a/libsemanage/tests/test_utilities.c
-+++ b/libsemanage/tests/test_utilities.c
-@@ -40,6 +40,7 @@ void test_semanage_split(void);
- void test_semanage_list(void);
- void test_semanage_str_count(void);
- void test_semanage_rtrim(void);
-+void test_semanage_str_replace(void);
- void test_semanage_findval(void);
- void test_slurp_file_filter(void);
-
-@@ -101,6 +102,10 @@ int semanage_utilities_add_tests(CU_pSuite suite)
-       if (NULL == CU_add_test(suite, "semanage_rtrim",

test_semanage_rtrim)) {

recipes-security/selinux/libsemanage.inc +0 -16
-               goto err;
-       }
-+      if (NULL == CU_add_test(suite, "semanage_str_replace",
-+                              test_semanage_str_replace)) {
-+              goto err;
-+      }
-       if (NULL == CU_add_test(suite, "semanage_findval",
-                               test_semanage_findval)) {
-               goto err;
-@@ -244,6 +249,35 @@ void test_semanage_rtrim(void)
-       CU_ASSERT_STRING_EQUAL(str, "/blah/foo/bar");
- }
-
-+void test_semanage_str_replace(void)
-+{
-+      const char *test_str = "Hello, I am %{USERNAME} and my id is

%{USERID}";
-+ char *str1, *str2;
-+
-+ str1 = semanage_str_replace("%{USERNAME}", "root", test_str, 0);
-+ CU_ASSERT_STRING_EQUAL(str1, "Hello, I am root and my id is
%{USERID}");
-+

-+      str2 = semanage_str_replace("%{USERID}", "0", str1, 1);
-+      CU_ASSERT_STRING_EQUAL(str2, "Hello, I am root and my id is 0");
-+      free(str1);
-+      free(str2);

-+
-+ str1 = semanage_str_replace(":(", ";)", "Test :( :) ! :(:(:))(:(",
0);
-+ CU_ASSERT_STRING_EQUAL(str1, "Test ;) :) ! ;);):))(;)");
-+ free(str1);
-+
-+ str1 = semanage_str_replace(":(", ";)", "Test :( :) ! :(:(:))(:(",
3);
-+ CU_ASSERT_STRING_EQUAL(str1, "Test ;) :) ! ;);):))(:(");
-+ free(str1);
-+
-+ str1 = semanage_str_replace("", "empty search string", "test", 0);
-+ CU_ASSERT_EQUAL(str1, NULL);
-+

-+      str1 = semanage_str_replace("a", "", "abracadabra", 0);
-+      CU_ASSERT_STRING_EQUAL(str1, "brcdbr");
-+      free(str1);

-+}
-+
- void test_semanage_findval(void)
- {

recipes-security/selinux/libsemanage.inc +0 -4
-       char *tok;
---
-2.10.2
-

diff --git a/recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch b/recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch deleted file mode 100644
index fde2349..0000000
---
a/recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch +++ /dev/null

recipes-security/selinux/libsemanage.inc +0 -4
@@ -1,323 +0,0 @@
-From e8dd31df2268013afb1e8dbe5e617b9c4e9e388e Mon Sep 17 00:00:00 2001
-From: Nicolas Iooss <[email protected]>
-Date: Wed, 21 Dec 2016 19:21:03 +0100
-Subject: [meta-selinux][PATCH 3/4] libsemanage: genhomedircon: drop ustr

dependency

recipes-security/selinux/libsemanage.inc +0 -6
-
-ustr library uses old (pre-C99) "extern inline" semantic. This makes it
-incompatible with recent versions of gcc and clang, which default to
-C99 standard. Distributions have shipped patched versions of this
-library to fix issues (e.g. Gentoo package uses this patch:
-

https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/ustr/files/ustr-1.0.4-gcc_5-check.patch?id=7dea6f8820f36bf389e6315044bea7507553bed0

recipes-security/selinux/libsemanage.inc +1 -17
-) but there is no upstream solution to make ustr compatible with C99
-standard.
-
-The git tree of ustr (http://www.and.org/ustr/ustr.git) has not been
-updated since 2008 and the developer of this project did not reply to
-emails.
-
-Therefore update genhomedircon implementation in order to no longer
-rely on ustr library.
-
-Signed-off-by: Nicolas Iooss <[email protected]>
-(cherry picked from commit 300b8ad4235688171f2a91e7aeb14d0ee3561c13)
----
- libsemanage/src/genhomedircon.c | 154
++++++++++++++++++++--------------------
- 1 file changed, 77 insertions(+), 77 deletions(-)
-
-diff --git a/libsemanage/src/genhomedircon.c

b/libsemanage/src/genhomedircon.c

recipes-security/selinux/libsemanage.inc +0 -15
-index 6991fff..0f84aa3 100644
---- a/libsemanage/src/genhomedircon.c
-+++ b/libsemanage/src/genhomedircon.c
-@@ -34,9 +34,9 @@
-
- #include "utilities.h"
- #include "genhomedircon.h"
--#include <ustr.h>
-
- #include <assert.h>
-+#include <ctype.h>
- #include <limits.h>
- #include <stdio.h>
- #include <stdlib.h>
-@@ -239,46 +239,39 @@ static int fcontext_matches(const

semanage_fcontext_t *fcontext, void *varg)
- {

recipes-security/selinux/libsemanage.inc +0 -43
-       const char *oexpr = semanage_fcontext_get_expr(fcontext);
-       fc_match_handle_t *handp = varg;
--      struct Ustr *expr;
-+      char *expr = NULL;
-       regex_t re;
-       int type, retval = -1;
-+      size_t len;
-
-       /* Only match ALL or DIR */
-       type = semanage_fcontext_get_type(fcontext);
-       if (type != SEMANAGE_FCONTEXT_ALL && type != SEMANAGE_FCONTEXT_ALL)
-               return 0;
-
--      /* Convert oexpr into a Ustr and anchor it at the beginning */
--      expr = ustr_dup_cstr("^");
--      if (expr == USTR_NULL)
--              goto done;
--      if (!ustr_add_cstr(&expr, oexpr))
--              goto done;
--
--      /* Strip off trailing ".+" or ".*" */
--      if (ustr_cmp_suffix_cstr_eq(expr, ".+") ||
--          ustr_cmp_suffix_cstr_eq(expr, ".*")) {
--              if (!ustr_del(&expr, 2))
--                      goto done;
--      }
--
--      /* Strip off trailing "(/.*)?" */
--      if (ustr_cmp_suffix_cstr_eq(expr, "(/.*)?")) {
--              if (!ustr_del(&expr, 6))
--                      goto done;
--      }
--
--      if (ustr_cmp_suffix_cstr_eq(expr, "/")) {
--              if (!ustr_del(&expr, 1))
--                      goto done;
--      }
--
--      /* Append pattern to eat up trailing slashes */
--      if (!ustr_add_cstr(&expr, "/*$"))
--              goto done;
-+      len = strlen(oexpr);
-+      /* Define a macro to strip a literal string from the end of oexpr

*/
-+#define rstrip_oexpr_len(cstr, cstrlen) \
-+ do { \
-+ if (len >= (cstrlen) && !strncmp(oexpr + len - (cstrlen),
(cstr), (cstrlen))) \
-+ len -= (cstrlen); \
-+ } while (0)
-+#define rstrip_oexpr(cstr) rstrip_oexpr_len(cstr, sizeof(cstr) - 1) -+

-+      rstrip_oexpr(".+");
-+      rstrip_oexpr(".*");
-+      rstrip_oexpr("(/.*)?");
-+      rstrip_oexpr("/");

-+
-+#undef rstrip_oexpr_len
-+#undef rstrip_oexpr
-+
-+ /* Anchor oexpr at the beginning and append pattern to eat up
trailing slashes */
-+ if (asprintf(&expr, "^%.*s/*$", (int)len, oexpr) < 0)
-+ return -1;

recipes-security/selinux/libsemanage.inc +0 -8
-
-       /* Check dir against expr */
--      if (regcomp(&re, ustr_cstr(expr), REG_EXTENDED) != 0)
-+      if (regcomp(&re, expr, REG_EXTENDED) != 0)
-               goto done;
-       if (regexec(&re, handp->dir, 0, NULL, 0) == 0)
-               handp->matched = 1;
-@@ -287,7 +280,7 @@ static int fcontext_matches(const semanage_fcontext_t

*fcontext, void *varg)

recipes-security/selinux/libsemanage.inc +0 -9
-       retval = 0;
-
- done:
--      ustr_free(expr);
-+      free(expr);
-
-       return retval;
- }
-@@ -523,44 +516,50 @@ static semanage_list_t

*make_template(genhomedircon_settings_t * s,

recipes-security/selinux/libsemanage.inc +0 -4
-       return template_data;
- }
-
--static Ustr *replace_all(const char *str, const replacement_pair_t *

repl)
-+static char *replace_all(const char *str, const replacement_pair_t * repl)
- {
-- Ustr *retval = USTR_NULL;
-+ char *retval, *retval2;

recipes-security/selinux/libsemanage.inc +0 -15
-       int i;
-
-       if (!str || !repl)
--              goto done;
--      if (!(retval = ustr_dup_cstr(str)))
--              goto done;
-+              return NULL;
-
--      for (i = 0; repl[i].search_for; i++) {
--              ustr_replace_cstr(&retval, repl[i].search_for,
--                                repl[i].replace_with, 0);
-+      retval = strdup(str);
-+      for (i = 0; retval != NULL && repl[i].search_for; i++) {
-+              retval2 = semanage_str_replace(repl[i].search_for,
-+                                             repl[i].replace_with,

retval, 0);
-+ free(retval);
-+ retval = retval2;

recipes-security/selinux/libsemanage.inc +0 -19
-       }
--      if (ustr_enomem(retval))
--              ustr_sc_free(&retval);
--
--      done:
-       return retval;
- }
-
--static const char * extract_context(Ustr *line)
-+static const char *extract_context(const char *line)
- {
--      const char whitespace[] = " \t\n";
--      size_t off, len;
--
--      /* check for trailing whitespace */
--      off = ustr_spn_chrs_rev(line, 0, whitespace, strlen(whitespace));
--
--      /* find the length of the last field in line */
--      len = ustr_cspn_chrs_rev(line, off, whitespace,

strlen(whitespace));
--

--      if (len == 0)
-+      const char *p = line;
-+      size_t off;
-+
-+      off = strlen(p);
-+      p += off;
-+      /* consider trailing whitespaces */
-+      while (off > 0) {
-+              p--;
-+              off--;
-+              if (!isspace(*p))

-+ break;
-+ }
-+ if (off == 0)

recipes-security/selinux/libsemanage.inc +0 -17
-               return NULL;
--      return ustr_cstr(line) + ustr_len(line) - (len + off);
-+
-+      /* find the last field in line */
-+      while (off > 0 && !isspace(*(p - 1))) {
-+              p--;
-+              off--;
-+      }
-+      return p;
- }
-
--static int check_line(genhomedircon_settings_t * s, Ustr *line)
-+static int check_line(genhomedircon_settings_t * s, const char *line)
- {
-       sepol_context_t *ctx_record = NULL;
-       const char *ctx_str;
-@@ -584,22 +583,22 @@ static int

write_replacements(genhomedircon_settings_t * s, FILE * out,

recipes-security/selinux/libsemanage.inc +0 -27
-                             const semanage_list_t * tpl,
-                             const replacement_pair_t *repl)
- {
--      Ustr *line = USTR_NULL;
-+      char *line;
-
-       for (; tpl; tpl = tpl->next) {
-               line = replace_all(tpl->data, repl);
-               if (!line)
-                       goto fail;
-               if (check_line(s, line) == STATUS_SUCCESS) {
--                      if (!ustr_io_putfileline(&line, out))
-+                      if (fprintf(out, "%s\n", line) < 0)
-                               goto fail;
-               }
--              ustr_sc_free(&line);
-+              free(line);
-       }
-       return STATUS_SUCCESS;
-
-       fail:
--      ustr_sc_free(&line);
-+      free(line);
-       return STATUS_ERR;
- }
-
-@@ -607,7 +606,7 @@ static int write_contexts(genhomedircon_settings_t

*s, FILE *out,
- semanage_list_t *tpl, const replacement_pair_t
*repl,

recipes-security/selinux/libsemanage.inc +0 -8
-                         const genhomedircon_user_entry_t *user)
- {
--      Ustr *line = USTR_NULL;
-+      char *line, *temp;
-       sepol_context_t *context = NULL;
-       char *new_context_str = NULL;
-
-@@ -624,10 +623,10 @@ static int write_contexts(genhomedircon_settings_t

*s, FILE *out,

recipes-security/selinux/libsemanage.inc +0 -13
-
-               if (strcmp(old_context_str, CONTEXT_NONE) == 0) {
-                       if (check_line(s, line) == STATUS_SUCCESS &&
--                          !ustr_io_putfileline(&line, out)) {
-+                          fprintf(out, "%s\n", line) < 0) {
-                               goto fail;
-                       }
--
-+                      free(line);
-                       continue;
-               }
-
-@@ -653,25 +652,27 @@ static int write_contexts(genhomedircon_settings_t

*s, FILE *out,

recipes-security/selinux/libsemanage.inc +0 -6
-                       goto fail;
-               }
-
--              if (!ustr_replace_cstr(&line, old_context_str,
--                                     new_context_str, 1)) {
-+              temp = semanage_str_replace(old_context_str,

new_context_str,
-+ line, 1);
-+ if (!temp) {

recipes-security/selinux/libsemanage.inc +0 -26
-                       goto fail;
-               }
-+              free(line);
-+              line = temp;
-
-               if (check_line(s, line) == STATUS_SUCCESS) {
--                      if (!ustr_io_putfileline(&line, out)) {
-+                      if (fprintf(out, "%s\n", line) < 0)
-                               goto fail;
--                      }
-               }
-
--              ustr_sc_free(&line);
-+              free(line);
-               sepol_context_free(context);
-               free(new_context_str);
-       }
-
-       return STATUS_SUCCESS;
- fail:
--      ustr_sc_free(&line);
-+      free(line);
-       sepol_context_free(context);
-       free(new_context_str);
-       return STATUS_ERR;
-@@ -1284,20 +1285,19 @@ static int

write_context_file(genhomedircon_settings_t * s, FILE * out)

recipes-security/selinux/libsemanage.inc +0 -7
-               }
-
-               for (h = homedirs; h; h = h->next) {
--                      Ustr *temp = ustr_dup_cstr(h->data);
-+                      char *temp = NULL;
-
--                      if (!temp || !ustr_add_cstr(&temp, "/"

FALLBACK_NAME)) {
-- ustr_sc_free(&temp);
-+ if (asprintf(&temp, "%s/%s", h->data,
FALLBACK_NAME) < 0) {

recipes-security/selinux/libsemanage.inc +0 -9
-                               retval = STATUS_ERR;
-                               goto done;
-                       }
-
-                       free(s->fallback->home);
--                      s->fallback->home = (char*) ustr_cstr(temp);
-+                      s->fallback->home = temp;
-
-                       if (write_home_dir_context(s, out,

homedir_context_tpl,
- s->fallback) !=
STATUS_SUCCESS) {
-- ustr_sc_free(&temp);
-+ free(temp);

recipes-security/selinux/libsemanage.inc +0 -4
-                               s->fallback->home = NULL;
-                               retval = STATUS_ERR;
-                               goto done;
-@@ -1305,13 +1305,13 @@ static int

write_context_file(genhomedircon_settings_t * s, FILE * out)

recipes-security/selinux/libsemanage.inc +0 -3
-                       if (write_home_root_context(s, out,
-                                                   homeroot_context_tpl,
-                                                   h->data) !=

STATUS_SUCCESS) {
-- ustr_sc_free(&temp);
-+ free(temp);

recipes-security/selinux/libsemanage.inc +0 -13
-                               s->fallback->home = NULL;
-                               retval = STATUS_ERR;
-                               goto done;
-                       }
-
--                      ustr_sc_free(&temp);
-+                      free(temp);
-                       s->fallback->home = NULL;
-               }
-       }
---
-2.10.2
-

diff --git a/recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch b/recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch deleted file mode 100644
index 1800493..0000000
---
a/recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch +++ /dev/null

recipes-security/selinux/libsemanage.inc +0 -4
@@ -1,61 +0,0 @@
-From c7e55daa20f5659799aed47b819ad73e03d11e8f Mon Sep 17 00:00:00 2001
-From: Nicolas Iooss <[email protected]>
-Date: Wed, 21 Dec 2016 19:21:04 +0100
-Subject: [meta-selinux][PATCH 4/4] libsemanage: remove ustr library from

Makefiles, README
- and pkg-config

recipes-security/selinux/libsemanage.inc +0 -32
-
-This library is no longer used by libsemanage.
-
-Signed-off-by: Nicolas Iooss <[email protected]>
-(cherry picked from commit 920ee9ee18024c7714f1121e91854f38fa1eef73)
-
-Tweaked due to conditional audit patch and no README.
----
- README                            | 2 +-
- libsemanage/src/Makefile          | 2 +-
- libsemanage/src/libsemanage.pc.in | 2 +-
- libsemanage/tests/Makefile        | 2 +-
- 4 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
-index 68aab72..83daf0f 100644
---- a/libsemanage/src/Makefile
-+++ b/libsemanage/src/Makefile
-@@ -91,7 +91,7 @@ $(LIBA): $(OBJS)
-       $(RANLIB) $@
-
- $(LIBSO): $(LOBJS)
--      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol $(LIBAUDIT)
-lselinux -lbz2 -lustr -L$(LIBDIR)
-Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
-+      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol $(LIBAUDIT)
-lselinux -lbz2 -L$(LIBDIR)
-Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
-       ln -sf $@ $(TARGET)
-
- $(LIBPC): $(LIBPC).in ../VERSION
-diff --git a/libsemanage/src/libsemanage.pc.in b/libsemanage/src/

libsemanage.pc.in

recipes-security/selinux/libsemanage.inc +0 -17
-index 81e1805..d3eaa06 100644
---- a/libsemanage/src/libsemanage.pc.in
-+++ b/libsemanage/src/libsemanage.pc.in
-@@ -7,7 +7,7 @@ Name: libsemanage
- Description: SELinux management library
- Version: @VERSION@
- URL: http://userspace.selinuxproject.org/
--Requires.private: libselinux libsepol ustr
-+Requires.private: libselinux libsepol
- Libs: -L${libdir} -lsemanage
- Libs.private: -lbz2
- Cflags: -I${includedir}
-diff --git a/libsemanage/tests/Makefile b/libsemanage/tests/Makefile
-index 4b81fed..56285b3 100644
---- a/libsemanage/tests/Makefile
-+++ b/libsemanage/tests/Makefile
-@@ -12,7 +12,7 @@ LIBS = ../src/libsemanage.a

../../libselinux/src/libselinux.a ../../libsepol/src

recipes-security/selinux/libsemanage.inc +0 -11
-       LIBAUDIT = -laudit
- endif
-
--LDFLAGS += -lcunit -lustr -lbz2 $(LIBAUDIT)
-+LDFLAGS += -lcunit -lbz2 $(LIBAUDIT)
- OBJECTS = $(SOURCES:.c=.o)
-
- all: $(EXECUTABLE)
---
-2.10.2
-

diff --git a/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch b/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch index d727acf..91efe81 100644
---
a/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch
+++
b/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch

recipes-security/selinux/libsemanage.inc +11 -22
@@ -7,16 +7,16 @@ Upstream-Status: Pending
 
 Signed-off-by: Wenzong Fan <[email protected]>
 ---
- src/Makefile        |   10 +++++++++-
- src/seusers_local.c |   13 +++++++++++++
- tests/Makefile      |   10 +++++++++-
+ src/Makefile        | 10 +++++++++-
+ src/seusers_local.c | 13 +++++++++++++
+ tests/Makefile      | 10 +++++++++-
  3 files changed, 31 insertions(+), 2 deletions(-)
 
-Index: libsemanage-2.5/src/Makefile
-===================================================================
---- libsemanage-2.5.orig/src/Makefile  2016-02-25 13:20:30.867978414 -0500
-+++ libsemanage-2.5/src/Makefile       2016-02-25 13:20:30.859978414 -0500
-@@ -28,6 +28,14 @@
+diff --git a/src/Makefile b/src/Makefile
+index fdb178f..43e1266 100644
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -29,6 +29,14 @@ ifeq ($(DEBUG),1)
        export LDFLAGS = -g
  endif
 
@@ -31,20 +31,20 @@ Index: libsemanage-2.5/src/Makefile
  LEX = flex
  LFLAGS = -s
  YACC = bison
-@@ -92,7 +100,7 @@
+@@ -91,7 +99,7 @@ $(LIBA): $(OBJS)
        $(RANLIB) $@
 
  $(LIBSO): $(LOBJS)
--      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -laudit
-lselinux -lbz2 -lustr -L$(LIBDIR)
-Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
-+      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol $(LIBAUDIT)
-lselinux -lbz2 -lustr -L$(LIBDIR)
-Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
+-      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -laudit
-lselinux -lbz2
-Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
++      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol $(LIBAUDIT)
-lselinux -lbz2
-Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
        ln -sf $@ $(TARGET)
 
  $(LIBPC): $(LIBPC).in ../VERSION
-Index: libsemanage-2.5/src/seusers_local.c
-===================================================================
---- libsemanage-2.5.orig/src/seusers_local.c   2016-02-25

13:20:30.867978414 -0500
-+++ libsemanage-2.5/src/seusers_local.c 2016-02-25
13:20:30.863978414 -0500
-@@ -8,7 +8,11 @@

recipes-security/selinux/libsemanage.inc +8 -3
+diff --git a/src/seusers_local.c b/src/seusers_local.c
+index 42c3a8b..9ee31e2 100644
+--- a/src/seusers_local.c
++++ b/src/seusers_local.c
+@@ -8,7 +8,11 @@ typedef struct semanage_seuser record_t;
 
  #include <sepol/policydb.h>
  #include <sepol/context.h>
@@ -56,7 +56,7 @@ Index: libsemanage-2.5/src/seusers_local.c
  #include <errno.h>
  #include "user_internal.h"
  #include "seuser_internal.h"
-@@ -51,6 +55,7 @@
+@@ -51,6 +55,7 @@ static char *semanage_user_roles(semanage_handle_t *
 handle, const char *sename)
        return roles;
  }
@@ -64,7 +64,7 @@ Index: libsemanage-2.5/src/seusers_local.c
  static int semanage_seuser_audit(semanage_handle_t * handle,
                          const semanage_seuser_t * seuser,
                          const semanage_seuser_t * previous,
-@@ -114,6 +119,7 @@
+@@ -114,6 +119,7 @@ err:
        free(proles);
        return rc;
  }
@@ -72,7 +72,7 @@ Index: libsemanage-2.5/src/seusers_local.c
 
  int semanage_seuser_modify_local(semanage_handle_t * handle,
                                 const semanage_seuser_key_t * key,
-@@ -158,8 +164,11 @@
+@@ -158,8 +164,11 @@ int semanage_seuser_modify_local(semanage_handle_t *
 handle,
        (void) semanage_seuser_query(handle, key, &previous);
        handle->msg_callback = callback;
        rc = dbase_modify(handle, dconfig, key, new);
recipes-security/selinux/libsemanage.inc +1 -1
@@ -84,7 +84,7 @@ Index: libsemanage-2.5/src/seusers_local.c
  err:
        if (previous)
                semanage_seuser_free(previous);
-@@ -175,8 +184,12 @@
+@@ -175,8 +184,12 @@ int semanage_seuser_del_local(semanage_handle_t *
 handle,
        dbase_config_t *dconfig = semanage_seuser_dbase_local(handle);
        rc = dbase_del(handle, dconfig, key);
        semanage_seuser_query(handle, key, &seuser);
recipes-security/selinux/libsemanage.inc +0 -3
@@ -97,15 +97,14 @@ Index: libsemanage-2.5/src/seusers_local.c
        if (seuser)
                semanage_seuser_free(seuser);
        return rc;
-Index: libsemanage-2.5/tests/Makefile
-===================================================================
---- libsemanage-2.5.orig/tests/Makefile        2016-02-25

13:20:30.867978414 -0500
-+++ libsemanage-2.5/tests/Makefile 2016-02-25 13:22:05.171978120 -0500
-@@ -13,7 +13,15 @@
- CC = gcc
- CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn

recipes-security/selinux/libsemanage.inc +7 -3
-Wmissing-format-attribute -Wno-unused-parameter
- INCLUDE = -I$(TESTSRC) -I$(TESTSRC)/../include
--LDFLAGS += -lcunit -lustr -lbz2 -laudit
+diff --git a/tests/Makefile b/tests/Makefile
+index 2ef8d30..50d582a 100644
+--- a/tests/Makefile
++++ b/tests/Makefile
+@@ -6,10 +6,18 @@ SOURCES = $(sort $(wildcard *.c))
+
+

###########################################################################

recipes-security/selinux/libsemanage.inc +10 -3
+
 +DISABLE_AUDIT ?= n
 +ifeq ($(DISABLE_AUDIT),y)
 +      LIBAUDIT =
@@ -114,7 +113,14 @@ Index: libsemanage-2.5/tests/Makefile
 +      LIBAUDIT = -laudit
 +endif
 +
-+LDFLAGS += -lcunit -lustr -lbz2 $(LIBAUDIT)
+ EXECUTABLE = libsemanage-tests
+ CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn
-Wmissing-format-attribute -Wno-unused-parameter
+ override CFLAGS += -I../src -I../include
+-override LDLIBS += -lcunit -lbz2 -laudit -lselinux -lsepol
++override LDLIBS += -lcunit -lbz2 $(LIBAUDIT) -lselinux -lsepol
+
  OBJECTS = $(SOURCES:.c=.o)
 
- all: $(EXECUTABLE)
+--
+2.13.0
+

diff --git a/recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch b/recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch deleted file mode 100644
index c98f3fc..0000000
---
a/recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch +++ /dev/null

recipes-security/selinux/libsemanage.inc +0 -28
@@ -1,28 +0,0 @@
-Subject: [meta-selinux][PATCH] libsemanage: fix path length limit
-
-semanage_remove_directory uses NAME_MAX(255) as the max length of
-file pathes, this will cause failures when the path length>255.
-
-Upstream-Status: pending
-
-Signed-off-by: Xin Ouyang <[email protected]>
----
- src/semanage_store.c |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/src/semanage_store.c b/src/semanage_store.c
-index 3fd4996..251a2d6 100644
---- a/src/semanage_store.c
-+++ b/src/semanage_store.c
-@@ -580,7 +580,7 @@ int semanage_remove_directory(const char *path)
-               return -1;
-       }
-       for (i = 0; i < num_entries; i++) {
--              char s[NAME_MAX];
-+              char s[PATH_MAX];
-               struct stat buf;
-               snprintf(s, sizeof(s), "%s/%s", path, namelist[i]->d_name);
-               if (stat(s, &buf) == -1) {
---
-1.7.9.5
-
recipes-security/selinux/libsemanage_2.7.bb renamed from recipes-security/selinux/libsemanage_2.6.bb +1 -3
similarity index 50%
rename from recipes-security/selinux/libsemanage_2.6.bb
rename to recipes-security/selinux/libsemanage_2.7.bb
index 5e24c9d..d7b5312 100644
@@ -1,23 +1,18 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343"
 
-SRC_URI[md5sum] = "666a48c4058c07f2b07ede9eaf210c5f"
-SRC_URI[sha256sum] =

"4f81541047290b751f2ffb926fcd381c186f22db18d9fe671b0b4a6a54e8cfce"

recipes-security/selinux/libsemanage_2.7.bb renamed from recipes-security/selinux/libsemanage_2.6.bb +2 -0
+SRC_URI[md5sum] = "a6b5c451fbe45ff9e3e0e65f2db0ae1d"
+SRC_URI[sha256sum] =

"07e9477714ce6a4557a1fe924ea4cb06501b62d0fa0e3c0dc32a2cf47cb8d476"

 SRC_URI += "\
        file://libsemanage-Fix-execve-segfaults-on-Ubuntu.patch \
-       file://libsemanage-fix-path-len-limit.patch \
        file://libsemanage-fix-path-nologin.patch \
        file://libsemanage-drop-Wno-unused-but-set-variable.patch \
file://libsemanage-define-FD_CLOEXEC-as-necessary.patch;striplevel=2 \
        file://libsemanage-allow-to-disable-audit-support.patch \
        file://libsemanage-disable-expand-check-on-policy-load.patch \
        file://0001-src-Makefile-fix-includedir-in-libselinux.pc.patch \

-
file://0001-libsemanage-simplify-string-utilities-functions.patch;striplevel=2
\
-
file://0002-libsemanage-add-semanage_str_replace-utility-functio.patch;striplevel=2
\
-
file://0003-libsemanage-genhomedircon-drop-ustr-dependency.patch;striplevel=2
\
-
file://0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch;striplevel=2

\
        "

FILES_${PN} += "/usr/libexec"
--
2.13.0

--
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto

#5 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 3 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject: [meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

I'll send v2.

Thanks
Wenzong

Quoted 1,087 lines

Best Regards,
Chanho Park

On Tue, 5 Sep 2017 at 3:05 PM <[email protected] <mailto:[email protected]>> wrote:

    From: Wenzong Fan <[email protected]
    <mailto:[email protected]>>

    Remove patches that included by new version:
       - 0001-libsemanage-simplify-string-utilities-functions.patch
       - 0002-libsemanage-add-semanage_str_replace-utility-functio.patch
       - 0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
       - 0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
       - libsemanage-fix-path-len-limit.patch

    Rebase patch:
       - libsemanage-allow-to-disable-audit-support.patch

    Set PYCEXT and PYSITEDIR to generate the _semanage.so and install it
    to ${libdir}/python${PYTHON_BASEVERSION}/site-packages.

    Signed-off-by: Wenzong Fan <[email protected]
    <mailto:[email protected]>>
    ---
      recipes-security/selinux/libsemanage.inc           |   2 +
      ...anage-simplify-string-utilities-functions.patch | 115 --------
      ...-add-semanage_str_replace-utility-functio.patch | 164 -----------
      ...manage-genhomedircon-drop-ustr-dependency.patch | 323
    ---------------------
      ...-remove-ustr-library-from-Makefiles-READM.patch |  61 ----
      ...ibsemanage-allow-to-disable-audit-support.patch |  68 +++--
      .../libsemanage-fix-path-len-limit.patch           |  28 --
      .../{libsemanage_2.6.bb <http://libsemanage_2.6.bb> =>
    libsemanage_2.7.bb <http://libsemanage_2.7.bb>}     |  11 +-
      8 files changed, 42 insertions(+), 730 deletions(-)
      delete mode 100644
    recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch
      delete mode 100644
    recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch
      delete mode 100644
    recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
      delete mode 100644
    recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
      delete mode 100644
    recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch
      rename recipes-security/selinux/{libsemanage_2.6.bb
    <http://libsemanage_2.6.bb> => libsemanage_2.7.bb
    <http://libsemanage_2.7.bb>} (50%)

    diff --git a/recipes-security/selinux/libsemanage.inc
    b/recipes-security/selinux/libsemanage.inc
    index 504101d..9b238c8 100644
    --- a/recipes-security/selinux/libsemanage.inc
    +++ b/recipes-security/selinux/libsemanage.inc
    @@ -40,6 +40,8 @@ do_install() {

          oe_runmake install-pywrap swigify \
                  DESTDIR=${D} \
    +            PYCEXT='.so' \
    +           
    PYSITEDIR='${D}${libdir}/python${PYTHON_BASEVERSION}/site-packages' \
                  PYLIBVER='python${PYTHON_BASEVERSION}' \
                  PYLIBDIR='${D}/${libdir}/$(PYLIBVER)'

    diff --git
    a/recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch
    b/recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch
    deleted file mode 100644
    index fd478d0..0000000
    ---
    a/recipes-security/selinux/libsemanage/0001-libsemanage-simplify-string-utilities-functions.patch
    +++ /dev/null
    @@ -1,115 +0,0 @@
    -From 514a5df959ea0e13db4e87f73c2ac5edcceebd52 Mon Sep 17 00:00:00 2001
    -From: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -Date: Wed, 21 Dec 2016 19:21:01 +0100
    -Subject: [meta-selinux][PATCH 1/4] libsemanage: simplify string
    utilities functions
    -
    -Use string functions from C standard library instead of ustr. This
    makes
    -the code simpler and make utilities.c no longer depend on ustr library.
    -
    -This changes how semanage_split() behaves when delim is not empty (NULL
    -or "") and the input string contains several successive delimiters:
    -semanage_split("foo::::bar", ":") returned "bar" and now returns
    ":bar".
    -This would not have any impact in the current code as semanage_split()
    -is only called with delim="=" (through semanage_findval(), in
    -libsemanage/src/genhomedircon.c), in order to split a "key=value"
    -statement.
    -
    -Signed-off-by: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -(cherry picked from commit a228bb3736c5957d41ad9e01eb1283fc6883a6e5)
    ----
    - libsemanage/src/utilities.c | 59
    ++++++++++-----------------------------------
    - 1 file changed, 13 insertions(+), 46 deletions(-)
    -
    -diff --git a/libsemanage/src/utilities.c b/libsemanage/src/utilities.c
    -index f48ffa4..fa86cc7 100644
    ---- a/libsemanage/src/utilities.c
    -+++ b/libsemanage/src/utilities.c
    -@@ -26,7 +26,6 @@
    - #include <string.h>
    - #include <sys/types.h>
    - #include <assert.h>
    --#include <ustr.h>
    -
    - #define TRUE 1
    - #define FALSE 0
    -@@ -74,64 +73,32 @@ char *semanage_split_on_space(const char *str)
    - {
    -       /* as per the man page, these are the isspace() chars */
    -       const char *seps = "\f\n\r\t\v ";
    --      size_t slen = strlen(seps);
    --      size_t off = 0, rside_len = 0;
    --      char *retval = NULL;
    --      Ustr *ustr = USTR_NULL, *temp = USTR_NULL;
    -+      size_t off = 0;
    -
    -       if (!str)
    --              goto done;
    --      if (!(ustr = ustr_dup_cstr(str)))
    --              goto done;
    --      temp =
    --          ustr_split_spn_chrs(ustr, &off, seps, slen, USTR_NULL,
    --                              USTR_FLAG_SPLIT_DEF);
    --      if (!temp)
    --              goto done;
    --      /* throw away the left hand side */
    --      ustr_sc_free(&temp);
    --
    --      rside_len = ustr_len(ustr) - off;
    --      temp = ustr_dup_subustr(ustr, off + 1, rside_len);
    --      if (!temp)
    --              goto done;
    --      retval = strdup(ustr_cstr(temp));
    --      ustr_sc_free(&temp);
    -+              return NULL;
    -
    --      done:
    --      ustr_sc_free(&ustr);
    --      return retval;
    -+      /* skip one token and the spaces before and after it */
    -+      off = strspn(str, seps);
    -+      off += strcspn(str + off, seps);
    -+      off += strspn(str + off, seps);
    -+      return strdup(str + off);
    - }
    -
    - char *semanage_split(const char *str, const char *delim)
    - {
    --      Ustr *ustr = USTR_NULL, *temp = USTR_NULL;
    --      size_t off = 0, rside_len = 0;
    --      char *retval = NULL;
    -+      char *retval;
    -
    -       if (!str)
    --              goto done;
    -+              return NULL;
    -       if (!delim || !(*delim))
    -               return semanage_split_on_space(str);
    --      ustr = ustr_dup_cstr(str);
    --      temp =
    --          ustr_split_cstr(ustr, &off, delim, USTR_NULL,
    USTR_FLAG_SPLIT_DEF);
    --      if (!temp)
    --              goto done;
    --      /* throw away the left hand side */
    --      ustr_sc_free(&temp);
    --
    --      rside_len = ustr_len(ustr) - off;
    -
    --      temp = ustr_dup_subustr(ustr, off + 1, rside_len);
    --      if (!temp)
    --              goto done;
    --      retval = strdup(ustr_cstr(temp));
    --      ustr_sc_free(&temp);
    -+      retval = strstr(str, delim);
    -+      if (retval == NULL)
    -+              return NULL;
    -
    --      done:
    --      ustr_sc_free(&ustr);
    --      return retval;
    -+      return strdup(retval + strlen(delim));
    - }
    -
    - int semanage_list_push(semanage_list_t ** list, const char *data)
    ---
    -2.10.2
    -
    diff --git
    a/recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch
    b/recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch
    deleted file mode 100644
    index ed32785..0000000
    ---
    a/recipes-security/selinux/libsemanage/0002-libsemanage-add-semanage_str_replace-utility-functio.patch
    +++ /dev/null
    @@ -1,164 +0,0 @@
    -From de8b13baf3773b41367f265e7dd06c013816ba0a Mon Sep 17 00:00:00 2001
    -From: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -Date: Wed, 21 Dec 2016 19:21:02 +0100
    -Subject: [meta-selinux][PATCH 2/4] libsemanage: add
    semanage_str_replace() utility function
    -
    -This function will be used in the next commit.
    -
    -Signed-off-by: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -(cherry picked from commit 57a3b1b4b0a50a1d14f825d2933339063ced4fec)
    ----
    - libsemanage/src/utilities.c        | 55
    ++++++++++++++++++++++++++++++++++++++
    - libsemanage/src/utilities.h        | 10 +++++++
    - libsemanage/tests/test_utilities.c | 34 +++++++++++++++++++++++
    - 3 files changed, 99 insertions(+)
    -
    -diff --git a/libsemanage/src/utilities.c b/libsemanage/src/utilities.c
    -index fa86cc7..0d50d99 100644
    ---- a/libsemanage/src/utilities.c
    -+++ b/libsemanage/src/utilities.c
    -@@ -230,6 +230,61 @@ void semanage_rtrim(char *str, char trim_to)
    -       }
    - }
    -
    -+char *semanage_str_replace(const char *search, const char *replace,
    -+                         const char *src, size_t lim)
    -+{
    -+      size_t count = 0, slen, rlen, newsize;
    -+      char *p, *pres, *result;
    -+      const char *psrc;
    -+
    -+      slen = strlen(search);
    -+      rlen = strlen(replace);
    -+
    -+      /* Do not support empty search strings */
    -+      if (slen == 0)
    -+              return NULL;
    -+
    -+      /* Count the occurences of search in src and compute the new
    size */
    -+      for (p = strstr(src, search); p != NULL; p = strstr(p +
    slen, search)) {
    -+              count++;
    -+              if (lim && count >= lim)
    -+                      break;
    -+      }
    -+      if (!count)
    -+              return strdup(src);
    -+
    -+      /* Allocate the result string */
    -+      newsize = strlen(src) + 1 + count * (rlen - slen);
    -+      result = malloc(newsize);
    -+      if (!result)
    -+              return NULL;
    -+
    -+      /* Fill the result */
    -+      psrc = src;
    -+      pres = result;
    -+      for (p = strstr(src, search); p != NULL; p = strstr(psrc,
    search)) {
    -+              /* Copy the part which has not been modified */
    -+              if (p != psrc) {
    -+                      size_t length = (size_t)(p - psrc);
    -+                      memcpy(pres, psrc, length);
    -+                      pres += length;
    -+              }
    -+              /* Copy the replacement part */
    -+              if (rlen != 0) {
    -+                      memcpy(pres, replace, rlen);
    -+                      pres += rlen;
    -+              }
    -+              psrc = p + slen;
    -+              count--;
    -+              if (!count)
    -+                      break;
    -+      }
    -+      /* Copy the last part, after doing a sanity check */
    -+      assert(pres + strlen(psrc) + 1 == result + newsize);
    -+      strcpy(pres, psrc);
    -+      return result;
    -+}
    -+
    - /* list_addafter_controlmem does *NOT* duplicate the data argument
    -  * use at your own risk, I am building a list out of malloc'd
    memory and
    -  * it is only going to get stored into this list, thus when I
    destroy it
    -diff --git a/libsemanage/src/utilities.h b/libsemanage/src/utilities.h
    -index 5fa15ef..f2ff31f 100644
    ---- a/libsemanage/src/utilities.h
    -+++ b/libsemanage/src/utilities.h
    -@@ -116,6 +116,16 @@ int semanage_str_count(char *data, char what);
    - void semanage_rtrim(char *str, char trim_to);
    -
    - /**
    -+ * @param      value being searched for
    -+ * @param      replacement value that replaces found search values
    -+ * @param      string being searched and replaced on
    -+ * @param      maximum number of value occurences (zero for unlimited)
    -+ * @return     newly-allocated string with the replaced values
    -+ */
    -+char *semanage_str_replace(const char *search, const char *replace,
    -+                         const char *src, size_t lim);
    -+
    -+/**
    -  * @param data    some string
    -  * @return  modifies the string such that the first whitespace
    char becomes
    -  *        '\0', ending the string.
    -diff --git a/libsemanage/tests/test_utilities.c
    b/libsemanage/tests/test_utilities.c
    -index 32cc33c..cdfed0c 100644
    ---- a/libsemanage/tests/test_utilities.c
    -+++ b/libsemanage/tests/test_utilities.c
    -@@ -40,6 +40,7 @@ void test_semanage_split(void);
    - void test_semanage_list(void);
    - void test_semanage_str_count(void);
    - void test_semanage_rtrim(void);
    -+void test_semanage_str_replace(void);
    - void test_semanage_findval(void);
    - void test_slurp_file_filter(void);
    -
    -@@ -101,6 +102,10 @@ int semanage_utilities_add_tests(CU_pSuite suite)
    -       if (NULL == CU_add_test(suite, "semanage_rtrim",
    test_semanage_rtrim)) {
    -               goto err;
    -       }
    -+      if (NULL == CU_add_test(suite, "semanage_str_replace",
    -+                              test_semanage_str_replace)) {
    -+              goto err;
    -+      }
    -       if (NULL == CU_add_test(suite, "semanage_findval",
    -                               test_semanage_findval)) {
    -               goto err;
    -@@ -244,6 +249,35 @@ void test_semanage_rtrim(void)
    -       CU_ASSERT_STRING_EQUAL(str, "/blah/foo/bar");
    - }
    -
    -+void test_semanage_str_replace(void)
    -+{
    -+      const char *test_str = "Hello, I am %{USERNAME} and my id is
    %{USERID}";
    -+      char *str1, *str2;
    -+
    -+      str1 = semanage_str_replace("%{USERNAME}", "root", test_str, 0);
    -+      CU_ASSERT_STRING_EQUAL(str1, "Hello, I am root and my id is
    %{USERID}");
    -+
    -+      str2 = semanage_str_replace("%{USERID}", "0", str1, 1);
    -+      CU_ASSERT_STRING_EQUAL(str2, "Hello, I am root and my id is 0");
    -+      free(str1);
    -+      free(str2);
    -+
    -+      str1 = semanage_str_replace(":(", ";)", "Test :( :) !
    :(:(:))(:(", 0);
    -+      CU_ASSERT_STRING_EQUAL(str1, "Test ;) :) ! ;);):))(;)");
    -+      free(str1);
    -+
    -+      str1 = semanage_str_replace(":(", ";)", "Test :( :) !
    :(:(:))(:(", 3);
    -+      CU_ASSERT_STRING_EQUAL(str1, "Test ;) :) ! ;);):))(:(");
    -+      free(str1);
    -+
    -+      str1 = semanage_str_replace("", "empty search string",
    "test", 0);
    -+      CU_ASSERT_EQUAL(str1, NULL);
    -+
    -+      str1 = semanage_str_replace("a", "", "abracadabra", 0);
    -+      CU_ASSERT_STRING_EQUAL(str1, "brcdbr");
    -+      free(str1);
    -+}
    -+
    - void test_semanage_findval(void)
    - {
    -       char *tok;
    ---
    -2.10.2
    -
    diff --git
    a/recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
    b/recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
    deleted file mode 100644
    index fde2349..0000000
    ---
    a/recipes-security/selinux/libsemanage/0003-libsemanage-genhomedircon-drop-ustr-dependency.patch
    +++ /dev/null
    @@ -1,323 +0,0 @@
    -From e8dd31df2268013afb1e8dbe5e617b9c4e9e388e Mon Sep 17 00:00:00 2001
    -From: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -Date: Wed, 21 Dec 2016 19:21:03 +0100
    -Subject: [meta-selinux][PATCH 3/4] libsemanage: genhomedircon: drop
    ustr dependency
    -
    -ustr library uses old (pre-C99) "extern inline" semantic. This makes it
    -incompatible with recent versions of gcc and clang, which default to
    -C99 standard. Distributions have shipped patched versions of this
    -library to fix issues (e.g. Gentoo package uses this patch:
    -https://gitweb.gentoo.org/repo/gentoo.git/tree/dev-libs/ustr/files/ustr-1.0.4-gcc_5-check.patch?id=7dea6f8820f36bf389e6315044bea7507553bed0
    -) but there is no upstream solution to make ustr compatible with C99
    -standard.
    -
    -The git tree of ustr (http://www.and.org/ustr/ustr.git) has not been
    -updated since 2008 and the developer of this project did not reply to
    -emails.
    -
    -Therefore update genhomedircon implementation in order to no longer
    -rely on ustr library.
    -
    -Signed-off-by: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -(cherry picked from commit 300b8ad4235688171f2a91e7aeb14d0ee3561c13)
    ----
    - libsemanage/src/genhomedircon.c | 154
    ++++++++++++++++++++--------------------
    - 1 file changed, 77 insertions(+), 77 deletions(-)
    -
    -diff --git a/libsemanage/src/genhomedircon.c
    b/libsemanage/src/genhomedircon.c
    -index 6991fff..0f84aa3 100644
    ---- a/libsemanage/src/genhomedircon.c
    -+++ b/libsemanage/src/genhomedircon.c
    -@@ -34,9 +34,9 @@
    -
    - #include "utilities.h"
    - #include "genhomedircon.h"
    --#include <ustr.h>
    -
    - #include <assert.h>
    -+#include <ctype.h>
    - #include <limits.h>
    - #include <stdio.h>
    - #include <stdlib.h>
    -@@ -239,46 +239,39 @@ static int fcontext_matches(const
    semanage_fcontext_t *fcontext, void *varg)
    - {
    -       const char *oexpr = semanage_fcontext_get_expr(fcontext);
    -       fc_match_handle_t *handp = varg;
    --      struct Ustr *expr;
    -+      char *expr = NULL;
    -       regex_t re;
    -       int type, retval = -1;
    -+      size_t len;
    -
    -       /* Only match ALL or DIR */
    -       type = semanage_fcontext_get_type(fcontext);
    -       if (type != SEMANAGE_FCONTEXT_ALL && type !=
    SEMANAGE_FCONTEXT_ALL)
    -               return 0;
    -
    --      /* Convert oexpr into a Ustr and anchor it at the beginning */
    --      expr = ustr_dup_cstr("^");
    --      if (expr == USTR_NULL)
    --              goto done;
    --      if (!ustr_add_cstr(&expr, oexpr))
    --              goto done;
    --
    --      /* Strip off trailing ".+" or ".*" */
    --      if (ustr_cmp_suffix_cstr_eq(expr, ".+") ||
    --          ustr_cmp_suffix_cstr_eq(expr, ".*")) {
    --              if (!ustr_del(&expr, 2))
    --                      goto done;
    --      }
    --
    --      /* Strip off trailing "(/.*)?" */
    --      if (ustr_cmp_suffix_cstr_eq(expr, "(/.*)?")) {
    --              if (!ustr_del(&expr, 6))
    --                      goto done;
    --      }
    --
    --      if (ustr_cmp_suffix_cstr_eq(expr, "/")) {
    --              if (!ustr_del(&expr, 1))
    --                      goto done;
    --      }
    --
    --      /* Append pattern to eat up trailing slashes */
    --      if (!ustr_add_cstr(&expr, "/*$"))
    --              goto done;
    -+      len = strlen(oexpr);
    -+      /* Define a macro to strip a literal string from the end of
    oexpr */
    -+#define rstrip_oexpr_len(cstr, cstrlen) \
    -+      do { \
    -+              if (len >= (cstrlen) && !strncmp(oexpr + len -
    (cstrlen), (cstr), (cstrlen))) \
    -+                      len -= (cstrlen); \
    -+      } while (0)
    -+#define rstrip_oexpr(cstr) rstrip_oexpr_len(cstr, sizeof(cstr) - 1)
    -+
    -+      rstrip_oexpr(".+");
    -+      rstrip_oexpr(".*");
    -+      rstrip_oexpr("(/.*)?");
    -+      rstrip_oexpr("/");
    -+
    -+#undef rstrip_oexpr_len
    -+#undef rstrip_oexpr
    -+
    -+      /* Anchor oexpr at the beginning and append pattern to eat
    up trailing slashes */
    -+      if (asprintf(&expr, "^%.*s/*$", (int)len, oexpr) < 0)
    -+              return -1;
    -
    -       /* Check dir against expr */
    --      if (regcomp(&re, ustr_cstr(expr), REG_EXTENDED) != 0)
    -+      if (regcomp(&re, expr, REG_EXTENDED) != 0)
    -               goto done;
    -       if (regexec(&re, handp->dir, 0, NULL, 0) == 0)
    -               handp->matched = 1;
    -@@ -287,7 +280,7 @@ static int fcontext_matches(const
    semanage_fcontext_t *fcontext, void *varg)
    -       retval = 0;
    -
    - done:
    --      ustr_free(expr);
    -+      free(expr);
    -
    -       return retval;
    - }
    -@@ -523,44 +516,50 @@ static semanage_list_t
    *make_template(genhomedircon_settings_t * s,
    -       return template_data;
    - }
    -
    --static Ustr *replace_all(const char *str, const replacement_pair_t
    * repl)
    -+static char *replace_all(const char *str, const replacement_pair_t
    * repl)
    - {
    --      Ustr *retval = USTR_NULL;
    -+      char *retval, *retval2;
    -       int i;
    -
    -       if (!str || !repl)
    --              goto done;
    --      if (!(retval = ustr_dup_cstr(str)))
    --              goto done;
    -+              return NULL;
    -
    --      for (i = 0; repl[i].search_for; i++) {
    --              ustr_replace_cstr(&retval, repl[i].search_for,
    --                                repl[i].replace_with, 0);
    -+      retval = strdup(str);
    -+      for (i = 0; retval != NULL && repl[i].search_for; i++) {
    -+              retval2 = semanage_str_replace(repl[i].search_for,
    -+                                             repl[i].replace_with,
    retval, 0);
    -+              free(retval);
    -+              retval = retval2;
    -       }
    --      if (ustr_enomem(retval))
    --              ustr_sc_free(&retval);
    --
    --      done:
    -       return retval;
    - }
    -
    --static const char * extract_context(Ustr *line)
    -+static const char *extract_context(const char *line)
    - {
    --      const char whitespace[] = " \t\n";
    --      size_t off, len;
    --
    --      /* check for trailing whitespace */
    --      off = ustr_spn_chrs_rev(line, 0, whitespace,
    strlen(whitespace));
    --
    --      /* find the length of the last field in line */
    --      len = ustr_cspn_chrs_rev(line, off, whitespace,
    strlen(whitespace));
    --
    --      if (len == 0)
    -+      const char *p = line;
    -+      size_t off;
    -+
    -+      off = strlen(p);
    -+      p += off;
    -+      /* consider trailing whitespaces */
    -+      while (off > 0) {
    -+              p--;
    -+              off--;
    -+              if (!isspace(*p))
    -+                      break;
    -+      }
    -+      if (off == 0)
    -               return NULL;
    --      return ustr_cstr(line) + ustr_len(line) - (len + off);
    -+
    -+      /* find the last field in line */
    -+      while (off > 0 && !isspace(*(p - 1))) {
    -+              p--;
    -+              off--;
    -+      }
    -+      return p;
    - }
    -
    --static int check_line(genhomedircon_settings_t * s, Ustr *line)
    -+static int check_line(genhomedircon_settings_t * s, const char *line)
    - {
    -       sepol_context_t *ctx_record = NULL;
    -       const char *ctx_str;
    -@@ -584,22 +583,22 @@ static int
    write_replacements(genhomedircon_settings_t * s, FILE * out,
    -                             const semanage_list_t * tpl,
    -                             const replacement_pair_t *repl)
    - {
    --      Ustr *line = USTR_NULL;
    -+      char *line;
    -
    -       for (; tpl; tpl = tpl->next) {
    -               line = replace_all(tpl->data, repl);
    -               if (!line)
    -                       goto fail;
    -               if (check_line(s, line) == STATUS_SUCCESS) {
    --                      if (!ustr_io_putfileline(&line, out))
    -+                      if (fprintf(out, "%s\n", line) < 0)
    -                               goto fail;
    -               }
    --              ustr_sc_free(&line);
    -+              free(line);
    -       }
    -       return STATUS_SUCCESS;
    -
    -       fail:
    --      ustr_sc_free(&line);
    -+      free(line);
    -       return STATUS_ERR;
    - }
    -
    -@@ -607,7 +606,7 @@ static int
    write_contexts(genhomedircon_settings_t *s, FILE *out,
    -                         semanage_list_t *tpl, const
    replacement_pair_t *repl,
    -                         const genhomedircon_user_entry_t *user)
    - {
    --      Ustr *line = USTR_NULL;
    -+      char *line, *temp;
    -       sepol_context_t *context = NULL;
    -       char *new_context_str = NULL;
    -
    -@@ -624,10 +623,10 @@ static int
    write_contexts(genhomedircon_settings_t *s, FILE *out,
    -
    -               if (strcmp(old_context_str, CONTEXT_NONE) == 0) {
    -                       if (check_line(s, line) == STATUS_SUCCESS &&
    --                          !ustr_io_putfileline(&line, out)) {
    -+                          fprintf(out, "%s\n", line) < 0) {
    -                               goto fail;
    -                       }
    --
    -+                      free(line);
    -                       continue;
    -               }
    -
    -@@ -653,25 +652,27 @@ static int
    write_contexts(genhomedircon_settings_t *s, FILE *out,
    -                       goto fail;
    -               }
    -
    --              if (!ustr_replace_cstr(&line, old_context_str,
    --                                     new_context_str, 1)) {
    -+              temp = semanage_str_replace(old_context_str,
    new_context_str,
    -+                                          line, 1);
    -+              if (!temp) {
    -                       goto fail;
    -               }
    -+              free(line);
    -+              line = temp;
    -
    -               if (check_line(s, line) == STATUS_SUCCESS) {
    --                      if (!ustr_io_putfileline(&line, out)) {
    -+                      if (fprintf(out, "%s\n", line) < 0)
    -                               goto fail;
    --                      }
    -               }
    -
    --              ustr_sc_free(&line);
    -+              free(line);
    -               sepol_context_free(context);
    -               free(new_context_str);
    -       }
    -
    -       return STATUS_SUCCESS;
    - fail:
    --      ustr_sc_free(&line);
    -+      free(line);
    -       sepol_context_free(context);
    -       free(new_context_str);
    -       return STATUS_ERR;
    -@@ -1284,20 +1285,19 @@ static int
    write_context_file(genhomedircon_settings_t * s, FILE * out)
    -               }
    -
    -               for (h = homedirs; h; h = h->next) {
    --                      Ustr *temp = ustr_dup_cstr(h->data);
    -+                      char *temp = NULL;
    -
    --                      if (!temp || !ustr_add_cstr(&temp, "/"
    FALLBACK_NAME)) {
    --                              ustr_sc_free(&temp);
    -+                      if (asprintf(&temp, "%s/%s", h->data,
    FALLBACK_NAME) < 0) {
    -                               retval = STATUS_ERR;
    -                               goto done;
    -                       }
    -
    -                       free(s->fallback->home);
    --                      s->fallback->home = (char*) ustr_cstr(temp);
    -+                      s->fallback->home = temp;
    -
    -                       if (write_home_dir_context(s, out,
    homedir_context_tpl,
    -                                                  s->fallback) !=
    STATUS_SUCCESS) {
    --                              ustr_sc_free(&temp);
    -+                              free(temp);
    -                               s->fallback->home = NULL;
    -                               retval = STATUS_ERR;
    -                               goto done;
    -@@ -1305,13 +1305,13 @@ static int
    write_context_file(genhomedircon_settings_t * s, FILE * out)
    -                       if (write_home_root_context(s, out,
    -                                                 
      homeroot_context_tpl,
    -                                                   h->data) !=
    STATUS_SUCCESS) {
    --                              ustr_sc_free(&temp);
    -+                              free(temp);
    -                               s->fallback->home = NULL;
    -                               retval = STATUS_ERR;
    -                               goto done;
    -                       }
    -
    --                      ustr_sc_free(&temp);
    -+                      free(temp);
    -                       s->fallback->home = NULL;
    -               }
    -       }
    ---
    -2.10.2
    -
    diff --git
    a/recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
    b/recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
    deleted file mode 100644
    index 1800493..0000000
    ---
    a/recipes-security/selinux/libsemanage/0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch
    +++ /dev/null
    @@ -1,61 +0,0 @@
    -From c7e55daa20f5659799aed47b819ad73e03d11e8f Mon Sep 17 00:00:00 2001
    -From: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -Date: Wed, 21 Dec 2016 19:21:04 +0100
    -Subject: [meta-selinux][PATCH 4/4] libsemanage: remove ustr library
    from Makefiles, README
    - and pkg-config
    -
    -This library is no longer used by libsemanage.
    -
    -Signed-off-by: Nicolas Iooss <[email protected]
    <mailto:[email protected]>>
    -(cherry picked from commit 920ee9ee18024c7714f1121e91854f38fa1eef73)
    -
    -Tweaked due to conditional audit patch and no README.
    ----
    - README                            | 2 +-
    - libsemanage/src/Makefile          | 2 +-
    - libsemanage/src/libsemanage.pc.in <http://libsemanage.pc.in> | 2 +-
    - libsemanage/tests/Makefile        | 2 +-
    - 4 files changed, 4 insertions(+), 4 deletions(-)
    -
    -diff --git a/libsemanage/src/Makefile b/libsemanage/src/Makefile
    -index 68aab72..83daf0f 100644
    ---- a/libsemanage/src/Makefile
    -+++ b/libsemanage/src/Makefile
    -@@ -91,7 +91,7 @@ $(LIBA): $(OBJS)
    -       $(RANLIB) $@
    -
    - $(LIBSO): $(LOBJS)
    --      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol
    $(LIBAUDIT) -lselinux -lbz2 -lustr -L$(LIBDIR)
    -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
    -+      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol
    $(LIBAUDIT) -lselinux -lbz2 -L$(LIBDIR)
    -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
    -       ln -sf $@ $(TARGET)
    -
    - $(LIBPC): $(LIBPC).in ../VERSION
    -diff --git a/libsemanage/src/libsemanage.pc.in
    <http://libsemanage.pc.in> b/libsemanage/src/libsemanage.pc.in
    <http://libsemanage.pc.in>
    -index 81e1805..d3eaa06 100644
    ---- a/libsemanage/src/libsemanage.pc.in <http://libsemanage.pc.in>
    -+++ b/libsemanage/src/libsemanage.pc.in <http://libsemanage.pc.in>
    -@@ -7,7 +7,7 @@ Name: libsemanage
    - Description: SELinux management library
    - Version: @VERSION@
    - URL: http://userspace.selinuxproject.org/
    --Requires.private: libselinux libsepol ustr
    -+Requires.private: libselinux libsepol
    - Libs: -L${libdir} -lsemanage
    - Libs.private: -lbz2
    - Cflags: -I${includedir}
    -diff --git a/libsemanage/tests/Makefile b/libsemanage/tests/Makefile
    -index 4b81fed..56285b3 100644
    ---- a/libsemanage/tests/Makefile
    -+++ b/libsemanage/tests/Makefile
    -@@ -12,7 +12,7 @@ LIBS = ../src/libsemanage.a
    ../../libselinux/src/libselinux.a ../../libsepol/src
    -       LIBAUDIT = -laudit
    - endif
    -
    --LDFLAGS += -lcunit -lustr -lbz2 $(LIBAUDIT)
    -+LDFLAGS += -lcunit -lbz2 $(LIBAUDIT)
    - OBJECTS = $(SOURCES:.c=.o)
    -
    - all: $(EXECUTABLE)
    ---
    -2.10.2
    -
    diff --git
    a/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch
    b/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch
    index d727acf..91efe81 100644
    ---
    a/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch
    +++
    b/recipes-security/selinux/libsemanage/libsemanage-allow-to-disable-audit-support.patch
    @@ -7,16 +7,16 @@ Upstream-Status: Pending

      Signed-off-by: Wenzong Fan <[email protected]
    <mailto:[email protected]>>
      ---
    - src/Makefile        |   10 +++++++++-
    - src/seusers_local.c |   13 +++++++++++++
    - tests/Makefile      |   10 +++++++++-
    + src/Makefile        | 10 +++++++++-
    + src/seusers_local.c | 13 +++++++++++++
    + tests/Makefile      | 10 +++++++++-
       3 files changed, 31 insertions(+), 2 deletions(-)

    -Index: libsemanage-2.5/src/Makefile
    -===================================================================
    ---- libsemanage-2.5.orig/src/Makefile  2016-02-25
    13:20:30.867978414 -0500
    -+++ libsemanage-2.5/src/Makefile       2016-02-25
    13:20:30.859978414 -0500
    -@@ -28,6 +28,14 @@
    +diff --git a/src/Makefile b/src/Makefile
    +index fdb178f..43e1266 100644
    +--- a/src/Makefile
    ++++ b/src/Makefile
    +@@ -29,6 +29,14 @@ ifeq ($(DEBUG),1)
             export LDFLAGS = -g
       endif

    @@ -31,20 +31,20 @@ Index: libsemanage-2.5/src/Makefile
       LEX = flex
       LFLAGS = -s
       YACC = bison
    -@@ -92,7 +100,7 @@
    +@@ -91,7 +99,7 @@ $(LIBA): $(OBJS)
             $(RANLIB) $@

       $(LIBSO): $(LOBJS)
    --      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -laudit
    -lselinux -lbz2 -lustr -L$(LIBDIR)
    -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
    -+      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol
    $(LIBAUDIT) -lselinux -lbz2 -lustr -L$(LIBDIR)
    -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
    +-      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol -laudit
    -lselinux -lbz2
    -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
    ++      $(CC) $(CFLAGS) $(LDFLAGS) -shared -o $@ $^ -lsepol
    $(LIBAUDIT) -lselinux -lbz2
    -Wl,-soname,$(LIBSO),--version-script=libsemanage.map,-z,defs
             ln -sf $@ $(TARGET)

       $(LIBPC): $(LIBPC).in ../VERSION
    -Index: libsemanage-2.5/src/seusers_local.c
    -===================================================================
    ---- libsemanage-2.5.orig/src/seusers_local.c   2016-02-25
    13:20:30.867978414 -0500
    -+++ libsemanage-2.5/src/seusers_local.c        2016-02-25
    13:20:30.863978414 -0500
    -@@ -8,7 +8,11 @@
    +diff --git a/src/seusers_local.c b/src/seusers_local.c
    +index 42c3a8b..9ee31e2 100644
    +--- a/src/seusers_local.c
    ++++ b/src/seusers_local.c
    +@@ -8,7 +8,11 @@ typedef struct semanage_seuser record_t;

       #include <sepol/policydb.h>
       #include <sepol/context.h>
    @@ -56,7 +56,7 @@ Index: libsemanage-2.5/src/seusers_local.c
       #include <errno.h>
       #include "user_internal.h"
       #include "seuser_internal.h"
    -@@ -51,6 +55,7 @@
    +@@ -51,6 +55,7 @@ static char
    *semanage_user_roles(semanage_handle_t * handle, const char *sename)
             return roles;
       }

    @@ -64,7 +64,7 @@ Index: libsemanage-2.5/src/seusers_local.c
       static int semanage_seuser_audit(semanage_handle_t * handle,
                               const semanage_seuser_t * seuser,
                               const semanage_seuser_t * previous,
    -@@ -114,6 +119,7 @@
    +@@ -114,6 +119,7 @@ err:
             free(proles);
             return rc;
       }
    @@ -72,7 +72,7 @@ Index: libsemanage-2.5/src/seusers_local.c

       int semanage_seuser_modify_local(semanage_handle_t * handle,
                                      const semanage_seuser_key_t * key,
    -@@ -158,8 +164,11 @@
    +@@ -158,8 +164,11 @@ int
    semanage_seuser_modify_local(semanage_handle_t * handle,
             (void) semanage_seuser_query(handle, key, &previous);
             handle->msg_callback = callback;
             rc = dbase_modify(handle, dconfig, key, new);
    @@ -84,7 +84,7 @@ Index: libsemanage-2.5/src/seusers_local.c
       err:
             if (previous)
                     semanage_seuser_free(previous);
    -@@ -175,8 +184,12 @@
    +@@ -175,8 +184,12 @@ int
    semanage_seuser_del_local(semanage_handle_t * handle,
             dbase_config_t *dconfig = semanage_seuser_dbase_local(handle);
             rc = dbase_del(handle, dconfig, key);
             semanage_seuser_query(handle, key, &seuser);
    @@ -97,15 +97,14 @@ Index: libsemanage-2.5/src/seusers_local.c
             if (seuser)
                     semanage_seuser_free(seuser);
             return rc;
    -Index: libsemanage-2.5/tests/Makefile
    -===================================================================
    ---- libsemanage-2.5.orig/tests/Makefile        2016-02-25
    13:20:30.867978414 -0500
    -+++ libsemanage-2.5/tests/Makefile     2016-02-25
    13:22:05.171978120 -0500
    -@@ -13,7 +13,15 @@
    - CC = gcc
    - CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn
    -Wmissing-format-attribute -Wno-unused-parameter
    - INCLUDE = -I$(TESTSRC) -I$(TESTSRC)/../include
    --LDFLAGS += -lcunit -lustr -lbz2 -laudit
    +diff --git a/tests/Makefile b/tests/Makefile
    +index 2ef8d30..50d582a 100644
    +--- a/tests/Makefile
    ++++ b/tests/Makefile
    +@@ -6,10 +6,18 @@ SOURCES = $(sort $(wildcard *.c))
    +
    +
    ###########################################################################
    +
      +DISABLE_AUDIT ?= n
      +ifeq ($(DISABLE_AUDIT),y)
      +      LIBAUDIT =
    @@ -114,7 +113,14 @@ Index: libsemanage-2.5/tests/Makefile
      +      LIBAUDIT = -laudit
      +endif
      +
    -+LDFLAGS += -lcunit -lustr -lbz2 $(LIBAUDIT)
    + EXECUTABLE = libsemanage-tests
    + CFLAGS += -g -O0 -Wall -W -Wundef -Wmissing-noreturn
    -Wmissing-format-attribute -Wno-unused-parameter
    + override CFLAGS += -I../src -I../include
    +-override LDLIBS += -lcunit -lbz2 -laudit -lselinux -lsepol
    ++override LDLIBS += -lcunit -lbz2 $(LIBAUDIT) -lselinux -lsepol
    +
       OBJECTS = $(SOURCES:.c=.o)

    - all: $(EXECUTABLE)
    +--
    +2.13.0
    +
    diff --git
    a/recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch
    b/recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch
    deleted file mode 100644
    index c98f3fc..0000000
    ---
    a/recipes-security/selinux/libsemanage/libsemanage-fix-path-len-limit.patch
    +++ /dev/null
    @@ -1,28 +0,0 @@
    -Subject: [meta-selinux][PATCH] libsemanage: fix path length limit
    -
    -semanage_remove_directory uses NAME_MAX(255) as the max length of
    -file pathes, this will cause failures when the path length>255.
    -
    -Upstream-Status: pending
    -
    -Signed-off-by: Xin Ouyang <[email protected]
    <mailto:[email protected]>>
    ----
    - src/semanage_store.c |    2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -diff --git a/src/semanage_store.c b/src/semanage_store.c
    -index 3fd4996..251a2d6 100644
    ---- a/src/semanage_store.c
    -+++ b/src/semanage_store.c
    -@@ -580,7 +580,7 @@ int semanage_remove_directory(const char *path)
    -               return -1;
    -       }
    -       for (i = 0; i < num_entries; i++) {
    --              char s[NAME_MAX];
    -+              char s[PATH_MAX];
    -               struct stat buf;
    -               snprintf(s, sizeof(s), "%s/%s", path,
    namelist[i]->d_name);
    -               if (stat(s, &buf) == -1) {
    ---
    -1.7.9.5
    -
    diff --git a/recipes-security/selinux/libsemanage_2.6.bb
    <http://libsemanage_2.6.bb>
    b/recipes-security/selinux/libsemanage_2.7.bb
    <http://libsemanage_2.7.bb>
    similarity index 50%
    rename from recipes-security/selinux/libsemanage_2.6.bb
    <http://libsemanage_2.6.bb>
    rename to recipes-security/selinux/libsemanage_2.7.bb
    <http://libsemanage_2.7.bb>
    index 5e24c9d..d7b5312 100644
    --- a/recipes-security/selinux/libsemanage_2.6.bb
    <http://libsemanage_2.6.bb>
    +++ b/recipes-security/selinux/libsemanage_2.7.bb
    <http://libsemanage_2.7.bb>
    @@ -1,23 +1,18 @@
    -include selinux_20161014.inc
    +include selinux_20170804.inc
      include ${BPN}.inc

      LIC_FILES_CHKSUM =
    "file://COPYING;md5=a6f89e2100d9b6cdffcea4f398e37343"

    -SRC_URI[md5sum] = "666a48c4058c07f2b07ede9eaf210c5f"
    -SRC_URI[sha256sum] =
    "4f81541047290b751f2ffb926fcd381c186f22db18d9fe671b0b4a6a54e8cfce"
    +SRC_URI[md5sum] = "a6b5c451fbe45ff9e3e0e65f2db0ae1d"
    +SRC_URI[sha256sum] =
    "07e9477714ce6a4557a1fe924ea4cb06501b62d0fa0e3c0dc32a2cf47cb8d476"

      SRC_URI += "\
             file://libsemanage-Fix-execve-segfaults-on-Ubuntu.patch \
    -       file://libsemanage-fix-path-len-limit.patch \
             file://libsemanage-fix-path-nologin.patch \
             file://libsemanage-drop-Wno-unused-but-set-variable.patch \
            
    file://libsemanage-define-FD_CLOEXEC-as-necessary.patch;striplevel=2 \
             file://libsemanage-allow-to-disable-audit-support.patch \
             file://libsemanage-disable-expand-check-on-policy-load.patch \
            
    file://0001-src-Makefile-fix-includedir-in-libselinux.pc.patch \
    -     
      file://0001-libsemanage-simplify-string-utilities-functions.patch;striplevel=2 \
    -     
      file://0002-libsemanage-add-semanage_str_replace-utility-functio.patch;striplevel=2 \
    -     
      file://0003-libsemanage-genhomedircon-drop-ustr-dependency.patch;striplevel=2 \
    -     
      file://0004-libsemanage-remove-ustr-library-from-Makefiles-READM.patch;striplevel=2 \
             "
      FILES_${PN} += "/usr/libexec"
    --
    2.13.0

    --
    _______________________________________________
    yocto mailing list
    [email protected] <mailto:[email protected]>
    https://lists.yoctoproject.org/listinfo/yocto
#6 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 6 lines · wenzong fan
Quoted 4 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Quoted 8 lines

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject:
[meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

I'll send v2.

Thanks
Wenzong

I don't see the original set of patches in my archives. When you rebase, please rebase on top of mgh/master-next.

--Mark

#7 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 11 lines · Mark Hatle
Quoted 10 lines · wenzong fan
Quoted 4 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject:
[meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

Quoted 7 lines
Quoted 4 lines

I'll send v2.

Thanks
Wenzong

I don't see the original set of patches in my archives. When you rebase, please rebase on top of mgh/master-next.

My mailer finally loaded the original set. I saw the same problems, but was able to get them merged.

I have updated 'mgh/master-next'. Please verify the contents include all of your changes.

I tried to build a system and boot it, but it didn't work. I'm guessing I forgot something simple, but I can't make master-next into master without knowing I can boot.. Any clue would be useful. Thanks!

My configuration is:

bblayers.conf:

oe-core (master) & meta-selinux (mgh/master-next)

local.conf:

IMAGE_FEATURES_append = " debug-tweaks ssh-server-openssh"

DISTRO_FEATURES_append = " opengl x11 wayland acl xattr pam selinux"

PREFERRED_PROVIDER_virtual/refpolicy = "refpolicy-mls" PREFERRED_VERSION_refpolicy-mls = "2.20170204"

I ran QEMU using:

runqemu qemux86 core-image-selinux ext4 nographic

Trying to login I get:

qemux86 login: root

[   23.960609] kauditd_printk_skb: 13 callbacks suppressed
Cannot execute /bin/sh: Permission denied
[   23.973922] audit: type=1400 audit(1505347190.805:29): avc:  denied  {
execute } for  pid=671 comm="login" name="bash.bash" dev="vda" ino=8163
scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023
tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0
[   23.975463] audit: type=1400 audit(1505347190.813:30): avc:  denied  {

execute } for pid=671 comm="login" name="bash.bash" dev="vda" ino=8163 scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Quoted 2 lines

--Mark

#8 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 17 lines · Mark Hatle
Quoted 16 lines · Mark Hatle
Quoted 14 lines · wenzong fan
Quoted 4 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject:
[meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

I'll send v2.

Thanks
Wenzong

Quoted 8 lines
Quoted 2 lines

I don't see the original set of patches in my archives. When you rebase, please rebase on top of mgh/master-next.

My mailer finally loaded the original set. I saw the same problems, but was able to get them merged.

I have updated 'mgh/master-next'. Please verify the contents include all of your changes.

All my changes are there now.

Quoted 13 lines

I tried to build a system and boot it, but it didn't work. I'm guessing I forgot something simple, but I can't make master-next into master without knowing I can boot.. Any clue would be useful. Thanks!

My configuration is:

bblayers.conf:

oe-core (master) & meta-selinux (mgh/master-next)

Quoted 8 lines

local.conf:

IMAGE_FEATURES_append = " debug-tweaks ssh-server-openssh"

DISTRO_FEATURES_append = " opengl x11 wayland acl xattr pam selinux"

PREFERRED_PROVIDER_virtual/refpolicy = "refpolicy-mls" PREFERRED_VERSION_refpolicy-mls = "2.20170204"

Above configs are OK, you can simply use:

DISTRO = "poky-selinux"
PREFERRED_VERSION_refpolicy-mls ?= "2.20170204"

Quoted 8 lines

I ran QEMU using:

runqemu qemux86 core-image-selinux ext4 nographic

Please run QEMU with:

$ runqemu qemux86 core-image-selinux ext4 nographic bootparams="selinux=1 enforcing=0"
Quoted 11 lines

Trying to login I get:

qemux86 login: root

[   23.960609] kauditd_printk_skb: 13 callbacks suppressed
Cannot execute /bin/sh: Permission denied
[   23.973922] audit: type=1400 audit(1505347190.805:29): avc:  denied  {
execute } for  pid=671 comm="login" name="bash.bash" dev="vda" ino=8163
scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023
tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0
[   23.975463] audit: type=1400 audit(1505347190.813:30): avc:  denied  {
Quoted 5 lines

execute } for pid=671 comm="login" name="bash.bash" dev="vda" ino=8163 scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

This should be blocked by refpolicy-mls, please boot with "selinux=1 enforcing=0" to verify if SELinux tools work. For example:

$ sestatus

OR:

$ semanage login -l
Actually this doesn't work since runtime dependencies, I commented off this from setools_4.1.1.bb:

# TODO: depends on meta-python, disable the RDEPENDS for now:
# RDEPENDS_${PN} += "python-networkx python-enum34 python-decorator python-setuptools"

For community, we need to discuss if we can get meta-selinux depend on meta-python by default? Or just get users to do that?

Thanks
Wenzong

Quoted 5 lines
Quoted 3 lines

--Mark

#9 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 50 lines · wenzong fan
Quoted 17 lines · Mark Hatle
Quoted 16 lines · Mark Hatle
Quoted 14 lines · wenzong fan
Quoted 4 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject:
[meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

I'll send v2.

Thanks
Wenzong

Quoted 8 lines
Quoted 2 lines

I don't see the original set of patches in my archives. When you rebase, please rebase on top of mgh/master-next.

My mailer finally loaded the original set. I saw the same problems, but was able to get them merged.

I have updated 'mgh/master-next'. Please verify the contents include all of your changes.

All my changes are there now.

Quoted 19 lines

I tried to build a system and boot it, but it didn't work. I'm guessing I forgot something simple, but I can't make master-next into master without knowing I can boot.. Any clue would be useful. Thanks!

My configuration is:

bblayers.conf:

oe-core (master) & meta-selinux (mgh/master-next)

local.conf:

IMAGE_FEATURES_append = " debug-tweaks ssh-server-openssh"

DISTRO_FEATURES_append = " opengl x11 wayland acl xattr pam selinux"

Quoted 7 lines
Quoted 2 lines

PREFERRED_PROVIDER_virtual/refpolicy = "refpolicy-mls" PREFERRED_VERSION_refpolicy-mls = "2.20170204"

Above configs are OK, you can simply use:

DISTRO = "poky-selinux"
PREFERRED_VERSION_refpolicy-mls ?= "2.20170204"

The DISTRO settings in meta-selinux are being removed (they are no longer in the master-next branch). Instead the user will be required to set the DISTRO_FEATURE 'selinux' to enable the components. (It is expected they will also enable acl/xattr and pam.)

Quoted 33 lines
Quoted 8 lines

I ran QEMU using:

runqemu qemux86 core-image-selinux ext4 nographic

Please run QEMU with:

$ runqemu qemux86 core-image-selinux ext4 nographic 
bootparams="selinux=1 enforcing=0"
Quoted 11 lines

Trying to login I get:

qemux86 login: root

[   23.960609] kauditd_printk_skb: 13 callbacks suppressed
Cannot execute /bin/sh: Permission denied
[   23.973922] audit: type=1400 audit(1505347190.805:29): avc:  denied  {
execute } for  pid=671 comm="login" name="bash.bash" dev="vda" ino=8163
scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023
tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0
[   23.975463] audit: type=1400 audit(1505347190.813:30): avc:  denied  {
Quoted 5 lines

execute } for pid=671 comm="login" name="bash.bash" dev="vda" ino=8163 scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Quoted 2 lines

This should be blocked by refpolicy-mls, please boot with "selinux=1 enforcing=0" to verify if SELinux tools work. For example:

I would like to update the README file for the layer on how the user can actually make a bootable system. If this involves adding a user, that is fine. But at present there is no way to login w/o turning off enforcing. That seems to defeat the purpose of enabling selinux in a design.

So any help you can give me for the documentation would be appreciated.

Quoted 1 line
$ sestatus
root@qemux86:~# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             mls
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     requested (insecure)
Max kernel policy version:      30
Quoted 2 lines

OR:

$ semanage login -l
root@qemux86:~# semanage login -l

Login Name SELinux User MLS/MCS Range Service

__default__          user_u               s0-s0                *
root                 root                 s0-s15:c0.c1023      *

(I followed the information below and enabled the python components.)

Quoted 9 lines

Actually this doesn't work since runtime dependencies, I commented off this from setools_4.1.1.bb:

# TODO: depends on meta-python, disable the RDEPENDS for now:
# RDEPENDS_${PN} += "python-networkx python-enum34 python-decorator python-setuptools"

For community, we need to discuss if we can get meta-selinux depend on meta-python by default? Or just get users to do that?

Yes, we can add a requirement for meta-python. I just need to clearly document in the commit message why it is there.

I will work to update the mgh/master-next with the meta-python items and some of the information above...

--Mark

Quoted 8 lines

Thanks
Wenzong

Quoted 5 lines
Quoted 3 lines

--Mark

#10 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 97 lines · Mark Hatle
Quoted 50 lines · wenzong fan
Quoted 17 lines · Mark Hatle
Quoted 16 lines · Mark Hatle
Quoted 14 lines · wenzong fan
Quoted 4 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject:
[meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

I'll send v2.

Thanks
Wenzong

Quoted 8 lines
Quoted 2 lines

I don't see the original set of patches in my archives. When you rebase, please rebase on top of mgh/master-next.

My mailer finally loaded the original set. I saw the same problems, but was able to get them merged.

I have updated 'mgh/master-next'. Please verify the contents include all of your changes.

All my changes are there now.

Quoted 19 lines

I tried to build a system and boot it, but it didn't work. I'm guessing I forgot something simple, but I can't make master-next into master without knowing I can boot.. Any clue would be useful. Thanks!

My configuration is:

bblayers.conf:

oe-core (master) & meta-selinux (mgh/master-next)

local.conf:

IMAGE_FEATURES_append = " debug-tweaks ssh-server-openssh"

DISTRO_FEATURES_append = " opengl x11 wayland acl xattr pam selinux"

Quoted 7 lines
Quoted 2 lines

PREFERRED_PROVIDER_virtual/refpolicy = "refpolicy-mls" PREFERRED_VERSION_refpolicy-mls = "2.20170204"

Above configs are OK, you can simply use:

DISTRO = "poky-selinux"
PREFERRED_VERSION_refpolicy-mls ?= "2.20170204"

The DISTRO settings in meta-selinux are being removed (they are no longer in the master-next branch). Instead the user will be required to set the DISTRO_FEATURE 'selinux' to enable the components. (It is expected they will also enable acl/xattr and pam.)

Quoted 33 lines
Quoted 8 lines

I ran QEMU using:

runqemu qemux86 core-image-selinux ext4 nographic

Please run QEMU with:

$ runqemu qemux86 core-image-selinux ext4 nographic
bootparams="selinux=1 enforcing=0"
Quoted 16 lines

Trying to login I get:

qemux86 login: root

[   23.960609] kauditd_printk_skb: 13 callbacks suppressed
Cannot execute /bin/sh: Permission denied
[   23.973922] audit: type=1400 audit(1505347190.805:29): avc:  denied  {
execute } for  pid=671 comm="login" name="bash.bash" dev="vda" ino=8163
scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023
tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0
[   23.975463] audit: type=1400 audit(1505347190.813:30): avc:  denied  {

execute } for pid=671 comm="login" name="bash.bash" dev="vda" ino=8163 scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

Quoted 7 lines
Quoted 2 lines

This should be blocked by refpolicy-mls, please boot with "selinux=1 enforcing=0" to verify if SELinux tools work. For example:

I would like to update the README file for the layer on how the user can actually make a bootable system. If this involves adding a user, that is fine. But at present there is no way to login w/o turning off enforcing. That seems to defeat the purpose of enabling selinux in a design.

This is really an issue, I'll fix it.

Thanks
Wenzong

Quoted 57 lines

So any help you can give me for the documentation would be appreciated.

Quoted 1 line
$ sestatus
root@qemux86:~# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             mls
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     requested (insecure)
Max kernel policy version:      30
Quoted 2 lines

OR:

$ semanage login -l
root@qemux86:~# semanage login -l

Login Name SELinux User MLS/MCS Range Service

__default__          user_u               s0-s0                *
root                 root                 s0-s15:c0.c1023      *

(I followed the information below and enabled the python components.)

Quoted 9 lines

Actually this doesn't work since runtime dependencies, I commented off this from setools_4.1.1.bb:

# TODO: depends on meta-python, disable the RDEPENDS for now:
# RDEPENDS_${PN} += "python-networkx python-enum34 python-decorator python-setuptools"

For community, we need to discuss if we can get meta-selinux depend on meta-python by default? Or just get users to do that?

Yes, we can add a requirement for meta-python. I just need to clearly document in the commit message why it is there.

I will work to update the mgh/master-next with the meta-python items and some of the information above...

--Mark

Quoted 8 lines

Thanks
Wenzong

Quoted 5 lines
Quoted 3 lines

--Mark

#11 lore raw

Re: [meta-selinux][PATCH 04/21] libsemanage: uprev to 2.7 (20170804)

Quoted 103 lines · wenzong fan
Quoted 100 lines · Mark Hatle
Quoted 50 lines · wenzong fan
Quoted 17 lines · Mark Hatle
Quoted 16 lines · Mark Hatle
Quoted 14 lines · wenzong fan
Quoted 4 lines · Chanho Park

Hi,

I can't apply this patch on top of the master branch. Which revision did you make the patches?

Oops, that's my fault. I did a "sed -i -e 's/Subject: [/Subject:
[meta-selinux][/g' 00*" to add prefix for mail subjects, that also changed the removed patch files in libsemanage.

I'll send v2.

Thanks
Wenzong

Quoted 8 lines
Quoted 2 lines

I don't see the original set of patches in my archives. When you rebase, please rebase on top of mgh/master-next.

My mailer finally loaded the original set. I saw the same problems, but was able to get them merged.

I have updated 'mgh/master-next'. Please verify the contents include all of your changes.

All my changes are there now.

Quoted 19 lines

I tried to build a system and boot it, but it didn't work. I'm guessing I forgot something simple, but I can't make master-next into master without knowing I can boot.. Any clue would be useful. Thanks!

My configuration is:

bblayers.conf:

oe-core (master) & meta-selinux (mgh/master-next)

local.conf:

IMAGE_FEATURES_append = " debug-tweaks ssh-server-openssh"

DISTRO_FEATURES_append = " opengl x11 wayland acl xattr pam selinux"

Quoted 7 lines
Quoted 2 lines

PREFERRED_PROVIDER_virtual/refpolicy = "refpolicy-mls" PREFERRED_VERSION_refpolicy-mls = "2.20170204"

Above configs are OK, you can simply use:

DISTRO = "poky-selinux"
PREFERRED_VERSION_refpolicy-mls ?= "2.20170204"

The DISTRO settings in meta-selinux are being removed (they are no longer in the master-next branch). Instead the user will be required to set the DISTRO_FEATURE 'selinux' to enable the components. (It is expected they will also enable acl/xattr and pam.)

Quoted 35 lines
Quoted 8 lines

I ran QEMU using:

runqemu qemux86 core-image-selinux ext4 nographic

Please run QEMU with:

$ runqemu qemux86 core-image-selinux ext4 nographic
bootparams="selinux=1 enforcing=0"
Quoted 11 lines

Trying to login I get:

qemux86 login: root

[   23.960609] kauditd_printk_skb: 13 callbacks suppressed
Cannot execute /bin/sh: Permission denied
[   23.973922] audit: type=1400 audit(1505347190.805:29): avc:  denied  {
execute } for  pid=671 comm="login" name="bash.bash" dev="vda" ino=8163
scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023
tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0
[   23.975463] audit: type=1400 audit(1505347190.813:30): avc:  denied  {
Quoted 5 lines

execute } for pid=671 comm="login" name="bash.bash" dev="vda" ino=8163 scontext=system_u:system_r:local_login_t:s0-s15:c0.c1023 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0

This should be blocked by refpolicy-mls, please boot with "selinux=1 enforcing=0" to verify if SELinux tools work. For example:

Quoted 6 lines
Quoted 4 lines

I would like to update the README file for the layer on how the user can actually make a bootable system. If this involves adding a user, that is fine. But at present there is no way to login w/o turning off enforcing. That seems to defeat the purpose of enabling selinux in a design.

This is really an issue, I'll fix it.

The root login issue was fixed in a commit. The above was due to 'bash.bash' not having appropriate context specified in the refpolicies.

I also added to the README file. If you have any additional suggestions or changes, please let me know.

--Mark

Quoted 60 lines

Thanks
Wenzong

Quoted 57 lines

So any help you can give me for the documentation would be appreciated.

Quoted 1 line
$ sestatus
root@qemux86:~# sestatus
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             mls
Current mode:                   permissive
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     requested (insecure)
Max kernel policy version:      30
Quoted 2 lines

OR:

$ semanage login -l
root@qemux86:~# semanage login -l

Login Name SELinux User MLS/MCS Range Service

__default__          user_u               s0-s0                *
root                 root                 s0-s15:c0.c1023      *

(I followed the information below and enabled the python components.)

Quoted 9 lines

Actually this doesn't work since runtime dependencies, I commented off this from setools_4.1.1.bb:

# TODO: depends on meta-python, disable the RDEPENDS for now:
# RDEPENDS_${PN} += "python-networkx python-enum34 python-decorator python-setuptools"

For community, we need to discuss if we can get meta-selinux depend on meta-python by default? Or just get users to do that?

Yes, we can add a requirement for meta-python. I just need to clearly document in the commit message why it is there.

I will work to update the mgh/master-next with the meta-python items and some of the information above...

--Mark

Quoted 8 lines

Thanks
Wenzong

Quoted 5 lines
Quoted 3 lines

--Mark

#12 lore raw

PATCH 5/21 checkpolicy: uprev to 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Remove patch that included by new version:
- checkpolicy-Do-not-link-against-libfl.patch

Specify LIBSEPOLA to fix build error:
make[1]: *** No rule to make target `/usr/lib/libsepol.a'

---
 recipes-security/selinux/checkpolicy.inc           |  3 +-
 .../checkpolicy-Do-not-link-against-libfl.patch    | 46 ----------------------
 .../{checkpolicy_2.6.bb => checkpolicy_2.7.bb}     |  6 +--
 3 files changed, 4 insertions(+), 51 deletions(-)
 delete mode 100644 recipes-security/selinux/checkpolicy/checkpolicy-Do-not-link-against-libfl.patch
 rename recipes-security/selinux/{checkpolicy_2.6.bb => checkpolicy_2.7.bb} (35%)
recipes-security/selinux/checkpolicy.inc +1 -2
index efcd821..878c656 100644
@@ -11,10 +11,9 @@ LICENSE = "GPLv2+"
 
 DEPENDS += "libsepol bison-native flex-native"
 
-SRC_URI += "file://checkpolicy-Do-not-link-against-libfl.patch"
-
 EXTRA_OEMAKE += "PREFIX=${D}" 
 EXTRA_OEMAKE += "LEX='flex'"
+EXTRA_OEMAKE += "LIBSEPOLA=${STAGING_LIBDIR}/libsepol.a"
 
 do_install_append() {
 	install test/dismod ${D}/${bindir}/sedismod
recipes-security/selinux/checkpolicy/checkpolicy-Do-not-link-against-libfl.patch deleted +0 -46

46 lines not on this page · raw message

recipes-security/selinux/checkpolicy_2.7.bb renamed from recipes-security/selinux/checkpolicy_2.6.bb +3 -3
similarity index 35%
rename from recipes-security/selinux/checkpolicy_2.6.bb
rename to recipes-security/selinux/checkpolicy_2.7.bb
index f67c150..90b8109 100644
@@ -1,7 +1,7 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
 
-SRC_URI[md5sum] = "2b581f8fe8eb8f55f111088e15d76c3a"
-SRC_URI[sha256sum] = "0bebd18688ca8027b1b3b4ff1532c0626f1fe49883ae6cb74d9d385940e74157"
+SRC_URI[md5sum] = "5c718eaad4d3015bd5665ffde77b50fd"
+SRC_URI[sha256sum] = "5413479f1dcde866c19896b4dbfec315d822aa431606e1d03c944408984c3201"
Signature · 1 line
2.13.0
#13 lore raw

PATCH 6/21 secilc: uprev to 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

---
 recipes-security/selinux/{secilc_2.6.bb => secilc_2.7.bb} | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 rename recipes-security/selinux/{secilc_2.6.bb => secilc_2.7.bb} (35%)
recipes-security/selinux/secilc_2.7.bb renamed from recipes-security/selinux/secilc_2.6.bb +3 -3
similarity index 35%
rename from recipes-security/selinux/secilc_2.6.bb
rename to recipes-security/selinux/secilc_2.7.bb
index 0f84b0e..611f165 100644
@@ -1,7 +1,7 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=5fb82e8deb357d4e5fd8f3fed01d2f38"
 
-SRC_URI[md5sum] = "38c06fb8d97206a12016b4516ee23efc"
-SRC_URI[sha256sum] = "a84838c15bb7b0141238b48294b15ff0e1618107f547541a0067d1ddabcc9502"
+SRC_URI[md5sum] = "301a4e477bc7214be16558f7c2dcbcff"
+SRC_URI[sha256sum] = "9ec63dd64645c718f66d33c96299adfe0445b0aa62d7ac8c642f873c570609c5"
Signature · 1 line
2.13.0
#14 lore raw

PATCH 7/21 policycoreutils: uprev to 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Uprev the recipe file as is.

Some packages have been moved out from policycoreutils, they will be added as new packages and the policycoreutils.inc need to be cleaned up from later commits accordingly.

Moved packages:

    From:                            To:
  - policycoreutils/gui              gui
  - policycoreutils/mcstrans         mcstrans
  - policycoreutils/restorecond      restorecond
  - policycoreutils/sandbox          sandbox
  - policycoreutils/sepolicy/dbus    dbus
  - policycoreutils/semodule_deps    semodule-utils/semodule_deps
  - policycoreutils/semodule_expand  semodule-utils/semodule_expand
  - policycoreutils/semodule_link    semodule-utils/semodule_link
  - policycoreutils/semodule_package semodule-utils/semodule_package
  - policycoreutils/semanage         python/semanage
  - policycoreutils/audit2allow      python/audit2allow
  - policycoreutils/sepolgen-ifgen   python/audit2allow/sepolgen-ifgen
  - policycoreutils/sepolicy         python/sepolicy
  - policycoreutils/scripts/chcat    python/chcat

Released package list refer to:
https://github.com/SELinuxProject/selinux/wiki/Releases

Cleanup the patch file that have been removed in 2.6:
- policycoreutils-fts_flags-FTS_NOCHDIR.patch

---
 .../policycoreutils-fts_flags-FTS_NOCHDIR.patch    | 25 ----------------------
 ...licycoreutils_2.6.bb => policycoreutils_2.7.bb} |  6 +++---
 2 files changed, 3 insertions(+), 28 deletions(-)
 delete mode 100644 recipes-security/selinux/policycoreutils/policycoreutils-fts_flags-FTS_NOCHDIR.patch
 rename recipes-security/selinux/{policycoreutils_2.6.bb => policycoreutils_2.7.bb} (74%)
recipes-security/selinux/policycoreutils/policycoreutils-fts_flags-FTS_NOCHDIR.patch deleted +0 -25
deleted file mode 100644
index fd04b51..0000000
@@ -1,25 +0,0 @@
-This works around a bug in the default libc used by OE. FTS functions are
-supposed to change the current working directory as they walk the file
-hierarchy. The fts_accpath member of the FTSENT structure relies on this
-behavior and without it the path is not relative to cwd as expected.
-Supplying the FTS_NOCHDIR flag disables this optimization and causes
-fts_accpath to be relative to the directory where the traversal started.
-Use of this flag doesn't effect compatibility with glibc.
-
-An alternative fix could replace the use of fts_accpath with fts_path
-which is absolute.
-
-Signed-off-by: Philip Tricca <[email protected]>
-Index: policycoreutils/setfiles/setfiles.c
-===================================================================
---- policycoreutils.orig/setfiles/setfiles.c
-+++ policycoreutils/setfiles/setfiles.c
-@@ -194,7 +194,7 @@ int main(int argc, char **argv)
- 		r_opts.expand_realpath = 0;
- 		r_opts.abort_on_error = 1;
- 		r_opts.add_assoc = 1;
--		r_opts.fts_flags = FTS_PHYSICAL | FTS_XDEV;
-+		r_opts.fts_flags = FTS_PHYSICAL | FTS_XDEV | FTS_NOCHDIR;
- 		ctx_validate = 1;
- 	} else {
- 		/*
recipes-security/selinux/policycoreutils_2.7.bb renamed from recipes-security/selinux/policycoreutils_2.6.bb +3 -3
similarity index 74%
rename from recipes-security/selinux/policycoreutils_2.6.bb
rename to recipes-security/selinux/policycoreutils_2.7.bb
index 6a625b3..50f15d0 100644
@@ -1,10 +1,10 @@
-include selinux_20161014.inc
+include selinux_20170804.inc
 include ${BPN}.inc
 
 LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
 
-SRC_URI[md5sum] = "0358f0136e2dd9a8c9e99f181aaab1b2"
-SRC_URI[sha256sum] = "68891b376f5048edc53c6ccb2fca44da3dc7f4563f4b6894e201d70c04a05a29"
+SRC_URI[md5sum] = "65311b66ae01f7b7ad7c2ea7401b68ed"
+SRC_URI[sha256sum] = "0a1b8a4a323b854981c6755ff025fe98a0f1cff307f109abb260f0490f13e4f4"
 
 SRC_URI += "\
 	file://policycoreutils-fix-sepolicy-install-path.patch \
Signature · 1 line
2.13.0
#15 lore raw

PATCH 8/21 sepolgen: remove package

In reply to [email protected]

From: Wenzong Fan <[email protected]>

The package has been moved to selinux-python/sepolgen.

---
 recipes-security/selinux/sepolgen.inc    | 34 --------------------------------
 recipes-security/selinux/sepolgen_2.6.bb |  7 -------
 recipes-security/selinux/sepolgen_git.bb |  7 -------
 3 files changed, 48 deletions(-)
 delete mode 100644 recipes-security/selinux/sepolgen.inc
 delete mode 100644 recipes-security/selinux/sepolgen_2.6.bb
 delete mode 100644 recipes-security/selinux/sepolgen_git.bb
recipes-security/selinux/sepolgen.inc deleted +0 -34
deleted file mode 100644
index daf213d..0000000
@@ -1,34 +0,0 @@
-SUMMARY = "Python modules for supporting various SELinux utilities."
-DESCRIPTION = "\
-This package contains a Python module that forms the core of the \
-modern audit2allow (which is a part of the package policycoreutils). \
-The sepolgen library is structured to give flexibility to the \
-application using it. The library contains: Reference Policy \
-Representation, which are Objects for representing policies and the \
-reference policy interfaces. Secondly, it has objects and algorithms \
-for representing access and sets of access in an abstract way and \
-searching that access. It also has a parser for reference policy \
-"headers". It contains infrastructure for parsing SELinux related \
-messages as produced by the audit system. It has facilities for \
-generating policy based on required access."
- 
-SECTION = "base"
-LICENSE = "LGPLv2+"
-
-FILES_${PN} = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*"
-
-DEPENDS += "python"
-
-inherit python-dir
-
-FILES_${PN} += "${libdir}/python${PYTHON_BASEVERSION}/site-packages \
-		/var/lib/sepolgen"
-
-do_install() {
-	oe_runmake DESTDIR=${D} \
-			PYTHONLIBDIR='${libdir}/python${PYTHON_BASEVERSION}/site-packages' \
-			install
-}
-
-BBCLASSEXTEND = "native"
-
recipes-security/selinux/sepolgen_2.6.bb deleted +0 -7
deleted file mode 100644
index 7825863..0000000
@@ -1,7 +0,0 @@
-include selinux_20161014.inc
-include ${BPN}.inc
-
-LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
-
-SRC_URI[md5sum] = "84faa46a0eb0b603e903efeed239c244"
-SRC_URI[sha256sum] = "6a327b1576d914e57ad796a541a7a9bcceefb14c445355559993de0fdb8e7a60"
recipes-security/selinux/sepolgen_git.bb deleted +0 -7
deleted file mode 100644
index 9b3cbe2..0000000
@@ -1,7 +0,0 @@
-PR = "r99"
-PV = "1.2.1+git${SRCPV}"
-
-include selinux_git.inc
-include ${BPN}.inc
- 
-LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
Signature · 1 line
2.13.0
#16 lore raw

PATCH 9/21 mcstrans: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move policycoreutils/mcstrans to mcstrans:

* Move and rebase patches:
- mcstrans-de-bashify.patch
- 0001-mcstrans-fix-the-init-script.patch

* Remove useless patch:
- enable-mcstrans.patch

* Cleanup policycoreutils_2.7.bb and policycoreutils.inc.

---
 recipes-security/selinux/mcstrans.inc              | 49 ++++++++++++++
 .../0001-mcstrans-fix-the-init-script.patch        |  9 +--
 .../mcstrans-de-bashify.patch                      | 20 +++++-
 recipes-security/selinux/mcstrans_2.7.bb           |  7 ++
 recipes-security/selinux/policycoreutils.inc       | 76 +---------------------
 .../selinux/policycoreutils/enable-mcstrans.patch  | 17 -----
 recipes-security/selinux/policycoreutils_2.7.bb    |  2 -
 7 files changed, 79 insertions(+), 101 deletions(-)
 create mode 100644 recipes-security/selinux/mcstrans.inc
 rename recipes-security/selinux/{policycoreutils => mcstrans}/0001-mcstrans-fix-the-init-script.patch (74%)
 rename recipes-security/selinux/{policycoreutils => mcstrans}/mcstrans-de-bashify.patch (22%)
 create mode 100644 recipes-security/selinux/mcstrans_2.7.bb
 delete mode 100644 recipes-security/selinux/policycoreutils/enable-mcstrans.patch
recipes-security/selinux/mcstrans.inc new file +49 -0
new file mode 100644
index 0000000..590e6d2
@@ -0,0 +1,49 @@
+SUMMARY = "Daemon to translate SELinux MCS/MLS sensitivity labels"
+DESCRIPTION = "\
+mcstrans provides an translation daemon to translate SELinux categories \
+from internal representations to user defined representation."
+
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+SRC_URI += "file://mcstrans-de-bashify.patch \
+            file://0001-mcstrans-fix-the-init-script.patch \
+"
+
+inherit systemd update-rc.d
+
+DEPENDS += "libsepol libselinux libcap"
+
+EXTRA_OEMAKE += "SYSTEMDDIR=${D}${systemd_unitdir}"
+do_install_append() {
+    install -d ${D}${sbindir}
+    install -m 755 utils/untranscon ${D}${sbindir}/
+    install -m 755 utils/transcon ${D}${sbindir}/
+
+    if ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
+        install -d ${D}${sysconfdir}/tmpfiles.d
+        echo "d ${localstatedir}/run/setrans - - - -" \
+            > ${D}${sysconfdir}/tmpfiles.d/setrans.conf
+    else
+        install -d ${D}${sysconfdir}/default/volatiles
+        echo "d root root 0755 /var/run/setrans none" \
+            >${D}${sysconfdir}/default/volatiles/volatiles.80_mcstrans
+    fi
+    install -d ${D}${datadir}/mcstrans
+    cp -r share/* ${D}${datadir}/mcstrans/.
+}
+
+SYSTEMD_SERVICE_mcstrans = "mcstrans.service"
+INITSCRIPT_PACKAGES = "mcstrans"
+INITSCRIPT_NAME_mcstrans = "mcstrans"
+INITSCRIPT_PARAMS_mcstrans = "defaults"
+
+pkg_postinst_mcstrans () {
+    if [ -z "$D" ]; then
+        if command -v systemd-tmpfiles >/dev/null; then
+            systemd-tmpfiles --create ${sysconfdir}/tmpfiles.d/setrans.conf
+        elif [ -e ${sysconfdir}/init.d/populate-volatile.sh ]; then
+            ${sysconfdir}/init.d/populate-volatile.sh update
+        fi
+    fi
+}
recipes-security/selinux/mcstrans/0001-mcstrans-fix-the-init-script.patch renamed from recipes-security/selinux/policycoreutils/0001-mcstrans-fix-the-init-script.patch +5 -4
similarity index 74%
rename from recipes-security/selinux/policycoreutils/0001-mcstrans-fix-the-init-script.patch
rename to recipes-security/selinux/mcstrans/0001-mcstrans-fix-the-init-script.patch
index 39be80a..5f7163d 100644
@@ -5,14 +5,15 @@ Upstream-Status: Inappropriate [embedded specific]
 replace daemon with start-stop-daemon, due to not daemon functions
 
 Signed-off-by: Roy Li <[email protected]>
+Signed-off-by: Wenzong Fan <[email protected]>
 ---
- mcstrans/src/mcstrans.init | 2 +-
+ src/mcstrans.init | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
-diff --git a/mcstrans/src/mcstrans.init b/mcstrans/src/mcstrans.init
+diff --git a/src/mcstrans.init b/src/mcstrans.init
 index 2804ec0..c660290 100644
---- a/mcstrans/src/mcstrans.init
-+++ b/mcstrans/src/mcstrans.init
+--- a/src/mcstrans.init
++++ b/src/mcstrans.init
 @@ -51,7 +51,7 @@ start(){
  	fi
  
recipes-security/selinux/mcstrans/mcstrans-de-bashify.patch renamed from recipes-security/selinux/policycoreutils/mcstrans-de-bashify.patch +17 -3
similarity index 22%
rename from recipes-security/selinux/policycoreutils/mcstrans-de-bashify.patch
rename to recipes-security/selinux/mcstrans/mcstrans-de-bashify.patch
index 86141a2..805d7e5 100644
@@ -1,9 +1,23 @@
+commit 54875dcb50f5e40fc86d6fe98dde244bfe4751af
+Author: Joe MacDonald <[email protected]>
+Date:   Fri Aug 7 15:16:45 2015 -0400
+
+    mcstrans: remove dependency on bash in initscript
+
+    There were no apparent bashisms in mcstrans.init, so remove the dependency
+    on bash.
+
+    Signed-off-by: Joe MacDonald <[email protected]>
+
+Upstream-Status: Pending
+
+Signed-off-by: Wenzong Fan <[email protected]>
 ---
- mcstrans/src/mcstrans.init |    2 +-
+ src/mcstrans.init |    2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
---- a/mcstrans/src/mcstrans.init
-+++ b/mcstrans/src/mcstrans.init
+--- a/src/mcstrans.init
++++ b/src/mcstrans.init
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
recipes-security/selinux/mcstrans_2.7.bb new file +7 -0
new file mode 100644
index 0000000..2d5bbfd
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f"
+
+SRC_URI[md5sum] = "edba0f72fdf7fdd1ad0a2c6d102e8cfa"
+SRC_URI[sha256sum] = "cdca003282d160b50ad695ab5b013c05ca21387a419b2f89288534184d16e1e2"
recipes-security/selinux/policycoreutils.inc +1 -75

111 lines not on this page · raw message

recipes-security/selinux/policycoreutils/enable-mcstrans.patch deleted +0 -17
deleted file mode 100644
index e923903..0000000
@@ -1,17 +0,0 @@
-Add the "mcstrans" subdir so it gets built too.
-
-Upstream-Status: Inappropriate [embedded specific]
-
-Signed-off-by: Roy Li <[email protected]>
-diff --git a/Makefile b/Makefile
-index 83ebd45..3ae784f 100644
---- a/Makefile
-+++ b/Makefile
-@@ -1,5 +1,7 @@
- SUBDIRS = sepolicy setfiles semanage load_policy newrole run_init sandbox secon audit2allow sestatus semodule_package semodule semodule_link semodule_expand semodule_deps sepolgen-ifgen setsebool scripts po man gui
- 
-+SUBDIRS += mcstrans
-+
- INOTIFYH = $(shell ls /usr/include/sys/inotify.h 2>/dev/null)
- 
- ifeq (${INOTIFYH}, /usr/include/sys/inotify.h)
recipes-security/selinux/policycoreutils_2.7.bb +0 -2
index 50f15d0..d407ac3 100644
@@ -12,6 +12,4 @@ SRC_URI += "\
 	file://policycoreutils-loadpolicy-symlink.patch \
 	file://policycoreutils-process-ValueError-for-sepolicy-seobject.patch \
 	file://policycoreutils-fix-TypeError-for-seobject.py.patch \
-	file://0001-mcstrans-fix-the-init-script.patch \
-	file://enable-mcstrans.patch \
 	"
Signature · 1 line
2.13.0
#17 lore raw

PATCH 10/21 restorecond: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move policycoreutils/restorecond to restorecond:

* Move and rebase patch:
- policycoreutils-make-O_CLOEXEC-optional.patch

* Cleanup policycoreutils_2.7.bb.

---
 recipes-security/selinux/policycoreutils_2.7.bb    |  1 -
 recipes-security/selinux/restorecond.inc           | 28 ++++++++++++++++++++++
 .../policycoreutils-make-O_CLOEXEC-optional.patch  |  8 +++----
 recipes-security/selinux/restorecond_2.7.bb        |  7 ++++++
 4 files changed, 39 insertions(+), 5 deletions(-)
 create mode 100644 recipes-security/selinux/restorecond.inc
 rename recipes-security/selinux/{policycoreutils => restorecond}/policycoreutils-make-O_CLOEXEC-optional.patch (90%)
 create mode 100644 recipes-security/selinux/restorecond_2.7.bb
recipes-security/selinux/policycoreutils_2.7.bb +0 -1
index d407ac3..54ec69a 100644
@@ -8,7 +8,6 @@ SRC_URI[sha256sum] = "0a1b8a4a323b854981c6755ff025fe98a0f1cff307f109abb260f0490f
 
 SRC_URI += "\
 	file://policycoreutils-fix-sepolicy-install-path.patch \
-	file://policycoreutils-make-O_CLOEXEC-optional.patch \
 	file://policycoreutils-loadpolicy-symlink.patch \
 	file://policycoreutils-process-ValueError-for-sepolicy-seobject.patch \
 	file://policycoreutils-fix-TypeError-for-seobject.py.patch \
recipes-security/selinux/restorecond.inc new file +28 -0
new file mode 100644
index 0000000..6f12d23
@@ -0,0 +1,28 @@
+SUMMARY = "Daemon to watch for file creation and set default file context"
+DESCRIPTION = "\
+The restorecond daemon uses inotify to watch files listed in the \
+/etc/selinux/restorecond.conf, when they are created, this daemon \
+will make sure they have the correct file context associated with \
+the policy."
+
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+SRC_URI += "file://policycoreutils-make-O_CLOEXEC-optional.patch \
+"
+
+inherit systemd update-rc.d
+
+DEPENDS += "libsepol libselinux libpcre dbus-glib glib-2.0 pkgconfig-native"
+
+FILES_${PN} += "${datadir}/dbus-1/services/org.selinux.Restorecond.service \
+"
+
+do_install_prepend() {
+        export SYSTEMDDIR=${D}/${systemd_unitdir}
+}
+
+SYSTEMD_SERVICE_restorecond = "restorecond.service"
+INITSCRIPT_PACKAGES = "restorecond"
+INITSCRIPT_NAME_restorecond = "restorecond"
+INITSCRIPT_PARAMS_restorecond = "defaults"
recipes-security/selinux/restorecond/policycoreutils-make-O_CLOEXEC-optional.patch renamed from recipes-security/selinux/policycoreutils/policycoreutils-make-O_CLOEXEC-optional.patch +4 -4
similarity index 90%
rename from recipes-security/selinux/policycoreutils/policycoreutils-make-O_CLOEXEC-optional.patch
rename to recipes-security/selinux/restorecond/policycoreutils-make-O_CLOEXEC-optional.patch
index d50356e..ab1a10a 100644
@@ -16,13 +16,13 @@ Uptream-Status: Inappropriate [O_CLOEXEC has been in Linux since 2007 and POSIX
 Signed-off-by: Joe MacDonald <[email protected]>
 Signed-off-by: Wenzong Fan <[email protected]>
 ---
- restorecond/user.c |    8 +++++++-
+ user.c |    8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)
 
-diff --git a/restorecond/user.c b/restorecond/user.c
+diff --git a/user.c b/user.c
 index 2c28676..6235772 100644
---- a/restorecond/user.c
-+++ b/restorecond/user.c
+--- a/user.c
++++ b/user.c
 @@ -202,7 +202,13 @@ static int local_server() {
  			perror("asprintf");
  		return -1;
recipes-security/selinux/restorecond_2.7.bb new file +7 -0
new file mode 100644
index 0000000..1f9a70c
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+SRC_URI[md5sum] = "46f8ad0a37f955ef148d4e19b8cc8b1f"
+SRC_URI[sha256sum] = "cb8e0a8d706cb2c1f105125f3514dffffefcbcfb49199183a7f91ab0bdf1f24d"
Signature · 1 line
2.13.0
#18 lore raw

PATCH 11/21 selinux-sandbox: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move policycoreutils/sandbox to sandbox:

* Move and rebase patch:
- policycoreutils-sandbox-de-bashify.patch

* Cleanup policycoreutils.inc

---
 recipes-security/selinux/policycoreutils.inc       | 17 -------------
 recipes-security/selinux/selinux-sandbox.inc       | 28 ++++++++++++++++++++++
 .../sandbox-de-bashify.patch}                      | 13 +++++-----
 recipes-security/selinux/selinux-sandbox_2.7.bb    |  7 ++++++
 4 files changed, 42 insertions(+), 23 deletions(-)
 create mode 100644 recipes-security/selinux/selinux-sandbox.inc
 rename recipes-security/selinux/{policycoreutils/policycoreutils-sandbox-de-bashify.patch => selinux-sandbox/sandbox-de-bashify.patch} (79%)
 create mode 100644 recipes-security/selinux/selinux-sandbox_2.7.bb
recipes-security/selinux/policycoreutils.inc +0 -17
index e8f6e5f..9e45e0c 100644
@@ -9,7 +9,6 @@ LICENSE = "GPLv2+"
 
 SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${PAM_SRC_URI}', '', d)} \
             file://policycoreutils-fixfiles-de-bashify.patch \
-            file://policycoreutils-sandbox-de-bashify.patch \
            "
 
 PAM_SRC_URI = "file://pam.d/newrole \
@@ -64,15 +63,6 @@ RDEPENDS_${BPN}-python += "\
 	libsemanage-python \
 "
 RDEPENDS_${BPN}-runinit += "libselinux"
-RDEPENDS_${BPN}-sandbox += "\
-	python-math \
-	python-shell \
-	python-subprocess \
-	python-textutils \
-	python-unixadmin \
-	libselinux-python \
-	${BPN}-python \
-"
 RDEPENDS_${BPN}-secon += "libselinux"
 RDEPENDS_${BPN}-semanage = "\
 	python-core \
@@ -128,7 +118,6 @@ PACKAGES =+ "\
 	${PN}-newrole \
 	${PN}-python \
 	${PN}-runinit \
-	${PN}-sandbox \
 	${PN}-secon \
 	${PN}-semanage \
 	${PN}-semodule \
@@ -171,12 +160,6 @@ FILES_${PN}-runinit += "\
 	${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d/run_init', '', d)} \
 "
 FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy/.debug/* ${prefix}/libexec/selinux/hll/.debug"
-FILES_${PN}-sandbox += "\
-	${datadir}/sandbox/* \
-	${bindir}/sandbox \
-	${sbindir}/seunshare \
-	${sysconfdir}/sysconfig/sandbox \
-"
 FILES_${PN}-secon += "${bindir}/secon"
 FILES_${PN}-semanage = "\
 	${sbindir}/semanage \
recipes-security/selinux/selinux-sandbox.inc new file +28 -0
new file mode 100644
index 0000000..8616dd7
@@ -0,0 +1,28 @@
+SUMMARY = "Run cmd under an SELinux sandbox"
+DESCRIPTION = "\
+Run application within a tightly confined SELinux domain. The default \
+sandbox domain only allows applications the ability to read and write \
+stdin, stdout and any other file descriptors handed to it."
+
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+SRC_URI += "file://sandbox-de-bashify.patch \
+"
+
+DEPENDS += "libcap-ng libselinux"
+
+RDEPENDS_${PN} += "\
+        python-math \
+        python-shell \
+        python-subprocess \
+        python-textutils \
+        python-unixadmin \
+        libselinux-python \
+        selinux-python \
+"
+
+FILES_${PN} += "\
+        ${datadir}/sandbox/sandboxX.sh \
+        ${datadir}/sandbox/start \
+"
recipes-security/selinux/selinux-sandbox/sandbox-de-bashify.patch renamed from recipes-security/selinux/policycoreutils/policycoreutils-sandbox-de-bashify.patch +7 -6
similarity index 79%
rename from recipes-security/selinux/policycoreutils/policycoreutils-sandbox-de-bashify.patch
rename to recipes-security/selinux/selinux-sandbox/sandbox-de-bashify.patch
index c078ef6..18cef4b 100644
@@ -9,25 +9,26 @@ sandboxX script, so point them at /bin/sh instead.
 Upstream-Status: Pending
 
 Signed-off-by: Joe MacDonald <[email protected]>
+Signed-off-by: Wenzong Fan <[email protected]>
 ---
  sandbox/sandbox.init | 2 +-
  sandbox/sandboxX.sh  | 2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)
 
-diff --git a/sandbox/sandbox.init b/sandbox/sandbox.init
+diff --git a/sandbox.init b/sandbox.init
 index b3979bf..1893dc8 100644
---- a/sandbox/sandbox.init
-+++ b/sandbox/sandbox.init
+--- a/sandbox.init
++++ b/sandbox.init
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
  ## BEGIN INIT INFO
  # Provides: sandbox
  # Default-Start: 3 4 5
-diff --git a/sandbox/sandboxX.sh b/sandbox/sandboxX.sh
+diff --git a/sandboxX.sh b/sandboxX.sh
 index eaa500d..8755d75 100644
---- a/sandbox/sandboxX.sh
-+++ b/sandbox/sandboxX.sh
+--- a/sandboxX.sh
++++ b/sandboxX.sh
 @@ -1,4 +1,4 @@
 -#!/bin/bash
 +#!/bin/sh
recipes-security/selinux/selinux-sandbox_2.7.bb new file +7 -0
new file mode 100644
index 0000000..1307ce7
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+SRC_URI[md5sum] = "7360e9dc7b1757b7f82face655982bfa"
+SRC_URI[sha256sum] = "9490620380ab6d428a92869002a51ada0343ca35fa2a6905595745902a64c541"
Signature · 1 line
2.13.0
#19 lore raw

PATCH 12/21 selinux-python: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move packages to python/*:
- policycoreutils/semanage -> python/semanage
- policycoreutils/audit2allow -> python/audit2allow
- policycoreutils/sepolgen-ifgen -> python/audit2allow/sepolgen-ifgen
- policycoreutils/sepolicy -> python/sepolicy
- policycoreutils/scripts/chcat -> python/chcat
- sepolgen -> python/sepolgen

* Move and rebase patches:
- policycoreutils-fix-TypeError-for-seobject.py.patch
- policycoreutils-fix-sepolicy-install-path.patch
- policycoreutils-process-ValueError-for-sepolicy-seobject.patch

* Cleanup policycoreutils.inc and policycoreutils_2.7.bb

---
 recipes-security/selinux/policycoreutils.inc       |  80 +---------------
 recipes-security/selinux/policycoreutils_2.7.bb    |   3 -
 recipes-security/selinux/selinux-python.inc        | 106 +++++++++++++++++++++
 .../fix-TypeError-for-seobject.py.patch}           |   0
 .../fix-sepolicy-install-path.patch}               |   0
 ...process-ValueError-for-sepolicy-seobject.patch} |   0
 recipes-security/selinux/selinux-python_2.7.bb     |   7 ++
 7 files changed, 115 insertions(+), 81 deletions(-)
 create mode 100644 recipes-security/selinux/selinux-python.inc
 rename recipes-security/selinux/{policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch => selinux-python/fix-TypeError-for-seobject.py.patch} (100%)
 rename recipes-security/selinux/{policycoreutils/policycoreutils-fix-sepolicy-install-path.patch => selinux-python/fix-sepolicy-install-path.patch} (100%)
 rename recipes-security/selinux/{policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch => selinux-python/process-ValueError-for-sepolicy-seobject.patch} (100%)
 create mode 100644 recipes-security/selinux/selinux-python_2.7.bb
recipes-security/selinux/policycoreutils.inc +2 -78
index 9e45e0c..05fd43d 100644
@@ -23,19 +23,6 @@ inherit selinux pythonnative
 
 DEPENDS += "${@target_selinux(d, 'libpam audit')}"
 
-RDEPENDS_${BPN}-audit2allow = "\
-	python-textutils \
-	libselinux-python \
-	sepolgen \
-"
-RDEPENDS_${BPN}-chcat = "\
-	python-codecs \
-	python-shell \
-	python-stringold \
-	python-unixadmin \
-	${BPN}-python \
-	libselinux-python \
-"
 RDEPENDS_${BPN}-fixfiles += "\
 	${BPN}-setfiles \
 "
@@ -51,27 +38,8 @@ RDEPENDS_${BPN}-newrole += "\
 	libcap-ng \
 	libselinux \
 "
-RDEPENDS_${BPN}-python += "\
-	python-codecs \
-	python-io \
-	python-ipy \
-	python-re \
-	python-stringold \
-	python-syslog \
-	python-unixadmin \
-	libselinux-python \
-	libsemanage-python \
-"
 RDEPENDS_${BPN}-runinit += "libselinux"
 RDEPENDS_${BPN}-secon += "libselinux"
-RDEPENDS_${BPN}-semanage = "\
-	python-core \
-	python-ipy \
-	python-compression \
-	python-xml \
-	${BPN}-python \
-	libselinux-python \
-"
 RDEPENDS_${BPN}-semodule += "\
 	libsepol \
 	libselinux \
@@ -82,16 +50,6 @@ DEPENDS_${BPN}-semodule-deps += "libsepol"
 RDEPENDS_${BPN}-semodule-expand += "libsepol libselinux"
 RDEPENDS_${BPN}-semodule-link += "libsepol libselinux"
 RDEPENDS_${BPN}-semodule-package += "libsepol libselinux"
-RDEPENDS_${BPN}-sepolicy += "\
-	python-argparse \
-	python-codecs \
-	python-core \
-	python-syslog \
-	${BPN}-python \
-"
-# static link to libsepol
-DEPENDS_${BPN}-sepolgen-ifgen += "libsepol"
-RDEPENDS_${BPN}-sepolgen-ifgen += "python libselinux-python"
 RDEPENDS_${BPN}-sestatus += "libselinux"
 RDEPENDS_${BPN}-setfiles += "\
 	libselinux \
@@ -102,43 +60,30 @@ RDEPENDS_${BPN}-setsebool += "\
 	libselinux \
 	libsemanage \
 "
-RDEPENDS_${BPN} += "setools setools-libs ${BPN}-python"
+RDEPENDS_${BPN} += "setools setools-libs selinux-python"
 
 WARN_QA := "${@oe_filter_out('unsafe-references-in-scripts', '${WARN_QA}', d)}"
 ERROR_QA := "${@oe_filter_out('unsafe-references-in-scripts', '${ERROR_QA}', d)}"
 
 
 PACKAGES =+ "\
-	${PN}-audit2allow \
-	${PN}-chcat \
 	${PN}-fixfiles \
 	${PN}-genhomedircon \
 	${PN}-hll \
 	${PN}-loadpolicy \
 	${PN}-newrole \
-	${PN}-python \
 	${PN}-runinit \
 	${PN}-secon \
-	${PN}-semanage \
 	${PN}-semodule \
 	${PN}-semodule-deps \
 	${PN}-semodule-expand \
 	${PN}-semodule-link \
 	${PN}-semodule-package \
-	${PN}-sepolgen-ifgen \
-	${PN}-sepolicy \
 	${PN}-sestatus \
 	${PN}-setfiles \
 	${PN}-setsebool \
 	system-config-selinux \
 "
-FILES_${PN}-audit2allow = "\
-	${bindir}/audit2allow \
-	${bindir}/audit2why \
-"
-FILES_${PN}-chcat = "\
-	${bindir}/chcat \
-"
 FILES_${PN}-fixfiles += "${base_sbindir}/fixfiles"
 FILES_${PN}-genhomedircon += "${sbindir}/genhomedircon"
 FILES_${PN}-loadpolicy += "\
@@ -149,22 +94,13 @@ FILES_${PN}-newrole += "\
 	${bindir}/newrole \
 	${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d/newrole', '', d)} \
 "
-FILES_${PN}-python = "\
-	${libdir}/python${PYTHON_BASEVERSION}/site-packages/seobject.py* \
-	${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy*.egg-info \
-	${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy/* \
-"
 FILES_${PN}-runinit += "\
 	${sbindir}/run_init \
 	${sbindir}/open_init_pty \
 	${@bb.utils.contains('DISTRO_FEATURES', 'pam', '${sysconfdir}/pam.d/run_init', '', d)} \
 "
-FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/site-packages/sepolicy/.debug/* ${prefix}/libexec/selinux/hll/.debug"
+FILES_${PN}-dbg += "${prefix}/libexec/selinux/hll/.debug"
 FILES_${PN}-secon += "${bindir}/secon"
-FILES_${PN}-semanage = "\
-	${sbindir}/semanage \
-	${datadir}/bash-completion/completions/semanage \
-"
 FILES_${PN}-semodule += "${sbindir}/semodule"
 FILES_${PN}-semodule-deps += "${bindir}/semodule_deps"
 FILES_${PN}-semodule-expand += "${bindir}/semodule_expand"
@@ -174,17 +110,6 @@ FILES_${PN}-semodule-package += "\
 	${bindir}/semodule_unpackage \
 "
 FILES_${PN}-hll += "${prefix}/libexec/selinux/hll/*"
-
-FILES_${PN}-sepolicy += "\
-	${bindir}/sepolicy \
-	${datadir}/bash-completion/completions/sepolicy \
-	${datadir}/dbus-1/system-services/org.selinux.service \
-	${datadir}/polkit-1/actions/org.selinux.policy \
-"
-FILES_${PN}-sepolgen-ifgen += "\
-	${bindir}/sepolgen-ifgen \
-	${bindir}/sepolgen-ifgen-attr-helper \
-"
 FILES_${PN}-sestatus += "\
 	${sbindir}/sestatus \
 	${sysconfdir}/sestatus.conf \
@@ -199,7 +124,6 @@ FILES_${PN}-setsebool += "\
 "
 
 FILES_system-config-selinux = " \
-    ${bindir}/sepolgen \
     ${datadir}/system-config-selinux/* \
     ${datadir}/icons/hicolor/ \
     ${datadir}/polkit-1/actions/org.selinux.config.policy \
recipes-security/selinux/policycoreutils_2.7.bb +0 -3
index 54ec69a..aa4870d 100644
@@ -7,8 +7,5 @@ SRC_URI[md5sum] = "65311b66ae01f7b7ad7c2ea7401b68ed"
 SRC_URI[sha256sum] = "0a1b8a4a323b854981c6755ff025fe98a0f1cff307f109abb260f0490f13e4f4"
 
 SRC_URI += "\
-	file://policycoreutils-fix-sepolicy-install-path.patch \
 	file://policycoreutils-loadpolicy-symlink.patch \
-	file://policycoreutils-process-ValueError-for-sepolicy-seobject.patch \
-	file://policycoreutils-fix-TypeError-for-seobject.py.patch \
 	"
recipes-security/selinux/selinux-python.inc new file +106 -0

106 lines not on this page · raw message

recipes-security/selinux/selinux-python/fix-TypeError-for-seobject.py.patch renamed from recipes-security/selinux/policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch +0 -0
similarity index 100%
rename from recipes-security/selinux/policycoreutils/policycoreutils-fix-TypeError-for-seobject.py.patch
rename to recipes-security/selinux/selinux-python/fix-TypeError-for-seobject.py.patch
recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch renamed from recipes-security/selinux/policycoreutils/policycoreutils-fix-sepolicy-install-path.patch +0 -0
similarity index 100%
rename from recipes-security/selinux/policycoreutils/policycoreutils-fix-sepolicy-install-path.patch
rename to recipes-security/selinux/selinux-python/fix-sepolicy-install-path.patch
recipes-security/selinux/selinux-python/process-ValueError-for-sepolicy-seobject.patch renamed from recipes-security/selinux/policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch +0 -0
similarity index 100%
rename from recipes-security/selinux/policycoreutils/policycoreutils-process-ValueError-for-sepolicy-seobject.patch
rename to recipes-security/selinux/selinux-python/process-ValueError-for-sepolicy-seobject.patch
recipes-security/selinux/selinux-python_2.7.bb new file +7 -0
new file mode 100644
index 0000000..f98be5f
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+SRC_URI[md5sum] = "b118229d34a6aec34471c3c2c9cac172"
+SRC_URI[sha256sum] = "4217cb965ecda96c91e15ffcc2e7ddd13ecc2bf5631100f3cd072a7616f140ed"
Signature · 1 line
2.13.0
#20 lore raw

PATCH 13/21 semodule-utils: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move policycoreutils/semodule_* to semodule-utils/*:

  - policycoreutils/semodule_deps    -> semodule-utils/semodule_deps
  - policycoreutils/semodule_expand  -> semodule-utils/semodule_expand
  - policycoreutils/semodule_link    -> semodule-utils/semodule_link

- policycoreutils/semodule_package -> semodule-utils/semodule_package

* Cleanup policycoreutils.inc

---
 recipes-security/selinux/policycoreutils.inc   | 13 +------------
 recipes-security/selinux/semodule-utils.inc    | 27 ++++++++++++++++++++++++++
 recipes-security/selinux/semodule-utils_2.7.bb |  7 +++++++
 3 files changed, 35 insertions(+), 12 deletions(-)
 create mode 100644 recipes-security/selinux/semodule-utils.inc
 create mode 100644 recipes-security/selinux/semodule-utils_2.7.bb
recipes-security/selinux/policycoreutils.inc +1 -12
index 05fd43d..8a9027b 100644
@@ -75,10 +75,6 @@ PACKAGES =+ "\
 	${PN}-runinit \
 	${PN}-secon \
 	${PN}-semodule \
-	${PN}-semodule-deps \
-	${PN}-semodule-expand \
-	${PN}-semodule-link \
-	${PN}-semodule-package \
 	${PN}-sestatus \
 	${PN}-setfiles \
 	${PN}-setsebool \
@@ -102,13 +98,6 @@ FILES_${PN}-runinit += "\
 FILES_${PN}-dbg += "${prefix}/libexec/selinux/hll/.debug"
 FILES_${PN}-secon += "${bindir}/secon"
 FILES_${PN}-semodule += "${sbindir}/semodule"
-FILES_${PN}-semodule-deps += "${bindir}/semodule_deps"
-FILES_${PN}-semodule-expand += "${bindir}/semodule_expand"
-FILES_${PN}-semodule-link += "${bindir}/semodule_link"
-FILES_${PN}-semodule-package += "\
-	${bindir}/semodule_package \
-	${bindir}/semodule_unpackage \
-"
 FILES_${PN}-hll += "${prefix}/libexec/selinux/hll/*"
 FILES_${PN}-sestatus += "\
 	${sbindir}/sestatus \
@@ -142,7 +131,7 @@ EXTRA_OEMAKE += "INITDIR=${D}/etc/init.d"
 
 BBCLASSEXTEND = "native"
 
-PCU_NATIVE_CMDS = "setfiles semodule_package semodule semodule_link semodule_expand semodule_deps hll"
+PCU_NATIVE_CMDS = "setfiles semodule hll"
 
 do_compile_virtclass-native() {
 	for PCU_CMD in ${PCU_NATIVE_CMDS} ; do
recipes-security/selinux/semodule-utils.inc new file +27 -0
new file mode 100644
index 0000000..1e92745
@@ -0,0 +1,27 @@
+SUMMARY = "Utilities to manipulate SELinux policy module package"
+DESCRIPTION = "\
+The utilities to create, expand, link and show the dependencies between \
+the SELinux policy module packages."
+
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+DEPENDS += "libsepol"
+
+EXTRA_OEMAKE += "LIBSEPOLA=${STAGING_LIBDIR}/libsepol.a"
+
+PACKAGES =+ "\
+        ${PN}-semodule-deps \
+        ${PN}-semodule-expand \
+        ${PN}-semodule-link \
+        ${PN}-semodule-package \
+"
+FILES_${PN}-semodule-deps += "${bindir}/semodule_deps"
+FILES_${PN}-semodule-expand += "${bindir}/semodule_expand"
+FILES_${PN}-semodule-link += "${bindir}/semodule_link"
+FILES_${PN}-semodule-package += "\
+        ${bindir}/semodule_package \
+        ${bindir}/semodule_unpackage \
+"
+
+BBCLASSEXTEND = "native"
recipes-security/selinux/semodule-utils_2.7.bb new file +7 -0
new file mode 100644
index 0000000..fbb88bf
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+SRC_URI[md5sum] = "678e3a5225f9645d40fd9d13bbaa156f"
+SRC_URI[sha256sum] = "90c98b3362a43b4da2a51a9176820a56f3e615225e23e3395bc566c4490786ba"
Signature · 1 line
2.13.0
#21 lore raw

PATCH 14/21 selinux-dbus: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move policycoreutils/sepolicy/dbus to dbus.

---
 recipes-security/selinux/selinux-dbus.inc    | 14 ++++++++++++++
 recipes-security/selinux/selinux-dbus_2.7.bb |  7 +++++++
 2 files changed, 21 insertions(+)
 create mode 100644 recipes-security/selinux/selinux-dbus.inc
 create mode 100644 recipes-security/selinux/selinux-dbus_2.7.bb
recipes-security/selinux/selinux-dbus.inc new file +14 -0
new file mode 100644
index 0000000..1b66136
@@ -0,0 +1,14 @@
+SUMMARY = "SELinux dbus service files"
+DESCRIPTION = "\
+Provide SELinux dbus service files and scripts."
+
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+RDEPENDS_${PN} += "python selinux-python-sepolicy"
+
+FILES_${PN} += "\
+        ${datadir}/system-config-selinux/selinux_server.py \
+        ${datadir}/polkit-1/actions/org.selinux.policy \
+        ${datadir}/dbus-1/system-services/org.selinux.service \
+"
recipes-security/selinux/selinux-dbus_2.7.bb new file +7 -0
new file mode 100644
index 0000000..a4f14ed
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+SRC_URI[md5sum] = "6944aa95cfb44e4d76b1aff48b38f08e"
+SRC_URI[sha256sum] = "a7f3dbe68c0d02cd1cbe6aac06e87c2957668cb88083389654fabacb79641ae4"
Signature · 1 line
2.13.0
#22 lore raw

PATCH 15/21 selinux-gui: add package 2.7 (20170804)

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Move policycoreutils/gui to gui and cleanup policycoreutils.inc.

---
 recipes-security/selinux/policycoreutils.inc |  7 -------
 recipes-security/selinux/selinux-gui.inc     | 15 +++++++++++++++
 recipes-security/selinux/selinux-gui_2.7.bb  |  7 +++++++
 3 files changed, 22 insertions(+), 7 deletions(-)
 create mode 100644 recipes-security/selinux/selinux-gui.inc
 create mode 100644 recipes-security/selinux/selinux-gui_2.7.bb
recipes-security/selinux/policycoreutils.inc +0 -7
index 8a9027b..5e03ba0 100644
@@ -78,7 +78,6 @@ PACKAGES =+ "\
 	${PN}-sestatus \
 	${PN}-setfiles \
 	${PN}-setsebool \
-	system-config-selinux \
 "
 FILES_${PN}-fixfiles += "${base_sbindir}/fixfiles"
 FILES_${PN}-genhomedircon += "${sbindir}/genhomedircon"
@@ -112,12 +111,6 @@ FILES_${PN}-setsebool += "\
 	${datadir}/bash-completion/completions/setsebool \
 "
 
-FILES_system-config-selinux = " \
-    ${datadir}/system-config-selinux/* \
-    ${datadir}/icons/hicolor/ \
-    ${datadir}/polkit-1/actions/org.selinux.config.policy \
-"
-
 export STAGING_INCDIR
 export STAGING_LIBDIR
 export BUILD_SYS
recipes-security/selinux/selinux-gui.inc new file +15 -0
new file mode 100644
index 0000000..1096f3f
@@ -0,0 +1,15 @@
+SUMMARY = "SELinux GUI tools"
+DESCRIPTION = "\
+Provide SELinux Management tool (system-config-selinux) and SELinux \
+Policy Generation Tool (selinux-polgengui)"
+
+SECTION = "base"
+LICENSE = "GPLv2+"
+
+RDEPENDS_${PN} += "python"
+
+FILES_${PN} += " \
+        ${datadir}/system-config-selinux/* \
+        ${datadir}/icons/hicolor/* \
+        ${datadir}/polkit-1/actions/org.selinux.config.policy \
+"
recipes-security/selinux/selinux-gui_2.7.bb new file +7 -0
new file mode 100644
index 0000000..3531591
@@ -0,0 +1,7 @@
+include selinux_20170804.inc
+include ${BPN}.inc
+
+LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
+
+SRC_URI[md5sum] = "f3555cb50a9e67b42bc917ede1982c7d"
+SRC_URI[sha256sum] = "693fb3347041b5a2273c52c33be0a256b109e60f2039ae1d7e90ba8a2ec0324f"
Signature · 1 line
2.13.0
#23 lore raw

PATCH 16/21 policycoreutils: fixes for 2.7 uprev

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Remove setools from DEPENDS/RDEPENDS, it was required by sepolicy, sepolgen, semanage which have been moved to python/*.

Rebase patch:
- policycoreutils-fixfiles-de-bashify.patch

Drop useless patch:
- policycoreutils-loadpolicy-symlink.patch

---
 recipes-security/selinux/policycoreutils.inc       |  4 +-
 .../policycoreutils-fixfiles-de-bashify.patch      | 53 ++++++++++------------
 recipes-security/selinux/policycoreutils_2.7.bb    |  3 --
 3 files changed, 27 insertions(+), 33 deletions(-)
recipes-security/selinux/policycoreutils.inc +2 -2
index 5e03ba0..fc181f7 100644
@@ -16,7 +16,7 @@ PAM_SRC_URI = "file://pam.d/newrole \
 "
 
 DEPENDS += "libsepol libselinux libsemanage libcap gettext-native"
-EXTRA_DEPENDS = "libcap-ng libcgroup setools"
+EXTRA_DEPENDS = "libcap-ng libcgroup"
 DEPENDS += "${@['', '${EXTRA_DEPENDS}']['${PN}' != '${BPN}-native']}"
 
 inherit selinux pythonnative
@@ -60,7 +60,7 @@ RDEPENDS_${BPN}-setsebool += "\
 	libselinux \
 	libsemanage \
 "
-RDEPENDS_${BPN} += "setools setools-libs selinux-python"
+RDEPENDS_${BPN} += "selinux-python"
 
 WARN_QA := "${@oe_filter_out('unsafe-references-in-scripts', '${WARN_QA}', d)}"
 ERROR_QA := "${@oe_filter_out('unsafe-references-in-scripts', '${ERROR_QA}', d)}"
recipes-security/selinux/policycoreutils/policycoreutils-fixfiles-de-bashify.patch +25 -28

95 lines not on this page · raw message

recipes-security/selinux/policycoreutils_2.7.bb +0 -3
index aa4870d..78bf031 100644
@@ -6,6 +6,3 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=393a5ca445f6965873eca0259a17f833"
 SRC_URI[md5sum] = "65311b66ae01f7b7ad7c2ea7401b68ed"
 SRC_URI[sha256sum] = "0a1b8a4a323b854981c6755ff025fe98a0f1cff307f109abb260f0490f13e4f4"
 
-SRC_URI += "\
-	file://policycoreutils-loadpolicy-symlink.patch \
-	"
Signature · 1 line
2.13.0
#24 lore raw

PATCH 17/21 refpolicy: fix a typo in RDEPENDS

In reply to [email protected]

From: Jackie Huang <[email protected]>

Underscore ("_") should be used for variable overrides.

---
 recipes-security/refpolicy/refpolicy_common.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-security/refpolicy/refpolicy_common.inc +1 -1
index 6a45e79..4a7b7eb 100644
@@ -31,7 +31,7 @@ EXTRANATIVEPATH += "bzip2-native"
 
 DEPENDS += "bzip2-replacement-native checkpolicy-native policycoreutils-native m4-native"
 
-RDEPENDS-${PN}-dev =+ " \
+RDEPENDS_${PN}-dev =+ " \
         python \
 "
 
Signature · 1 line
2.13.0
#25 lore raw

PATCH 18/21 refpolicy_common: depends on semodule-utils-native

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Those tools have been moved from policycoreutils to semodule-utils:
semodule_deps, semodule_expand, semodule_link, semodule_package

---
 recipes-security/refpolicy/refpolicy_common.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
recipes-security/refpolicy/refpolicy_common.inc +1 -1
index 4a7b7eb..2ce02ac 100644
@@ -29,7 +29,7 @@ FILES_${PN}-dev =+ " \
 
 EXTRANATIVEPATH += "bzip2-native"
 
-DEPENDS += "bzip2-replacement-native checkpolicy-native policycoreutils-native m4-native"
+DEPENDS += "bzip2-replacement-native checkpolicy-native policycoreutils-native semodule-utils-native m4-native"
 
 RDEPENDS_${PN}-dev =+ " \
         python \
Signature · 1 line
2.13.0
#26 lore raw

PATCH 19/21 setools: uprev to 4.1.1

In reply to [email protected]

From: Wenzong Fan <[email protected]>

SETools v4 is a rewrite of SETools in Python, details refer to:
https://github.com/TresysTechnology/setools/wiki/Changes-Since-SETools-v3

Changes for upreving:
* removed setools_3.3.8.bb and all useless patch
* add patches to fix cross-compiling issues:
- setools4-fixes-for-cross-compiling.patch
- setools4-fix-cross-compiling-errors-for-powerpc-mips.patch

---
 ...-Don-t-check-selinux-policies-if-disabled.patch |  25 --
 .../setools-Fix-man-pages-and-getoptions.patch     |  80 ------
 .../setools-Fix-output-to-match-policy-lines.patch |  36 ---
 ...-Fix-python-setools-Makefile.am-for-cross.patch |  33 ---
 ...-sepol-calls-to-work-with-latest-libsepol.patch |  36 ---
 .../setools-Fix-test-bug-for-unary-operator.patch  |  25 --
 .../setools/setools-Remove-unused-variables.patch  | 279 ---------------------
 ...s-Update-for-2015-02-02-Userspace-release.patch | 114 ---------
 .../setools/setools/setools-configure-ac.patch     | 107 --------
 .../setools-configure-with-latest-libsepol.patch   |  33 ---
 .../setools/setools/setools-cross-ar.patch         |  17 --
 .../setools-neverallow-rules-all-always-fail.patch |  31 ---
 ...ols-seinfo-should-exit-with-correct-errno.patch | 134 ----------
 recipes-security/setools/setools/setools.pam       |   4 -
 ...x-cross-compiling-errors-for-powerpc-mips.patch |  35 +++
 .../setools4-fixes-for-cross-compiling.patch       |  40 +++
 .../setools/{setools_3.3.8.bb => setools_4.1.1.bb} | 100 ++------
 17 files changed, 91 insertions(+), 1038 deletions(-)
 delete mode 100644 recipes-security/setools/setools/setools-Don-t-check-selinux-policies-if-disabled.patch
 delete mode 100644 recipes-security/setools/setools/setools-Fix-man-pages-and-getoptions.patch
 delete mode 100644 recipes-security/setools/setools/setools-Fix-output-to-match-policy-lines.patch
 delete mode 100644 recipes-security/setools/setools/setools-Fix-python-setools-Makefile.am-for-cross.patch
 delete mode 100644 recipes-security/setools/setools/setools-Fix-sepol-calls-to-work-with-latest-libsepol.patch
 delete mode 100644 recipes-security/setools/setools/setools-Fix-test-bug-for-unary-operator.patch
 delete mode 100644 recipes-security/setools/setools/setools-Remove-unused-variables.patch
 delete mode 100644 recipes-security/setools/setools/setools-Update-for-2015-02-02-Userspace-release.patch
 delete mode 100644 recipes-security/setools/setools/setools-configure-ac.patch
 delete mode 100644 recipes-security/setools/setools/setools-configure-with-latest-libsepol.patch
 delete mode 100644 recipes-security/setools/setools/setools-cross-ar.patch
 delete mode 100644 recipes-security/setools/setools/setools-neverallow-rules-all-always-fail.patch
 delete mode 100644 recipes-security/setools/setools/setools-seinfo-should-exit-with-correct-errno.patch
 delete mode 100644 recipes-security/setools/setools/setools.pam
 create mode 100644 recipes-security/setools/setools/setools4-fix-cross-compiling-errors-for-powerpc-mips.patch
 create mode 100644 recipes-security/setools/setools/setools4-fixes-for-cross-compiling.patch
 rename recipes-security/setools/{setools_3.3.8.bb => setools_4.1.1.bb} (11%)
recipes-security/setools/setools/setools-Don-t-check-selinux-policies-if-disabled.patch deleted +0 -25
deleted file mode 100644
index ed841e8..0000000
@@ -1,25 +0,0 @@
-From 7515aa80e7ead8d3016ea161e5d0eb9c59399278 Mon Sep 17 00:00:00 2001
-From: Xin Ouyang <[email protected]>
-Date: Wed, 7 Mar 2012 14:36:19 +0800
-Subject: [meta-selinux][PATCH] setools: Don't check selinux policies if disabled.
-
----
- configure.ac |    2 +-
- 1 files changed, 1 insertions(+), 1 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index e1db271..899e5e9 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -390,7 +390,7 @@ if test "x${enable_selinux_check}" = "xyes"; then
-       use_selinux=yes
-   fi
- else
--      use_selinux=yes
-+      use_selinux=no
- fi
- 
- AC_CACHE_SAVE
--- 
-1.7.5.4
-
recipes-security/setools/setools/setools-Fix-man-pages-and-getoptions.patch deleted +0 -80

80 lines not on this page · raw message

recipes-security/setools/setools/setools-Fix-output-to-match-policy-lines.patch deleted +0 -36
deleted file mode 100644
index c397aa6..0000000
@@ -1,36 +0,0 @@
-From 81f2221ab707ca8d5e204b0f9be61d537888e439 Mon Sep 17 00:00:00 2001
-From: Xin Ouyang <[email protected]>
-Date: Wed, 7 Mar 2012 11:03:00 +0800
-Subject: [meta-selinux][PATCH 7/7] setools: Fix output to match policy lines
-
-Integrated from Fedora:
-https://community.dev.fedoraproject.org/packages/setools/sources/patches/
----
- libapol/src/ftrule-query.c |    4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/libapol/src/ftrule-query.c b/libapol/src/ftrule-query.c
-index 9c7a23b..1d5f5c8 100644
---- a/libapol/src/ftrule-query.c
-+++ b/libapol/src/ftrule-query.c
-@@ -282,7 +282,7 @@ char *apol_filename_trans_render(const apol_policy_t * policy, const qpol_filena
- 		error = errno;
- 		goto err;
- 	}
--	if (apol_str_appendf(&tmp, &tmp_sz, "transition_type %s ", tmp_name)) {
-+	if (apol_str_appendf(&tmp, &tmp_sz, "type_transition %s ", tmp_name)) {
- 		error = errno;
- 		ERR(policy, "%s", strerror(error));
- 		goto err;
-@@ -338,7 +338,7 @@ char *apol_filename_trans_render(const apol_policy_t * policy, const qpol_filena
- 		goto err;
- 	}
- 
--	if (apol_str_appendf(&tmp, &tmp_sz, " %s", tmp_name)) {
-+	if (apol_str_appendf(&tmp, &tmp_sz, " \"%s\"", tmp_name)) {
- 		error = errno;
- 		ERR(policy, "%s", strerror(error));
- 		goto err;
--- 
-1.7.5.4
-
recipes-security/setools/setools/setools-Fix-python-setools-Makefile.am-for-cross.patch deleted +0 -33
deleted file mode 100644
index c4d062a..0000000
@@ -1,33 +0,0 @@
-From 7d386c429202b393aa4ca281a11b5e1f2259b109 Mon Sep 17 00:00:00 2001
-From: Xin Ouyang <[email protected]>
-Date: Wed, 7 Mar 2012 15:43:41 +0800
-Subject: [meta-selinux][PATCH] setools: Fix python/setools/Makefile.am for cross.
-
----
- python/setools/Makefile.am |    6 +++---
- 1 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/python/setools/Makefile.am b/python/setools/Makefile.am
-index c4635fb..80aa385 100644
---- a/python/setools/Makefile.am
-+++ b/python/setools/Makefile.am
-@@ -22,13 +22,13 @@ sesearch_SOURCES = sesearch.c
- python-build: sesearch.c seinfo.c
- 	@mkdir -p setools
- 	@cp __init__.py setools
--	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build
-+	CC="${CC}" LDSHARED="$(CC) -shared" LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG) $(PYTHON_LDFLAGS)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS) $(PYTHON_CPPFLAGS)" ${PYTHON} setup.py build 
- 
- install-exec-hook:
--	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
-+	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --install-lib=$(PYTHON_SITE_PKG)`
- 
- uninstall-hook: 
--	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
-+	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR) --install-lib=$(PYTHON_SITE_PKG)`
- 
- clean-local:
- 	$(PYTHON) setup.py clean -a 
--- 
-1.7.5.4
-
recipes-security/setools/setools/setools-Fix-sepol-calls-to-work-with-latest-libsepol.patch deleted +0 -36
deleted file mode 100644
index 8519ab2..0000000
@@ -1,36 +0,0 @@
-From 16d3a0b41273be4289f70d1d63fb983721bb60c0 Mon Sep 17 00:00:00 2001
-From: Xin Ouyang <[email protected]>
-Date: Wed, 7 Mar 2012 10:54:55 +0800
-Subject: [meta-selinux][PATCH 4/7] setools: Fix sepol calls to work with latest libsepol
-
-Integrated from Fedora:
-https://community.dev.fedoraproject.org/packages/setools/sources/patches/
----
- configure.ac |    4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index e837e03..3c11e23 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -505,7 +505,7 @@ AC_COMPILE_IFELSE(
-                   [AC_LANG_SOURCE([
- #include <sepol/policydb/expand.h>
- int main () {
--  return role_set_expand(NULL, NULL, NULL, NULL);
-+  return role_set_expand(NULL, NULL, NULL, NULL, NULL);
- }])],
-                   sepol_new_user_role_mapping="yes",
-                   sepol_new_user_role_mapping="no")
-@@ -541,7 +541,7 @@ if test ${sepol_check_boolmap} = "yes"; then
-                          [AC_LANG_SOURCE([
- #include <sepol/policydb/expand.h>
- int main () {
--  return expand_module_avrules(NULL, NULL, NULL, NULL, NULL, 0, 0);
-+  return expand_module_avrules(NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0);
- }])],
-                          AC_MSG_RESULT([yes]),
-                          AC_MSG_ERROR([this version of libsepol is incompatible with SETools]))
--- 
-1.7.5.4
-
recipes-security/setools/setools/setools-Fix-test-bug-for-unary-operator.patch deleted +0 -25
deleted file mode 100644
index 7b6e539..0000000
@@ -1,25 +0,0 @@
-From 5f574dc0fb68fe07c5b611ca34c01b8484735aab Mon Sep 17 00:00:00 2001
-From: Xin Ouyang <[email protected]>
-Date: Wed, 7 Mar 2012 14:47:44 +0800
-Subject: [meta-selinux][PATCH] setools: Fix "test" bug for unary operator.
-
-configure: line 22969: test: =: unary operator expected
----
- configure.ac |    1 +
- 1 files changed, 1 insertions(+), 0 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index 899e5e9..6854c69 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -233,6 +233,7 @@ if test ${do_swigify} = "yes"; then
-    AC_PROG_SWIG(2.0.0)
- fi
- build_apol=yes
-+do_swigify_tcl=no
- AC_ARG_ENABLE(swig-tcl,
-               AC_HELP_STRING([--enable-swig-tcl],
-                              [build SWIG interfaces for Tcl (default)]),
--- 
-1.7.5.4
-
recipes-security/setools/setools/setools-Remove-unused-variables.patch deleted +0 -279

279 lines not on this page · raw message

recipes-security/setools/setools/setools-Update-for-2015-02-02-Userspace-release.patch deleted +0 -114

114 lines not on this page · raw message

recipes-security/setools/setools/setools-configure-ac.patch deleted +0 -107

107 lines not on this page · raw message

recipes-security/setools/setools/setools-configure-with-latest-libsepol.patch deleted +0 -33
deleted file mode 100644
index 84ac3dc..0000000
@@ -1,33 +0,0 @@
-From 2b58d92add64b53b16cbb438e7b69e85d046afd1 Mon Sep 17 00:00:00 2001
-From: Dan Walsh <[email protected]>
-Date: Tue, 20 Sep 2011 15:46:38 -0400
-Subject: [meta-selinux][PATCH 5/6] Fix sepol calls to work with latest libsepol
-
----
- configure.ac |    4 ++--
- 1 files changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/configure.ac b/configure.ac
-index e837e03..3c11e23 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -505,7 +505,7 @@ AC_COMPILE_IFELSE(
-                   [AC_LANG_SOURCE([
- #include <sepol/policydb/expand.h>
- int main () {
--  return role_set_expand(NULL, NULL, NULL, NULL);
-+  return role_set_expand(NULL, NULL, NULL, NULL, NULL);
- }])],
-                   sepol_new_user_role_mapping="yes",
-                   sepol_new_user_role_mapping="no")
-@@ -541,7 +541,7 @@ if test ${sepol_check_boolmap} = "yes"; then
-                          [AC_LANG_SOURCE([
- #include <sepol/policydb/expand.h>
- int main () {
--  return expand_module_avrules(NULL, NULL, NULL, NULL, NULL, 0, 0);
-+  return expand_module_avrules(NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0);
- }])],
-                          AC_MSG_RESULT([yes]),
-                          AC_MSG_ERROR([this version of libsepol is incompatible with SETools]))
--- 
-1.7.6.2
recipes-security/setools/setools/setools-cross-ar.patch deleted +0 -17
deleted file mode 100644
index eba24c2..0000000
@@ -1,17 +0,0 @@
-Use the specified $(AR), not "ar", for cross-compiling.
-
----
- libqpol/src/Makefile.am |    2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
---- a/libqpol/src/Makefile.am
-+++ b/libqpol/src/Makefile.am
-@@ -64,7 +64,7 @@
- 	mkdir -p $@
- 	rm -f $@/*
- 	cp $< $@
--	(cd $@; ar x libsepol.a)
-+	(cd $@; $(AR) x libsepol.a)
- 
- $(qpolso_DATA): $(tmp_sepol) $(libqpol_so_OBJS) libqpol.map
- 	$(CC) -shared -o $@ $(libqpol_so_OBJS) $(AM_LDFLAGS) $(LDFLAGS) -Wl,-soname,$(LIBQPOL_SONAME),--version-script=$(srcdir)/libqpol.map,-z,defs -Wl,--whole-archive $(sepol_srcdir)/libsepol.a -Wl,--no-whole-archive @SELINUX_LIB_FLAG@ -lselinux -lsepol -lbz2
recipes-security/setools/setools/setools-neverallow-rules-all-always-fail.patch deleted +0 -31
deleted file mode 100644
index a165dae..0000000
@@ -1,31 +0,0 @@
-From 4360fae5a6fbee9c8866573fe5a8af2fdae4944d Mon Sep 17 00:00:00 2001
-From: Xin Ouyang <[email protected]>
-Date: Fri, 9 Mar 2012 10:18:35 +0800
-Subject: [meta-selinux][PATCH] setools: neverallow rules all always fail.
-
-Since we do not ship neverallow rules all always fail.
-ERROR: Cannot get avrules: Neverallow rules requested but not available
-ERROR: Operation not supported
----
- libqpol/src/avrule_query.c |    3 +++
- 1 files changed, 3 insertions(+), 0 deletions(-)
-
-diff --git a/libqpol/src/avrule_query.c b/libqpol/src/avrule_query.c
-index 749565b..e7d42fc 100644
---- a/libqpol/src/avrule_query.c
-+++ b/libqpol/src/avrule_query.c
-@@ -57,8 +57,11 @@ int qpol_policy_get_avrule_iter(const qpol_policy_t * policy, uint32_t rule_type
- 
- 	if ((rule_type_mask & QPOL_RULE_NEVERALLOW) && !qpol_policy_has_capability(policy, QPOL_CAP_NEVERALLOW)) {
- 		ERR(policy, "%s", "Cannot get avrules: Neverallow rules requested but not available");
-+		/*
- 		errno = ENOTSUP;
- 		return STATUS_ERR;
-+		*/
-+		return STATUS_SUCCESS;
- 	}
- 
- 	db = &policy->p->p;
--- 
-1.7.5.4
-
recipes-security/setools/setools/setools-seinfo-should-exit-with-correct-errno.patch deleted +0 -134

134 lines not on this page · raw message

recipes-security/setools/setools/setools.pam deleted +0 -4
deleted file mode 100644
index c7d67e3..0000000
@@ -1,4 +0,0 @@
-#%PAM-1.0
-auth		include		config-util
-account		include		config-util
-session		include		config-util
recipes-security/setools/setools/setools4-fix-cross-compiling-errors-for-powerpc-mips.patch new file +35 -0
new file mode 100644
index 0000000..88b8c8c
@@ -0,0 +1,35 @@
+From dc86d880ae0d66233679112a2bf0115c39df68f1 Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <[email protected]>
+Date: Fri, 17 Feb 2017 08:57:35 +0000
+Subject: [meta-selinux][PATCH] setools4: fix cross-compiling errors for powerpc, mips
+
+Fix build errors:
+| libqpol/policy.c: In function 'qpol_binpol_version':
+| libqpol/policy.c:95:24: error: implicit declaration of function 'bswap_32' [-Werror=implicit-function-declaration]
+| #define le32_to_cpu(x) bswap_32(x)
+
+Upstream-Status: Pending
+
+Signed-off-by: Wenzong Fan <[email protected]>
+---
+ libqpol/policy.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/libqpol/policy.c b/libqpol/policy.c
+index ae3acb5..b5b87f9 100644
+--- a/libqpol/policy.c
++++ b/libqpol/policy.c
+@@ -45,6 +45,10 @@
+ # include <asm/types.h>
+ #endif
+ 
++#if defined(_ARCH_PPC) || defined(mips)
++#include <byteswap.h>
++#endif
++
+ #include <sepol/debug.h>
+ #include <sepol/handle.h>
+ #include <sepol/policydb/flask_types.h>
+-- 
+2.11.0
+
recipes-security/setools/setools/setools4-fixes-for-cross-compiling.patch new file +40 -0
new file mode 100644
index 0000000..18bb055
@@ -0,0 +1,40 @@
+From a104374147b398838edc04e937c92e762ea3f5d9 Mon Sep 17 00:00:00 2001
+From: Wenzong Fan <[email protected]>
+Date: Tue, 14 Feb 2017 06:32:35 +0000
+Subject: [meta-selinux][PATCH] setools4: fixes for cross compiling
+
+* search libsepol from $STAGING_LIBDIR
+* fix manual install path as '/usr/share/man/man1'
+
+Upstream-Status: Inappropriate [embedded specific]
+
+Signed-off-by: Wenzong Fan <[email protected]>
+---
+ setup.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 2ca44c9..300ff70 100644
+--- a/setup.py
++++ b/setup.py
+@@ -77,7 +77,7 @@ class BuildExtCommand(build_ext):
+         build_ext.run(self)
+ 
+ 
+-base_lib_dirs = ['.', '/usr/lib64', '/usr/lib', '/usr/local/lib']
++base_lib_dirs = [os.environ["STAGING_LIBDIR"]]
+ include_dirs = ['libqpol', 'libqpol/include']
+ 
+ try:
+@@ -182,7 +182,7 @@ setup(name='setools',
+                 'build_qhc': QtHelpCommand},
+       packages=['setools', 'setools.diff', 'setools.policyrep', 'setoolsgui', 'setoolsgui.apol'],
+       scripts=['apol', 'sediff', 'seinfo', 'seinfoflow', 'sesearch', 'sedta'],
+-      data_files=[(join(sys.prefix, 'share/man/man1'), glob.glob("man/*.1"))],
++      data_files=[('/usr/share/man/man1', glob.glob("man/*.1"))],
+       package_data={'': ['*.ui', '*.qhc', '*.qch'], 'setools': ['perm_map']},
+       ext_modules=ext_py_mods,
+       test_suite='tests',
+-- 
+2.13.0
+
recipes-security/setools/setools_4.1.1.bb renamed from recipes-security/setools/setools_3.3.8.bb +16 -84

112 lines not on this page · raw message

Signature · 1 line
2.13.0
#27 lore raw

PATCH 20/21 packagegroup-*: sync package names

In reply to [email protected]

From: Wenzong Fan <[email protected]>

Some new packages added after SELinux uprev to 2.7, sync the package names accordingly:

  policycoreutils-audit2allow      -> selinux-python-audit2allow
  policycoreutils-chcat            -> selinux-python-chcat
  policycoreutils-python           -> selinux-python
  policycoreutils-semanage         -> selinux-python-semanage
  policycoreutils-sandbox          -> selinux-sandbox
  policycoreutils-sepolgen-ifgen   -> selinux-python-sepolgen-ifgen
  policycoreutils-sepolicy         -> selinux-python-sepolicy,
                                      selinux-dbus
  policycoreutils-semodule-deps    -> semodule-utils-semodule-deps
  policycoreutils-semodule-expand  -> semodule-utils-semodule-expand
  policycoreutils-semodule-link    -> semodule-utils-semodule-link

policycoreutils-semodule-package -> semodule-utils-semodule-package
system-config-selinux -> selinux-gui
sepolgen -> selinux-python-sepolgen

---
 .../packagegroups/packagegroup-core-selinux.bb     |  2 +-
 .../packagegroup-selinux-policycoreutils.bb        | 25 +++++++++++-----------
 2 files changed, 14 insertions(+), 13 deletions(-)
recipes-security/packagegroups/packagegroup-core-selinux.bb +1 -1
index 128dfba..fd501d6 100644
@@ -17,7 +17,7 @@ RDEPENDS_${PN} = " \
 	libselinux-bin \
 	libsemanage \
 	checkpolicy \
-	sepolgen \
+	selinux-python-sepolgen \
 	packagegroup-selinux-policycoreutils \
 	setools \
 	setools-console \
recipes-security/packagegroups/packagegroup-selinux-policycoreutils.bb +13 -12
index b566134..e1ddee6 100644
@@ -12,27 +12,28 @@ PACKAGES = "\
 ALLOW_EMPTY_${PN} = "1"
 
 RDEPENDS_${PN} = "\
-	policycoreutils-audit2allow \
-	policycoreutils-chcat \
 	policycoreutils-fixfiles \
 	policycoreutils-genhomedircon \
 	policycoreutils-loadpolicy \
 	policycoreutils-newrole \
-	policycoreutils-python \
 	policycoreutils-runinit \
-	policycoreutils-sandbox \
 	policycoreutils-secon \
-	policycoreutils-semanage \
 	policycoreutils-semodule \
-	policycoreutils-semodule-deps \
-	policycoreutils-semodule-expand \
-	policycoreutils-semodule-link \
-	policycoreutils-semodule-package \
-	policycoreutils-sepolgen-ifgen \
-	policycoreutils-sepolicy \
 	policycoreutils-sestatus \
 	policycoreutils-setfiles \
 	policycoreutils-setsebool \
 	policycoreutils-hll \
-	system-config-selinux \
+	semodule-utils-semodule-deps \
+	semodule-utils-semodule-expand \
+	semodule-utils-semodule-link \
+	semodule-utils-semodule-package \
+	selinux-python-audit2allow \
+	selinux-python-sepolgen-ifgen \
+	selinux-python-semanage \
+	selinux-python-sepolicy \
+	selinux-python-chcat \
+	selinux-python \
+	selinux-sandbox \
+	selinux-dbus \
+	selinux-gui \
 "
Signature · 1 line
2.13.0
#28 lore raw

PATCH 21/21 selinux-python: add setools to RDEPENDS

In reply to [email protected]

From: Wenzong Fan <[email protected]>

---
 recipes-security/selinux/selinux-python.inc | 1 +
 1 file changed, 1 insertion(+)
recipes-security/selinux/selinux-python.inc +1 -0
index cc907ae..55060e3 100644
@@ -37,6 +37,7 @@ RDEPENDS_${BPN} += "\
         python-unixadmin \
         libselinux-python \
         libsemanage-python \
+        setools \
 "
 RDEPENDS_${BPN}-semanage += "\
         python-core \
Signature · 1 line
2.13.0