From fa877f406029f364bf244b313921baaf0d475ca7 Mon Sep 17 00:00:00 2001 From: Jesse Keating Date: Wed, 17 Feb 2010 03:10:22 +0000 Subject: [PATCH 01/13] Initialize branch F-13 for setools --- branch | 1 + 1 file changed, 1 insertion(+) create mode 100644 branch diff --git a/branch b/branch new file mode 100644 index 0000000..baa94ef --- /dev/null +++ b/branch @@ -0,0 +1 @@ +F-13 From 6755ec81282555892df028ffc912cadf23ae8d57 Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Thu, 27 May 2010 17:36:39 +0000 Subject: [PATCH 02/13] - Add missing bzip2 dependencies. --- .cvsignore | 2 +- setools.spec | 20 ++++++++++++-------- sources | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/.cvsignore b/.cvsignore index dd24e2f..e648632 100644 --- a/.cvsignore +++ b/.cvsignore @@ -1 +1 @@ -setools-3.3.6.tar.bz2 +setools-3.3.7.tar.bz2 diff --git a/setools.spec b/setools.spec index 12ca286..696ae4b 100644 --- a/setools.spec +++ b/setools.spec @@ -1,11 +1,11 @@ %define setools_maj_ver 3.3 -%define setools_min_ver 6 +%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} -Release: 4%{?dist} +Release: 2%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -14,8 +14,7 @@ Source1: setools.pam Source2: apol.desktop Source3: seaudit.desktop Source4: sediffx.desktop -Patch1: setools-qpol.patch -Patch2: setools-python.patch +Patch1: setools-python.patch Summary: Policy analysis tools for SELinux Group: System Environment/Base Requires: setools-libs = %{version}-%{release} setools-libs-tcl = %{version}-%{release} setools-gui = %{version}-%{release} setools-console = %{version}-%{release} @@ -68,8 +67,8 @@ This package includes the following run-time libraries: License: LGPLv2 Summary: Python bindings for SELinux policy analysis Group: Development/Languages -Requires: setools-libs = %{version}-%{release} python2 >= %{python_ver} -BuildRequires: python2-devel >= %{python_ver} swig >= %{swig_ver} +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 @@ -187,8 +186,7 @@ This package includes the following graphical tools: %prep %setup -q -%patch1 -p 1 -b .qpol -%patch2 -p 1 -b .python +%patch1 -p 1 -b .python %build %configure --libdir=%{_libdir} --disable-bwidget-check --disable-selinux-check \ @@ -349,6 +347,12 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Wed May 12 2010 Chris PeBenito 3.3.7-2 +- Add missing bzip2 dependencies. + +* Wed May 12 2010 Chris PeBenito 3.3.7-1 +- New upstream release. + * Tue Aug 11 2009 Dan Walsh 3.3.6-4 - Add python bindings for sesearch and seinfo diff --git a/sources b/sources index c02f87c..1a9fb5f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -93db5be0bfc32519f8e7fbf769542db5 setools-3.3.6.tar.bz2 +206d1b31d1dda4ace2fbf6ce02d13814 setools-3.3.7.tar.bz2 From 27381f3a97aebafe32dea213b12b58e54fc2e927 Mon Sep 17 00:00:00 2001 From: Fedora Release Engineering Date: Thu, 29 Jul 2010 12:37:38 +0000 Subject: [PATCH 03/13] dist-git conversion --- .cvsignore => .gitignore | 0 Makefile | 21 --------------------- branch | 1 - 3 files changed, 22 deletions(-) rename .cvsignore => .gitignore (100%) delete mode 100644 Makefile delete mode 100644 branch diff --git a/.cvsignore b/.gitignore similarity index 100% rename from .cvsignore rename to .gitignore diff --git a/Makefile b/Makefile deleted file mode 100644 index 2af2ceb..0000000 --- a/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# Makefile for source rpm: setools -# $Id: Makefile,v 1.2 2007/10/15 19:22:32 notting Exp $ -NAME := setools -SPECFILE = $(firstword $(wildcard *.spec)) - -define find-makefile-common -for d in common ../common ../../common ; do if [ -f $$d/Makefile.common ] ; then if [ -f $$d/CVS/Root -a -w $$d/Makefile.common ] ; then cd $$d ; cvs -Q update ; fi ; echo "$$d/Makefile.common" ; break ; fi ; done -endef - -MAKEFILE_COMMON := $(shell $(find-makefile-common)) - -ifeq ($(MAKEFILE_COMMON),) -# attempt a checkout -define checkout-makefile-common -test -f CVS/Root && { cvs -Q -d $$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 -endef - -MAKEFILE_COMMON := $(shell $(checkout-makefile-common)) -endif - -include $(MAKEFILE_COMMON) diff --git a/branch b/branch deleted file mode 100644 index baa94ef..0000000 --- a/branch +++ /dev/null @@ -1 +0,0 @@ -F-13 From 7c3a366a44bd374b1b02e4d4ee7aca0f5dea9d9c Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Tue, 17 Aug 2010 10:04:08 -0400 Subject: [PATCH 04/13] - Return range with ports --- setools-python.patch | 231 ++++++++++++++++++++++++++++++++++--------- setools.spec | 21 +++- 2 files changed, 203 insertions(+), 49 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 49c43d0..745eb56 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -1,25 +1,52 @@ -diff -up setools-3.3.6/configure.ac.python setools-3.3.6/configure.ac ---- setools-3.3.6/configure.ac.python 2009-07-22 14:07:35.000000000 -0400 -+++ setools-3.3.6/configure.ac 2009-08-11 13:15:57.000000000 -0400 -@@ -216,6 +216,9 @@ if test "x${enable_jswig}" = xyes; then +diff -up setools-3.3.7/configure.ac.python setools-3.3.7/configure.ac +--- setools-3.3.7/configure.ac.python 2010-04-30 10:25:48.000000000 -0400 ++++ setools-3.3.7/configure.ac 2010-07-30 15:02:10.000000000 -0400 +@@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java, + enable_jswig="$enableval") + if test "x${enable_jswig}" = xyes; then + if test ${do_swigify} = no; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi + AC_JAVA_OPTIONS + if test "x$JAVAPREFIX" = x; then +@@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then do_swigify_java=yes do_swigify=yes fi + -+AM_PATH_PYTHON(2.6) ++AM_PATH_PYTHON(2.7) + AC_ARG_ENABLE(swig-python, AC_HELP_STRING([--enable-swig-python], [build SWIG interfaces for Python]), -@@ -224,7 +227,6 @@ if test "x${enable_pyswig}" = xyes; then + enable_pyswig="$enableval") + if test "x${enable_pyswig}" = xyes; then if test ${do_swigify} = no; then - AC_PROG_SWIG(1.3.28) +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) fi - AM_PATH_PYTHON(2.3) SWIG_PYTHON do_swigify_python=yes do_swigify=yes -@@ -873,6 +875,8 @@ AC_CONFIG_FILES([Makefile VERSION \ + fi + if test ${do_swigify} = "yes"; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi + build_apol=yes + AC_ARG_ENABLE(swig-tcl, +@@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl, + enable_tclswig="$enableval", enable_tclswig="yes") + if test "x${enable_tclswig}" = xyes; then + if test ${do_swigify} = no; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi + TEA_INIT(3.5) + TEA_PATH_TCLCONFIG +@@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \ sediff/Makefile \ man/Makefile \ debian/Makefile \ @@ -28,9 +55,9 @@ diff -up setools-3.3.6/configure.ac.python setools-3.3.6/configure.ac packages/Makefile packages/rpm/Makefile \ packages/libqpol.pc packages/libapol.pc packages/libpoldiff.pc packages/libseaudit.pc packages/libsefs.pc]) -diff -up setools-3.3.6/Makefile.am.python setools-3.3.6/Makefile.am ---- setools-3.3.6/Makefile.am.python 2008-02-22 14:06:28.000000000 -0500 -+++ setools-3.3.6/Makefile.am 2009-08-11 13:15:57.000000000 -0400 +diff -up setools-3.3.7/Makefile.am.python setools-3.3.7/Makefile.am +--- setools-3.3.7/Makefile.am.python 2008-02-22 14:06:28.000000000 -0500 ++++ setools-3.3.7/Makefile.am 2010-07-30 15:02:10.000000000 -0400 @@ -10,7 +10,7 @@ if BUILD_GUI endif # sediffx is also built conditionally, from sediffx/Makefile.am @@ -40,9 +67,9 @@ diff -up setools-3.3.6/Makefile.am.python setools-3.3.6/Makefile.am #old indent opts #INDENT_OPTS = -npro -nbad -bap -sob -ss -l132 -di1 -nbc -br -nbbb -c40 -cd40 -ncdb -ce -cli0 -cp40 -ncs -d0 -nfc1 -nfca -i8 -ts8 -ci8 -lp -ip0 -npcs -npsl -sc -diff -up setools-3.3.6/Makefile.in.python setools-3.3.6/Makefile.in ---- setools-3.3.6/Makefile.in.python 2009-07-22 14:08:36.000000000 -0400 -+++ setools-3.3.6/Makefile.in 2009-08-11 15:14:56.000000000 -0400 +diff -up setools-3.3.7/Makefile.in.python setools-3.3.7/Makefile.in +--- setools-3.3.7/Makefile.in.python 2010-05-12 10:01:09.000000000 -0400 ++++ setools-3.3.7/Makefile.in 2010-07-30 15:02:47.000000000 -0400 @@ -79,7 +79,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGE ETAGS = etags CTAGS = ctags @@ -52,7 +79,7 @@ diff -up setools-3.3.6/Makefile.in.python setools-3.3.6/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) -@@ -384,7 +384,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 +@@ -385,7 +385,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 @BUILD_APOL_TRUE@MAYBE_APOL = apol @BUILD_GUI_TRUE@MAYBE_GUI = seaudit # sediffx is also built conditionally, from sediffx/Makefile.am @@ -61,16 +88,16 @@ diff -up setools-3.3.6/Makefile.in.python setools-3.3.6/Makefile.in #old indent opts #INDENT_OPTS = -npro -nbad -bap -sob -ss -l132 -di1 -nbc -br -nbbb -c40 -cd40 -ncdb -ce -cli0 -cp40 -ncs -d0 -nfc1 -nfca -i8 -ts8 -ci8 -lp -ip0 -npcs -npsl -sc -diff -up /dev/null setools-3.3.6/python/Makefile.am ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/Makefile.am 2009-08-11 15:12:36.000000000 -0400 +diff -up setools-3.3.7/python/Makefile.am.python setools-3.3.7/python/Makefile.am +--- setools-3.3.7/python/Makefile.am.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/Makefile.am 2010-07-30 15:02:10.000000000 -0400 @@ -0,0 +1 @@ +SUBDIRS = setools -diff -up /dev/null setools-3.3.6/python/Makefile.in ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/Makefile.in 2009-08-11 15:14:56.000000000 -0400 -@@ -0,0 +1,715 @@ -+# Makefile.in generated by automake 1.11 from Makefile.am. +diff -up setools-3.3.7/python/Makefile.in.python setools-3.3.7/python/Makefile.in +--- setools-3.3.7/python/Makefile.in.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/Makefile.in 2010-07-30 15:02:46.000000000 -0400 +@@ -0,0 +1,716 @@ ++# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -249,6 +276,7 @@ diff -up /dev/null setools-3.3.6/python/Makefile.in +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ ++PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXBUF_CFLAGS = @PIXBUF_CFLAGS@ @@ -482,7 +510,7 @@ diff -up /dev/null setools-3.3.6/python/Makefile.in +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): -+ @failcom='exit 1'; \ ++ @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ @@ -507,7 +535,7 @@ diff -up /dev/null setools-3.3.6/python/Makefile.in + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): -+ @failcom='exit 1'; \ ++ @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ @@ -785,10 +813,10 @@ diff -up /dev/null setools-3.3.6/python/Makefile.in +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: -diff -up /dev/null setools-3.3.6/python/setools/__init__.py ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/setools/__init__.py 2009-08-11 13:15:57.000000000 -0400 -@@ -0,0 +1,49 @@ +diff -up setools-3.3.7/python/setools/__init__.py.python setools-3.3.7/python/setools/__init__.py +--- setools-3.3.7/python/setools/__init__.py.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/setools/__init__.py 2010-08-03 15:52:27.000000000 -0400 +@@ -0,0 +1,50 @@ +#!/usr/bin/env python + +# Author: Thomas Liu @@ -800,6 +828,7 @@ diff -up /dev/null setools-3.3.6/python/setools/__init__.py +TYPE = _seinfo.TYPE +ROLE = _seinfo.ROLE +ATTRIBUTE = _seinfo.ATTRIBUTE ++PORT = _seinfo.PORT +USER = _seinfo.USER + +ALLOW = 'allow' @@ -838,9 +867,9 @@ diff -up /dev/null setools-3.3.6/python/setools/__init__.py +def seinfo(setype, name=None): + dict_list = _seinfo.seinfo(setype, name) + return dict_list -diff -up /dev/null setools-3.3.6/python/setools/Makefile.am ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/setools/Makefile.am 2009-08-11 17:17:15.000000000 -0400 +diff -up setools-3.3.7/python/setools/Makefile.am.python setools-3.3.7/python/setools/Makefile.am +--- setools-3.3.7/python/setools/Makefile.am.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/setools/Makefile.am 2010-07-30 15:02:10.000000000 -0400 @@ -0,0 +1,36 @@ +EXTRA_DIST = \ + sesearch.c \ @@ -878,11 +907,11 @@ diff -up /dev/null setools-3.3.6/python/setools/Makefile.am + $(PYTHON) setup.py clean -a + rm -f *~ + -diff -up /dev/null setools-3.3.6/python/setools/Makefile.in ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/setools/Makefile.in 2009-08-11 17:17:18.000000000 -0400 -@@ -0,0 +1,549 @@ -+# Makefile.in generated by automake 1.11 from Makefile.am. +diff -up setools-3.3.7/python/setools/Makefile.in.python setools-3.3.7/python/setools/Makefile.in +--- setools-3.3.7/python/setools/Makefile.in.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/setools/Makefile.in 2010-07-30 15:02:46.000000000 -0400 +@@ -0,0 +1,550 @@ ++# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -1021,6 +1050,7 @@ diff -up /dev/null setools-3.3.6/python/setools/Makefile.in +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ ++PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXBUF_CFLAGS = @PIXBUF_CFLAGS@ @@ -1431,10 +1461,10 @@ diff -up /dev/null setools-3.3.6/python/setools/Makefile.in +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: -diff -up /dev/null setools-3.3.6/python/setools/seinfo.c ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/setools/seinfo.c 2009-08-11 16:31:05.000000000 -0400 -@@ -0,0 +1,649 @@ +diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setools/seinfo.c +--- setools-3.3.7/python/setools/seinfo.c.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/setools/seinfo.c 2010-08-03 17:27:28.000000000 -0400 +@@ -0,0 +1,754 @@ +/** + * @file + * Command line tool to search TE rules. @@ -1492,7 +1522,7 @@ diff -up /dev/null setools-3.3.6/python/setools/seinfo.c + +enum input +{ -+ TYPE, ATTRIBUTE, ROLE, USER ++ TYPE, ATTRIBUTE, ROLE, USER, PORT, +}; + +/** @@ -1902,6 +1932,107 @@ diff -up /dev/null setools-3.3.6/python/setools/seinfo.c +} + +/** ++ * Get statistics regarding a policy's ports. ++ * If this function is given a name, it will attempt to ++ * get statistics about a particular port; otherwise ++ * the function get statistics about all of the policy's ports. ++ * ++ * @param name Reference to an port's name; if NULL, ++ * all ports will be considered ++ * @param policydb Reference to a policy ++ * ++ * @return 0 on success, < 0 on error. ++ */ ++static PyObject* get_ports(const char *num, const apol_policy_t * policydb) ++{ ++ PyObject *list = PyList_New(0); ++ int retval = -1; ++ const qpol_portcon_t *portcon = NULL; ++ qpol_iterator_t *iter = NULL; ++ uint16_t low_port, high_port; ++ uint8_t ocon_proto; ++ qpol_policy_t *q = apol_policy_get_qpol(policydb); ++ const qpol_context_t *ctxt = NULL; ++ const char *proto_str; ++ PyObject *dict; ++ const char *type = NULL; ++ PyObject *obj = NULL; ++ apol_context_t *c = NULL; ++ ++ if (qpol_policy_get_portcon_iter(q, &iter)) ++ goto cleanup; ++ ++ for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { ++ if (qpol_iterator_get_item(iter, (void **)&portcon)) ++ goto cleanup; ++ if (qpol_portcon_get_low_port(q, portcon, &low_port)) ++ goto cleanup; ++ if (qpol_portcon_get_high_port(q, portcon, &high_port)) ++ goto cleanup; ++ if (qpol_portcon_get_protocol(q, portcon, &ocon_proto)) ++ goto cleanup; ++ if (num) { ++ if (atoi(num) < low_port || atoi(num) > high_port) ++ continue; ++ } ++ ++ if ((ocon_proto != IPPROTO_TCP) && ++ (ocon_proto != IPPROTO_UDP)) ++ goto cleanup; ++ ++ if (qpol_portcon_get_context(q, portcon, &ctxt)) { ++ PyErr_SetString(PyExc_RuntimeError, "Could not get for port context."); ++ goto cleanup; ++ } ++ ++ if ((proto_str = apol_protocol_to_str(ocon_proto)) == NULL) { ++ PyErr_SetString(PyExc_RuntimeError, "Invalid protocol for port"); ++ goto cleanup; ++ } ++ ++ if ((c = apol_context_create_from_qpol_context(policydb, ctxt)) == NULL) { ++ goto cleanup; ++ } ++ ++ if((type = apol_context_get_type(c)) == NULL) { ++ apol_context_destroy(&c); ++ goto cleanup; ++ } ++ ++ dict = PyDict_New(); ++ obj = PyString_FromString(type); ++ PyDict_SetItemString(dict, "type", obj); ++ Py_DECREF(obj); ++ apol_context_destroy(&c); ++ ++ obj = PyString_FromString(proto_str); ++ PyDict_SetItemString(dict, "protocol", obj); ++ Py_DECREF(obj); ++ ++ obj = PyInt_FromLong(high_port); ++ PyDict_SetItemString(dict, "high", obj); ++ Py_DECREF(obj); ++ ++ obj = PyInt_FromLong(high_port); ++ PyDict_SetItemString(dict, "low", obj); ++ Py_DECREF(obj); ++ ++ PyList_Append(list, dict); ++ Py_DECREF(dict); ++ } ++ retval = 0; ++ cleanup: ++ qpol_iterator_destroy(&iter); ++ ++ if (retval) { ++ Py_DECREF(list); ++ PyErr_SetString(PyExc_RuntimeError,strerror(errno)); ++ return NULL; ++ } ++ return list; ++} ++ ++/** + * Get statistics regarding a policy's roles. + * If this function is given a name, it will attempt to + * get statistics about a particular role; otherwise @@ -2055,6 +2186,9 @@ diff -up /dev/null setools-3.3.6/python/setools/seinfo.c + if (type == USER) + output = get_users(name, policydb); + ++ if (type == PORT) ++ output = get_ports(name, policydb); ++ + apol_policy_destroy(&policydb); + apol_policy_path_destroy(&pol_path); + return output; @@ -2080,13 +2214,14 @@ diff -up /dev/null setools-3.3.6/python/setools/seinfo.c + PyObject *m; + m = Py_InitModule("_seinfo", methods); + PyModule_AddIntConstant(m, "ATTRIBUTE", ATTRIBUTE); ++ PyModule_AddIntConstant(m, "PORT", PORT); + PyModule_AddIntConstant(m, "ROLE", ROLE); + PyModule_AddIntConstant(m, "TYPE", TYPE); + PyModule_AddIntConstant(m, "USER", USER); +} -diff -up /dev/null setools-3.3.6/python/setools/sesearch.c ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/setools/sesearch.c 2009-08-11 16:31:05.000000000 -0400 +diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/setools/sesearch.c +--- setools-3.3.7/python/setools/sesearch.c.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/setools/sesearch.c 2010-07-30 15:02:10.000000000 -0400 @@ -0,0 +1,477 @@ +// Author: Thomas Liu + @@ -2565,9 +2700,9 @@ diff -up /dev/null setools-3.3.6/python/setools/sesearch.c + PyObject *m; + m = Py_InitModule("_sesearch", methods); +} -diff -up /dev/null setools-3.3.6/python/setools/setup.py ---- /dev/null 2009-08-08 15:30:39.325298375 -0400 -+++ setools-3.3.6/python/setools/setup.py 2009-08-11 17:29:42.000000000 -0400 +diff -up setools-3.3.7/python/setools/setup.py.python setools-3.3.7/python/setools/setup.py +--- setools-3.3.7/python/setools/setup.py.python 2010-07-30 15:02:10.000000000 -0400 ++++ setools-3.3.7/python/setools/setup.py 2010-07-30 15:02:10.000000000 -0400 @@ -0,0 +1,25 @@ +#!/usr/bin/env python + diff --git a/setools.spec b/setools.spec index 696ae4b..3d6fcee 100644 --- a/setools.spec +++ b/setools.spec @@ -5,7 +5,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 2%{?dist} +Release: 6%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -188,6 +188,12 @@ This package includes the following graphical tools: %setup -q %patch1 -p 1 -b .python +# Fixup expected version of SWIG: +sed -i -e "s|AC_PROG_SWIG(1.3.28)|AC_PROG_SWIG(2.0.0)|g" configure.ac +# and rebuild the configure script: +autoconf + + %build %configure --libdir=%{_libdir} --disable-bwidget-check --disable-selinux-check \ --enable-swig-python --enable-swig-java --enable-swig-tcl --with-java-prefix=/usr/lib/jvm/java @@ -347,6 +353,19 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Tue Aug 3 2010 Dan Walsh 3.3.6-6 +- Return range with ports + +* Tue Aug 3 2010 Dan Walsh 3.3.6-5 +- Add port support to setools python + +* Mon Jul 26 2010 David Malcolm - 3.3.7-4 +- fixup configure.ac to expect SWIG 2.0.0; bump the python version to 2.7 in +patch 1 + +* Thu Jul 22 2010 David Malcolm - 3.3.7-3 +- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild + * Wed May 12 2010 Chris PeBenito 3.3.7-2 - Add missing bzip2 dependencies. From 457043a49bbcccff0bcf6a8e335e8bf0114988e7 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 19 Aug 2010 06:45:05 -0400 Subject: [PATCH 05/13] - Add range to ports in seinfo python --- setools-python.patch | 23 +++++++++++++++++++---- setools.spec | 5 ++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 745eb56..31631f1 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -1463,8 +1463,8 @@ diff -up setools-3.3.7/python/setools/Makefile.in.python setools-3.3.7/python/se +.NOEXPORT: diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setools/seinfo.c --- setools-3.3.7/python/setools/seinfo.c.python 2010-07-30 15:02:10.000000000 -0400 -+++ setools-3.3.7/python/setools/seinfo.c 2010-08-03 17:27:28.000000000 -0400 -@@ -0,0 +1,754 @@ ++++ setools-3.3.7/python/setools/seinfo.c 2010-08-03 18:07:17.000000000 -0400 +@@ -0,0 +1,769 @@ +/** + * @file + * Command line tool to search TE rules. @@ -1956,6 +1956,8 @@ diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setoo + const char *proto_str; + PyObject *dict; + const char *type = NULL; ++ const apol_mls_range_t *range = NULL; ++ char *range_str = NULL; + PyObject *obj = NULL; + apol_context_t *c = NULL; + @@ -2003,7 +2005,18 @@ diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setoo + obj = PyString_FromString(type); + PyDict_SetItemString(dict, "type", obj); + Py_DECREF(obj); -+ apol_context_destroy(&c); ++ ++ if((range = apol_context_get_range(c)) == NULL) { ++ goto cleanup; ++ } ++ ++ range_str = apol_mls_range_render(policydb, range); ++ if (range_str == NULL) { ++ goto cleanup; ++ } ++ obj = PyString_FromString(range_str); ++ PyDict_SetItemString(dict, "range", obj); ++ Py_DECREF(obj); + + obj = PyString_FromString(proto_str); + PyDict_SetItemString(dict, "protocol", obj); @@ -2013,7 +2026,7 @@ diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setoo + PyDict_SetItemString(dict, "high", obj); + Py_DECREF(obj); + -+ obj = PyInt_FromLong(high_port); ++ obj = PyInt_FromLong(low_port); + PyDict_SetItemString(dict, "low", obj); + Py_DECREF(obj); + @@ -2022,6 +2035,8 @@ diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setoo + } + retval = 0; + cleanup: ++ free(range_str); ++ apol_context_destroy(&c); + qpol_iterator_destroy(&iter); + + if (retval) { diff --git a/setools.spec b/setools.spec index 3d6fcee..92a9691 100644 --- a/setools.spec +++ b/setools.spec @@ -5,7 +5,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 6%{?dist} +Release: 7%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -353,6 +353,9 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Thu Aug 19 2010 Dan Walsh 3.3.6-7 +- Add range to ports in seinfo python + * Tue Aug 3 2010 Dan Walsh 3.3.6-6 - Return range with ports From 44e46ade744f3af2cd4a28d1c831b36c1e86b739 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 19 Aug 2010 07:05:55 -0400 Subject: [PATCH 06/13] - Add range to ports in seinfo python --- setools-python.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setools-python.patch b/setools-python.patch index 31631f1..3785a66 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -15,7 +15,7 @@ diff -up setools-3.3.7/configure.ac.python setools-3.3.7/configure.ac do_swigify=yes fi + -+AM_PATH_PYTHON(2.7) ++AM_PATH_PYTHON(2.6) + AC_ARG_ENABLE(swig-python, AC_HELP_STRING([--enable-swig-python], From dd0662276959c1f3d299c374dcadc732fadc4332 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 19 Aug 2010 07:24:37 -0400 Subject: [PATCH 07/13] - Add range to ports in seinfo python --- setools-python.patch | 45 -------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 3785a66..804981e 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -1,51 +1,6 @@ diff -up setools-3.3.7/configure.ac.python setools-3.3.7/configure.ac --- setools-3.3.7/configure.ac.python 2010-04-30 10:25:48.000000000 -0400 +++ setools-3.3.7/configure.ac 2010-07-30 15:02:10.000000000 -0400 -@@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java, - enable_jswig="$enableval") - if test "x${enable_jswig}" = xyes; then - if test ${do_swigify} = no; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi - AC_JAVA_OPTIONS - if test "x$JAVAPREFIX" = x; then -@@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then - do_swigify_java=yes - do_swigify=yes - fi -+ -+AM_PATH_PYTHON(2.6) -+ - AC_ARG_ENABLE(swig-python, - AC_HELP_STRING([--enable-swig-python], - [build SWIG interfaces for Python]), - enable_pyswig="$enableval") - if test "x${enable_pyswig}" = xyes; then - if test ${do_swigify} = no; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi -- AM_PATH_PYTHON(2.3) - SWIG_PYTHON - do_swigify_python=yes - do_swigify=yes - fi - if test ${do_swigify} = "yes"; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi - build_apol=yes - AC_ARG_ENABLE(swig-tcl, -@@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl, - enable_tclswig="$enableval", enable_tclswig="yes") - if test "x${enable_tclswig}" = xyes; then - if test ${do_swigify} = no; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi - TEA_INIT(3.5) - TEA_PATH_TCLCONFIG @@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \ sediff/Makefile \ man/Makefile \ From 55d66d0743b0e5ce202cc389e719b5ff18eb4997 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Wed, 1 Sep 2010 10:38:55 -0400 Subject: [PATCH 08/13] - Add range to ports in seinfo python --- setools.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/setools.spec b/setools.spec index 92a9691..9dae959 100644 --- a/setools.spec +++ b/setools.spec @@ -188,9 +188,6 @@ This package includes the following graphical tools: %setup -q %patch1 -p 1 -b .python -# Fixup expected version of SWIG: -sed -i -e "s|AC_PROG_SWIG(1.3.28)|AC_PROG_SWIG(2.0.0)|g" configure.ac -# and rebuild the configure script: autoconf From 26a5d87ff2d2a51c4a4e3c5ca3352044338f4631 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 14 Oct 2010 14:25:53 -0400 Subject: [PATCH 09/13] - Return None when no records match python setools.sesearch --- setools-python.patch | 55 ++++++++++++++++++++++++++++++++++++++++---- setools.spec | 8 ++++++- 2 files changed, 58 insertions(+), 5 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 804981e..01cb56a 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -1,6 +1,51 @@ diff -up setools-3.3.7/configure.ac.python setools-3.3.7/configure.ac --- setools-3.3.7/configure.ac.python 2010-04-30 10:25:48.000000000 -0400 +++ setools-3.3.7/configure.ac 2010-07-30 15:02:10.000000000 -0400 +@@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java, + enable_jswig="$enableval") + if test "x${enable_jswig}" = xyes; then + if test ${do_swigify} = no; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi + AC_JAVA_OPTIONS + if test "x$JAVAPREFIX" = x; then +@@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then + do_swigify_java=yes + do_swigify=yes + fi ++ ++AM_PATH_PYTHON(2.7) ++ + AC_ARG_ENABLE(swig-python, + AC_HELP_STRING([--enable-swig-python], + [build SWIG interfaces for Python]), + enable_pyswig="$enableval") + if test "x${enable_pyswig}" = xyes; then + if test ${do_swigify} = no; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi +- AM_PATH_PYTHON(2.3) + SWIG_PYTHON + do_swigify_python=yes + do_swigify=yes + fi + if test ${do_swigify} = "yes"; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi + build_apol=yes + AC_ARG_ENABLE(swig-tcl, +@@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl, + enable_tclswig="$enableval", enable_tclswig="yes") + if test "x${enable_tclswig}" = xyes; then + if test ${do_swigify} = no; then +- AC_PROG_SWIG(1.3.28) ++ AC_PROG_SWIG(2.0.0) + fi + TEA_INIT(3.5) + TEA_PATH_TCLCONFIG @@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \ sediff/Makefile \ man/Makefile \ @@ -2191,8 +2236,8 @@ diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setoo +} diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/setools/sesearch.c --- setools-3.3.7/python/setools/sesearch.c.python 2010-07-30 15:02:10.000000000 -0400 -+++ setools-3.3.7/python/setools/sesearch.c 2010-07-30 15:02:10.000000000 -0400 -@@ -0,0 +1,477 @@ ++++ setools-3.3.7/python/setools/sesearch.c 2010-10-14 11:04:53.000000000 -0400 +@@ -0,0 +1,479 @@ +// Author: Thomas Liu + +/** @@ -2611,6 +2656,7 @@ diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/set + goto cleanup; + } + if (v) { ++ printf("Dan 1\n"); + output = get_av_results(policy, &cmd_opts, v); + } + apol_vector_destroy(&v); @@ -2626,8 +2672,9 @@ diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/set + free(cmd_opts.tgt_role_name); + apol_vector_destroy(&cmd_opts.perm_vector); + apol_vector_destroy(&cmd_opts.class_vector); -+ -+ return output; ++ ++ if (output) return output; ++ return Py_None; +} +static int Dict_ContainsInt(PyObject *dict, const char *key){ + PyObject *item = PyDict_GetItemString(dict, key); diff --git a/setools.spec b/setools.spec index 9dae959..6d8e2b6 100644 --- a/setools.spec +++ b/setools.spec @@ -5,7 +5,7 @@ Name: setools Version: %{setools_maj_ver}.%{setools_min_ver} -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2 URL: http://oss.tresys.com/projects/setools BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root @@ -188,6 +188,9 @@ This package includes the following graphical tools: %setup -q %patch1 -p 1 -b .python +# Fixup expected version of SWIG: +sed -i -e "s|AC_PROG_SWIG(1.3.28)|AC_PROG_SWIG(2.0.0)|g" configure.ac +# and rebuild the configure script: autoconf @@ -350,6 +353,9 @@ rm -rf ${RPM_BUILD_ROOT} %postun libs-tcl -p /sbin/ldconfig %changelog +* Thu Oct 14 2010 Dan Walsh 3.3.6-8 +- Return None when no records match python setools.sesearch + * Thu Aug 19 2010 Dan Walsh 3.3.6-7 - Add range to ports in seinfo python From 98437ee95afdecc0633003394a6e8a45a69758d7 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 14 Oct 2010 14:32:27 -0400 Subject: [PATCH 10/13] - Return None when no records match python setools.sesearch --- setools-python.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 01cb56a..690cf57 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -815,7 +815,7 @@ diff -up setools-3.3.7/python/Makefile.in.python setools-3.3.7/python/Makefile.i +.NOEXPORT: diff -up setools-3.3.7/python/setools/__init__.py.python setools-3.3.7/python/setools/__init__.py --- setools-3.3.7/python/setools/__init__.py.python 2010-07-30 15:02:10.000000000 -0400 -+++ setools-3.3.7/python/setools/__init__.py 2010-08-03 15:52:27.000000000 -0400 ++++ setools-3.3.7/python/setools/__init__.py 2010-10-14 14:31:06.000000000 -0400 @@ -0,0 +1,50 @@ +#!/usr/bin/env python + @@ -854,7 +854,7 @@ diff -up setools-3.3.7/python/setools/__init__.py.python setools-3.3.7/python/se + + + dict_list = _sesearch.sesearch(info) -+ if len(perms) != 0: ++ if dict_list and len(perms) != 0: + dict_list = filter(lambda x: dict_has_perms(x, perms), dict_list) + return dict_list + From f03c2be12aa53db5fce78e59aac7bdc9d6e0d71d Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 14 Oct 2010 14:35:32 -0400 Subject: [PATCH 11/13] - Return None when no records match python setools.sesearch --- setools-python.patch | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 690cf57..6d13af6 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -2236,8 +2236,8 @@ diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setoo +} diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/setools/sesearch.c --- setools-3.3.7/python/setools/sesearch.c.python 2010-07-30 15:02:10.000000000 -0400 -+++ setools-3.3.7/python/setools/sesearch.c 2010-10-14 11:04:53.000000000 -0400 -@@ -0,0 +1,479 @@ ++++ setools-3.3.7/python/setools/sesearch.c 2010-10-14 14:34:47.000000000 -0400 +@@ -0,0 +1,478 @@ +// Author: Thomas Liu + +/** @@ -2656,7 +2656,6 @@ diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/set + goto cleanup; + } + if (v) { -+ printf("Dan 1\n"); + output = get_av_results(policy, &cmd_opts, v); + } + apol_vector_destroy(&v); From 896cad265fa5da2c42efa90d8d6198e34df55496 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 14 Oct 2010 15:06:59 -0400 Subject: [PATCH 12/13] - Return None when no records match python setools.sesearch --- setools-python.patch | 45 -------------------------------------------- 1 file changed, 45 deletions(-) diff --git a/setools-python.patch b/setools-python.patch index 6d13af6..14a8cc1 100644 --- a/setools-python.patch +++ b/setools-python.patch @@ -1,51 +1,6 @@ diff -up setools-3.3.7/configure.ac.python setools-3.3.7/configure.ac --- setools-3.3.7/configure.ac.python 2010-04-30 10:25:48.000000000 -0400 +++ setools-3.3.7/configure.ac 2010-07-30 15:02:10.000000000 -0400 -@@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java, - enable_jswig="$enableval") - if test "x${enable_jswig}" = xyes; then - if test ${do_swigify} = no; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi - AC_JAVA_OPTIONS - if test "x$JAVAPREFIX" = x; then -@@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then - do_swigify_java=yes - do_swigify=yes - fi -+ -+AM_PATH_PYTHON(2.7) -+ - AC_ARG_ENABLE(swig-python, - AC_HELP_STRING([--enable-swig-python], - [build SWIG interfaces for Python]), - enable_pyswig="$enableval") - if test "x${enable_pyswig}" = xyes; then - if test ${do_swigify} = no; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi -- AM_PATH_PYTHON(2.3) - SWIG_PYTHON - do_swigify_python=yes - do_swigify=yes - fi - if test ${do_swigify} = "yes"; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi - build_apol=yes - AC_ARG_ENABLE(swig-tcl, -@@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl, - enable_tclswig="$enableval", enable_tclswig="yes") - if test "x${enable_tclswig}" = xyes; then - if test ${do_swigify} = no; then -- AC_PROG_SWIG(1.3.28) -+ AC_PROG_SWIG(2.0.0) - fi - TEA_INIT(3.5) - TEA_PATH_TCLCONFIG @@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \ sediff/Makefile \ man/Makefile \ From ebe983dc9a24c0c07fc00082d8177a2f960e6e99 Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Thu, 14 Oct 2010 15:21:13 -0400 Subject: [PATCH 13/13] - Return None when no records match python setools.sesearch --- setools.spec | 3 --- 1 file changed, 3 deletions(-) diff --git a/setools.spec b/setools.spec index 6d8e2b6..3d18329 100644 --- a/setools.spec +++ b/setools.spec @@ -188,9 +188,6 @@ This package includes the following graphical tools: %setup -q %patch1 -p 1 -b .python -# Fixup expected version of SWIG: -sed -i -e "s|AC_PROG_SWIG(1.3.28)|AC_PROG_SWIG(2.0.0)|g" configure.ac -# and rebuild the configure script: autoconf