0fd180
From 32e8d1d3619dcdb40431c7eae3fe00efaae089c6 Mon Sep 17 00:00:00 2001
0fd180
From: Dan Walsh <dwalsh@redhat.com>
0fd180
Date: Tue, 20 Sep 2011 15:38:50 -0400
0fd180
Subject: [PATCH 1/6] add-setools-seinfo-and-sesearch-python-bindings
0fd180
0fd180
---
0fd180
 Makefile.am                |    2 +-
0fd180
 configure.ac               |   14 +-
0fd180
 python/Makefile.am         |    1 +
0fd180
 python/Makefile.in         |  716 +++++++++++++++++++++++++++++++++++++++++
0fd180
 python/setools/Makefile.am |   36 ++
0fd180
 python/setools/Makefile.in |  550 +++++++++++++++++++++++++++++++
0fd180
 python/setools/__init__.py |   50 +++
0fd180
 python/setools/seinfo.c    |  769 ++++++++++++++++++++++++++++++++++++++++++++
0fd180
 python/setools/sesearch.c  |  478 +++++++++++++++++++++++++++
0fd180
 python/setools/setup.py    |   25 ++
0fd180
 11 files changed, 2635 insertions(+), 8 deletions(-)
0fd180
 create mode 100644 python/Makefile.am
0fd180
 create mode 100644 python/Makefile.in
0fd180
 create mode 100644 python/setools/Makefile.am
0fd180
 create mode 100644 python/setools/Makefile.in
0fd180
 create mode 100644 python/setools/__init__.py
0fd180
 create mode 100644 python/setools/seinfo.c
0fd180
 create mode 100644 python/setools/sesearch.c
0fd180
 create mode 100644 python/setools/setup.py
0fd180
0fd180
diff --git a/Makefile.am b/Makefile.am
0fd180
index 5dc1b5d..176c8ea 100644
0fd180
--- a/Makefile.am
0fd180
+++ b/Makefile.am
0fd180
@@ -10,7 +10,7 @@ if BUILD_GUI
0fd180
 endif
0fd180
 # sediffx is also built conditionally, from sediffx/Makefile.am
0fd180
 
0fd180
-SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI)
0fd180
+SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) python
0fd180
 
0fd180
 #old indent opts
0fd180
 #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
0fd180
diff --git a/configure.ac b/configure.ac
0fd180
index b885981..e837e03 100644
0fd180
--- a/configure.ac
0fd180
+++ b/configure.ac
0fd180
@@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java,
0fd180
               enable_jswig="$enableval")
0fd180
 if test "x${enable_jswig}" = xyes; then
0fd180
    if test ${do_swigify} = no; then
0fd180
-      AC_PROG_SWIG(1.3.28)
0fd180
+      AC_PROG_SWIG(2.0.0)
0fd180
    fi
0fd180
    AC_JAVA_OPTIONS
0fd180
    if test "x$JAVAPREFIX" = x; then
0fd180
@@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then
0fd180
    do_swigify_java=yes
0fd180
    do_swigify=yes
0fd180
 fi
0fd180
+
0fd180
+AM_PATH_PYTHON(2.7)
0fd180
+
0fd180
 AC_ARG_ENABLE(swig-python,
0fd180
               AC_HELP_STRING([--enable-swig-python],
0fd180
                              [build SWIG interfaces for Python]),
0fd180
               enable_pyswig="$enableval")
0fd180
 if test "x${enable_pyswig}" = xyes; then
0fd180
    if test ${do_swigify} = no; then
0fd180
-      AC_PROG_SWIG(1.3.28)
0fd180
+      AC_PROG_SWIG(2.0.0)
0fd180
    fi
0fd180
-   AM_PATH_PYTHON(2.3)
0fd180
    SWIG_PYTHON
0fd180
    do_swigify_python=yes
0fd180
    do_swigify=yes
0fd180
 fi
0fd180
 if test ${do_swigify} = "yes"; then
0fd180
-   AC_PROG_SWIG(1.3.28)
0fd180
+   AC_PROG_SWIG(2.0.0)
0fd180
 fi
0fd180
 build_apol=yes
0fd180
 AC_ARG_ENABLE(swig-tcl,
0fd180
@@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl,
0fd180
               enable_tclswig="$enableval", enable_tclswig="yes")
0fd180
 if test "x${enable_tclswig}" = xyes; then
0fd180
    if test ${do_swigify} = no; then
0fd180
-      AC_PROG_SWIG(1.3.28)
0fd180
+      AC_PROG_SWIG(2.0.0)
0fd180
    fi
0fd180
    TEA_INIT(3.5)
0fd180
    TEA_PATH_TCLCONFIG
0fd180
@@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \
0fd180
                  sediff/Makefile \
0fd180
                  man/Makefile \
0fd180
                  debian/Makefile \
0fd180
+   		 python/Makefile \
0fd180
+   		 python/setools/Makefile \
0fd180
                  packages/Makefile packages/rpm/Makefile \
0fd180
                  packages/libqpol.pc packages/libapol.pc packages/libpoldiff.pc packages/libseaudit.pc packages/libsefs.pc])
0fd180
 
0fd180
diff --git a/python/Makefile.am b/python/Makefile.am
0fd180
new file mode 100644
0fd180
index 0000000..a1510c8
0fd180
--- /dev/null
0fd180
+++ b/python/Makefile.am
0fd180
@@ -0,0 +1 @@
0fd180
+SUBDIRS = setools
0fd180
diff --git a/python/Makefile.in b/python/Makefile.in
0fd180
new file mode 100644
0fd180
index 0000000..48c87ab
0fd180
--- /dev/null
0fd180
+++ b/python/Makefile.in
0fd180
@@ -0,0 +1,716 @@
0fd180
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
0fd180
+# @configure_input@
0fd180
+
0fd180
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
0fd180
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
0fd180
+# Inc.
0fd180
+# This Makefile.in is free software; the Free Software Foundation
0fd180
+# gives unlimited permission to copy and/or distribute it,
0fd180
+# with or without modifications, as long as this notice is preserved.
0fd180
+
0fd180
+# This program is distributed in the hope that it will be useful,
0fd180
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
0fd180
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0fd180
+# PARTICULAR PURPOSE.
0fd180
+
0fd180
+@SET_MAKE@
0fd180
+VPATH = @srcdir@
0fd180
+pkgdatadir = $(datadir)/@PACKAGE@
0fd180
+pkgincludedir = $(includedir)/@PACKAGE@
0fd180
+pkglibdir = $(libdir)/@PACKAGE@
0fd180
+pkglibexecdir = $(libexecdir)/@PACKAGE@
0fd180
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
0fd180
+install_sh_DATA = $(install_sh) -c -m 644
0fd180
+install_sh_PROGRAM = $(install_sh) -c
0fd180
+install_sh_SCRIPT = $(install_sh) -c
0fd180
+INSTALL_HEADER = $(INSTALL_DATA)
0fd180
+transform = $(program_transform_name)
0fd180
+NORMAL_INSTALL = :
0fd180
+PRE_INSTALL = :
0fd180
+POST_INSTALL = :
0fd180
+NORMAL_UNINSTALL = :
0fd180
+PRE_UNINSTALL = :
0fd180
+POST_UNINSTALL = :
0fd180
+build_triplet = @build@
0fd180
+host_triplet = @host@
0fd180
+subdir = python
0fd180
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
0fd180
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
0fd180
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_classpath.m4 \
0fd180
+	$(top_srcdir)/m4/ac_java_options.m4 \
0fd180
+	$(top_srcdir)/m4/ac_pkg_swig.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_jar.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_java.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_java_works.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_javac.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_javac_works.m4 \
0fd180
+	$(top_srcdir)/m4/ac_python_devel.m4 $(top_srcdir)/m4/c.m4 \
0fd180
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
0fd180
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
0fd180
+	$(top_srcdir)/m4/lt~obsolete.m4 \
0fd180
+	$(top_srcdir)/m4/swig_python.m4 $(top_srcdir)/m4/tcl.m4 \
0fd180
+	$(top_srcdir)/configure.ac
0fd180
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
0fd180
+	$(ACLOCAL_M4)
0fd180
+mkinstalldirs = $(install_sh) -d
0fd180
+CONFIG_HEADER = $(top_builddir)/config.h
0fd180
+CONFIG_CLEAN_FILES =
0fd180
+CONFIG_CLEAN_VPATH_FILES =
0fd180
+SOURCES =
0fd180
+DIST_SOURCES =
0fd180
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
0fd180
+	html-recursive info-recursive install-data-recursive \
0fd180
+	install-dvi-recursive install-exec-recursive \
0fd180
+	install-html-recursive install-info-recursive \
0fd180
+	install-pdf-recursive install-ps-recursive install-recursive \
0fd180
+	installcheck-recursive installdirs-recursive pdf-recursive \
0fd180
+	ps-recursive uninstall-recursive
0fd180
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
0fd180
+  distclean-recursive maintainer-clean-recursive
0fd180
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
0fd180
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
0fd180
+	distdir
0fd180
+ETAGS = etags
0fd180
+CTAGS = ctags
0fd180
+DIST_SUBDIRS = $(SUBDIRS)
0fd180
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
0fd180
+am__relativize = \
0fd180
+  dir0=`pwd`; \
0fd180
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
0fd180
+  sed_rest='s,^[^/]*/*,,'; \
0fd180
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
0fd180
+  sed_butlast='s,/*[^/]*$$,,'; \
0fd180
+  while test -n "$$dir1"; do \
0fd180
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
0fd180
+    if test "$$first" != "."; then \
0fd180
+      if test "$$first" = ".."; then \
0fd180
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
0fd180
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
0fd180
+      else \
0fd180
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
0fd180
+        if test "$$first2" = "$$first"; then \
0fd180
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
0fd180
+        else \
0fd180
+          dir2="../$$dir2"; \
0fd180
+        fi; \
0fd180
+        dir0="$$dir0"/"$$first"; \
0fd180
+      fi; \
0fd180
+    fi; \
0fd180
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
0fd180
+  done; \
0fd180
+  reldir="$$dir2"
0fd180
+ACLOCAL = @ACLOCAL@
0fd180
+AMTAR = @AMTAR@
0fd180
+APOL_CFLAGS = @APOL_CFLAGS@
0fd180
+APOL_LIB_FLAG = @APOL_LIB_FLAG@
0fd180
+AR = @AR@
0fd180
+AUTOCONF = @AUTOCONF@
0fd180
+AUTOHEADER = @AUTOHEADER@
0fd180
+AUTOMAKE = @AUTOMAKE@
0fd180
+AWK = @AWK@
0fd180
+BWIDGET_DESTDIR = @BWIDGET_DESTDIR@
0fd180
+CC = @CC@
0fd180
+CCDEPMODE = @CCDEPMODE@
0fd180
+CFLAGS = @CFLAGS@
0fd180
+CPP = @CPP@
0fd180
+CPPFLAGS = @CPPFLAGS@
0fd180
+CUNIT_LIB_FLAG = @CUNIT_LIB_FLAG@
0fd180
+CXX = @CXX@
0fd180
+CXXCPP = @CXXCPP@
0fd180
+CXXDEPMODE = @CXXDEPMODE@
0fd180
+CXXFLAGS = @CXXFLAGS@
0fd180
+CYGPATH = @CYGPATH@
0fd180
+CYGPATH_W = @CYGPATH_W@
0fd180
+DEBUGCFLAGS = @DEBUGCFLAGS@
0fd180
+DEBUGCXXFLAGS = @DEBUGCXXFLAGS@
0fd180
+DEBUGJFLAGS = @DEBUGJFLAGS@
0fd180
+DEBUGLDFLAGS = @DEBUGLDFLAGS@
0fd180
+DEFS = @DEFS@
0fd180
+DEPDIR = @DEPDIR@
0fd180
+DSYMUTIL = @DSYMUTIL@
0fd180
+DUMPBIN = @DUMPBIN@
0fd180
+ECHO_C = @ECHO_C@
0fd180
+ECHO_N = @ECHO_N@
0fd180
+ECHO_T = @ECHO_T@
0fd180
+EGREP = @EGREP@
0fd180
+EXEEXT = @EXEEXT@
0fd180
+FGREP = @FGREP@
0fd180
+GLADE_CFLAGS = @GLADE_CFLAGS@
0fd180
+GLADE_LIBS = @GLADE_LIBS@
0fd180
+GREP = @GREP@
0fd180
+GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
0fd180
+GTHREAD_LIBS = @GTHREAD_LIBS@
0fd180
+GTK_CFLAGS = @GTK_CFLAGS@
0fd180
+GTK_LIBS = @GTK_LIBS@
0fd180
+INSTALL = @INSTALL@
0fd180
+INSTALL_DATA = @INSTALL_DATA@
0fd180
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
0fd180
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
0fd180
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
0fd180
+JAR = @JAR@
0fd180
+JAVA = @JAVA@
0fd180
+JAVAC = @JAVAC@
0fd180
+JAVACFLAGS = @JAVACFLAGS@
0fd180
+JAVAFLAGS = @JAVAFLAGS@
0fd180
+JAVAPREFIX = @JAVAPREFIX@
0fd180
+LD = @LD@
0fd180
+LDFLAGS = @LDFLAGS@
0fd180
+LEX = @LEX@
0fd180
+LEXLIB = @LEXLIB@
0fd180
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
0fd180
+LIBOBJS = @LIBOBJS@
0fd180
+LIBS = @LIBS@
0fd180
+LIBTOOL = @LIBTOOL@
0fd180
+LIPO = @LIPO@
0fd180
+LN_S = @LN_S@
0fd180
+LTLIBOBJS = @LTLIBOBJS@
0fd180
+MAKEINFO = @MAKEINFO@
0fd180
+MKDIR_P = @MKDIR_P@
0fd180
+NM = @NM@
0fd180
+NMEDIT = @NMEDIT@
0fd180
+OBJDUMP = @OBJDUMP@
0fd180
+OBJEXT = @OBJEXT@
0fd180
+OTOOL = @OTOOL@
0fd180
+OTOOL64 = @OTOOL64@
0fd180
+PACKAGE = @PACKAGE@
0fd180
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
0fd180
+PACKAGE_NAME = @PACKAGE_NAME@
0fd180
+PACKAGE_STRING = @PACKAGE_STRING@
0fd180
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
0fd180
+PACKAGE_URL = @PACKAGE_URL@
0fd180
+PACKAGE_VERSION = @PACKAGE_VERSION@
0fd180
+PATH_SEPARATOR = @PATH_SEPARATOR@
0fd180
+PIXBUF_CFLAGS = @PIXBUF_CFLAGS@
0fd180
+PIXBUF_LIBS = @PIXBUF_LIBS@
0fd180
+PKG_CFLAGS = @PKG_CFLAGS@
0fd180
+PKG_HEADERS = @PKG_HEADERS@
0fd180
+PKG_INCLUDES = @PKG_INCLUDES@
0fd180
+PKG_LIBS = @PKG_LIBS@
0fd180
+PKG_LIB_FILE = @PKG_LIB_FILE@
0fd180
+PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
0fd180
+PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
0fd180
+PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
0fd180
+PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
0fd180
+POLDIFF_CFLAGS = @POLDIFF_CFLAGS@
0fd180
+POLDIFF_LIB_FLAG = @POLDIFF_LIB_FLAG@
0fd180
+PROFILECFLAGS = @PROFILECFLAGS@
0fd180
+PROFILELDFLAGS = @PROFILELDFLAGS@
0fd180
+PYTHON = @PYTHON@
0fd180
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
0fd180
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
0fd180
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
0fd180
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
0fd180
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
0fd180
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
0fd180
+PYTHON_PREFIX = @PYTHON_PREFIX@
0fd180
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
0fd180
+PYTHON_VERSION = @PYTHON_VERSION@
0fd180
+QPOL_CFLAGS = @QPOL_CFLAGS@
0fd180
+QPOL_LIB_FLAG = @QPOL_LIB_FLAG@
0fd180
+RANLIB = @RANLIB@
0fd180
+SEAUDIT_CFLAGS = @SEAUDIT_CFLAGS@
0fd180
+SEAUDIT_LIB_FLAG = @SEAUDIT_LIB_FLAG@
0fd180
+SED = @SED@
0fd180
+SEFS_CFLAGS = @SEFS_CFLAGS@
0fd180
+SEFS_LIB_FLAG = @SEFS_LIB_FLAG@
0fd180
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
0fd180
+SELINUX_LIB_FLAG = @SELINUX_LIB_FLAG@
0fd180
+SET_MAKE = @SET_MAKE@
0fd180
+SHELL = @SHELL@
0fd180
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
0fd180
+SQLITE3_LIBS = @SQLITE3_LIBS@
0fd180
+STRIP = @STRIP@
0fd180
+SWIG = @SWIG@
0fd180
+SWIG_JAVA_CFLAGS = @SWIG_JAVA_CFLAGS@
0fd180
+SWIG_JAVA_OPT = @SWIG_JAVA_OPT@
0fd180
+SWIG_LIB = @SWIG_LIB@
0fd180
+SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@
0fd180
+SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
0fd180
+SWIG_TCL_CFLAGS = @SWIG_TCL_CFLAGS@
0fd180
+SWIG_TCL_OPT = @SWIG_TCL_OPT@
0fd180
+TCLSH_PROG = @TCLSH_PROG@
0fd180
+TCL_AUTOPATH = @TCL_AUTOPATH@
0fd180
+TCL_BIN_DIR = @TCL_BIN_DIR@
0fd180
+TCL_DEFS = @TCL_DEFS@
0fd180
+TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
0fd180
+TCL_INCLUDES = @TCL_INCLUDES@
0fd180
+TCL_LD_FLAGS = @TCL_LD_FLAGS@
0fd180
+TCL_LIBS = @TCL_LIBS@
0fd180
+TCL_LIB_FILE = @TCL_LIB_FILE@
0fd180
+TCL_LIB_FLAG = @TCL_LIB_FLAG@
0fd180
+TCL_LIB_SPEC = @TCL_LIB_SPEC@
0fd180
+TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
0fd180
+TCL_SRC_DIR = @TCL_SRC_DIR@
0fd180
+TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
0fd180
+TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
0fd180
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
0fd180
+TCL_VERSION = @TCL_VERSION@
0fd180
+TK_BIN_DIR = @TK_BIN_DIR@
0fd180
+TK_INCLUDES = @TK_INCLUDES@
0fd180
+TK_LIBS = @TK_LIBS@
0fd180
+TK_LIB_FILE = @TK_LIB_FILE@
0fd180
+TK_LIB_FLAG = @TK_LIB_FLAG@
0fd180
+TK_LIB_SPEC = @TK_LIB_SPEC@
0fd180
+TK_SRC_DIR = @TK_SRC_DIR@
0fd180
+TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
0fd180
+TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
0fd180
+TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
0fd180
+TK_VERSION = @TK_VERSION@
0fd180
+TK_XINCLUDES = @TK_XINCLUDES@
0fd180
+VERSION = @VERSION@
0fd180
+WARNCFLAGS = @WARNCFLAGS@
0fd180
+WARNCXXFLAGS = @WARNCXXFLAGS@
0fd180
+WARNJFLAGS = @WARNJFLAGS@
0fd180
+WARNLDFLAGS = @WARNLDFLAGS@
0fd180
+WISH_PROG = @WISH_PROG@
0fd180
+XMKMF = @XMKMF@
0fd180
+XML_CFLAGS = @XML_CFLAGS@
0fd180
+XML_LIBS = @XML_LIBS@
0fd180
+YACC = @YACC@
0fd180
+YFLAGS = @YFLAGS@
0fd180
+abs_builddir = @abs_builddir@
0fd180
+abs_srcdir = @abs_srcdir@
0fd180
+abs_top_builddir = @abs_top_builddir@
0fd180
+abs_top_srcdir = @abs_top_srcdir@
0fd180
+ac_ct_CC = @ac_ct_CC@
0fd180
+ac_ct_CXX = @ac_ct_CXX@
0fd180
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
0fd180
+am__include = @am__include@
0fd180
+am__leading_dot = @am__leading_dot@
0fd180
+am__quote = @am__quote@
0fd180
+am__tar = @am__tar@
0fd180
+am__untar = @am__untar@
0fd180
+bindir = @bindir@
0fd180
+build = @build@
0fd180
+build_alias = @build_alias@
0fd180
+build_cpu = @build_cpu@
0fd180
+build_os = @build_os@
0fd180
+build_vendor = @build_vendor@
0fd180
+builddir = @builddir@
0fd180
+datadir = @datadir@
0fd180
+datarootdir = @datarootdir@
0fd180
+docdir = @docdir@
0fd180
+dvidir = @dvidir@
0fd180
+exec_prefix = @exec_prefix@
0fd180
+has_pkg_config = @has_pkg_config@
0fd180
+host = @host@
0fd180
+host_alias = @host_alias@
0fd180
+host_cpu = @host_cpu@
0fd180
+host_os = @host_os@
0fd180
+host_vendor = @host_vendor@
0fd180
+htmldir = @htmldir@
0fd180
+includedir = @includedir@
0fd180
+infodir = @infodir@
0fd180
+install_sh = @install_sh@
0fd180
+javadir = @javadir@
0fd180
+libapol_jswig_soname = @libapol_jswig_soname@
0fd180
+libapol_pyswig_soname = @libapol_pyswig_soname@
0fd180
+libapol_soname = @libapol_soname@
0fd180
+libapol_soversion = @libapol_soversion@
0fd180
+libapol_tswig_soname = @libapol_tswig_soname@
0fd180
+libapol_version = @libapol_version@
0fd180
+libdir = @libdir@
0fd180
+libexecdir = @libexecdir@
0fd180
+libpoldiff_jswig_soname = @libpoldiff_jswig_soname@
0fd180
+libpoldiff_pyswig_soname = @libpoldiff_pyswig_soname@
0fd180
+libpoldiff_soname = @libpoldiff_soname@
0fd180
+libpoldiff_soversion = @libpoldiff_soversion@
0fd180
+libpoldiff_tswig_soname = @libpoldiff_tswig_soname@
0fd180
+libpoldiff_version = @libpoldiff_version@
0fd180
+libqpol_jswig_soname = @libqpol_jswig_soname@
0fd180
+libqpol_pyswig_soname = @libqpol_pyswig_soname@
0fd180
+libqpol_soname = @libqpol_soname@
0fd180
+libqpol_soversion = @libqpol_soversion@
0fd180
+libqpol_tswig_soname = @libqpol_tswig_soname@
0fd180
+libqpol_version = @libqpol_version@
0fd180
+libseaudit_jswig_soname = @libseaudit_jswig_soname@
0fd180
+libseaudit_pyswig_soname = @libseaudit_pyswig_soname@
0fd180
+libseaudit_soname = @libseaudit_soname@
0fd180
+libseaudit_soversion = @libseaudit_soversion@
0fd180
+libseaudit_tswig_soname = @libseaudit_tswig_soname@
0fd180
+libseaudit_version = @libseaudit_version@
0fd180
+libsefs_jswig_soname = @libsefs_jswig_soname@
0fd180
+libsefs_pyswig_soname = @libsefs_pyswig_soname@
0fd180
+libsefs_soname = @libsefs_soname@
0fd180
+libsefs_soversion = @libsefs_soversion@
0fd180
+libsefs_tswig_soname = @libsefs_tswig_soname@
0fd180
+libsefs_version = @libsefs_version@
0fd180
+localedir = @localedir@
0fd180
+localstatedir = @localstatedir@
0fd180
+lt_ECHO = @lt_ECHO@
0fd180
+mandir = @mandir@
0fd180
+mkdir_p = @mkdir_p@
0fd180
+oldincludedir = @oldincludedir@
0fd180
+pdfdir = @pdfdir@
0fd180
+pkgpyexecdir = @pkgpyexecdir@
0fd180
+pkgpythondir = @pkgpythondir@
0fd180
+prefix = @prefix@
0fd180
+profile_install_dir = @profile_install_dir@
0fd180
+program_transform_name = @program_transform_name@
0fd180
+psdir = @psdir@
0fd180
+pyexecdir = @pyexecdir@
0fd180
+pythondir = @pythondir@
0fd180
+sbindir = @sbindir@
0fd180
+selinux_default_policy = @selinux_default_policy@
0fd180
+selinux_policy_dir = @selinux_policy_dir@
0fd180
+sepol_srcdir = @sepol_srcdir@
0fd180
+setoolsdir = @setoolsdir@
0fd180
+sharedstatedir = @sharedstatedir@
0fd180
+srcdir = @srcdir@
0fd180
+sysconfdir = @sysconfdir@
0fd180
+target_alias = @target_alias@
0fd180
+top_build_prefix = @top_build_prefix@
0fd180
+top_builddir = @top_builddir@
0fd180
+top_srcdir = @top_srcdir@
0fd180
+uudecode = @uudecode@
0fd180
+SUBDIRS = setools
0fd180
+all: all-recursive
0fd180
+
0fd180
+.SUFFIXES:
0fd180
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
0fd180
+	@for dep in $?; do \
0fd180
+	  case '$(am__configure_deps)' in \
0fd180
+	    *$$dep*) \
0fd180
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
0fd180
+	        && { if test -f $@; then exit 0; else break; fi; }; \
0fd180
+	      exit 1;; \
0fd180
+	  esac; \
0fd180
+	done; \
0fd180
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \
0fd180
+	$(am__cd) $(top_srcdir) && \
0fd180
+	  $(AUTOMAKE) --gnu python/Makefile
0fd180
+.PRECIOUS: Makefile
0fd180
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
0fd180
+	@case '$?' in \
0fd180
+	  *config.status*) \
0fd180
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
0fd180
+	  *) \
0fd180
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
0fd180
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
0fd180
+	esac;
0fd180
+
0fd180
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
0fd180
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
0fd180
+
0fd180
+$(top_srcdir)/configure:  $(am__configure_deps)
0fd180
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
0fd180
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
0fd180
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
0fd180
+$(am__aclocal_m4_deps):
0fd180
+
0fd180
+mostlyclean-libtool:
0fd180
+	-rm -f *.lo
0fd180
+
0fd180
+clean-libtool:
0fd180
+	-rm -rf .libs _libs
0fd180
+
0fd180
+# This directory's subdirectories are mostly independent; you can cd
0fd180
+# into them and run `make' without going through this Makefile.
0fd180
+# To change the values of `make' variables: instead of editing Makefiles,
0fd180
+# (1) if the variable is set in `config.status', edit `config.status'
0fd180
+#     (which will cause the Makefiles to be regenerated when you run `make');
0fd180
+# (2) otherwise, pass the desired values on the `make' command line.
0fd180
+$(RECURSIVE_TARGETS):
0fd180
+	@fail= failcom='exit 1'; \
0fd180
+	for f in x $$MAKEFLAGS; do \
0fd180
+	  case $$f in \
0fd180
+	    *=* | --[!k]*);; \
0fd180
+	    *k*) failcom='fail=yes';; \
0fd180
+	  esac; \
0fd180
+	done; \
0fd180
+	dot_seen=no; \
0fd180
+	target=`echo $@ | sed s/-recursive//`; \
0fd180
+	list='$(SUBDIRS)'; for subdir in $$list; do \
0fd180
+	  echo "Making $$target in $$subdir"; \
0fd180
+	  if test "$$subdir" = "."; then \
0fd180
+	    dot_seen=yes; \
0fd180
+	    local_target="$$target-am"; \
0fd180
+	  else \
0fd180
+	    local_target="$$target"; \
0fd180
+	  fi; \
0fd180
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
0fd180
+	  || eval $$failcom; \
0fd180
+	done; \
0fd180
+	if test "$$dot_seen" = "no"; then \
0fd180
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
0fd180
+	fi; test -z "$$fail"
0fd180
+
0fd180
+$(RECURSIVE_CLEAN_TARGETS):
0fd180
+	@fail= failcom='exit 1'; \
0fd180
+	for f in x $$MAKEFLAGS; do \
0fd180
+	  case $$f in \
0fd180
+	    *=* | --[!k]*);; \
0fd180
+	    *k*) failcom='fail=yes';; \
0fd180
+	  esac; \
0fd180
+	done; \
0fd180
+	dot_seen=no; \
0fd180
+	case "$@" in \
0fd180
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
0fd180
+	  *) list='$(SUBDIRS)' ;; \
0fd180
+	esac; \
0fd180
+	rev=''; for subdir in $$list; do \
0fd180
+	  if test "$$subdir" = "."; then :; else \
0fd180
+	    rev="$$subdir $$rev"; \
0fd180
+	  fi; \
0fd180
+	done; \
0fd180
+	rev="$$rev ."; \
0fd180
+	target=`echo $@ | sed s/-recursive//`; \
0fd180
+	for subdir in $$rev; do \
0fd180
+	  echo "Making $$target in $$subdir"; \
0fd180
+	  if test "$$subdir" = "."; then \
0fd180
+	    local_target="$$target-am"; \
0fd180
+	  else \
0fd180
+	    local_target="$$target"; \
0fd180
+	  fi; \
0fd180
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
0fd180
+	  || eval $$failcom; \
0fd180
+	done && test -z "$$fail"
0fd180
+tags-recursive:
0fd180
+	list='$(SUBDIRS)'; for subdir in $$list; do \
0fd180
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
0fd180
+	done
0fd180
+ctags-recursive:
0fd180
+	list='$(SUBDIRS)'; for subdir in $$list; do \
0fd180
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
0fd180
+	done
0fd180
+
0fd180
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
0fd180
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
0fd180
+	unique=`for i in $$list; do \
0fd180
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
0fd180
+	  done | \
0fd180
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
0fd180
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
0fd180
+	mkid -fID $$unique
0fd180
+tags: TAGS
0fd180
+
0fd180
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
0fd180
+		$(TAGS_FILES) $(LISP)
0fd180
+	set x; \
0fd180
+	here=`pwd`; \
0fd180
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
0fd180
+	  include_option=--etags-include; \
0fd180
+	  empty_fix=.; \
0fd180
+	else \
0fd180
+	  include_option=--include; \
0fd180
+	  empty_fix=; \
0fd180
+	fi; \
0fd180
+	list='$(SUBDIRS)'; for subdir in $$list; do \
0fd180
+	  if test "$$subdir" = .; then :; else \
0fd180
+	    test ! -f $$subdir/TAGS || \
0fd180
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
0fd180
+	  fi; \
0fd180
+	done; \
0fd180
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
0fd180
+	unique=`for i in $$list; do \
0fd180
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
0fd180
+	  done | \
0fd180
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
0fd180
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
0fd180
+	shift; \
0fd180
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
0fd180
+	  test -n "$$unique" || unique=$$empty_fix; \
0fd180
+	  if test $$# -gt 0; then \
0fd180
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
0fd180
+	      "$$@" $$unique; \
0fd180
+	  else \
0fd180
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
0fd180
+	      $$unique; \
0fd180
+	  fi; \
0fd180
+	fi
0fd180
+ctags: CTAGS
0fd180
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
0fd180
+		$(TAGS_FILES) $(LISP)
0fd180
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
0fd180
+	unique=`for i in $$list; do \
0fd180
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
0fd180
+	  done | \
0fd180
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
0fd180
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
0fd180
+	test -z "$(CTAGS_ARGS)$$unique" \
0fd180
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
0fd180
+	     $$unique
0fd180
+
0fd180
+GTAGS:
0fd180
+	here=`$(am__cd) $(top_builddir) && pwd` \
0fd180
+	  && $(am__cd) $(top_srcdir) \
0fd180
+	  && gtags -i $(GTAGS_ARGS) "$$here"
0fd180
+
0fd180
+distclean-tags:
0fd180
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
0fd180
+
0fd180
+distdir: $(DISTFILES)
0fd180
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
0fd180
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
0fd180
+	list='$(DISTFILES)'; \
0fd180
+	  dist_files=`for file in $$list; do echo $$file; done | \
0fd180
+	  sed -e "s|^$$srcdirstrip/||;t" \
0fd180
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
0fd180
+	case $$dist_files in \
0fd180
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
0fd180
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
0fd180
+			   sort -u` ;; \
0fd180
+	esac; \
0fd180
+	for file in $$dist_files; do \
0fd180
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
0fd180
+	  if test -d $$d/$$file; then \
0fd180
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
0fd180
+	    if test -d "$(distdir)/$$file"; then \
0fd180
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
0fd180
+	    fi; \
0fd180
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
0fd180
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
0fd180
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
0fd180
+	    fi; \
0fd180
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
0fd180
+	  else \
0fd180
+	    test -f "$(distdir)/$$file" \
0fd180
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
0fd180
+	    || exit 1; \
0fd180
+	  fi; \
0fd180
+	done
0fd180
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
0fd180
+	  if test "$$subdir" = .; then :; else \
0fd180
+	    test -d "$(distdir)/$$subdir" \
0fd180
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
0fd180
+	    || exit 1; \
0fd180
+	  fi; \
0fd180
+	done
0fd180
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
0fd180
+	  if test "$$subdir" = .; then :; else \
0fd180
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
0fd180
+	    $(am__relativize); \
0fd180
+	    new_distdir=$$reldir; \
0fd180
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
0fd180
+	    $(am__relativize); \
0fd180
+	    new_top_distdir=$$reldir; \
0fd180
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
0fd180
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
0fd180
+	    ($(am__cd) $$subdir && \
0fd180
+	      $(MAKE) $(AM_MAKEFLAGS) \
0fd180
+	        top_distdir="$$new_top_distdir" \
0fd180
+	        distdir="$$new_distdir" \
0fd180
+		am__remove_distdir=: \
0fd180
+		am__skip_length_check=: \
0fd180
+		am__skip_mode_fix=: \
0fd180
+	        distdir) \
0fd180
+	      || exit 1; \
0fd180
+	  fi; \
0fd180
+	done
0fd180
+check-am: all-am
0fd180
+check: check-recursive
0fd180
+all-am: Makefile
0fd180
+installdirs: installdirs-recursive
0fd180
+installdirs-am:
0fd180
+install: install-recursive
0fd180
+install-exec: install-exec-recursive
0fd180
+install-data: install-data-recursive
0fd180
+uninstall: uninstall-recursive
0fd180
+
0fd180
+install-am: all-am
0fd180
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
0fd180
+
0fd180
+installcheck: installcheck-recursive
0fd180
+install-strip:
0fd180
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
0fd180
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
0fd180
+	  `test -z '$(STRIP)' || \
0fd180
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
0fd180
+mostlyclean-generic:
0fd180
+
0fd180
+clean-generic:
0fd180
+
0fd180
+distclean-generic:
0fd180
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
0fd180
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
0fd180
+
0fd180
+maintainer-clean-generic:
0fd180
+	@echo "This command is intended for maintainers to use"
0fd180
+	@echo "it deletes files that may require special tools to rebuild."
0fd180
+clean: clean-recursive
0fd180
+
0fd180
+clean-am: clean-generic clean-libtool mostlyclean-am
0fd180
+
0fd180
+distclean: distclean-recursive
0fd180
+	-rm -f Makefile
0fd180
+distclean-am: clean-am distclean-generic distclean-tags
0fd180
+
0fd180
+dvi: dvi-recursive
0fd180
+
0fd180
+dvi-am:
0fd180
+
0fd180
+html: html-recursive
0fd180
+
0fd180
+html-am:
0fd180
+
0fd180
+info: info-recursive
0fd180
+
0fd180
+info-am:
0fd180
+
0fd180
+install-data-am:
0fd180
+
0fd180
+install-dvi: install-dvi-recursive
0fd180
+
0fd180
+install-dvi-am:
0fd180
+
0fd180
+install-exec-am:
0fd180
+
0fd180
+install-html: install-html-recursive
0fd180
+
0fd180
+install-html-am:
0fd180
+
0fd180
+install-info: install-info-recursive
0fd180
+
0fd180
+install-info-am:
0fd180
+
0fd180
+install-man:
0fd180
+
0fd180
+install-pdf: install-pdf-recursive
0fd180
+
0fd180
+install-pdf-am:
0fd180
+
0fd180
+install-ps: install-ps-recursive
0fd180
+
0fd180
+install-ps-am:
0fd180
+
0fd180
+installcheck-am:
0fd180
+
0fd180
+maintainer-clean: maintainer-clean-recursive
0fd180
+	-rm -f Makefile
0fd180
+maintainer-clean-am: distclean-am maintainer-clean-generic
0fd180
+
0fd180
+mostlyclean: mostlyclean-recursive
0fd180
+
0fd180
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
0fd180
+
0fd180
+pdf: pdf-recursive
0fd180
+
0fd180
+pdf-am:
0fd180
+
0fd180
+ps: ps-recursive
0fd180
+
0fd180
+ps-am:
0fd180
+
0fd180
+uninstall-am:
0fd180
+
0fd180
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
0fd180
+	install-am install-strip tags-recursive
0fd180
+
0fd180
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
0fd180
+	all all-am check check-am clean clean-generic clean-libtool \
0fd180
+	ctags ctags-recursive distclean distclean-generic \
0fd180
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
0fd180
+	html-am info info-am install install-am install-data \
0fd180
+	install-data-am install-dvi install-dvi-am install-exec \
0fd180
+	install-exec-am install-html install-html-am install-info \
0fd180
+	install-info-am install-man install-pdf install-pdf-am \
0fd180
+	install-ps install-ps-am install-strip installcheck \
0fd180
+	installcheck-am installdirs installdirs-am maintainer-clean \
0fd180
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
0fd180
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
0fd180
+	uninstall uninstall-am
0fd180
+
0fd180
+
0fd180
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
0fd180
+# Otherwise a system limit (for SysV at least) may be exceeded.
0fd180
+.NOEXPORT:
0fd180
diff --git a/python/setools/Makefile.am b/python/setools/Makefile.am
0fd180
new file mode 100644
0fd180
index 0000000..c4635fb
0fd180
--- /dev/null
0fd180
+++ b/python/setools/Makefile.am
0fd180
@@ -0,0 +1,36 @@
0fd180
+EXTRA_DIST =				\
0fd180
+	sesearch.c			\
0fd180
+	seinfo.c			\
0fd180
+	__init__.py			\
0fd180
+	setup.py			\
0fd180
+	$(NULL)
0fd180
+
0fd180
+AM_CFLAGS = @DEBUGCFLAGS@ @WARNCFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
0fd180
+	@QPOL_CFLAGS@ @APOL_CFLAGS@
0fd180
+AM_CXXFLAGS = @DEBUGCXXFLAGS@ @WARNCXXFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
0fd180
+	@QPOL_CFLAGS@ @APOL_CFLAGS@ @SEFS_CFLAGS@
0fd180
+AM_LDFLAGS = @DEBUGLDFLAGS@ @WARNLDFLAGS@ @PROFILELDFLAGS@
0fd180
+
0fd180
+LDADD = @SELINUX_LIB_FLAG@ @APOL_LIB_FLAG@ @QPOL_LIB_FLAG@
0fd180
+DEPENDENCIES = $(top_builddir)/libapol/src/libapol.so $(top_builddir)/libqpol/src/libqpol.so
0fd180
+all-am: python-build
0fd180
+
0fd180
+seinfo_SOURCES = seinfo.c
0fd180
+
0fd180
+sesearch_SOURCES = sesearch.c
0fd180
+
0fd180
+python-build: sesearch.c seinfo.c
0fd180
+	@mkdir -p setools
0fd180
+	@cp __init__.py setools
0fd180
+	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build
0fd180
+
0fd180
+install-exec-hook:
0fd180
+	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
0fd180
+
0fd180
+uninstall-hook: 
0fd180
+	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
0fd180
+
0fd180
+clean-local:
0fd180
+	$(PYTHON) setup.py clean -a 
0fd180
+	rm -f *~
0fd180
+
0fd180
diff --git a/python/setools/Makefile.in b/python/setools/Makefile.in
0fd180
new file mode 100644
0fd180
index 0000000..704ffc7
0fd180
--- /dev/null
0fd180
+++ b/python/setools/Makefile.in
0fd180
@@ -0,0 +1,550 @@
0fd180
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
0fd180
+# @configure_input@
0fd180
+
0fd180
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
0fd180
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
0fd180
+# Inc.
0fd180
+# This Makefile.in is free software; the Free Software Foundation
0fd180
+# gives unlimited permission to copy and/or distribute it,
0fd180
+# with or without modifications, as long as this notice is preserved.
0fd180
+
0fd180
+# This program is distributed in the hope that it will be useful,
0fd180
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
0fd180
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0fd180
+# PARTICULAR PURPOSE.
0fd180
+
0fd180
+@SET_MAKE@
0fd180
+VPATH = @srcdir@
0fd180
+pkgdatadir = $(datadir)/@PACKAGE@
0fd180
+pkgincludedir = $(includedir)/@PACKAGE@
0fd180
+pkglibdir = $(libdir)/@PACKAGE@
0fd180
+pkglibexecdir = $(libexecdir)/@PACKAGE@
0fd180
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
0fd180
+install_sh_DATA = $(install_sh) -c -m 644
0fd180
+install_sh_PROGRAM = $(install_sh) -c
0fd180
+install_sh_SCRIPT = $(install_sh) -c
0fd180
+INSTALL_HEADER = $(INSTALL_DATA)
0fd180
+transform = $(program_transform_name)
0fd180
+NORMAL_INSTALL = :
0fd180
+PRE_INSTALL = :
0fd180
+POST_INSTALL = :
0fd180
+NORMAL_UNINSTALL = :
0fd180
+PRE_UNINSTALL = :
0fd180
+POST_UNINSTALL = :
0fd180
+build_triplet = @build@
0fd180
+host_triplet = @host@
0fd180
+subdir = python/setools
0fd180
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
0fd180
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
0fd180
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_classpath.m4 \
0fd180
+	$(top_srcdir)/m4/ac_java_options.m4 \
0fd180
+	$(top_srcdir)/m4/ac_pkg_swig.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_jar.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_java.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_java_works.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_javac.m4 \
0fd180
+	$(top_srcdir)/m4/ac_prog_javac_works.m4 \
0fd180
+	$(top_srcdir)/m4/ac_python_devel.m4 $(top_srcdir)/m4/c.m4 \
0fd180
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
0fd180
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
0fd180
+	$(top_srcdir)/m4/lt~obsolete.m4 \
0fd180
+	$(top_srcdir)/m4/swig_python.m4 $(top_srcdir)/m4/tcl.m4 \
0fd180
+	$(top_srcdir)/configure.ac
0fd180
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
0fd180
+	$(ACLOCAL_M4)
0fd180
+mkinstalldirs = $(install_sh) -d
0fd180
+CONFIG_HEADER = $(top_builddir)/config.h
0fd180
+CONFIG_CLEAN_FILES =
0fd180
+CONFIG_CLEAN_VPATH_FILES =
0fd180
+SOURCES =
0fd180
+DIST_SOURCES =
0fd180
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
0fd180
+ACLOCAL = @ACLOCAL@
0fd180
+AMTAR = @AMTAR@
0fd180
+APOL_CFLAGS = @APOL_CFLAGS@
0fd180
+APOL_LIB_FLAG = @APOL_LIB_FLAG@
0fd180
+AR = @AR@
0fd180
+AUTOCONF = @AUTOCONF@
0fd180
+AUTOHEADER = @AUTOHEADER@
0fd180
+AUTOMAKE = @AUTOMAKE@
0fd180
+AWK = @AWK@
0fd180
+BWIDGET_DESTDIR = @BWIDGET_DESTDIR@
0fd180
+CC = @CC@
0fd180
+CCDEPMODE = @CCDEPMODE@
0fd180
+CFLAGS = @CFLAGS@
0fd180
+CPP = @CPP@
0fd180
+CPPFLAGS = @CPPFLAGS@
0fd180
+CUNIT_LIB_FLAG = @CUNIT_LIB_FLAG@
0fd180
+CXX = @CXX@
0fd180
+CXXCPP = @CXXCPP@
0fd180
+CXXDEPMODE = @CXXDEPMODE@
0fd180
+CXXFLAGS = @CXXFLAGS@
0fd180
+CYGPATH = @CYGPATH@
0fd180
+CYGPATH_W = @CYGPATH_W@
0fd180
+DEBUGCFLAGS = @DEBUGCFLAGS@
0fd180
+DEBUGCXXFLAGS = @DEBUGCXXFLAGS@
0fd180
+DEBUGJFLAGS = @DEBUGJFLAGS@
0fd180
+DEBUGLDFLAGS = @DEBUGLDFLAGS@
0fd180
+DEFS = @DEFS@
0fd180
+DEPDIR = @DEPDIR@
0fd180
+DSYMUTIL = @DSYMUTIL@
0fd180
+DUMPBIN = @DUMPBIN@
0fd180
+ECHO_C = @ECHO_C@
0fd180
+ECHO_N = @ECHO_N@
0fd180
+ECHO_T = @ECHO_T@
0fd180
+EGREP = @EGREP@
0fd180
+EXEEXT = @EXEEXT@
0fd180
+FGREP = @FGREP@
0fd180
+GLADE_CFLAGS = @GLADE_CFLAGS@
0fd180
+GLADE_LIBS = @GLADE_LIBS@
0fd180
+GREP = @GREP@
0fd180
+GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
0fd180
+GTHREAD_LIBS = @GTHREAD_LIBS@
0fd180
+GTK_CFLAGS = @GTK_CFLAGS@
0fd180
+GTK_LIBS = @GTK_LIBS@
0fd180
+INSTALL = @INSTALL@
0fd180
+INSTALL_DATA = @INSTALL_DATA@
0fd180
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
0fd180
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
0fd180
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
0fd180
+JAR = @JAR@
0fd180
+JAVA = @JAVA@
0fd180
+JAVAC = @JAVAC@
0fd180
+JAVACFLAGS = @JAVACFLAGS@
0fd180
+JAVAFLAGS = @JAVAFLAGS@
0fd180
+JAVAPREFIX = @JAVAPREFIX@
0fd180
+LD = @LD@
0fd180
+LDFLAGS = @LDFLAGS@
0fd180
+LEX = @LEX@
0fd180
+LEXLIB = @LEXLIB@
0fd180
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
0fd180
+LIBOBJS = @LIBOBJS@
0fd180
+LIBS = @LIBS@
0fd180
+LIBTOOL = @LIBTOOL@
0fd180
+LIPO = @LIPO@
0fd180
+LN_S = @LN_S@
0fd180
+LTLIBOBJS = @LTLIBOBJS@
0fd180
+MAKEINFO = @MAKEINFO@
0fd180
+MKDIR_P = @MKDIR_P@
0fd180
+NM = @NM@
0fd180
+NMEDIT = @NMEDIT@
0fd180
+OBJDUMP = @OBJDUMP@
0fd180
+OBJEXT = @OBJEXT@
0fd180
+OTOOL = @OTOOL@
0fd180
+OTOOL64 = @OTOOL64@
0fd180
+PACKAGE = @PACKAGE@
0fd180
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
0fd180
+PACKAGE_NAME = @PACKAGE_NAME@
0fd180
+PACKAGE_STRING = @PACKAGE_STRING@
0fd180
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
0fd180
+PACKAGE_URL = @PACKAGE_URL@
0fd180
+PACKAGE_VERSION = @PACKAGE_VERSION@
0fd180
+PATH_SEPARATOR = @PATH_SEPARATOR@
0fd180
+PIXBUF_CFLAGS = @PIXBUF_CFLAGS@
0fd180
+PIXBUF_LIBS = @PIXBUF_LIBS@
0fd180
+PKG_CFLAGS = @PKG_CFLAGS@
0fd180
+PKG_HEADERS = @PKG_HEADERS@
0fd180
+PKG_INCLUDES = @PKG_INCLUDES@
0fd180
+PKG_LIBS = @PKG_LIBS@
0fd180
+PKG_LIB_FILE = @PKG_LIB_FILE@
0fd180
+PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
0fd180
+PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
0fd180
+PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
0fd180
+PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
0fd180
+POLDIFF_CFLAGS = @POLDIFF_CFLAGS@
0fd180
+POLDIFF_LIB_FLAG = @POLDIFF_LIB_FLAG@
0fd180
+PROFILECFLAGS = @PROFILECFLAGS@
0fd180
+PROFILELDFLAGS = @PROFILELDFLAGS@
0fd180
+PYTHON = @PYTHON@
0fd180
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
0fd180
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
0fd180
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
0fd180
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
0fd180
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
0fd180
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
0fd180
+PYTHON_PREFIX = @PYTHON_PREFIX@
0fd180
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
0fd180
+PYTHON_VERSION = @PYTHON_VERSION@
0fd180
+QPOL_CFLAGS = @QPOL_CFLAGS@
0fd180
+QPOL_LIB_FLAG = @QPOL_LIB_FLAG@
0fd180
+RANLIB = @RANLIB@
0fd180
+SEAUDIT_CFLAGS = @SEAUDIT_CFLAGS@
0fd180
+SEAUDIT_LIB_FLAG = @SEAUDIT_LIB_FLAG@
0fd180
+SED = @SED@
0fd180
+SEFS_CFLAGS = @SEFS_CFLAGS@
0fd180
+SEFS_LIB_FLAG = @SEFS_LIB_FLAG@
0fd180
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
0fd180
+SELINUX_LIB_FLAG = @SELINUX_LIB_FLAG@
0fd180
+SET_MAKE = @SET_MAKE@
0fd180
+SHELL = @SHELL@
0fd180
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
0fd180
+SQLITE3_LIBS = @SQLITE3_LIBS@
0fd180
+STRIP = @STRIP@
0fd180
+SWIG = @SWIG@
0fd180
+SWIG_JAVA_CFLAGS = @SWIG_JAVA_CFLAGS@
0fd180
+SWIG_JAVA_OPT = @SWIG_JAVA_OPT@
0fd180
+SWIG_LIB = @SWIG_LIB@
0fd180
+SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@
0fd180
+SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
0fd180
+SWIG_TCL_CFLAGS = @SWIG_TCL_CFLAGS@
0fd180
+SWIG_TCL_OPT = @SWIG_TCL_OPT@
0fd180
+TCLSH_PROG = @TCLSH_PROG@
0fd180
+TCL_AUTOPATH = @TCL_AUTOPATH@
0fd180
+TCL_BIN_DIR = @TCL_BIN_DIR@
0fd180
+TCL_DEFS = @TCL_DEFS@
0fd180
+TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
0fd180
+TCL_INCLUDES = @TCL_INCLUDES@
0fd180
+TCL_LD_FLAGS = @TCL_LD_FLAGS@
0fd180
+TCL_LIBS = @TCL_LIBS@
0fd180
+TCL_LIB_FILE = @TCL_LIB_FILE@
0fd180
+TCL_LIB_FLAG = @TCL_LIB_FLAG@
0fd180
+TCL_LIB_SPEC = @TCL_LIB_SPEC@
0fd180
+TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
0fd180
+TCL_SRC_DIR = @TCL_SRC_DIR@
0fd180
+TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
0fd180
+TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
0fd180
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
0fd180
+TCL_VERSION = @TCL_VERSION@
0fd180
+TK_BIN_DIR = @TK_BIN_DIR@
0fd180
+TK_INCLUDES = @TK_INCLUDES@
0fd180
+TK_LIBS = @TK_LIBS@
0fd180
+TK_LIB_FILE = @TK_LIB_FILE@
0fd180
+TK_LIB_FLAG = @TK_LIB_FLAG@
0fd180
+TK_LIB_SPEC = @TK_LIB_SPEC@
0fd180
+TK_SRC_DIR = @TK_SRC_DIR@
0fd180
+TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
0fd180
+TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
0fd180
+TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
0fd180
+TK_VERSION = @TK_VERSION@
0fd180
+TK_XINCLUDES = @TK_XINCLUDES@
0fd180
+VERSION = @VERSION@
0fd180
+WARNCFLAGS = @WARNCFLAGS@
0fd180
+WARNCXXFLAGS = @WARNCXXFLAGS@
0fd180
+WARNJFLAGS = @WARNJFLAGS@
0fd180
+WARNLDFLAGS = @WARNLDFLAGS@
0fd180
+WISH_PROG = @WISH_PROG@
0fd180
+XMKMF = @XMKMF@
0fd180
+XML_CFLAGS = @XML_CFLAGS@
0fd180
+XML_LIBS = @XML_LIBS@
0fd180
+YACC = @YACC@
0fd180
+YFLAGS = @YFLAGS@
0fd180
+abs_builddir = @abs_builddir@
0fd180
+abs_srcdir = @abs_srcdir@
0fd180
+abs_top_builddir = @abs_top_builddir@
0fd180
+abs_top_srcdir = @abs_top_srcdir@
0fd180
+ac_ct_CC = @ac_ct_CC@
0fd180
+ac_ct_CXX = @ac_ct_CXX@
0fd180
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
0fd180
+am__include = @am__include@
0fd180
+am__leading_dot = @am__leading_dot@
0fd180
+am__quote = @am__quote@
0fd180
+am__tar = @am__tar@
0fd180
+am__untar = @am__untar@
0fd180
+bindir = @bindir@
0fd180
+build = @build@
0fd180
+build_alias = @build_alias@
0fd180
+build_cpu = @build_cpu@
0fd180
+build_os = @build_os@
0fd180
+build_vendor = @build_vendor@
0fd180
+builddir = @builddir@
0fd180
+datadir = @datadir@
0fd180
+datarootdir = @datarootdir@
0fd180
+docdir = @docdir@
0fd180
+dvidir = @dvidir@
0fd180
+exec_prefix = @exec_prefix@
0fd180
+has_pkg_config = @has_pkg_config@
0fd180
+host = @host@
0fd180
+host_alias = @host_alias@
0fd180
+host_cpu = @host_cpu@
0fd180
+host_os = @host_os@
0fd180
+host_vendor = @host_vendor@
0fd180
+htmldir = @htmldir@
0fd180
+includedir = @includedir@
0fd180
+infodir = @infodir@
0fd180
+install_sh = @install_sh@
0fd180
+javadir = @javadir@
0fd180
+libapol_jswig_soname = @libapol_jswig_soname@
0fd180
+libapol_pyswig_soname = @libapol_pyswig_soname@
0fd180
+libapol_soname = @libapol_soname@
0fd180
+libapol_soversion = @libapol_soversion@
0fd180
+libapol_tswig_soname = @libapol_tswig_soname@
0fd180
+libapol_version = @libapol_version@
0fd180
+libdir = @libdir@
0fd180
+libexecdir = @libexecdir@
0fd180
+libpoldiff_jswig_soname = @libpoldiff_jswig_soname@
0fd180
+libpoldiff_pyswig_soname = @libpoldiff_pyswig_soname@
0fd180
+libpoldiff_soname = @libpoldiff_soname@
0fd180
+libpoldiff_soversion = @libpoldiff_soversion@
0fd180
+libpoldiff_tswig_soname = @libpoldiff_tswig_soname@
0fd180
+libpoldiff_version = @libpoldiff_version@
0fd180
+libqpol_jswig_soname = @libqpol_jswig_soname@
0fd180
+libqpol_pyswig_soname = @libqpol_pyswig_soname@
0fd180
+libqpol_soname = @libqpol_soname@
0fd180
+libqpol_soversion = @libqpol_soversion@
0fd180
+libqpol_tswig_soname = @libqpol_tswig_soname@
0fd180
+libqpol_version = @libqpol_version@
0fd180
+libseaudit_jswig_soname = @libseaudit_jswig_soname@
0fd180
+libseaudit_pyswig_soname = @libseaudit_pyswig_soname@
0fd180
+libseaudit_soname = @libseaudit_soname@
0fd180
+libseaudit_soversion = @libseaudit_soversion@
0fd180
+libseaudit_tswig_soname = @libseaudit_tswig_soname@
0fd180
+libseaudit_version = @libseaudit_version@
0fd180
+libsefs_jswig_soname = @libsefs_jswig_soname@
0fd180
+libsefs_pyswig_soname = @libsefs_pyswig_soname@
0fd180
+libsefs_soname = @libsefs_soname@
0fd180
+libsefs_soversion = @libsefs_soversion@
0fd180
+libsefs_tswig_soname = @libsefs_tswig_soname@
0fd180
+libsefs_version = @libsefs_version@
0fd180
+localedir = @localedir@
0fd180
+localstatedir = @localstatedir@
0fd180
+lt_ECHO = @lt_ECHO@
0fd180
+mandir = @mandir@
0fd180
+mkdir_p = @mkdir_p@
0fd180
+oldincludedir = @oldincludedir@
0fd180
+pdfdir = @pdfdir@
0fd180
+pkgpyexecdir = @pkgpyexecdir@
0fd180
+pkgpythondir = @pkgpythondir@
0fd180
+prefix = @prefix@
0fd180
+profile_install_dir = @profile_install_dir@
0fd180
+program_transform_name = @program_transform_name@
0fd180
+psdir = @psdir@
0fd180
+pyexecdir = @pyexecdir@
0fd180
+pythondir = @pythondir@
0fd180
+sbindir = @sbindir@
0fd180
+selinux_default_policy = @selinux_default_policy@
0fd180
+selinux_policy_dir = @selinux_policy_dir@
0fd180
+sepol_srcdir = @sepol_srcdir@
0fd180
+setoolsdir = @setoolsdir@
0fd180
+sharedstatedir = @sharedstatedir@
0fd180
+srcdir = @srcdir@
0fd180
+sysconfdir = @sysconfdir@
0fd180
+target_alias = @target_alias@
0fd180
+top_build_prefix = @top_build_prefix@
0fd180
+top_builddir = @top_builddir@
0fd180
+top_srcdir = @top_srcdir@
0fd180
+uudecode = @uudecode@
0fd180
+EXTRA_DIST = \
0fd180
+	sesearch.c			\
0fd180
+	seinfo.c			\
0fd180
+	__init__.py			\
0fd180
+	setup.py			\
0fd180
+	$(NULL)
0fd180
+
0fd180
+AM_CFLAGS = @DEBUGCFLAGS@ @WARNCFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
0fd180
+	@QPOL_CFLAGS@ @APOL_CFLAGS@
0fd180
+
0fd180
+AM_CXXFLAGS = @DEBUGCXXFLAGS@ @WARNCXXFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
0fd180
+	@QPOL_CFLAGS@ @APOL_CFLAGS@ @SEFS_CFLAGS@
0fd180
+
0fd180
+AM_LDFLAGS = @DEBUGLDFLAGS@ @WARNLDFLAGS@ @PROFILELDFLAGS@
0fd180
+LDADD = @SELINUX_LIB_FLAG@ @APOL_LIB_FLAG@ @QPOL_LIB_FLAG@
0fd180
+DEPENDENCIES = $(top_builddir)/libapol/src/libapol.so $(top_builddir)/libqpol/src/libqpol.so
0fd180
+seinfo_SOURCES = seinfo.c
0fd180
+sesearch_SOURCES = sesearch.c
0fd180
+all: all-am
0fd180
+
0fd180
+.SUFFIXES:
0fd180
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
0fd180
+	@for dep in $?; do \
0fd180
+	  case '$(am__configure_deps)' in \
0fd180
+	    *$$dep*) \
0fd180
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
0fd180
+	        && { if test -f $@; then exit 0; else break; fi; }; \
0fd180
+	      exit 1;; \
0fd180
+	  esac; \
0fd180
+	done; \
0fd180
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/setools/Makefile'; \
0fd180
+	$(am__cd) $(top_srcdir) && \
0fd180
+	  $(AUTOMAKE) --gnu python/setools/Makefile
0fd180
+.PRECIOUS: Makefile
0fd180
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
0fd180
+	@case '$?' in \
0fd180
+	  *config.status*) \
0fd180
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
0fd180
+	  *) \
0fd180
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
0fd180
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
0fd180
+	esac;
0fd180
+
0fd180
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
0fd180
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
0fd180
+
0fd180
+$(top_srcdir)/configure:  $(am__configure_deps)
0fd180
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
0fd180
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
0fd180
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
0fd180
+$(am__aclocal_m4_deps):
0fd180
+
0fd180
+mostlyclean-libtool:
0fd180
+	-rm -f *.lo
0fd180
+
0fd180
+clean-libtool:
0fd180
+	-rm -rf .libs _libs
0fd180
+tags: TAGS
0fd180
+TAGS:
0fd180
+
0fd180
+ctags: CTAGS
0fd180
+CTAGS:
0fd180
+
0fd180
+
0fd180
+distdir: $(DISTFILES)
0fd180
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
0fd180
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
0fd180
+	list='$(DISTFILES)'; \
0fd180
+	  dist_files=`for file in $$list; do echo $$file; done | \
0fd180
+	  sed -e "s|^$$srcdirstrip/||;t" \
0fd180
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
0fd180
+	case $$dist_files in \
0fd180
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
0fd180
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
0fd180
+			   sort -u` ;; \
0fd180
+	esac; \
0fd180
+	for file in $$dist_files; do \
0fd180
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
0fd180
+	  if test -d $$d/$$file; then \
0fd180
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
0fd180
+	    if test -d "$(distdir)/$$file"; then \
0fd180
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
0fd180
+	    fi; \
0fd180
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
0fd180
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
0fd180
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
0fd180
+	    fi; \
0fd180
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
0fd180
+	  else \
0fd180
+	    test -f "$(distdir)/$$file" \
0fd180
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
0fd180
+	    || exit 1; \
0fd180
+	  fi; \
0fd180
+	done
0fd180
+check-am: all-am
0fd180
+check: check-am
0fd180
+all-am: Makefile
0fd180
+installdirs:
0fd180
+install: install-am
0fd180
+install-exec: install-exec-am
0fd180
+install-data: install-data-am
0fd180
+uninstall: uninstall-am
0fd180
+
0fd180
+install-am: all-am
0fd180
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
0fd180
+
0fd180
+installcheck: installcheck-am
0fd180
+install-strip:
0fd180
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
0fd180
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
0fd180
+	  `test -z '$(STRIP)' || \
0fd180
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
0fd180
+mostlyclean-generic:
0fd180
+
0fd180
+clean-generic:
0fd180
+
0fd180
+distclean-generic:
0fd180
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
0fd180
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
0fd180
+
0fd180
+maintainer-clean-generic:
0fd180
+	@echo "This command is intended for maintainers to use"
0fd180
+	@echo "it deletes files that may require special tools to rebuild."
0fd180
+clean: clean-am
0fd180
+
0fd180
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
0fd180
+
0fd180
+distclean: distclean-am
0fd180
+	-rm -f Makefile
0fd180
+distclean-am: clean-am distclean-generic
0fd180
+
0fd180
+dvi: dvi-am
0fd180
+
0fd180
+dvi-am:
0fd180
+
0fd180
+html: html-am
0fd180
+
0fd180
+html-am:
0fd180
+
0fd180
+info: info-am
0fd180
+
0fd180
+info-am:
0fd180
+
0fd180
+install-data-am:
0fd180
+
0fd180
+install-dvi: install-dvi-am
0fd180
+
0fd180
+install-dvi-am:
0fd180
+
0fd180
+install-exec-am:
0fd180
+	@$(NORMAL_INSTALL)
0fd180
+	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
0fd180
+install-html: install-html-am
0fd180
+
0fd180
+install-html-am:
0fd180
+
0fd180
+install-info: install-info-am
0fd180
+
0fd180
+install-info-am:
0fd180
+
0fd180
+install-man:
0fd180
+
0fd180
+install-pdf: install-pdf-am
0fd180
+
0fd180
+install-pdf-am:
0fd180
+
0fd180
+install-ps: install-ps-am
0fd180
+
0fd180
+install-ps-am:
0fd180
+
0fd180
+installcheck-am:
0fd180
+
0fd180
+maintainer-clean: maintainer-clean-am
0fd180
+	-rm -f Makefile
0fd180
+maintainer-clean-am: distclean-am maintainer-clean-generic
0fd180
+
0fd180
+mostlyclean: mostlyclean-am
0fd180
+
0fd180
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
0fd180
+
0fd180
+pdf: pdf-am
0fd180
+
0fd180
+pdf-am:
0fd180
+
0fd180
+ps: ps-am
0fd180
+
0fd180
+ps-am:
0fd180
+
0fd180
+uninstall-am:
0fd180
+	@$(NORMAL_INSTALL)
0fd180
+	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
0fd180
+.MAKE: install-am install-exec-am install-strip uninstall-am
0fd180
+
0fd180
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
0fd180
+	clean-local distclean distclean-generic distclean-libtool \
0fd180
+	distdir dvi dvi-am html html-am info info-am install \
0fd180
+	install-am install-data install-data-am install-dvi \
0fd180
+	install-dvi-am install-exec install-exec-am install-exec-hook \
0fd180
+	install-html install-html-am install-info install-info-am \
0fd180
+	install-man install-pdf install-pdf-am install-ps \
0fd180
+	install-ps-am install-strip installcheck installcheck-am \
0fd180
+	installdirs maintainer-clean maintainer-clean-generic \
0fd180
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
0fd180
+	ps ps-am uninstall uninstall-am uninstall-hook
0fd180
+
0fd180
+all-am: python-build
0fd180
+
0fd180
+python-build: sesearch.c seinfo.c
0fd180
+	@mkdir -p setools
0fd180
+	@cp __init__.py setools
0fd180
+	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build
0fd180
+
0fd180
+install-exec-hook:
0fd180
+	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
0fd180
+
0fd180
+uninstall-hook: 
0fd180
+	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
0fd180
+
0fd180
+clean-local:
0fd180
+	$(PYTHON) setup.py clean -a 
0fd180
+	rm -f *~
0fd180
+
0fd180
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
0fd180
+# Otherwise a system limit (for SysV at least) may be exceeded.
0fd180
+.NOEXPORT:
0fd180
diff --git a/python/setools/__init__.py b/python/setools/__init__.py
0fd180
new file mode 100644
0fd180
index 0000000..6f075c4
0fd180
--- /dev/null
0fd180
+++ b/python/setools/__init__.py
0fd180
@@ -0,0 +1,50 @@
0fd180
+#!/usr/bin/env python
0fd180
+
0fd180
+# Author: Thomas Liu <tliu@redhat.com>
0fd180
+
0fd180
+import _sesearch
0fd180
+import _seinfo
0fd180
+import types
0fd180
+
0fd180
+TYPE = _seinfo.TYPE
0fd180
+ROLE = _seinfo.ROLE
0fd180
+ATTRIBUTE = _seinfo.ATTRIBUTE
0fd180
+PORT = _seinfo.PORT
0fd180
+USER = _seinfo.USER
0fd180
+
0fd180
+ALLOW = 'allow'
0fd180
+AUDITALLOW = 'auditallow'
0fd180
+NEVERALLOW = 'neverallow'
0fd180
+DONTAUDIT = 'dontaudit'
0fd180
+SCONTEXT = 'scontext'
0fd180
+TCONTEXT = 'tcontext'
0fd180
+PERMS = 'permlist'
0fd180
+CLASS = 'class'
0fd180
+
0fd180
+def sesearch(types, info):
0fd180
+    valid_types = [ALLOW, AUDITALLOW, NEVERALLOW, DONTAUDIT]
0fd180
+    for type in types:
0fd180
+        if type not in valid_types:
0fd180
+            raise ValueError("Type has to be in %s" % valid_types)
0fd180
+        info[type] = True
0fd180
+
0fd180
+    perms = []
0fd180
+    if PERMS in info:
0fd180
+        perms = info[PERMS]
0fd180
+        info[PERMS] = ",".join(info[PERMS])
0fd180
+     
0fd180
+    
0fd180
+    dict_list = _sesearch.sesearch(info)
0fd180
+    if dict_list and len(perms) != 0:
0fd180
+        dict_list = filter(lambda x: dict_has_perms(x, perms), dict_list)
0fd180
+    return dict_list
0fd180
+
0fd180
+def dict_has_perms(dict, perms):
0fd180
+    for perm in perms:
0fd180
+        if perm not in dict[PERMS]:
0fd180
+            return False
0fd180
+    return True
0fd180
+
0fd180
+def seinfo(setype, name=None):
0fd180
+    dict_list = _seinfo.seinfo(setype, name)
0fd180
+    return dict_list
0fd180
diff --git a/python/setools/seinfo.c b/python/setools/seinfo.c
0fd180
new file mode 100644
0fd180
index 0000000..211930a
0fd180
--- /dev/null
0fd180
+++ b/python/setools/seinfo.c
0fd180
@@ -0,0 +1,769 @@
0fd180
+/**
0fd180
+ *  @file
0fd180
+ *  Command line tool to search TE rules.
0fd180
+ *
0fd180
+ *  @author Frank Mayer  mayerf@tresys.com
0fd180
+ *  @author Jeremy A. Mowery jmowery@tresys.com
0fd180
+ *  @author Paul Rosenfeld  prosenfeld@tresys.com
0fd180
+ *  @author Thomas Liu  <tliu@redhat.com>
0fd180
+ *  @author Dan Walsh  <dwalsh@redhat.com>
0fd180
+ *
0fd180
+ *  Copyright (C) 2003-2008 Tresys Technology, LLC
0fd180
+ *
0fd180
+ *  This program is free software; you can redistribute it and/or modify
0fd180
+ *  it under the terms of the GNU General Public License as published by
0fd180
+ *  the Free Software Foundation; either version 2 of the License, or
0fd180
+ *  (at your option) any later version.
0fd180
+ *
0fd180
+ *  This program is distributed in the hope that it will be useful,
0fd180
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0fd180
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0fd180
+ *  GNU General Public License for more details.
0fd180
+ *
0fd180
+ *  You should have received a copy of the GNU General Public License
0fd180
+ *  along with this program; if not, write to the Free Software
0fd180
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
0fd180
+ */
0fd180
+
0fd180
+/**
0fd180
+ * This is a modified version of seinfo to be used as part of a library for
0fd180
+ * Python bindings.
0fd180
+ */
0fd180
+
0fd180
+#include "Python.h"
0fd180
+
0fd180
+/* libapol */
0fd180
+#include <apol policy.h="">
0fd180
+#include <apol policy-query.h="">
0fd180
+#include <apol render.h="">
0fd180
+#include <apol util.h="">
0fd180
+#include <apol vector.h="">
0fd180
+
0fd180
+/* libqpol */
0fd180
+#include <qpol policy.h="">
0fd180
+#include <qpol util.h="">
0fd180
+
0fd180
+/* other */
0fd180
+#include <errno.h>
0fd180
+#include <stdlib.h>
0fd180
+#include <stdio.h>
0fd180
+#include <string.h>
0fd180
+#include <assert.h>
0fd180
+
0fd180
+#define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC"
0fd180
+static char *policy_file = NULL;
0fd180
+
0fd180
+enum input
0fd180
+{
0fd180
+	TYPE, ATTRIBUTE, ROLE, USER, PORT,
0fd180
+};
0fd180
+
0fd180
+/**
0fd180
+ * Gets a textual representation of an attribute, and 
0fd180
+ * all of that attribute's types.
0fd180
+ *
0fd180
+ * @param type_datum Reference to sepol type_datum
0fd180
+ * @param policydb Reference to a policy
0fd180
+ */
0fd180
+static PyObject* get_attr(const qpol_type_t * type_datum, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	int retval = -1;
0fd180
+	PyObject *dict = PyDict_New(); 
0fd180
+	const qpol_type_t *attr_datum = NULL;
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	const char *attr_name = NULL, *type_name = NULL;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+	unsigned char isattr;
0fd180
+
0fd180
+	if (qpol_type_get_name(q, type_datum, &attr_name))
0fd180
+		goto cleanup;
0fd180
+	PyObject *obj = PyString_FromString(attr_name);
0fd180
+	PyDict_SetItemString(dict, "name", obj);
0fd180
+	Py_DECREF(obj);
0fd180
+
0fd180
+	/* get an iterator over all types this attribute has */
0fd180
+	if (qpol_type_get_isattr(q, type_datum, &isattr))
0fd180
+		goto cleanup;
0fd180
+	if (isattr) {	       /* sanity check */
0fd180
+		if (qpol_type_get_type_iter(q, type_datum, &iter))
0fd180
+			goto cleanup;
0fd180
+		PyObject *list = PyList_New(0);
0fd180
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+			if (qpol_iterator_get_item(iter, (void **)&attr_datum))
0fd180
+				goto cleanup;
0fd180
+			if (qpol_type_get_name(q, attr_datum, &type_name))
0fd180
+				goto cleanup;
0fd180
+			PyObject *obj = PyString_FromString(type_name);
0fd180
+			PyList_Append(list, obj);
0fd180
+			Py_DECREF(obj);
0fd180
+		}
0fd180
+		qpol_iterator_destroy(&iter);
0fd180
+		PyDict_SetItemString(dict, "types", list);
0fd180
+		Py_DECREF(list);
0fd180
+	} else		       /* this should never happen */
0fd180
+		goto cleanup;
0fd180
+	
0fd180
+	retval = 0;
0fd180
+cleanup:
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+	if (retval) {
0fd180
+		Py_DECREF(dict);
0fd180
+		return NULL;
0fd180
+	}
0fd180
+	return dict;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * Gets statistics regarding a policy's attributes.
0fd180
+ * If this function is given a name, it will attempt to
0fd180
+ * get statistics about a particular attribute; otherwise
0fd180
+ * the function gets statistics about all of the policy's
0fd180
+ * attributes.
0fd180
+ *
0fd180
+ * @param name Reference to an attribute's name; if NULL,
0fd180
+ * all object classes will be considered
0fd180
+ * @param policydb Reference to a policy
0fd180
+ *
0fd180
+ * @return 0 on success, < 0 on error.
0fd180
+ */
0fd180
+static PyObject* get_attribs(const char *name, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	int retval = -1;
0fd180
+	PyObject *list = PyList_New(0);
0fd180
+	apol_attr_query_t *attr_query = NULL;
0fd180
+	apol_vector_t *v = NULL;
0fd180
+	const qpol_type_t *type_datum = NULL;
0fd180
+	size_t n_attrs, i;
0fd180
+
0fd180
+	/* we are only getting information about 1 attribute */
0fd180
+	if (name != NULL) {
0fd180
+		attr_query = apol_attr_query_create();
0fd180
+		if (!attr_query)
0fd180
+			goto cleanup;
0fd180
+		if (apol_attr_query_set_attr(policydb, attr_query, name))
0fd180
+			goto cleanup;
0fd180
+		if (apol_attr_get_by_query(policydb, attr_query, &v))
0fd180
+			goto cleanup;
0fd180
+		apol_attr_query_destroy(&attr_query);
0fd180
+		if (apol_vector_get_size(v) == 0) {
0fd180
+			apol_vector_destroy(&v);
0fd180
+			errno = EINVAL;
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+
0fd180
+		type_datum = apol_vector_get_element(v, (size_t) 0);
0fd180
+		PyObject *obj = get_attr(type_datum, policydb);
0fd180
+		PyList_Append(list, obj);
0fd180
+		Py_DECREF(obj);
0fd180
+	} else {
0fd180
+		attr_query = apol_attr_query_create();
0fd180
+		if (!attr_query)
0fd180
+			goto cleanup;
0fd180
+		if (apol_attr_get_by_query(policydb, attr_query, &v))
0fd180
+			goto cleanup;
0fd180
+		apol_attr_query_destroy(&attr_query);
0fd180
+		n_attrs = apol_vector_get_size(v);
0fd180
+
0fd180
+		for (i = 0; i < n_attrs; i++) {
0fd180
+			/* get qpol_type_t* item from vector */
0fd180
+			type_datum = (qpol_type_t *) apol_vector_get_element(v, (size_t) i);
0fd180
+			if (!type_datum)
0fd180
+				goto cleanup;
0fd180
+			PyObject *obj = get_attr(type_datum, policydb);
0fd180
+			PyList_Append(list, obj);
0fd180
+			Py_DECREF(obj);
0fd180
+		}
0fd180
+	}
0fd180
+	apol_vector_destroy(&v);
0fd180
+
0fd180
+	retval = 0;
0fd180
+      cleanup:
0fd180
+	apol_attr_query_destroy(&attr_query);
0fd180
+	apol_vector_destroy(&v);
0fd180
+	if (retval) {
0fd180
+		Py_DECREF(list);
0fd180
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
0fd180
+		return NULL;
0fd180
+	}
0fd180
+	return list;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * Get a textual representation of a type, and
0fd180
+ * all of that type's attributes.
0fd180
+ *
0fd180
+ * @param type_datum Reference to sepol type_datum
0fd180
+ * @param policydb Reference to a policy
0fd180
+ */
0fd180
+static PyObject* get_type_attrs(const qpol_type_t * type_datum, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	const char *attr_name = NULL;
0fd180
+	const qpol_type_t *attr_datum = NULL;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+
0fd180
+	if (qpol_type_get_attr_iter(q, type_datum, &iter))
0fd180
+		goto cleanup;
0fd180
+	PyObject *list = PyList_New(0);
0fd180
+	for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+		if (qpol_iterator_get_item(iter, (void **)&attr_datum))
0fd180
+			goto cleanup;
0fd180
+		if (qpol_type_get_name(q, attr_datum, &attr_name))
0fd180
+			goto cleanup;
0fd180
+		PyObject *obj = PyString_FromString(attr_name);
0fd180
+		PyList_Append(list, obj);
0fd180
+		Py_DECREF(obj);
0fd180
+	}
0fd180
+
0fd180
+      cleanup:
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+	return list;
0fd180
+}
0fd180
+
0fd180
+static PyObject* get_type( const qpol_type_t * type_datum, const apol_policy_t * policydb) {
0fd180
+
0fd180
+	PyObject *dict = PyDict_New(); 
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+	const char *type_name = NULL;
0fd180
+
0fd180
+	unsigned char isalias, ispermissive, isattr;
0fd180
+
0fd180
+	if (qpol_type_get_name(q, type_datum, &type_name))
0fd180
+		goto cleanup;
0fd180
+	if (qpol_type_get_isalias(q, type_datum, &isalias))
0fd180
+		goto cleanup;
0fd180
+	if (qpol_type_get_isattr(q, type_datum, &isattr))
0fd180
+		goto cleanup;
0fd180
+	if (qpol_type_get_ispermissive(q, type_datum, &ispermissive))
0fd180
+		goto cleanup;
0fd180
+
0fd180
+	PyObject *obj = PyString_FromString(type_name);
0fd180
+	PyDict_SetItemString(dict, "name", obj);
0fd180
+	Py_DECREF(obj);
0fd180
+	obj = PyBool_FromLong(ispermissive);
0fd180
+	PyDict_SetItemString(dict, "permissive", obj);
0fd180
+	Py_DECREF(obj);
0fd180
+	if (!isattr && !isalias) {
0fd180
+		obj = get_type_attrs(type_datum, policydb);
0fd180
+		PyDict_SetItemString(dict, "attributes", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+	}
0fd180
+	return dict;
0fd180
+cleanup:
0fd180
+	Py_DECREF(dict);
0fd180
+	return NULL;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * Gets a textual representation of a user, and
0fd180
+ * all of that user's roles.
0fd180
+ *
0fd180
+ * @param type_datum Reference to sepol type_datum
0fd180
+ * @param policydb Reference to a policy
0fd180
+ * roles
0fd180
+ */
0fd180
+static PyObject* get_user(const qpol_user_t * user_datum, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	PyObject *dict = NULL;
0fd180
+	const qpol_role_t *role_datum = NULL;
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	const qpol_mls_range_t *range = NULL;
0fd180
+	const qpol_mls_level_t *dflt_level = NULL;
0fd180
+	apol_mls_level_t *ap_lvl = NULL;
0fd180
+	apol_mls_range_t *ap_range = NULL;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+	char *tmp;
0fd180
+	const char *user_name, *role_name;
0fd180
+
0fd180
+	if (qpol_user_get_name(q, user_datum, &user_name))
0fd180
+		goto cleanup;
0fd180
+
0fd180
+	dict = PyDict_New(); 
0fd180
+	PyObject *obj = PyString_FromString(user_name);
0fd180
+	PyDict_SetItemString(dict, "name", obj);
0fd180
+	Py_DECREF(obj);
0fd180
+
0fd180
+	if (qpol_policy_has_capability(q, QPOL_CAP_MLS)) {
0fd180
+		if (qpol_user_get_dfltlevel(q, user_datum, &dflt_level))
0fd180
+			goto cleanup;
0fd180
+		ap_lvl = apol_mls_level_create_from_qpol_mls_level(policydb, dflt_level);
0fd180
+		tmp = apol_mls_level_render(policydb, ap_lvl);
0fd180
+		if (!tmp)
0fd180
+			goto cleanup;
0fd180
+		obj = PyString_FromString(tmp);
0fd180
+		PyDict_SetItemString(dict, "level", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+		free(tmp);
0fd180
+		/* print default range */
0fd180
+		if (qpol_user_get_range(q, user_datum, &range))
0fd180
+			goto cleanup;
0fd180
+		ap_range = apol_mls_range_create_from_qpol_mls_range(policydb, range);
0fd180
+		tmp = apol_mls_range_render(policydb, ap_range);
0fd180
+		if (!tmp)
0fd180
+			goto cleanup;
0fd180
+		obj = PyString_FromString(tmp);
0fd180
+		PyDict_SetItemString(dict, "range", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+		free(tmp);
0fd180
+	}
0fd180
+	
0fd180
+	if (qpol_user_get_role_iter(q, user_datum, &iter))
0fd180
+		goto cleanup;
0fd180
+	PyObject *list = PyList_New(0);
0fd180
+	for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+		if (qpol_iterator_get_item(iter, (void **)&role_datum)) {
0fd180
+			Py_DECREF(list);
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+		if (qpol_role_get_name(q, role_datum, &role_name)) {
0fd180
+			Py_DECREF(list);
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+		PyObject *obj = PyString_FromString(role_name);
0fd180
+		PyList_Append(list, obj);
0fd180
+		Py_DECREF(obj);
0fd180
+	}
0fd180
+	PyDict_SetItemString(dict, "roles", list);
0fd180
+	Py_DECREF(list);
0fd180
+
0fd180
+cleanup:
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+	apol_mls_level_destroy(&ap_lvl);
0fd180
+	apol_mls_range_destroy(&ap_range);
0fd180
+	return dict;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * Gets statistics regarding a policy's users.
0fd180
+ * If this function is given a name, it will attempt to
0fd180
+ * get statistics about a particular user; otherwise
0fd180
+ * the function gets statistics about all of the policy's
0fd180
+ * users.
0fd180
+ *
0fd180
+ * @param name Reference to a user's name; if NULL,
0fd180
+ * all users will be considered
0fd180
+ * @param policydb Reference to a policy
0fd180
+ *
0fd180
+ * @return 0 on success, < 0 on error.
0fd180
+ */
0fd180
+static PyObject*  get_users(const char *name, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	int retval = -1;
0fd180
+	PyObject *list = PyList_New(0);
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	const qpol_user_t *user_datum = NULL;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+
0fd180
+	if (name != NULL) {
0fd180
+		if (qpol_policy_get_user_by_name(q, name, &user_datum)) {
0fd180
+			errno = EINVAL;
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+		PyObject *obj = get_user(user_datum, policydb);
0fd180
+		PyList_Append(list, obj);
0fd180
+		Py_DECREF(obj);
0fd180
+	} else {
0fd180
+		if (qpol_policy_get_user_iter(q, &iter))
0fd180
+			goto cleanup;
0fd180
+
0fd180
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+			if (qpol_iterator_get_item(iter, (void **)&user_datum))
0fd180
+				goto cleanup;
0fd180
+			PyObject *obj = get_user(user_datum, policydb);
0fd180
+			PyList_Append(list, obj);
0fd180
+			Py_DECREF(obj);
0fd180
+		}
0fd180
+		qpol_iterator_destroy(&iter);
0fd180
+	}
0fd180
+
0fd180
+	retval = 0;
0fd180
+      cleanup:
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+	if (retval) {
0fd180
+		Py_DECREF(list);
0fd180
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
0fd180
+		return NULL;
0fd180
+	}
0fd180
+	return list;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * get a textual representation of a role, and 
0fd180
+ * all of that role's types.
0fd180
+ *
0fd180
+ * @param type_datum Reference to sepol type_datum
0fd180
+ * @param policydb Reference to a policy
0fd180
+ * types
0fd180
+ */
0fd180
+static PyObject* get_role(const qpol_role_t * role_datum, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	int retval = -1;
0fd180
+	PyObject *dict = PyDict_New();
0fd180
+	const char *role_name = NULL, *type_name = NULL;
0fd180
+	const qpol_role_t *dom_datum = NULL;
0fd180
+	const qpol_type_t *type_datum = NULL;
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+	size_t n_dom = 0, n_types = 0;
0fd180
+
0fd180
+	if (qpol_role_get_name(q, role_datum, &role_name))
0fd180
+		goto cleanup;
0fd180
+
0fd180
+	PyObject *obj = PyString_FromString(role_name);
0fd180
+	PyDict_SetItemString(dict, "name", obj);
0fd180
+	Py_DECREF(obj);
0fd180
+
0fd180
+	if (qpol_role_get_dominate_iter(q, role_datum, &iter))
0fd180
+		goto cleanup;
0fd180
+	if (qpol_iterator_get_size(iter, &n_dom))
0fd180
+		goto cleanup;
0fd180
+	if ((int)n_dom > 0) {
0fd180
+		PyObject *list = PyList_New(0);
0fd180
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+			if (qpol_iterator_get_item(iter, (void **)&dom_datum))
0fd180
+				goto cleanup;
0fd180
+			if (qpol_role_get_name(q, dom_datum, &role_name))
0fd180
+				goto cleanup;
0fd180
+			PyObject *obj = PyString_FromString(role_name);
0fd180
+			PyList_Append(list, obj);
0fd180
+			Py_DECREF(obj);
0fd180
+		}
0fd180
+		PyDict_SetItemString(dict, "dominate", list);
0fd180
+		Py_DECREF(list);
0fd180
+	}
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+	
0fd180
+	if (qpol_role_get_type_iter(q, role_datum, &iter))
0fd180
+		goto cleanup;
0fd180
+	if (qpol_iterator_get_size(iter, &n_types))
0fd180
+		goto cleanup;
0fd180
+	if ((int)n_types > 0) {
0fd180
+		PyObject *list = PyList_New(0);
0fd180
+		/* print types */
0fd180
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+			if (qpol_iterator_get_item(iter, (void **)&type_datum))
0fd180
+				goto cleanup;
0fd180
+			if (qpol_type_get_name(q, type_datum, &type_name))
0fd180
+				goto cleanup;
0fd180
+			PyObject *obj = PyString_FromString(type_name);
0fd180
+			PyList_Append(list, obj);
0fd180
+			Py_DECREF(obj);
0fd180
+		}
0fd180
+		PyDict_SetItemString(dict, "types", list);
0fd180
+		Py_DECREF(list);
0fd180
+	}
0fd180
+
0fd180
+	retval = 0;
0fd180
+cleanup:
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+	if (retval) {
0fd180
+		Py_DECREF(dict);
0fd180
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
0fd180
+		return NULL;
0fd180
+	}
0fd180
+	return dict;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * Get statistics regarding a policy's ports.
0fd180
+ * If this function is given a name, it will attempt to
0fd180
+ * get statistics about a particular port; otherwise
0fd180
+ * the function get statistics about all of the policy's ports.
0fd180
+ *
0fd180
+ * @param name Reference to an port's name; if NULL,
0fd180
+ * all ports will be considered
0fd180
+ * @param policydb Reference to a policy
0fd180
+ *
0fd180
+ * @return 0 on success, < 0 on error.
0fd180
+ */
0fd180
+static PyObject*  get_ports(const char *num, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	PyObject *list = PyList_New(0);
0fd180
+	int retval = -1;
0fd180
+	const qpol_portcon_t *portcon = NULL;
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	uint16_t low_port, high_port;
0fd180
+	uint8_t ocon_proto;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+	const qpol_context_t *ctxt = NULL;
0fd180
+	const char *proto_str;
0fd180
+	PyObject *dict;
0fd180
+	const char *type = NULL;
0fd180
+	const apol_mls_range_t *range = NULL;
0fd180
+	char *range_str = NULL;
0fd180
+	PyObject *obj = NULL;
0fd180
+	apol_context_t *c = NULL;
0fd180
+
0fd180
+	if (qpol_policy_get_portcon_iter(q, &iter))
0fd180
+		goto cleanup;
0fd180
+
0fd180
+	for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
0fd180
+		if (qpol_iterator_get_item(iter, (void **)&portcon))
0fd180
+			goto cleanup;
0fd180
+		if (qpol_portcon_get_low_port(q, portcon, &low_port))
0fd180
+			goto cleanup;
0fd180
+		if (qpol_portcon_get_high_port(q, portcon, &high_port))
0fd180
+			goto cleanup;
0fd180
+		if (qpol_portcon_get_protocol(q, portcon, &ocon_proto))
0fd180
+			goto cleanup;
0fd180
+		if (num) {
0fd180
+			if (atoi(num) < low_port || atoi(num) > high_port)
0fd180
+				continue;
0fd180
+		}
0fd180
+
0fd180
+		if ((ocon_proto != IPPROTO_TCP) &&
0fd180
+		    (ocon_proto != IPPROTO_UDP)) 
0fd180
+			goto cleanup;
0fd180
+
0fd180
+		if (qpol_portcon_get_context(q, portcon, &ctxt)) {
0fd180
+			PyErr_SetString(PyExc_RuntimeError, "Could not get for port context.");
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+
0fd180
+		if ((proto_str = apol_protocol_to_str(ocon_proto)) == NULL) {
0fd180
+			PyErr_SetString(PyExc_RuntimeError, "Invalid protocol for port");
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+
0fd180
+		if ((c = apol_context_create_from_qpol_context(policydb, ctxt)) == NULL) {
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+		
0fd180
+		if((type = apol_context_get_type(c)) == NULL) {
0fd180
+			apol_context_destroy(&c);
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+			
0fd180
+		dict = PyDict_New(); 
0fd180
+		obj = PyString_FromString(type);
0fd180
+		PyDict_SetItemString(dict, "type", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+
0fd180
+		if((range = apol_context_get_range(c)) == NULL) {
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+			
0fd180
+		range_str = apol_mls_range_render(policydb, range);
0fd180
+		if (range_str == NULL) {
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+		obj = PyString_FromString(range_str);
0fd180
+		PyDict_SetItemString(dict, "range", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+
0fd180
+		obj = PyString_FromString(proto_str);
0fd180
+		PyDict_SetItemString(dict, "protocol", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+
0fd180
+		obj = PyInt_FromLong(high_port);
0fd180
+		PyDict_SetItemString(dict, "high", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+
0fd180
+		obj = PyInt_FromLong(low_port);
0fd180
+		PyDict_SetItemString(dict, "low", obj);
0fd180
+		Py_DECREF(obj);
0fd180
+
0fd180
+		PyList_Append(list, dict);
0fd180
+		Py_DECREF(dict);
0fd180
+	}
0fd180
+	retval = 0;
0fd180
+      cleanup:
0fd180
+	free(range_str);
0fd180
+	apol_context_destroy(&c);
0fd180
+	qpol_iterator_destroy(&iter);
0fd180
+
0fd180
+	if (retval) {
0fd180
+		Py_DECREF(list);
0fd180
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
0fd180
+		return NULL;
0fd180
+	}
0fd180
+	return list;
0fd180
+}
0fd180
+
0fd180
+/**
0fd180
+ * Get statistics regarding a policy's roles.
0fd180
+ * If this function is given a name, it will attempt to
0fd180
+ * get statistics about a particular role; otherwise
0fd180
+ * the function get statistics about all of the policy's roles.
0fd180
+ *
0fd180
+ * @param name Reference to an role's name; if NULL,
0fd180
+ * all roles will be considered
0fd180
+ * @param policydb Reference to a policy
0fd180
+ *
0fd180
+ * @return 0 on success, < 0 on error.
0fd180
+ */
0fd180
+static PyObject*  get_roles(const char *name, const apol_policy_t * policydb)
0fd180
+{
0fd180
+	int retval = -1;
0fd180
+	PyObject *list = PyList_New(0);
0fd180
+	const qpol_role_t *role_datum = NULL;
0fd180
+	qpol_iterator_t *iter = NULL;
0fd180
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
0fd180
+
0fd180
+	if (name != NULL) {
0fd180
+		if (qpol_policy_get_role_by_name(q, name, &role_datum)) {
0fd180
+			errno = EINVAL;
0fd180
+			goto cleanup;
0fd180
+		}
0fd180
+		PyObject *obj = get_role(role_datum, policydb);
0fd180
+		PyList_Append(list, obj);
0fd180
+		Py_DECREF(obj);
0fd180
+	} else {