[setools/f13/master] - Add range to ports in seinfo python

Daniel J Walsh dwalsh at fedoraproject.org
Thu Aug 19 10:45:12 UTC 2010


commit 457043a49bbcccff0bcf6a8e335e8bf0114988e7
Author: Dan Walsh <dwalsh at redhat.com>
Date:   Thu Aug 19 06:45:05 2010 -0400

    - 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 <dwalsh at redhat.com> 3.3.6-7
+- Add range to ports in seinfo python
+
 * Tue Aug 3 2010 Dan Walsh <dwalsh at redhat.com> 3.3.6-6
 - Return range with ports
 


More information about the scm-commits mailing list