From fa48245323d3de6e648403121b236efc93d67325 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 14 Mar 2013 16:09:05 -0400 Subject: [PATCH 1/7] Add support for substituting bools to sesearch and seinfo --- 0014-boolsub.patch | 24 ++++++++++++++++++++++++ setools.spec | 7 ++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 0014-boolsub.patch diff --git a/0014-boolsub.patch b/0014-boolsub.patch new file mode 100644 index 0000000..2890628 --- /dev/null +++ b/0014-boolsub.patch @@ -0,0 +1,24 @@ +diff -up ./setools-3.3.7/secmds/seinfo.c~ ./setools-3.3.7/secmds/seinfo.c +--- ./setools-3.3.7/secmds/seinfo.c~ 2013-03-14 15:26:31.467121596 -0400 ++++ ./setools-3.3.7/secmds/seinfo.c 2013-03-14 15:35:20.154650517 -0400 +@@ -1705,7 +1705,7 @@ int main(int argc, char **argv) + case 'b': /* conditional booleans */ + bools = 1; + if (optarg != 0) +- bool_name = optarg; ++ bool_name = selinux_boolean_sub(optarg); + break; + case OPT_INITIALSID: + isids = 1; +diff -up ./setools-3.3.7/secmds/sesearch.c~ ./setools-3.3.7/secmds/sesearch.c +--- ./setools-3.3.7/secmds/sesearch.c~ 2013-03-14 15:26:31.539121944 -0400 ++++ ./setools-3.3.7/secmds/sesearch.c 2013-03-14 15:34:36.615445562 -0400 +@@ -1056,7 +1056,7 @@ int main(int argc, char **argv) + printf("Missing boolean for -b (--bool)\n"); + exit(1); + } +- cmd_opts.bool_name = strdup(optarg); ++ cmd_opts.bool_name = strdup(selinux_boolean_sub(optarg)); + if (!cmd_opts.bool_name) { + fprintf(stderr, "%s\n", strerror(errno)); + exit(1); diff --git a/setools.spec b/setools.spec index 8ee8d11..c865e27 100644 --- a/setools.spec +++ b/setools.spec @@ -5,7 +5,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 34%{?dist} +Release: 35%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -25,6 +25,7 @@ Patch10: 0010-selinux_current_policy_path.patch Patch11: 0011-setools-noship.patch Patch12: 0012-seaudit.patch Patch13: 0013-swig.patch +Patch14: 0014-boolsub.patch Summary: Policy analysis tools for SELinux Group: System Environment/Base @@ -185,6 +186,7 @@ This package includes the following graphical tools: %patch11 -p 1 -b .noship %patch12 -p 1 -b .seaudit %patch13 -p 1 -b .swig +%patch14 -p 2 -b .boolsub %ifarch sparc sparcv9 sparc64 s390 s390x for file in `find . -name Makefile.am`; do sed -i -e 's:-fpic:-fPIC:' $file; @@ -310,6 +312,9 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Thu Mar 14 2013 Dan Walsh - 3.3.7-35 +- Add support for substituting bools to sesearch and seinfo + * Wed Jan 30 2013 Dan Walsh - 3.3.7-34 - Rebuild using pristine source from Tresys From 065e8bc3fa4e541d510ca6689f1e51b9fc7c3c65 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Fri, 15 Mar 2013 11:57:56 -0400 Subject: [PATCH 2/7] Drop support for python bindings --- setools.spec | 38 ++++---------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/setools.spec b/setools.spec index c865e27..90091d9 100644 --- a/setools.spec +++ b/setools.spec @@ -1,7 +1,5 @@ %define setools_maj_ver 3.3 %define setools_min_ver 7 -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")} Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} @@ -35,7 +33,6 @@ Requires: setools-libs = %{version}-%{release} setools-libs-tcl = %{version}-%{r %define autoconf_ver 2.59 %define bwidget_ver 1.8 %define gtk_ver 2.8 -%define python_ver 2.3 %define sepol_ver 2.1.8-5 %define selinux_ver 2.1.12-10 %define sqlite_ver 3.2.0 @@ -75,25 +72,6 @@ This package includes the following run-time libraries: libseaudit parse and filter SELinux audit messages in log files libsefs SELinux file contexts library -%package libs-python -License: LGPLv2 -Summary: Python bindings for SELinux policy analysis -Group: Development/Languages -Requires: setools-libs = %{version}-%{release} python2 >= %{python_ver} bzip2-libs -BuildRequires: python2-devel >= %{python_ver} swig >= %{swig_ver} bzip2-devel - -%description libs-python -SETools is a collection of graphical tools, command-line tools, and -libraries designed to facilitate SELinux policy analysis. - -This package includes Python bindings for the following libraries: - - libapol policy analysis library - libpoldiff semantic policy difference library - libqpol library that abstracts policy internals - libseaudit parse and filter SELinux audit messages in log files - libsefs SELinux file contexts library - %package libs-tcl License: LGPLv2 Summary: Tcl bindings for SELinux policy analysis @@ -168,8 +146,6 @@ This package includes the following graphical tools: seaudit audit log analysis tool %define setoolsdir %{_datadir}/setools-%{setools_maj_ver} -%define pkg_py_lib %{python_sitelib}/setools -%define pkg_py_arch %{python_sitearch}/setools %define tcllibdir %{_libdir}/setools %prep @@ -201,9 +177,8 @@ autoreconf -if %build automake %configure --libdir=%{_libdir} --disable-bwidget-check --disable-selinux-check \ - --enable-swig-python --enable-swig-tcl + --enable-swig-tcl # work around issue with gcc 4.3 + gnu99 + swig-generated code: -sed -i -e 's:$(CC):gcc -std=gnu89:' libseaudit/swig/python/Makefile make %{?_smp_mflags} %install @@ -225,7 +200,6 @@ rm -f ${RPM_BUILD_ROOT}/%{_libdir}/*.a # ensure permissions are correct chmod 0755 ${RPM_BUILD_ROOT}/%{_libdir}/*.so.* chmod 0755 ${RPM_BUILD_ROOT}/%{_libdir}/%{name}/*/*.so.* -chmod 0755 ${RPM_BUILD_ROOT}/%{pkg_py_arch}/*.so.* chmod 0644 ${RPM_BUILD_ROOT}/%{tcllibdir}/*/pkgIndex.tcl %clean @@ -244,13 +218,6 @@ rm -rf ${RPM_BUILD_ROOT} %{_libdir}/libseaudit.so.* %dir %{setoolsdir} -%files libs-python -%defattr(-,root,root,-) -%{pkg_py_lib}/ -%ifarch x86_64 ppc64 sparc64 s390x -%{pkg_py_arch}/ -%endif - %files libs-tcl %defattr(-,root,root,-) %dir %{tcllibdir} @@ -312,6 +279,9 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Fri Mar 15 2013 Dan Walsh - 3.3.7-36 +- Drop support for python bindings + * Thu Mar 14 2013 Dan Walsh - 3.3.7-35 - Add support for substituting bools to sesearch and seinfo From 9e94ff2343ae2eff2a5a83b7483fe4604f3f2aad Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Fri, 15 Mar 2013 12:36:46 -0400 Subject: [PATCH 3/7] Drop support for python bindings --- setools.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setools.spec b/setools.spec index 90091d9..d2dd4d0 100644 --- a/setools.spec +++ b/setools.spec @@ -3,7 +3,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 35%{?dist} +Release: 36%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root From 4b5d47d81150c4b9896433d4149c2d4ed06621c1 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Fri, 15 Mar 2013 12:51:27 -0400 Subject: [PATCH 4/7] Drop support for python bindings --- setools.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setools.spec b/setools.spec index d2dd4d0..eb1b704 100644 --- a/setools.spec +++ b/setools.spec @@ -52,7 +52,7 @@ Summary: Policy analysis support libraries for SELinux Group: System Environment/Libraries Requires: libselinux >= %{selinux_ver} libsepol >= %{sepol_ver} sqlite >= %{sqlite_ver} Obsoletes: setools-libs-java -BuildRequires: flex bison pkgconfig +BuildRequires: flex bison pkgconfig bzip2-libs BuildRequires: glibc-devel libstdc++-devel gcc gcc-c++ BuildRequires: libselinux-devel >= %{selinux_ver} libsepol-devel >= %{sepol_ver} BuildRequires: libsepol-static >= %{sepol_ver} From 0dcd573dd368aca39befad646c7d5ca5538048c9 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Mon, 25 Mar 2013 11:44:59 -0400 Subject: [PATCH 5/7] Drop support for python bindings --- setools.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setools.spec b/setools.spec index eb1b704..bce343d 100644 --- a/setools.spec +++ b/setools.spec @@ -52,7 +52,7 @@ Summary: Policy analysis support libraries for SELinux Group: System Environment/Libraries Requires: libselinux >= %{selinux_ver} libsepol >= %{sepol_ver} sqlite >= %{sqlite_ver} Obsoletes: setools-libs-java -BuildRequires: flex bison pkgconfig bzip2-libs +BuildRequires: flex bison pkgconfig bzip2-devel BuildRequires: glibc-devel libstdc++-devel gcc gcc-c++ BuildRequires: libselinux-devel >= %{selinux_ver} libsepol-devel >= %{sepol_ver} BuildRequires: libsepol-static >= %{sepol_ver} From 2d56f95bb7aa91374d7ac637fc337e5e8a8e10c5 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Tue, 26 Mar 2013 22:48:34 +0100 Subject: [PATCH 6/7] Obsolete the removed setools-libs-python subpackage --- setools.spec | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setools.spec b/setools.spec index bce343d..60e4afa 100644 --- a/setools.spec +++ b/setools.spec @@ -3,7 +3,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 36%{?dist} +Release: 37%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -52,6 +52,7 @@ Summary: Policy analysis support libraries for SELinux Group: System Environment/Libraries Requires: libselinux >= %{selinux_ver} libsepol >= %{sepol_ver} sqlite >= %{sqlite_ver} Obsoletes: setools-libs-java +Obsoletes: setools-libs-python < 3.3.7-36 BuildRequires: flex bison pkgconfig bzip2-devel BuildRequires: glibc-devel libstdc++-devel gcc gcc-c++ BuildRequires: libselinux-devel >= %{selinux_ver} libsepol-devel >= %{sepol_ver} @@ -279,6 +280,9 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Wed Mar 27 2013 Kalev Lember - 3.3.7-37 +- Obsolete the removed setools-libs-python subpackage + * Fri Mar 15 2013 Dan Walsh - 3.3.7-36 - Drop support for python bindings From f800905db3ac77371abbd8a80fa2b49dc597c640 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 28 Mar 2013 13:45:10 -0400 Subject: [PATCH 7/7] Add alias support to seinfo -t --- 0015-aliases.patch | 82 ++++++++++++++++++++++++++++++++++++++++++++++ setools.spec | 7 +++- 2 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 0015-aliases.patch diff --git a/0015-aliases.patch b/0015-aliases.patch new file mode 100644 index 0000000..355aff3 --- /dev/null +++ b/0015-aliases.patch @@ -0,0 +1,82 @@ +diff -up setools-3.3.7/libapol/src/policy-query.c~ setools-3.3.7/libapol/src/policy-query.c +diff -up setools-3.3.7/libqpol/include/qpol/type_query.h~ setools-3.3.7/libqpol/include/qpol/type_query.h +diff -up setools-3.3.7/libqpol/tests/iterators-tests.c~ setools-3.3.7/libqpol/tests/iterators-tests.c +diff -up setools-3.3.7/secmds/seinfo.c~ setools-3.3.7/secmds/seinfo.c +--- setools-3.3.7/secmds/seinfo.c~ 2013-03-25 11:30:23.161633059 -0400 ++++ setools-3.3.7/secmds/seinfo.c 2013-03-28 13:08:07.281751011 -0400 +@@ -46,6 +46,7 @@ + #include + #include + #include ++#include + + #define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC" + +@@ -54,6 +55,7 @@ + + static char *policy_file = NULL; + ++static void print_type_aliases(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb); + static void print_type_attrs(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb, const int expand); + static void print_attr_types(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb, const int expand); + static void print_user_roles(FILE * fp, const qpol_user_t * user_datum, const apol_policy_t * policydb, const int expand); +@@ -511,6 +513,7 @@ static int print_types(FILE * fp, const + if (qpol_policy_get_type_by_name(q, name, &type_datum)) + goto cleanup; + print_type_attrs(fp, type_datum, policydb, expand); ++ print_type_aliases(fp, type_datum, policydb); + } else { + if (qpol_policy_get_type_iter(q, &iter)) + goto cleanup; +@@ -1897,6 +1900,51 @@ int main(int argc, char **argv) + } + + /** ++ * Prints the alias of a type. ++ * ++ * @param fp Reference to a file to which to print type information ++ * @param type_datum Reference to sepol type_datum ++ * @param policydb Reference to a policy ++ * attributes ++ */ ++static void print_type_aliases(FILE * fp, const qpol_type_t * type_datum, const apol_policy_t * policydb) ++{ ++ qpol_iterator_t *iter = NULL; ++ size_t alias_size; ++ unsigned char isattr, isalias; ++ const char *type_name = NULL; ++ const char *alias_name; ++ qpol_policy_t *q = apol_policy_get_qpol(policydb); ++ ++ if (qpol_type_get_name(q, type_datum, &type_name)) ++ goto cleanup; ++ if (qpol_type_get_isattr(q, type_datum, &isattr)) ++ goto cleanup; ++ if (qpol_type_get_isalias(q, type_datum, &isalias)) ++ goto cleanup; ++ ++ if (isalias) { ++ fprintf(fp, " TypeName %s\n", type_name); ++ } ++ if (qpol_type_get_alias_iter(q, type_datum, &iter)) ++ goto cleanup; ++ if (qpol_iterator_get_size(iter, &alias_size)) ++ goto cleanup; ++ if (alias_size > 0) { ++ fprintf(fp, " Aliases\n"); ++ for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { ++ if (qpol_iterator_get_item(iter, (void **)&alias_name)) ++ goto cleanup; ++ fprintf(fp, " %s\n", alias_name); ++ } ++ } ++ ++ cleanup: ++ qpol_iterator_destroy(&iter); ++ return; ++} ++ ++/** + * Prints a textual representation of a type, and possibly + * all of that type's attributes. + * diff --git a/setools.spec b/setools.spec index 60e4afa..93a3a48 100644 --- a/setools.spec +++ b/setools.spec @@ -3,7 +3,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 37%{?dist} +Release: 38%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -24,6 +24,7 @@ Patch11: 0011-setools-noship.patch Patch12: 0012-seaudit.patch Patch13: 0013-swig.patch Patch14: 0014-boolsub.patch +Patch15: 0015-aliases.patch Summary: Policy analysis tools for SELinux Group: System Environment/Base @@ -164,6 +165,7 @@ This package includes the following graphical tools: %patch12 -p 1 -b .seaudit %patch13 -p 1 -b .swig %patch14 -p 2 -b .boolsub +%patch15 -p 1 -b .aliases %ifarch sparc sparcv9 sparc64 s390 s390x for file in `find . -name Makefile.am`; do sed -i -e 's:-fpic:-fPIC:' $file; @@ -280,6 +282,9 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Thu Mar 28 2013 Dan Walsh - 3.3.7-38 +- Add alias support to seinfo -t + * Wed Mar 27 2013 Kalev Lember - 3.3.7-37 - Obsolete the removed setools-libs-python subpackage