- Add range to ports in seinfo python
This commit is contained in:
parent
7c3a366a44
commit
457043a49b
2 changed files with 23 additions and 5 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue