summaryrefslogtreecommitdiff
path: root/pcr
diff options
context:
space:
mode:
Diffstat (limited to 'pcr')
-rw-r--r--pcr/libselinux/0001-libselinux-fix-pointer-handling-in-realpath_not_fina.patch37
-rw-r--r--pcr/libselinux/0002-Revert-libselinux-support-new-python3-functions.patch82
-rw-r--r--pcr/libselinux/PKGBUILD67
-rw-r--r--pcr/libselinux/libselinux.tmpfiles1
4 files changed, 187 insertions, 0 deletions
diff --git a/pcr/libselinux/0001-libselinux-fix-pointer-handling-in-realpath_not_fina.patch b/pcr/libselinux/0001-libselinux-fix-pointer-handling-in-realpath_not_fina.patch
new file mode 100644
index 000000000..28da417a2
--- /dev/null
+++ b/pcr/libselinux/0001-libselinux-fix-pointer-handling-in-realpath_not_fina.patch
@@ -0,0 +1,37 @@
+From 550c0122ee22c5c41bba6cd1ddd5a71529610ada Mon Sep 17 00:00:00 2001
+From: vmojzis <vmojzis@redhat.com>
+Date: Thu, 27 Oct 2016 13:52:36 +0200
+Subject: [PATCH] libselinux: fix pointer handling in realpath_not_final
+
+Loop designed for stripping leading "//" was changing
+the only pointer referencing block of memory allocated
+by "strdup", resulting in "free()" failure. The loop
+had no effect because "realpath" is used later on.
+
+Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1376598
+
+Signed-off-by: vmojzis <vmojzis@redhat.com>
+---
+ libselinux/src/matchpathcon.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+diff --git a/libselinux/src/matchpathcon.c b/libselinux/src/matchpathcon.c
+index 724eb65097d6..58b4144ac0bf 100644
+--- a/libselinux/src/matchpathcon.c
++++ b/libselinux/src/matchpathcon.c
+@@ -389,12 +389,6 @@ int realpath_not_final(const char *name, char *resolved_path)
+ goto out;
+ }
+
+- /* strip leading // */
+- while (tmp_path[len] && tmp_path[len] == '/' &&
+- tmp_path[len+1] && tmp_path[len+1] == '/') {
+- tmp_path++;
+- len++;
+- }
+ last_component = strrchr(tmp_path, '/');
+
+ if (last_component == tmp_path) {
+--
+2.10.2
+
diff --git a/pcr/libselinux/0002-Revert-libselinux-support-new-python3-functions.patch b/pcr/libselinux/0002-Revert-libselinux-support-new-python3-functions.patch
new file mode 100644
index 000000000..4570a1074
--- /dev/null
+++ b/pcr/libselinux/0002-Revert-libselinux-support-new-python3-functions.patch
@@ -0,0 +1,82 @@
+From cc550202c358286c488aba45be2009d6f2d2746d Mon Sep 17 00:00:00 2001
+From: Laurent Bigonville <bigon@bigon.be>
+Date: Wed, 2 Nov 2016 16:24:31 +0100
+Subject: [PATCH] Revert "libselinux: support new python3 functions"
+
+With the reverted commit applied, some functions were returning arrays
+of bytes instead of python strings under python3 this was causing issues
+with string manipulation functions like split().
+
+Swig (checked with 3.0.7) is adding compatibility macros that take care
+of the differences between python2 and python3.
+
+This reverts commit 63df0f7ef12844b9b86cc293299671da772fcf84.
+
+Signed-off-by: Laurent Bigonville <bigon@bigon.be>
+---
+ libselinux/src/selinuxswig_python.i | 22 +++++++---------------
+ 1 file changed, 7 insertions(+), 15 deletions(-)
+
+diff --git a/libselinux/src/selinuxswig_python.i b/libselinux/src/selinuxswig_python.i
+index 8cea18d25dba..43df29153d7c 100644
+--- a/libselinux/src/selinuxswig_python.i
++++ b/libselinux/src/selinuxswig_python.i
+@@ -64,7 +64,7 @@ def install(src, dest):
+ PyObject* list = PyList_New(*$2);
+ int i;
+ for (i = 0; i < *$2; i++) {
+- PyList_SetItem(list, i, PyBytes_FromString((*$1)[i]));
++ PyList_SetItem(list, i, PyString_FromString((*$1)[i]));
+ }
+ $result = SWIG_Python_AppendOutput($result, list);
+ }
+@@ -97,9 +97,7 @@ def install(src, dest):
+ len++;
+ plist = PyList_New(len);
+ for (i = 0; i < len; i++) {
+- PyList_SetItem(plist, i,
+- PyBytes_FromString((*$1)[i])
+- );
++ PyList_SetItem(plist, i, PyString_FromString((*$1)[i]));
+ }
+ } else {
+ plist = PyList_New(0);
+@@ -116,9 +114,7 @@ def install(src, dest):
+ if (*$1) {
+ plist = PyList_New(result);
+ for (i = 0; i < result; i++) {
+- PyList_SetItem(plist, i,
+- PyBytes_FromString((*$1)[i])
+- );
++ PyList_SetItem(plist, i, PyString_FromString((*$1)[i]));
+ }
+ } else {
+ plist = PyList_New(0);
+@@ -171,20 +167,16 @@ def install(src, dest):
+ $1 = (char**) malloc(size + 1);
+
+ for(i = 0; i < size; i++) {
+- if (!PyBytes_Check(PySequence_GetItem($input, i))) {
+- PyErr_SetString(PyExc_ValueError, "Sequence must contain only bytes");
+-
++ if (!PyString_Check(PySequence_GetItem($input, i))) {
++ PyErr_SetString(PyExc_ValueError, "Sequence must contain only strings");
+ return NULL;
+ }
+-
+ }
+
+ for(i = 0; i < size; i++) {
+ s = PySequence_GetItem($input, i);
+-
+- $1[i] = (char*) malloc(PyBytes_Size(s) + 1);
+- strcpy($1[i], PyBytes_AsString(s));
+-
++ $1[i] = (char*) malloc(PyString_Size(s) + 1);
++ strcpy($1[i], PyString_AsString(s));
+ }
+ $1[size] = NULL;
+ }
+--
+2.10.2
+
diff --git a/pcr/libselinux/PKGBUILD b/pcr/libselinux/PKGBUILD
new file mode 100644
index 000000000..c3b84f061
--- /dev/null
+++ b/pcr/libselinux/PKGBUILD
@@ -0,0 +1,67 @@
+# Maintainer: Luke Shumaker <lukeshu@parabola.nu>
+# Maintainer (AUR): Nicolas Iooss <nicolas.iooss@m4x.org>
+# Contributor (AUR): Timothée Ravier <tim@siosm.fr>
+# Contributor (AUR): Nicky726 <Nicky726@gmail.com>
+# Contributor (AUR): Sergej Pupykin <pupykin.s+arch@gmail.com>
+# Contributor (AUR): Zezadas
+
+pkgname=libselinux
+_reldate=20161014
+pkgver=2.6
+pkgrel=2
+pkgdesc="SELinux library and simple utilities"
+arch=('i686' 'x86_64' 'armv6h')
+url='https://github.com/SELinuxProject/selinux/wiki/Userspace-Packages'
+license=('GPL')
+groups=('selinux')
+makedepends=('python2' 'python' 'ruby' 'xz' 'swig')
+depends=('libsepol' 'pcre')
+optdepends=('python2: python2 bindings'
+ 'python: python bindings'
+ 'ruby: ruby bindings')
+conflicts=("selinux-usr-${pkgname}")
+provides=("selinux-usr-${pkgname}=${pkgver}-${pkgrel}")
+options=(!emptydirs)
+source=("https://raw.githubusercontent.com/wiki/SELinuxProject/selinux/files/releases/${_reldate}/${pkgname}-${pkgver}.tar.gz"
+ "libselinux.tmpfiles"
+ '0001-libselinux-fix-pointer-handling-in-realpath_not_fina.patch'
+ '0002-Revert-libselinux-support-new-python3-functions.patch')
+sha256sums=('4ea2dde50665c202253ba5caac7738370ea0337c47b251ba981c60d24e1a118a'
+ 'afe23890fb2e12e6756e5d81bad3c3da33f38a95d072731c0422fbeb0b1fa1fc'
+ '4d7998c5368a6d13f5b730184b4e9ddb28dd42e1576f8daf12676ca468a935b3'
+ '82f598ab5c5d21b8b76e887fea43e5d8549f4e9a4047ba3a4cf1a6980ff22eec')
+
+prepare() {
+ cd "${pkgname}-${pkgver}"
+
+ patch -Np2 -i '../0001-libselinux-fix-pointer-handling-in-realpath_not_fina.patch'
+ patch -Np2 -i '../0002-Revert-libselinux-support-new-python3-functions.patch'
+}
+
+build() {
+ cd "${pkgname}-${pkgver}"
+
+ # Do not build deprecated rpm_execcon() interface. It is useless on Arch Linux anyway.
+ export DISABLE_RPM=y
+
+ make swigify
+ make all
+ make PYTHON=python2 pywrap
+ make PYTHON=python3 pywrap
+ make rubywrap
+}
+
+package(){
+ cd "${pkgname}-${pkgver}"
+
+ export DISABLE_RPM=y
+
+ make DESTDIR="${pkgdir}" USRBINDIR="${pkgdir}"/usr/bin LIBDIR="${pkgdir}"/usr/lib SHLIBDIR="${pkgdir}"/usr/lib install
+ make DESTDIR="${pkgdir}" USRBINDIR="${pkgdir}"/usr/bin LIBDIR="${pkgdir}"/usr/lib SHLIBDIR="${pkgdir}"/usr/lib PYTHON=python2 install-pywrap
+ make DESTDIR="${pkgdir}" USRBINDIR="${pkgdir}"/usr/bin LIBDIR="${pkgdir}"/usr/lib SHLIBDIR="${pkgdir}"/usr/lib PYTHON=python3 install-pywrap
+ make DESTDIR="${pkgdir}" USRBINDIR="${pkgdir}"/usr/bin LIBDIR="${pkgdir}"/usr/lib SHLIBDIR="${pkgdir}"/usr/lib install-rubywrap
+ python2 -m compileall "${pkgdir}/$(python2 -c 'import site; print(site.getsitepackages()[0])')"
+ python3 -m compileall "${pkgdir}/$(python3 -c 'import site; print(site.getsitepackages()[0])')"
+
+ install -Dm 0644 "${srcdir}"/libselinux.tmpfiles "${pkgdir}"/usr/lib/tmpfiles.d/libselinux.conf
+}
diff --git a/pcr/libselinux/libselinux.tmpfiles b/pcr/libselinux/libselinux.tmpfiles
new file mode 100644
index 000000000..b2aaf2e4c
--- /dev/null
+++ b/pcr/libselinux/libselinux.tmpfiles
@@ -0,0 +1 @@
+d /run/setrans 0755 root root