764e716
diff -up setools-3.3.7/configure.ac.python setools-3.3.7/configure.ac
764e716
--- setools-3.3.7/configure.ac.python	2010-04-30 10:25:48.000000000 -0400
764e716
+++ setools-3.3.7/configure.ac	2010-07-30 15:02:10.000000000 -0400
764e716
@@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java,
764e716
               enable_jswig="$enableval")
764e716
 if test "x${enable_jswig}" = xyes; then
764e716
    if test ${do_swigify} = no; then
764e716
-      AC_PROG_SWIG(1.3.28)
764e716
+      AC_PROG_SWIG(2.0.0)
764e716
    fi
764e716
    AC_JAVA_OPTIONS
764e716
    if test "x$JAVAPREFIX" = x; then
764e716
@@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then
00fe000
    do_swigify_java=yes
00fe000
    do_swigify=yes
00fe000
 fi
00fe000
+
277093c
+AM_PATH_PYTHON(2.7)
00fe000
+
00fe000
 AC_ARG_ENABLE(swig-python,
00fe000
               AC_HELP_STRING([--enable-swig-python],
00fe000
                              [build SWIG interfaces for Python]),
764e716
               enable_pyswig="$enableval")
764e716
 if test "x${enable_pyswig}" = xyes; then
00fe000
    if test ${do_swigify} = no; then
764e716
-      AC_PROG_SWIG(1.3.28)
764e716
+      AC_PROG_SWIG(2.0.0)
00fe000
    fi
00fe000
-   AM_PATH_PYTHON(2.3)
00fe000
    SWIG_PYTHON
00fe000
    do_swigify_python=yes
00fe000
    do_swigify=yes
764e716
 fi
764e716
 if test ${do_swigify} = "yes"; then
764e716
-   AC_PROG_SWIG(1.3.28)
764e716
+   AC_PROG_SWIG(2.0.0)
764e716
 fi
764e716
 build_apol=yes
764e716
 AC_ARG_ENABLE(swig-tcl,
764e716
@@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl,
764e716
               enable_tclswig="$enableval", enable_tclswig="yes")
764e716
 if test "x${enable_tclswig}" = xyes; then
764e716
    if test ${do_swigify} = no; then
764e716
-      AC_PROG_SWIG(1.3.28)
764e716
+      AC_PROG_SWIG(2.0.0)
764e716
    fi
764e716
    TEA_INIT(3.5)
764e716
    TEA_PATH_TCLCONFIG
764e716
@@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \
00fe000
                  sediff/Makefile \
00fe000
                  man/Makefile \
00fe000
                  debian/Makefile \
00fe000
+   		 python/Makefile \
00fe000
+   		 python/setools/Makefile \
00fe000
                  packages/Makefile packages/rpm/Makefile \
00fe000
                  packages/libqpol.pc packages/libapol.pc packages/libpoldiff.pc packages/libseaudit.pc packages/libsefs.pc])
00fe000
 
764e716
diff -up setools-3.3.7/Makefile.am.python setools-3.3.7/Makefile.am
764e716
--- setools-3.3.7/Makefile.am.python	2008-02-22 14:06:28.000000000 -0500
764e716
+++ setools-3.3.7/Makefile.am	2010-07-30 15:02:10.000000000 -0400
00fe000
@@ -10,7 +10,7 @@ if BUILD_GUI
00fe000
 endif
00fe000
 # sediffx is also built conditionally, from sediffx/Makefile.am
00fe000
 
00fe000
-SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI)
00fe000
+SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) python
00fe000
 
00fe000
 #old indent opts
00fe000
 #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
764e716
diff -up setools-3.3.7/Makefile.in.python setools-3.3.7/Makefile.in
764e716
--- setools-3.3.7/Makefile.in.python	2010-05-12 10:01:09.000000000 -0400
764e716
+++ setools-3.3.7/Makefile.in	2010-07-30 15:02:47.000000000 -0400
00fe000
@@ -79,7 +79,7 @@ AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGE
00fe000
 ETAGS = etags
00fe000
 CTAGS = ctags
00fe000
 DIST_SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds \
00fe000
-	sechecker sediff man packages debian apol seaudit
00fe000
+	sechecker sediff man packages debian apol seaudit python
00fe000
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
00fe000
 distdir = $(PACKAGE)-$(VERSION)
00fe000
 top_distdir = $(distdir)
764e716
@@ -385,7 +385,7 @@ AUTOMAKE_OPTIONS = dist-bzip2
00fe000
 @BUILD_APOL_TRUE@MAYBE_APOL = apol
00fe000
 @BUILD_GUI_TRUE@MAYBE_GUI = seaudit
00fe000
 # sediffx is also built conditionally, from sediffx/Makefile.am
00fe000
-SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI)
00fe000
+SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) python
00fe000
 
00fe000
 #old indent opts
00fe000
 #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
764e716
diff -up setools-3.3.7/python/Makefile.am.python setools-3.3.7/python/Makefile.am
764e716
--- setools-3.3.7/python/Makefile.am.python	2010-07-30 15:02:10.000000000 -0400
764e716
+++ setools-3.3.7/python/Makefile.am	2010-07-30 15:02:10.000000000 -0400
d7380e7
@@ -0,0 +1 @@
00fe000
+SUBDIRS = setools
764e716
diff -up setools-3.3.7/python/Makefile.in.python setools-3.3.7/python/Makefile.in
764e716
--- setools-3.3.7/python/Makefile.in.python	2010-07-30 15:02:10.000000000 -0400
764e716
+++ setools-3.3.7/python/Makefile.in	2010-07-30 15:02:46.000000000 -0400
764e716
@@ -0,0 +1,716 @@
764e716
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
00fe000
+# @configure_input@
00fe000
+
00fe000
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
00fe000
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
00fe000
+# Inc.
00fe000
+# This Makefile.in is free software; the Free Software Foundation
00fe000
+# gives unlimited permission to copy and/or distribute it,
00fe000
+# with or without modifications, as long as this notice is preserved.
00fe000
+
00fe000
+# This program is distributed in the hope that it will be useful,
00fe000
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
00fe000
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00fe000
+# PARTICULAR PURPOSE.
00fe000
+
00fe000
+@SET_MAKE@
00fe000
+VPATH = @srcdir@
00fe000
+pkgdatadir = $(datadir)/@PACKAGE@
00fe000
+pkgincludedir = $(includedir)/@PACKAGE@
00fe000
+pkglibdir = $(libdir)/@PACKAGE@
00fe000
+pkglibexecdir = $(libexecdir)/@PACKAGE@
00fe000
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
00fe000
+install_sh_DATA = $(install_sh) -c -m 644
00fe000
+install_sh_PROGRAM = $(install_sh) -c
00fe000
+install_sh_SCRIPT = $(install_sh) -c
00fe000
+INSTALL_HEADER = $(INSTALL_DATA)
00fe000
+transform = $(program_transform_name)
00fe000
+NORMAL_INSTALL = :
00fe000
+PRE_INSTALL = :
00fe000
+POST_INSTALL = :
00fe000
+NORMAL_UNINSTALL = :
00fe000
+PRE_UNINSTALL = :
00fe000
+POST_UNINSTALL = :
00fe000
+build_triplet = @build@
00fe000
+host_triplet = @host@
00fe000
+subdir = python
00fe000
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
00fe000
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
00fe000
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_classpath.m4 \
00fe000
+	$(top_srcdir)/m4/ac_java_options.m4 \
00fe000
+	$(top_srcdir)/m4/ac_pkg_swig.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_jar.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_java.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_java_works.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_javac.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_javac_works.m4 \
00fe000
+	$(top_srcdir)/m4/ac_python_devel.m4 $(top_srcdir)/m4/c.m4 \
00fe000
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
00fe000
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
00fe000
+	$(top_srcdir)/m4/lt~obsolete.m4 \
00fe000
+	$(top_srcdir)/m4/swig_python.m4 $(top_srcdir)/m4/tcl.m4 \
00fe000
+	$(top_srcdir)/configure.ac
00fe000
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
00fe000
+	$(ACLOCAL_M4)
00fe000
+mkinstalldirs = $(install_sh) -d
00fe000
+CONFIG_HEADER = $(top_builddir)/config.h
00fe000
+CONFIG_CLEAN_FILES =
00fe000
+CONFIG_CLEAN_VPATH_FILES =
00fe000
+SOURCES =
00fe000
+DIST_SOURCES =
00fe000
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
00fe000
+	html-recursive info-recursive install-data-recursive \
00fe000
+	install-dvi-recursive install-exec-recursive \
00fe000
+	install-html-recursive install-info-recursive \
00fe000
+	install-pdf-recursive install-ps-recursive install-recursive \
00fe000
+	installcheck-recursive installdirs-recursive pdf-recursive \
00fe000
+	ps-recursive uninstall-recursive
00fe000
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive	\
00fe000
+  distclean-recursive maintainer-clean-recursive
00fe000
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
00fe000
+	$(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
00fe000
+	distdir
00fe000
+ETAGS = etags
00fe000
+CTAGS = ctags
00fe000
+DIST_SUBDIRS = $(SUBDIRS)
00fe000
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
00fe000
+am__relativize = \
00fe000
+  dir0=`pwd`; \
00fe000
+  sed_first='s,^\([^/]*\)/.*$$,\1,'; \
00fe000
+  sed_rest='s,^[^/]*/*,,'; \
00fe000
+  sed_last='s,^.*/\([^/]*\)$$,\1,'; \
00fe000
+  sed_butlast='s,/*[^/]*$$,,'; \
00fe000
+  while test -n "$$dir1"; do \
00fe000
+    first=`echo "$$dir1" | sed -e "$$sed_first"`; \
00fe000
+    if test "$$first" != "."; then \
00fe000
+      if test "$$first" = ".."; then \
00fe000
+        dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
00fe000
+        dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
00fe000
+      else \
00fe000
+        first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
00fe000
+        if test "$$first2" = "$$first"; then \
00fe000
+          dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
00fe000
+        else \
00fe000
+          dir2="../$$dir2"; \
00fe000
+        fi; \
00fe000
+        dir0="$$dir0"/"$$first"; \
00fe000
+      fi; \
00fe000
+    fi; \
00fe000
+    dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
00fe000
+  done; \
00fe000
+  reldir="$$dir2"
00fe000
+ACLOCAL = @ACLOCAL@
00fe000
+AMTAR = @AMTAR@
00fe000
+APOL_CFLAGS = @APOL_CFLAGS@
00fe000
+APOL_LIB_FLAG = @APOL_LIB_FLAG@
00fe000
+AR = @AR@
00fe000
+AUTOCONF = @AUTOCONF@
00fe000
+AUTOHEADER = @AUTOHEADER@
00fe000
+AUTOMAKE = @AUTOMAKE@
00fe000
+AWK = @AWK@
00fe000
+BWIDGET_DESTDIR = @BWIDGET_DESTDIR@
00fe000
+CC = @CC@
00fe000
+CCDEPMODE = @CCDEPMODE@
00fe000
+CFLAGS = @CFLAGS@
00fe000
+CPP = @CPP@
00fe000
+CPPFLAGS = @CPPFLAGS@
00fe000
+CUNIT_LIB_FLAG = @CUNIT_LIB_FLAG@
00fe000
+CXX = @CXX@
00fe000
+CXXCPP = @CXXCPP@
00fe000
+CXXDEPMODE = @CXXDEPMODE@
00fe000
+CXXFLAGS = @CXXFLAGS@
00fe000
+CYGPATH = @CYGPATH@
00fe000
+CYGPATH_W = @CYGPATH_W@
00fe000
+DEBUGCFLAGS = @DEBUGCFLAGS@
00fe000
+DEBUGCXXFLAGS = @DEBUGCXXFLAGS@
00fe000
+DEBUGJFLAGS = @DEBUGJFLAGS@
00fe000
+DEBUGLDFLAGS = @DEBUGLDFLAGS@
00fe000
+DEFS = @DEFS@
00fe000
+DEPDIR = @DEPDIR@
00fe000
+DSYMUTIL = @DSYMUTIL@
00fe000
+DUMPBIN = @DUMPBIN@
00fe000
+ECHO_C = @ECHO_C@
00fe000
+ECHO_N = @ECHO_N@
00fe000
+ECHO_T = @ECHO_T@
00fe000
+EGREP = @EGREP@
00fe000
+EXEEXT = @EXEEXT@
00fe000
+FGREP = @FGREP@
00fe000
+GLADE_CFLAGS = @GLADE_CFLAGS@
00fe000
+GLADE_LIBS = @GLADE_LIBS@
00fe000
+GREP = @GREP@
00fe000
+GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
00fe000
+GTHREAD_LIBS = @GTHREAD_LIBS@
00fe000
+GTK_CFLAGS = @GTK_CFLAGS@
00fe000
+GTK_LIBS = @GTK_LIBS@
00fe000
+INSTALL = @INSTALL@
00fe000
+INSTALL_DATA = @INSTALL_DATA@
00fe000
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
00fe000
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
00fe000
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
00fe000
+JAR = @JAR@
00fe000
+JAVA = @JAVA@
00fe000
+JAVAC = @JAVAC@
00fe000
+JAVACFLAGS = @JAVACFLAGS@
00fe000
+JAVAFLAGS = @JAVAFLAGS@
00fe000
+JAVAPREFIX = @JAVAPREFIX@
00fe000
+LD = @LD@
00fe000
+LDFLAGS = @LDFLAGS@
00fe000
+LEX = @LEX@
00fe000
+LEXLIB = @LEXLIB@
00fe000
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
00fe000
+LIBOBJS = @LIBOBJS@
00fe000
+LIBS = @LIBS@
00fe000
+LIBTOOL = @LIBTOOL@
00fe000
+LIPO = @LIPO@
00fe000
+LN_S = @LN_S@
00fe000
+LTLIBOBJS = @LTLIBOBJS@
00fe000
+MAKEINFO = @MAKEINFO@
00fe000
+MKDIR_P = @MKDIR_P@
00fe000
+NM = @NM@
00fe000
+NMEDIT = @NMEDIT@
00fe000
+OBJDUMP = @OBJDUMP@
00fe000
+OBJEXT = @OBJEXT@
00fe000
+OTOOL = @OTOOL@
00fe000
+OTOOL64 = @OTOOL64@
00fe000
+PACKAGE = @PACKAGE@
00fe000
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
00fe000
+PACKAGE_NAME = @PACKAGE_NAME@
00fe000
+PACKAGE_STRING = @PACKAGE_STRING@
00fe000
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
764e716
+PACKAGE_URL = @PACKAGE_URL@
00fe000
+PACKAGE_VERSION = @PACKAGE_VERSION@
00fe000
+PATH_SEPARATOR = @PATH_SEPARATOR@
00fe000
+PIXBUF_CFLAGS = @PIXBUF_CFLAGS@
00fe000
+PIXBUF_LIBS = @PIXBUF_LIBS@
00fe000
+PKG_CFLAGS = @PKG_CFLAGS@
00fe000
+PKG_HEADERS = @PKG_HEADERS@
00fe000
+PKG_INCLUDES = @PKG_INCLUDES@
00fe000
+PKG_LIBS = @PKG_LIBS@
00fe000
+PKG_LIB_FILE = @PKG_LIB_FILE@
00fe000
+PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
00fe000
+PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
00fe000
+PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
00fe000
+PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
00fe000
+POLDIFF_CFLAGS = @POLDIFF_CFLAGS@
00fe000
+POLDIFF_LIB_FLAG = @POLDIFF_LIB_FLAG@
00fe000
+PROFILECFLAGS = @PROFILECFLAGS@
00fe000
+PROFILELDFLAGS = @PROFILELDFLAGS@
00fe000
+PYTHON = @PYTHON@
00fe000
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
00fe000
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
00fe000
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
00fe000
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
00fe000
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
00fe000
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
00fe000
+PYTHON_PREFIX = @PYTHON_PREFIX@
00fe000
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
00fe000
+PYTHON_VERSION = @PYTHON_VERSION@
00fe000
+QPOL_CFLAGS = @QPOL_CFLAGS@
00fe000
+QPOL_LIB_FLAG = @QPOL_LIB_FLAG@
00fe000
+RANLIB = @RANLIB@
00fe000
+SEAUDIT_CFLAGS = @SEAUDIT_CFLAGS@
00fe000
+SEAUDIT_LIB_FLAG = @SEAUDIT_LIB_FLAG@
00fe000
+SED = @SED@
00fe000
+SEFS_CFLAGS = @SEFS_CFLAGS@
00fe000
+SEFS_LIB_FLAG = @SEFS_LIB_FLAG@
00fe000
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
00fe000
+SELINUX_LIB_FLAG = @SELINUX_LIB_FLAG@
00fe000
+SET_MAKE = @SET_MAKE@
00fe000
+SHELL = @SHELL@
00fe000
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
00fe000
+SQLITE3_LIBS = @SQLITE3_LIBS@
00fe000
+STRIP = @STRIP@
00fe000
+SWIG = @SWIG@
00fe000
+SWIG_JAVA_CFLAGS = @SWIG_JAVA_CFLAGS@
00fe000
+SWIG_JAVA_OPT = @SWIG_JAVA_OPT@
00fe000
+SWIG_LIB = @SWIG_LIB@
00fe000
+SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@
00fe000
+SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
00fe000
+SWIG_TCL_CFLAGS = @SWIG_TCL_CFLAGS@
00fe000
+SWIG_TCL_OPT = @SWIG_TCL_OPT@
00fe000
+TCLSH_PROG = @TCLSH_PROG@
00fe000
+TCL_AUTOPATH = @TCL_AUTOPATH@
00fe000
+TCL_BIN_DIR = @TCL_BIN_DIR@
00fe000
+TCL_DEFS = @TCL_DEFS@
00fe000
+TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
00fe000
+TCL_INCLUDES = @TCL_INCLUDES@
00fe000
+TCL_LD_FLAGS = @TCL_LD_FLAGS@
00fe000
+TCL_LIBS = @TCL_LIBS@
00fe000
+TCL_LIB_FILE = @TCL_LIB_FILE@
00fe000
+TCL_LIB_FLAG = @TCL_LIB_FLAG@
00fe000
+TCL_LIB_SPEC = @TCL_LIB_SPEC@
00fe000
+TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
00fe000
+TCL_SRC_DIR = @TCL_SRC_DIR@
00fe000
+TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
00fe000
+TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
00fe000
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
00fe000
+TCL_VERSION = @TCL_VERSION@
00fe000
+TK_BIN_DIR = @TK_BIN_DIR@
00fe000
+TK_INCLUDES = @TK_INCLUDES@
00fe000
+TK_LIBS = @TK_LIBS@
00fe000
+TK_LIB_FILE = @TK_LIB_FILE@
00fe000
+TK_LIB_FLAG = @TK_LIB_FLAG@
00fe000
+TK_LIB_SPEC = @TK_LIB_SPEC@
00fe000
+TK_SRC_DIR = @TK_SRC_DIR@
00fe000
+TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
00fe000
+TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
00fe000
+TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
00fe000
+TK_VERSION = @TK_VERSION@
00fe000
+TK_XINCLUDES = @TK_XINCLUDES@
00fe000
+VERSION = @VERSION@
00fe000
+WARNCFLAGS = @WARNCFLAGS@
00fe000
+WARNCXXFLAGS = @WARNCXXFLAGS@
00fe000
+WARNJFLAGS = @WARNJFLAGS@
00fe000
+WARNLDFLAGS = @WARNLDFLAGS@
00fe000
+WISH_PROG = @WISH_PROG@
00fe000
+XMKMF = @XMKMF@
00fe000
+XML_CFLAGS = @XML_CFLAGS@
00fe000
+XML_LIBS = @XML_LIBS@
00fe000
+YACC = @YACC@
00fe000
+YFLAGS = @YFLAGS@
00fe000
+abs_builddir = @abs_builddir@
00fe000
+abs_srcdir = @abs_srcdir@
00fe000
+abs_top_builddir = @abs_top_builddir@
00fe000
+abs_top_srcdir = @abs_top_srcdir@
00fe000
+ac_ct_CC = @ac_ct_CC@
00fe000
+ac_ct_CXX = @ac_ct_CXX@
00fe000
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
00fe000
+am__include = @am__include@
00fe000
+am__leading_dot = @am__leading_dot@
00fe000
+am__quote = @am__quote@
00fe000
+am__tar = @am__tar@
00fe000
+am__untar = @am__untar@
00fe000
+bindir = @bindir@
00fe000
+build = @build@
00fe000
+build_alias = @build_alias@
00fe000
+build_cpu = @build_cpu@
00fe000
+build_os = @build_os@
00fe000
+build_vendor = @build_vendor@
00fe000
+builddir = @builddir@
00fe000
+datadir = @datadir@
00fe000
+datarootdir = @datarootdir@
00fe000
+docdir = @docdir@
00fe000
+dvidir = @dvidir@
00fe000
+exec_prefix = @exec_prefix@
00fe000
+has_pkg_config = @has_pkg_config@
00fe000
+host = @host@
00fe000
+host_alias = @host_alias@
00fe000
+host_cpu = @host_cpu@
00fe000
+host_os = @host_os@
00fe000
+host_vendor = @host_vendor@
00fe000
+htmldir = @htmldir@
00fe000
+includedir = @includedir@
00fe000
+infodir = @infodir@
00fe000
+install_sh = @install_sh@
00fe000
+javadir = @javadir@
00fe000
+libapol_jswig_soname = @libapol_jswig_soname@
00fe000
+libapol_pyswig_soname = @libapol_pyswig_soname@
00fe000
+libapol_soname = @libapol_soname@
00fe000
+libapol_soversion = @libapol_soversion@
00fe000
+libapol_tswig_soname = @libapol_tswig_soname@
00fe000
+libapol_version = @libapol_version@
00fe000
+libdir = @libdir@
00fe000
+libexecdir = @libexecdir@
00fe000
+libpoldiff_jswig_soname = @libpoldiff_jswig_soname@
00fe000
+libpoldiff_pyswig_soname = @libpoldiff_pyswig_soname@
00fe000
+libpoldiff_soname = @libpoldiff_soname@
00fe000
+libpoldiff_soversion = @libpoldiff_soversion@
00fe000
+libpoldiff_tswig_soname = @libpoldiff_tswig_soname@
00fe000
+libpoldiff_version = @libpoldiff_version@
00fe000
+libqpol_jswig_soname = @libqpol_jswig_soname@
00fe000
+libqpol_pyswig_soname = @libqpol_pyswig_soname@
00fe000
+libqpol_soname = @libqpol_soname@
00fe000
+libqpol_soversion = @libqpol_soversion@
00fe000
+libqpol_tswig_soname = @libqpol_tswig_soname@
00fe000
+libqpol_version = @libqpol_version@
00fe000
+libseaudit_jswig_soname = @libseaudit_jswig_soname@
00fe000
+libseaudit_pyswig_soname = @libseaudit_pyswig_soname@
00fe000
+libseaudit_soname = @libseaudit_soname@
00fe000
+libseaudit_soversion = @libseaudit_soversion@
00fe000
+libseaudit_tswig_soname = @libseaudit_tswig_soname@
00fe000
+libseaudit_version = @libseaudit_version@
00fe000
+libsefs_jswig_soname = @libsefs_jswig_soname@
00fe000
+libsefs_pyswig_soname = @libsefs_pyswig_soname@
00fe000
+libsefs_soname = @libsefs_soname@
00fe000
+libsefs_soversion = @libsefs_soversion@
00fe000
+libsefs_tswig_soname = @libsefs_tswig_soname@
00fe000
+libsefs_version = @libsefs_version@
00fe000
+localedir = @localedir@
00fe000
+localstatedir = @localstatedir@
00fe000
+lt_ECHO = @lt_ECHO@
00fe000
+mandir = @mandir@
00fe000
+mkdir_p = @mkdir_p@
00fe000
+oldincludedir = @oldincludedir@
00fe000
+pdfdir = @pdfdir@
00fe000
+pkgpyexecdir = @pkgpyexecdir@
00fe000
+pkgpythondir = @pkgpythondir@
00fe000
+prefix = @prefix@
00fe000
+profile_install_dir = @profile_install_dir@
00fe000
+program_transform_name = @program_transform_name@
00fe000
+psdir = @psdir@
00fe000
+pyexecdir = @pyexecdir@
00fe000
+pythondir = @pythondir@
00fe000
+sbindir = @sbindir@
00fe000
+selinux_default_policy = @selinux_default_policy@
00fe000
+selinux_policy_dir = @selinux_policy_dir@
00fe000
+sepol_srcdir = @sepol_srcdir@
00fe000
+setoolsdir = @setoolsdir@
00fe000
+sharedstatedir = @sharedstatedir@
00fe000
+srcdir = @srcdir@
00fe000
+sysconfdir = @sysconfdir@
00fe000
+target_alias = @target_alias@
00fe000
+top_build_prefix = @top_build_prefix@
00fe000
+top_builddir = @top_builddir@
00fe000
+top_srcdir = @top_srcdir@
00fe000
+uudecode = @uudecode@
00fe000
+SUBDIRS = setools
00fe000
+all: all-recursive
00fe000
+
00fe000
+.SUFFIXES:
00fe000
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
00fe000
+	@for dep in $?; do \
00fe000
+	  case '$(am__configure_deps)' in \
00fe000
+	    *$$dep*) \
00fe000
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
00fe000
+	        && { if test -f $@; then exit 0; else break; fi; }; \
00fe000
+	      exit 1;; \
00fe000
+	  esac; \
00fe000
+	done; \
00fe000
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \
00fe000
+	$(am__cd) $(top_srcdir) && \
00fe000
+	  $(AUTOMAKE) --gnu python/Makefile
00fe000
+.PRECIOUS: Makefile
00fe000
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
00fe000
+	@case '$?' in \
00fe000
+	  *config.status*) \
00fe000
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
00fe000
+	  *) \
00fe000
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
00fe000
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
00fe000
+	esac;
00fe000
+
00fe000
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
00fe000
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
00fe000
+
00fe000
+$(top_srcdir)/configure:  $(am__configure_deps)
00fe000
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
00fe000
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
00fe000
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
00fe000
+$(am__aclocal_m4_deps):
00fe000
+
00fe000
+mostlyclean-libtool:
00fe000
+	-rm -f *.lo
00fe000
+
00fe000
+clean-libtool:
00fe000
+	-rm -rf .libs _libs
00fe000
+
00fe000
+# This directory's subdirectories are mostly independent; you can cd
00fe000
+# into them and run `make' without going through this Makefile.
00fe000
+# To change the values of `make' variables: instead of editing Makefiles,
00fe000
+# (1) if the variable is set in `config.status', edit `config.status'
00fe000
+#     (which will cause the Makefiles to be regenerated when you run `make');
00fe000
+# (2) otherwise, pass the desired values on the `make' command line.
00fe000
+$(RECURSIVE_TARGETS):
764e716
+	@fail= failcom='exit 1'; \
00fe000
+	for f in x $$MAKEFLAGS; do \
00fe000
+	  case $$f in \
00fe000
+	    *=* | --[!k]*);; \
00fe000
+	    *k*) failcom='fail=yes';; \
00fe000
+	  esac; \
00fe000
+	done; \
00fe000
+	dot_seen=no; \
00fe000
+	target=`echo $@ | sed s/-recursive//`; \
00fe000
+	list='$(SUBDIRS)'; for subdir in $$list; do \
00fe000
+	  echo "Making $$target in $$subdir"; \
00fe000
+	  if test "$$subdir" = "."; then \
00fe000
+	    dot_seen=yes; \
00fe000
+	    local_target="$$target-am"; \
00fe000
+	  else \
00fe000
+	    local_target="$$target"; \
00fe000
+	  fi; \
00fe000
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
00fe000
+	  || eval $$failcom; \
00fe000
+	done; \
00fe000
+	if test "$$dot_seen" = "no"; then \
00fe000
+	  $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
00fe000
+	fi; test -z "$$fail"
00fe000
+
00fe000
+$(RECURSIVE_CLEAN_TARGETS):
764e716
+	@fail= failcom='exit 1'; \
00fe000
+	for f in x $$MAKEFLAGS; do \
00fe000
+	  case $$f in \
00fe000
+	    *=* | --[!k]*);; \
00fe000
+	    *k*) failcom='fail=yes';; \
00fe000
+	  esac; \
00fe000
+	done; \
00fe000
+	dot_seen=no; \
00fe000
+	case "$@" in \
00fe000
+	  distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
00fe000
+	  *) list='$(SUBDIRS)' ;; \
00fe000
+	esac; \
00fe000
+	rev=''; for subdir in $$list; do \
00fe000
+	  if test "$$subdir" = "."; then :; else \
00fe000
+	    rev="$$subdir $$rev"; \
00fe000
+	  fi; \
00fe000
+	done; \
00fe000
+	rev="$$rev ."; \
00fe000
+	target=`echo $@ | sed s/-recursive//`; \
00fe000
+	for subdir in $$rev; do \
00fe000
+	  echo "Making $$target in $$subdir"; \
00fe000
+	  if test "$$subdir" = "."; then \
00fe000
+	    local_target="$$target-am"; \
00fe000
+	  else \
00fe000
+	    local_target="$$target"; \
00fe000
+	  fi; \
00fe000
+	  ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
00fe000
+	  || eval $$failcom; \
00fe000
+	done && test -z "$$fail"
00fe000
+tags-recursive:
00fe000
+	list='$(SUBDIRS)'; for subdir in $$list; do \
00fe000
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
00fe000
+	done
00fe000
+ctags-recursive:
00fe000
+	list='$(SUBDIRS)'; for subdir in $$list; do \
00fe000
+	  test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
00fe000
+	done
00fe000
+
00fe000
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
00fe000
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
00fe000
+	unique=`for i in $$list; do \
00fe000
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
00fe000
+	  done | \
00fe000
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
00fe000
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
00fe000
+	mkid -fID $$unique
00fe000
+tags: TAGS
00fe000
+
00fe000
+TAGS: tags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
00fe000
+		$(TAGS_FILES) $(LISP)
00fe000
+	set x; \
00fe000
+	here=`pwd`; \
00fe000
+	if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
00fe000
+	  include_option=--etags-include; \
00fe000
+	  empty_fix=.; \
00fe000
+	else \
00fe000
+	  include_option=--include; \
00fe000
+	  empty_fix=; \
00fe000
+	fi; \
00fe000
+	list='$(SUBDIRS)'; for subdir in $$list; do \
00fe000
+	  if test "$$subdir" = .; then :; else \
00fe000
+	    test ! -f $$subdir/TAGS || \
00fe000
+	      set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
00fe000
+	  fi; \
00fe000
+	done; \
00fe000
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
00fe000
+	unique=`for i in $$list; do \
00fe000
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
00fe000
+	  done | \
00fe000
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
00fe000
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
00fe000
+	shift; \
00fe000
+	if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
00fe000
+	  test -n "$$unique" || unique=$$empty_fix; \
00fe000
+	  if test $$# -gt 0; then \
00fe000
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
00fe000
+	      "$$@" $$unique; \
00fe000
+	  else \
00fe000
+	    $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
00fe000
+	      $$unique; \
00fe000
+	  fi; \
00fe000
+	fi
00fe000
+ctags: CTAGS
00fe000
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
00fe000
+		$(TAGS_FILES) $(LISP)
00fe000
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
00fe000
+	unique=`for i in $$list; do \
00fe000
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
00fe000
+	  done | \
00fe000
+	  $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
00fe000
+	      END { if (nonempty) { for (i in files) print i; }; }'`; \
00fe000
+	test -z "$(CTAGS_ARGS)$$unique" \
00fe000
+	  || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
00fe000
+	     $$unique
00fe000
+
00fe000
+GTAGS:
00fe000
+	here=`$(am__cd) $(top_builddir) && pwd` \
00fe000
+	  && $(am__cd) $(top_srcdir) \
00fe000
+	  && gtags -i $(GTAGS_ARGS) "$$here"
00fe000
+
00fe000
+distclean-tags:
00fe000
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
00fe000
+
00fe000
+distdir: $(DISTFILES)
00fe000
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
00fe000
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
00fe000
+	list='$(DISTFILES)'; \
00fe000
+	  dist_files=`for file in $$list; do echo $$file; done | \
00fe000
+	  sed -e "s|^$$srcdirstrip/||;t" \
00fe000
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
00fe000
+	case $$dist_files in \
00fe000
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
00fe000
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
00fe000
+			   sort -u` ;; \
00fe000
+	esac; \
00fe000
+	for file in $$dist_files; do \
00fe000
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
00fe000
+	  if test -d $$d/$$file; then \
00fe000
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
00fe000
+	    if test -d "$(distdir)/$$file"; then \
00fe000
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
00fe000
+	    fi; \
00fe000
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
00fe000
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
00fe000
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
00fe000
+	    fi; \
00fe000
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
00fe000
+	  else \
00fe000
+	    test -f "$(distdir)/$$file" \
00fe000
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
00fe000
+	    || exit 1; \
00fe000
+	  fi; \
00fe000
+	done
00fe000
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
00fe000
+	  if test "$$subdir" = .; then :; else \
00fe000
+	    test -d "$(distdir)/$$subdir" \
00fe000
+	    || $(MKDIR_P) "$(distdir)/$$subdir" \
00fe000
+	    || exit 1; \
00fe000
+	  fi; \
00fe000
+	done
00fe000
+	@list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
00fe000
+	  if test "$$subdir" = .; then :; else \
00fe000
+	    dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
00fe000
+	    $(am__relativize); \
00fe000
+	    new_distdir=$$reldir; \
00fe000
+	    dir1=$$subdir; dir2="$(top_distdir)"; \
00fe000
+	    $(am__relativize); \
00fe000
+	    new_top_distdir=$$reldir; \
00fe000
+	    echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
00fe000
+	    echo "     am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
00fe000
+	    ($(am__cd) $$subdir && \
00fe000
+	      $(MAKE) $(AM_MAKEFLAGS) \
00fe000
+	        top_distdir="$$new_top_distdir" \
00fe000
+	        distdir="$$new_distdir" \
00fe000
+		am__remove_distdir=: \
00fe000
+		am__skip_length_check=: \
00fe000
+		am__skip_mode_fix=: \
00fe000
+	        distdir) \
00fe000
+	      || exit 1; \
00fe000
+	  fi; \
00fe000
+	done
00fe000
+check-am: all-am
00fe000
+check: check-recursive
00fe000
+all-am: Makefile
00fe000
+installdirs: installdirs-recursive
00fe000
+installdirs-am:
00fe000
+install: install-recursive
00fe000
+install-exec: install-exec-recursive
00fe000
+install-data: install-data-recursive
00fe000
+uninstall: uninstall-recursive
00fe000
+
00fe000
+install-am: all-am
00fe000
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
00fe000
+
00fe000
+installcheck: installcheck-recursive
00fe000
+install-strip:
00fe000
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
00fe000
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
00fe000
+	  `test -z '$(STRIP)' || \
00fe000
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
00fe000
+mostlyclean-generic:
00fe000
+
00fe000
+clean-generic:
00fe000
+
00fe000
+distclean-generic:
00fe000
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
00fe000
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
00fe000
+
00fe000
+maintainer-clean-generic:
00fe000
+	@echo "This command is intended for maintainers to use"
00fe000
+	@echo "it deletes files that may require special tools to rebuild."
00fe000
+clean: clean-recursive
00fe000
+
00fe000
+clean-am: clean-generic clean-libtool mostlyclean-am
00fe000
+
00fe000
+distclean: distclean-recursive
00fe000
+	-rm -f Makefile
00fe000
+distclean-am: clean-am distclean-generic distclean-tags
00fe000
+
00fe000
+dvi: dvi-recursive
00fe000
+
00fe000
+dvi-am:
00fe000
+
00fe000
+html: html-recursive
00fe000
+
00fe000
+html-am:
00fe000
+
00fe000
+info: info-recursive
00fe000
+
00fe000
+info-am:
00fe000
+
00fe000
+install-data-am:
00fe000
+
00fe000
+install-dvi: install-dvi-recursive
00fe000
+
00fe000
+install-dvi-am:
00fe000
+
00fe000
+install-exec-am:
00fe000
+
00fe000
+install-html: install-html-recursive
00fe000
+
00fe000
+install-html-am:
00fe000
+
00fe000
+install-info: install-info-recursive
00fe000
+
00fe000
+install-info-am:
00fe000
+
00fe000
+install-man:
00fe000
+
00fe000
+install-pdf: install-pdf-recursive
00fe000
+
00fe000
+install-pdf-am:
00fe000
+
00fe000
+install-ps: install-ps-recursive
00fe000
+
00fe000
+install-ps-am:
00fe000
+
00fe000
+installcheck-am:
00fe000
+
00fe000
+maintainer-clean: maintainer-clean-recursive
00fe000
+	-rm -f Makefile
00fe000
+maintainer-clean-am: distclean-am maintainer-clean-generic
00fe000
+
00fe000
+mostlyclean: mostlyclean-recursive
00fe000
+
00fe000
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
00fe000
+
00fe000
+pdf: pdf-recursive
00fe000
+
00fe000
+pdf-am:
00fe000
+
00fe000
+ps: ps-recursive
00fe000
+
00fe000
+ps-am:
00fe000
+
00fe000
+uninstall-am:
00fe000
+
00fe000
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
00fe000
+	install-am install-strip tags-recursive
00fe000
+
00fe000
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
00fe000
+	all all-am check check-am clean clean-generic clean-libtool \
00fe000
+	ctags ctags-recursive distclean distclean-generic \
00fe000
+	distclean-libtool distclean-tags distdir dvi dvi-am html \
00fe000
+	html-am info info-am install install-am install-data \
00fe000
+	install-data-am install-dvi install-dvi-am install-exec \
00fe000
+	install-exec-am install-html install-html-am install-info \
00fe000
+	install-info-am install-man install-pdf install-pdf-am \
00fe000
+	install-ps install-ps-am install-strip installcheck \
00fe000
+	installcheck-am installdirs installdirs-am maintainer-clean \
00fe000
+	maintainer-clean-generic mostlyclean mostlyclean-generic \
00fe000
+	mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
00fe000
+	uninstall uninstall-am
00fe000
+
00fe000
+
00fe000
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
00fe000
+# Otherwise a system limit (for SysV at least) may be exceeded.
00fe000
+.NOEXPORT:
764e716
diff -up setools-3.3.7/python/setools/__init__.py.python setools-3.3.7/python/setools/__init__.py
764e716
--- setools-3.3.7/python/setools/__init__.py.python	2010-07-30 15:02:10.000000000 -0400
51f1614
+++ setools-3.3.7/python/setools/__init__.py	2010-10-14 14:31:06.000000000 -0400
764e716
@@ -0,0 +1,50 @@
00fe000
+#!/usr/bin/env python
00fe000
+
00fe000
+# Author: Thomas Liu <tliu@redhat.com>
00fe000
+
00fe000
+import _sesearch
00fe000
+import _seinfo
00fe000
+import types
00fe000
+
00fe000
+TYPE = _seinfo.TYPE
00fe000
+ROLE = _seinfo.ROLE
00fe000
+ATTRIBUTE = _seinfo.ATTRIBUTE
764e716
+PORT = _seinfo.PORT
00fe000
+USER = _seinfo.USER
00fe000
+
00fe000
+ALLOW = 'allow'
00fe000
+AUDITALLOW = 'auditallow'
00fe000
+NEVERALLOW = 'neverallow'
00fe000
+DONTAUDIT = 'dontaudit'
00fe000
+SCONTEXT = 'scontext'
00fe000
+TCONTEXT = 'tcontext'
00fe000
+PERMS = 'permlist'
00fe000
+CLASS = 'class'
00fe000
+
00fe000
+def sesearch(types, info):
00fe000
+    valid_types = [ALLOW, AUDITALLOW, NEVERALLOW, DONTAUDIT]
00fe000
+    for type in types:
00fe000
+        if type not in valid_types:
00fe000
+            raise ValueError("Type has to be in %s" % valid_types)
00fe000
+        info[type] = True
00fe000
+
00fe000
+    perms = []
00fe000
+    if PERMS in info:
00fe000
+        perms = info[PERMS]
00fe000
+        info[PERMS] = ",".join(info[PERMS])
00fe000
+     
00fe000
+    
00fe000
+    dict_list = _sesearch.sesearch(info)
51f1614
+    if dict_list and len(perms) != 0:
00fe000
+        dict_list = filter(lambda x: dict_has_perms(x, perms), dict_list)
00fe000
+    return dict_list
00fe000
+
00fe000
+def dict_has_perms(dict, perms):
00fe000
+    for perm in perms:
00fe000
+        if perm not in dict[PERMS]:
00fe000
+            return False
00fe000
+    return True
00fe000
+
00fe000
+def seinfo(setype, name=None):
00fe000
+    dict_list = _seinfo.seinfo(setype, name)
00fe000
+    return dict_list
764e716
diff -up setools-3.3.7/python/setools/Makefile.am.python setools-3.3.7/python/setools/Makefile.am
764e716
--- setools-3.3.7/python/setools/Makefile.am.python	2010-07-30 15:02:10.000000000 -0400
764e716
+++ setools-3.3.7/python/setools/Makefile.am	2010-07-30 15:02:10.000000000 -0400
d7380e7
@@ -0,0 +1,36 @@
00fe000
+EXTRA_DIST =				\
00fe000
+	sesearch.c			\
00fe000
+	seinfo.c			\
00fe000
+	__init__.py			\
00fe000
+	setup.py			\
00fe000
+	$(NULL)
00fe000
+
d7380e7
+AM_CFLAGS = @DEBUGCFLAGS@ @WARNCFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
d7380e7
+	@QPOL_CFLAGS@ @APOL_CFLAGS@
d7380e7
+AM_CXXFLAGS = @DEBUGCXXFLAGS@ @WARNCXXFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
d7380e7
+	@QPOL_CFLAGS@ @APOL_CFLAGS@ @SEFS_CFLAGS@
d7380e7
+AM_LDFLAGS = @DEBUGLDFLAGS@ @WARNLDFLAGS@ @PROFILELDFLAGS@
d7380e7
+
d7380e7
+LDADD = @SELINUX_LIB_FLAG@ @APOL_LIB_FLAG@ @QPOL_LIB_FLAG@
d7380e7
+DEPENDENCIES = $(top_builddir)/libapol/src/libapol.so $(top_builddir)/libqpol/src/libqpol.so
00fe000
+all-am: python-build
00fe000
+
d7380e7
+seinfo_SOURCES = seinfo.c
d7380e7
+
d7380e7
+sesearch_SOURCES = sesearch.c
d7380e7
+
00fe000
+python-build: sesearch.c seinfo.c
00fe000
+	@mkdir -p setools
00fe000
+	@cp __init__.py setools
d7380e7
+	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build
00fe000
+
00fe000
+install-exec-hook:
00fe000
+	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
00fe000
+
00fe000
+uninstall-hook: 
00fe000
+	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
00fe000
+
00fe000
+clean-local:
00fe000
+	$(PYTHON) setup.py clean -a 
00fe000
+	rm -f *~
00fe000
+
764e716
diff -up setools-3.3.7/python/setools/Makefile.in.python setools-3.3.7/python/setools/Makefile.in
764e716
--- setools-3.3.7/python/setools/Makefile.in.python	2010-07-30 15:02:10.000000000 -0400
764e716
+++ setools-3.3.7/python/setools/Makefile.in	2010-07-30 15:02:46.000000000 -0400
764e716
@@ -0,0 +1,550 @@
764e716
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
00fe000
+# @configure_input@
00fe000
+
00fe000
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
00fe000
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009  Free Software Foundation,
00fe000
+# Inc.
00fe000
+# This Makefile.in is free software; the Free Software Foundation
00fe000
+# gives unlimited permission to copy and/or distribute it,
00fe000
+# with or without modifications, as long as this notice is preserved.
00fe000
+
00fe000
+# This program is distributed in the hope that it will be useful,
00fe000
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
00fe000
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
00fe000
+# PARTICULAR PURPOSE.
00fe000
+
00fe000
+@SET_MAKE@
00fe000
+VPATH = @srcdir@
00fe000
+pkgdatadir = $(datadir)/@PACKAGE@
00fe000
+pkgincludedir = $(includedir)/@PACKAGE@
00fe000
+pkglibdir = $(libdir)/@PACKAGE@
00fe000
+pkglibexecdir = $(libexecdir)/@PACKAGE@
00fe000
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
00fe000
+install_sh_DATA = $(install_sh) -c -m 644
00fe000
+install_sh_PROGRAM = $(install_sh) -c
00fe000
+install_sh_SCRIPT = $(install_sh) -c
00fe000
+INSTALL_HEADER = $(INSTALL_DATA)
00fe000
+transform = $(program_transform_name)
00fe000
+NORMAL_INSTALL = :
00fe000
+PRE_INSTALL = :
00fe000
+POST_INSTALL = :
00fe000
+NORMAL_UNINSTALL = :
00fe000
+PRE_UNINSTALL = :
00fe000
+POST_UNINSTALL = :
00fe000
+build_triplet = @build@
00fe000
+host_triplet = @host@
00fe000
+subdir = python/setools
00fe000
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
00fe000
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
00fe000
+am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_classpath.m4 \
00fe000
+	$(top_srcdir)/m4/ac_java_options.m4 \
00fe000
+	$(top_srcdir)/m4/ac_pkg_swig.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_jar.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_java.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_java_works.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_javac.m4 \
00fe000
+	$(top_srcdir)/m4/ac_prog_javac_works.m4 \
00fe000
+	$(top_srcdir)/m4/ac_python_devel.m4 $(top_srcdir)/m4/c.m4 \
00fe000
+	$(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \
00fe000
+	$(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \
00fe000
+	$(top_srcdir)/m4/lt~obsolete.m4 \
00fe000
+	$(top_srcdir)/m4/swig_python.m4 $(top_srcdir)/m4/tcl.m4 \
00fe000
+	$(top_srcdir)/configure.ac
00fe000
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
00fe000
+	$(ACLOCAL_M4)
00fe000
+mkinstalldirs = $(install_sh) -d
00fe000
+CONFIG_HEADER = $(top_builddir)/config.h
00fe000
+CONFIG_CLEAN_FILES =
00fe000
+CONFIG_CLEAN_VPATH_FILES =
00fe000
+SOURCES =
00fe000
+DIST_SOURCES =
00fe000
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
00fe000
+ACLOCAL = @ACLOCAL@
00fe000
+AMTAR = @AMTAR@
00fe000
+APOL_CFLAGS = @APOL_CFLAGS@
00fe000
+APOL_LIB_FLAG = @APOL_LIB_FLAG@
00fe000
+AR = @AR@
00fe000
+AUTOCONF = @AUTOCONF@
00fe000
+AUTOHEADER = @AUTOHEADER@
00fe000
+AUTOMAKE = @AUTOMAKE@
00fe000
+AWK = @AWK@
00fe000
+BWIDGET_DESTDIR = @BWIDGET_DESTDIR@
00fe000
+CC = @CC@
00fe000
+CCDEPMODE = @CCDEPMODE@
00fe000
+CFLAGS = @CFLAGS@
00fe000
+CPP = @CPP@
00fe000
+CPPFLAGS = @CPPFLAGS@
00fe000
+CUNIT_LIB_FLAG = @CUNIT_LIB_FLAG@
00fe000
+CXX = @CXX@
00fe000
+CXXCPP = @CXXCPP@
00fe000
+CXXDEPMODE = @CXXDEPMODE@
00fe000
+CXXFLAGS = @CXXFLAGS@
00fe000
+CYGPATH = @CYGPATH@
00fe000
+CYGPATH_W = @CYGPATH_W@
00fe000
+DEBUGCFLAGS = @DEBUGCFLAGS@
00fe000
+DEBUGCXXFLAGS = @DEBUGCXXFLAGS@
00fe000
+DEBUGJFLAGS = @DEBUGJFLAGS@
00fe000
+DEBUGLDFLAGS = @DEBUGLDFLAGS@
00fe000
+DEFS = @DEFS@
00fe000
+DEPDIR = @DEPDIR@
00fe000
+DSYMUTIL = @DSYMUTIL@
00fe000
+DUMPBIN = @DUMPBIN@
00fe000
+ECHO_C = @ECHO_C@
00fe000
+ECHO_N = @ECHO_N@
00fe000
+ECHO_T = @ECHO_T@
00fe000
+EGREP = @EGREP@
00fe000
+EXEEXT = @EXEEXT@
00fe000
+FGREP = @FGREP@
00fe000
+GLADE_CFLAGS = @GLADE_CFLAGS@
00fe000
+GLADE_LIBS = @GLADE_LIBS@
00fe000
+GREP = @GREP@
00fe000
+GTHREAD_CFLAGS = @GTHREAD_CFLAGS@
00fe000
+GTHREAD_LIBS = @GTHREAD_LIBS@
00fe000
+GTK_CFLAGS = @GTK_CFLAGS@
00fe000
+GTK_LIBS = @GTK_LIBS@
00fe000
+INSTALL = @INSTALL@
00fe000
+INSTALL_DATA = @INSTALL_DATA@
00fe000
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
00fe000
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
00fe000
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
00fe000
+JAR = @JAR@
00fe000
+JAVA = @JAVA@
00fe000
+JAVAC = @JAVAC@
00fe000
+JAVACFLAGS = @JAVACFLAGS@
00fe000
+JAVAFLAGS = @JAVAFLAGS@
00fe000
+JAVAPREFIX = @JAVAPREFIX@
00fe000
+LD = @LD@
00fe000
+LDFLAGS = @LDFLAGS@
00fe000
+LEX = @LEX@
00fe000
+LEXLIB = @LEXLIB@
00fe000
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
00fe000
+LIBOBJS = @LIBOBJS@
00fe000
+LIBS = @LIBS@
00fe000
+LIBTOOL = @LIBTOOL@
00fe000
+LIPO = @LIPO@
00fe000
+LN_S = @LN_S@
00fe000
+LTLIBOBJS = @LTLIBOBJS@
00fe000
+MAKEINFO = @MAKEINFO@
00fe000
+MKDIR_P = @MKDIR_P@
00fe000
+NM = @NM@
00fe000
+NMEDIT = @NMEDIT@
00fe000
+OBJDUMP = @OBJDUMP@
00fe000
+OBJEXT = @OBJEXT@
00fe000
+OTOOL = @OTOOL@
00fe000
+OTOOL64 = @OTOOL64@
00fe000
+PACKAGE = @PACKAGE@
00fe000
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
00fe000
+PACKAGE_NAME = @PACKAGE_NAME@
00fe000
+PACKAGE_STRING = @PACKAGE_STRING@
00fe000
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
764e716
+PACKAGE_URL = @PACKAGE_URL@
00fe000
+PACKAGE_VERSION = @PACKAGE_VERSION@
00fe000
+PATH_SEPARATOR = @PATH_SEPARATOR@
00fe000
+PIXBUF_CFLAGS = @PIXBUF_CFLAGS@
00fe000
+PIXBUF_LIBS = @PIXBUF_LIBS@
00fe000
+PKG_CFLAGS = @PKG_CFLAGS@
00fe000
+PKG_HEADERS = @PKG_HEADERS@
00fe000
+PKG_INCLUDES = @PKG_INCLUDES@
00fe000
+PKG_LIBS = @PKG_LIBS@
00fe000
+PKG_LIB_FILE = @PKG_LIB_FILE@
00fe000
+PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@
00fe000
+PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@
00fe000
+PKG_STUB_SOURCES = @PKG_STUB_SOURCES@
00fe000
+PKG_TCL_SOURCES = @PKG_TCL_SOURCES@
00fe000
+POLDIFF_CFLAGS = @POLDIFF_CFLAGS@
00fe000
+POLDIFF_LIB_FLAG = @POLDIFF_LIB_FLAG@
00fe000
+PROFILECFLAGS = @PROFILECFLAGS@
00fe000
+PROFILELDFLAGS = @PROFILELDFLAGS@
00fe000
+PYTHON = @PYTHON@
00fe000
+PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@
00fe000
+PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@
00fe000
+PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@
00fe000
+PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@
00fe000
+PYTHON_LDFLAGS = @PYTHON_LDFLAGS@
00fe000
+PYTHON_PLATFORM = @PYTHON_PLATFORM@
00fe000
+PYTHON_PREFIX = @PYTHON_PREFIX@
00fe000
+PYTHON_SITE_PKG = @PYTHON_SITE_PKG@
00fe000
+PYTHON_VERSION = @PYTHON_VERSION@
00fe000
+QPOL_CFLAGS = @QPOL_CFLAGS@
00fe000
+QPOL_LIB_FLAG = @QPOL_LIB_FLAG@
00fe000
+RANLIB = @RANLIB@
00fe000
+SEAUDIT_CFLAGS = @SEAUDIT_CFLAGS@
00fe000
+SEAUDIT_LIB_FLAG = @SEAUDIT_LIB_FLAG@
00fe000
+SED = @SED@
00fe000
+SEFS_CFLAGS = @SEFS_CFLAGS@
00fe000
+SEFS_LIB_FLAG = @SEFS_LIB_FLAG@
00fe000
+SELINUX_CFLAGS = @SELINUX_CFLAGS@
00fe000
+SELINUX_LIB_FLAG = @SELINUX_LIB_FLAG@
00fe000
+SET_MAKE = @SET_MAKE@
00fe000
+SHELL = @SHELL@
00fe000
+SQLITE3_CFLAGS = @SQLITE3_CFLAGS@
00fe000
+SQLITE3_LIBS = @SQLITE3_LIBS@
00fe000
+STRIP = @STRIP@
00fe000
+SWIG = @SWIG@
00fe000
+SWIG_JAVA_CFLAGS = @SWIG_JAVA_CFLAGS@
00fe000
+SWIG_JAVA_OPT = @SWIG_JAVA_OPT@
00fe000
+SWIG_LIB = @SWIG_LIB@
00fe000
+SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@
00fe000
+SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@
00fe000
+SWIG_TCL_CFLAGS = @SWIG_TCL_CFLAGS@
00fe000
+SWIG_TCL_OPT = @SWIG_TCL_OPT@
00fe000
+TCLSH_PROG = @TCLSH_PROG@
00fe000
+TCL_AUTOPATH = @TCL_AUTOPATH@
00fe000
+TCL_BIN_DIR = @TCL_BIN_DIR@
00fe000
+TCL_DEFS = @TCL_DEFS@
00fe000
+TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@
00fe000
+TCL_INCLUDES = @TCL_INCLUDES@
00fe000
+TCL_LD_FLAGS = @TCL_LD_FLAGS@
00fe000
+TCL_LIBS = @TCL_LIBS@
00fe000
+TCL_LIB_FILE = @TCL_LIB_FILE@
00fe000
+TCL_LIB_FLAG = @TCL_LIB_FLAG@
00fe000
+TCL_LIB_SPEC = @TCL_LIB_SPEC@
00fe000
+TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@
00fe000
+TCL_SRC_DIR = @TCL_SRC_DIR@
00fe000
+TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@
00fe000
+TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@
00fe000
+TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@
00fe000
+TCL_VERSION = @TCL_VERSION@
00fe000
+TK_BIN_DIR = @TK_BIN_DIR@
00fe000
+TK_INCLUDES = @TK_INCLUDES@
00fe000
+TK_LIBS = @TK_LIBS@
00fe000
+TK_LIB_FILE = @TK_LIB_FILE@
00fe000
+TK_LIB_FLAG = @TK_LIB_FLAG@
00fe000
+TK_LIB_SPEC = @TK_LIB_SPEC@
00fe000
+TK_SRC_DIR = @TK_SRC_DIR@
00fe000
+TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@
00fe000
+TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@
00fe000
+TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@
00fe000
+TK_VERSION = @TK_VERSION@
00fe000
+TK_XINCLUDES = @TK_XINCLUDES@
00fe000
+VERSION = @VERSION@
00fe000
+WARNCFLAGS = @WARNCFLAGS@
00fe000
+WARNCXXFLAGS = @WARNCXXFLAGS@
00fe000
+WARNJFLAGS = @WARNJFLAGS@
00fe000
+WARNLDFLAGS = @WARNLDFLAGS@
00fe000
+WISH_PROG = @WISH_PROG@
00fe000
+XMKMF = @XMKMF@
00fe000
+XML_CFLAGS = @XML_CFLAGS@
00fe000
+XML_LIBS = @XML_LIBS@
00fe000
+YACC = @YACC@
00fe000
+YFLAGS = @YFLAGS@
00fe000
+abs_builddir = @abs_builddir@
00fe000
+abs_srcdir = @abs_srcdir@
00fe000
+abs_top_builddir = @abs_top_builddir@
00fe000
+abs_top_srcdir = @abs_top_srcdir@
00fe000
+ac_ct_CC = @ac_ct_CC@
00fe000
+ac_ct_CXX = @ac_ct_CXX@
00fe000
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
00fe000
+am__include = @am__include@
00fe000
+am__leading_dot = @am__leading_dot@
00fe000
+am__quote = @am__quote@
00fe000
+am__tar = @am__tar@
00fe000
+am__untar = @am__untar@
00fe000
+bindir = @bindir@
00fe000
+build = @build@
00fe000
+build_alias = @build_alias@
00fe000
+build_cpu = @build_cpu@
00fe000
+build_os = @build_os@
00fe000
+build_vendor = @build_vendor@
00fe000
+builddir = @builddir@
00fe000
+datadir = @datadir@
00fe000
+datarootdir = @datarootdir@
00fe000
+docdir = @docdir@
00fe000
+dvidir = @dvidir@
00fe000
+exec_prefix = @exec_prefix@
00fe000
+has_pkg_config = @has_pkg_config@
00fe000
+host = @host@
00fe000
+host_alias = @host_alias@
00fe000
+host_cpu = @host_cpu@
00fe000
+host_os = @host_os@
00fe000
+host_vendor = @host_vendor@
00fe000
+htmldir = @htmldir@
00fe000
+includedir = @includedir@
00fe000
+infodir = @infodir@
00fe000
+install_sh = @install_sh@
00fe000
+javadir = @javadir@
00fe000
+libapol_jswig_soname = @libapol_jswig_soname@
00fe000
+libapol_pyswig_soname = @libapol_pyswig_soname@
00fe000
+libapol_soname = @libapol_soname@
00fe000
+libapol_soversion = @libapol_soversion@
00fe000
+libapol_tswig_soname = @libapol_tswig_soname@
00fe000
+libapol_version = @libapol_version@
00fe000
+libdir = @libdir@
00fe000
+libexecdir = @libexecdir@
00fe000
+libpoldiff_jswig_soname = @libpoldiff_jswig_soname@
00fe000
+libpoldiff_pyswig_soname = @libpoldiff_pyswig_soname@
00fe000
+libpoldiff_soname = @libpoldiff_soname@
00fe000
+libpoldiff_soversion = @libpoldiff_soversion@
00fe000
+libpoldiff_tswig_soname = @libpoldiff_tswig_soname@
00fe000
+libpoldiff_version = @libpoldiff_version@
00fe000
+libqpol_jswig_soname = @libqpol_jswig_soname@
00fe000
+libqpol_pyswig_soname = @libqpol_pyswig_soname@
00fe000
+libqpol_soname = @libqpol_soname@
00fe000
+libqpol_soversion = @libqpol_soversion@
00fe000
+libqpol_tswig_soname = @libqpol_tswig_soname@
00fe000
+libqpol_version = @libqpol_version@
00fe000
+libseaudit_jswig_soname = @libseaudit_jswig_soname@
00fe000
+libseaudit_pyswig_soname = @libseaudit_pyswig_soname@
00fe000
+libseaudit_soname = @libseaudit_soname@
00fe000
+libseaudit_soversion = @libseaudit_soversion@
00fe000
+libseaudit_tswig_soname = @libseaudit_tswig_soname@
00fe000
+libseaudit_version = @libseaudit_version@
00fe000
+libsefs_jswig_soname = @libsefs_jswig_soname@
00fe000
+libsefs_pyswig_soname = @libsefs_pyswig_soname@
00fe000
+libsefs_soname = @libsefs_soname@
00fe000
+libsefs_soversion = @libsefs_soversion@
00fe000
+libsefs_tswig_soname = @libsefs_tswig_soname@
00fe000
+libsefs_version = @libsefs_version@
00fe000
+localedir = @localedir@
00fe000
+localstatedir = @localstatedir@
00fe000
+lt_ECHO = @lt_ECHO@
00fe000
+mandir = @mandir@
00fe000
+mkdir_p = @mkdir_p@
00fe000
+oldincludedir = @oldincludedir@
00fe000
+pdfdir = @pdfdir@
00fe000
+pkgpyexecdir = @pkgpyexecdir@
00fe000
+pkgpythondir = @pkgpythondir@
00fe000
+prefix = @prefix@
00fe000
+profile_install_dir = @profile_install_dir@
00fe000
+program_transform_name = @program_transform_name@
00fe000
+psdir = @psdir@
00fe000
+pyexecdir = @pyexecdir@
00fe000
+pythondir = @pythondir@
00fe000
+sbindir = @sbindir@
00fe000
+selinux_default_policy = @selinux_default_policy@
00fe000
+selinux_policy_dir = @selinux_policy_dir@
00fe000
+sepol_srcdir = @sepol_srcdir@
00fe000
+setoolsdir = @setoolsdir@
00fe000
+sharedstatedir = @sharedstatedir@
00fe000
+srcdir = @srcdir@
00fe000
+sysconfdir = @sysconfdir@
00fe000
+target_alias = @target_alias@
00fe000
+top_build_prefix = @top_build_prefix@
00fe000
+top_builddir = @top_builddir@
00fe000
+top_srcdir = @top_srcdir@
00fe000
+uudecode = @uudecode@
00fe000
+EXTRA_DIST = \
00fe000
+	sesearch.c			\
00fe000
+	seinfo.c			\
00fe000
+	__init__.py			\
00fe000
+	setup.py			\
00fe000
+	$(NULL)
00fe000
+
d7380e7
+AM_CFLAGS = @DEBUGCFLAGS@ @WARNCFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
d7380e7
+	@QPOL_CFLAGS@ @APOL_CFLAGS@
d7380e7
+
d7380e7
+AM_CXXFLAGS = @DEBUGCXXFLAGS@ @WARNCXXFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \
d7380e7
+	@QPOL_CFLAGS@ @APOL_CFLAGS@ @SEFS_CFLAGS@
d7380e7
+
d7380e7
+AM_LDFLAGS = @DEBUGLDFLAGS@ @WARNLDFLAGS@ @PROFILELDFLAGS@
d7380e7
+LDADD = @SELINUX_LIB_FLAG@ @APOL_LIB_FLAG@ @QPOL_LIB_FLAG@
d7380e7
+DEPENDENCIES = $(top_builddir)/libapol/src/libapol.so $(top_builddir)/libqpol/src/libqpol.so
d7380e7
+seinfo_SOURCES = seinfo.c
d7380e7
+sesearch_SOURCES = sesearch.c
00fe000
+all: all-am
00fe000
+
00fe000
+.SUFFIXES:
00fe000
+$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am  $(am__configure_deps)
00fe000
+	@for dep in $?; do \
00fe000
+	  case '$(am__configure_deps)' in \
00fe000
+	    *$$dep*) \
00fe000
+	      ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
00fe000
+	        && { if test -f $@; then exit 0; else break; fi; }; \
00fe000
+	      exit 1;; \
00fe000
+	  esac; \
00fe000
+	done; \
00fe000
+	echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/setools/Makefile'; \
00fe000
+	$(am__cd) $(top_srcdir) && \
00fe000
+	  $(AUTOMAKE) --gnu python/setools/Makefile
00fe000
+.PRECIOUS: Makefile
00fe000
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
00fe000
+	@case '$?' in \
00fe000
+	  *config.status*) \
00fe000
+	    cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
00fe000
+	  *) \
00fe000
+	    echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
00fe000
+	    cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
00fe000
+	esac;
00fe000
+
00fe000
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
00fe000
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
00fe000
+
00fe000
+$(top_srcdir)/configure:  $(am__configure_deps)
00fe000
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
00fe000
+$(ACLOCAL_M4):  $(am__aclocal_m4_deps)
00fe000
+	cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
00fe000
+$(am__aclocal_m4_deps):
00fe000
+
00fe000
+mostlyclean-libtool:
00fe000
+	-rm -f *.lo
00fe000
+
00fe000
+clean-libtool:
00fe000
+	-rm -rf .libs _libs
00fe000
+tags: TAGS
00fe000
+TAGS:
00fe000
+
00fe000
+ctags: CTAGS
00fe000
+CTAGS:
00fe000
+
00fe000
+
00fe000
+distdir: $(DISTFILES)
00fe000
+	@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
00fe000
+	topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
00fe000
+	list='$(DISTFILES)'; \
00fe000
+	  dist_files=`for file in $$list; do echo $$file; done | \
00fe000
+	  sed -e "s|^$$srcdirstrip/||;t" \
00fe000
+	      -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
00fe000
+	case $$dist_files in \
00fe000
+	  */*) $(MKDIR_P) `echo "$$dist_files" | \
00fe000
+			   sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
00fe000
+			   sort -u` ;; \
00fe000
+	esac; \
00fe000
+	for file in $$dist_files; do \
00fe000
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
00fe000
+	  if test -d $$d/$$file; then \
00fe000
+	    dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
00fe000
+	    if test -d "$(distdir)/$$file"; then \
00fe000
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
00fe000
+	    fi; \
00fe000
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
00fe000
+	      cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
00fe000
+	      find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
00fe000
+	    fi; \
00fe000
+	    cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
00fe000
+	  else \
00fe000
+	    test -f "$(distdir)/$$file" \
00fe000
+	    || cp -p $$d/$$file "$(distdir)/$$file" \
00fe000
+	    || exit 1; \
00fe000
+	  fi; \
00fe000
+	done
00fe000
+check-am: all-am
00fe000
+check: check-am
00fe000
+all-am: Makefile
00fe000
+installdirs:
00fe000
+install: install-am
00fe000
+install-exec: install-exec-am
00fe000
+install-data: install-data-am
00fe000
+uninstall: uninstall-am
00fe000
+
00fe000
+install-am: all-am
00fe000
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
00fe000
+
00fe000
+installcheck: installcheck-am
00fe000
+install-strip:
00fe000
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
00fe000
+	  install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
00fe000
+	  `test -z '$(STRIP)' || \
00fe000
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
00fe000
+mostlyclean-generic:
00fe000
+
00fe000
+clean-generic:
00fe000
+
00fe000
+distclean-generic:
00fe000
+	-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
00fe000
+	-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
00fe000
+
00fe000
+maintainer-clean-generic:
00fe000
+	@echo "This command is intended for maintainers to use"
00fe000
+	@echo "it deletes files that may require special tools to rebuild."
00fe000
+clean: clean-am
00fe000
+
00fe000
+clean-am: clean-generic clean-libtool clean-local mostlyclean-am
00fe000
+
00fe000
+distclean: distclean-am
00fe000
+	-rm -f Makefile
00fe000
+distclean-am: clean-am distclean-generic
00fe000
+
00fe000
+dvi: dvi-am
00fe000
+
00fe000
+dvi-am:
00fe000
+
00fe000
+html: html-am
00fe000
+
00fe000
+html-am:
00fe000
+
00fe000
+info: info-am
00fe000
+
00fe000
+info-am:
00fe000
+
00fe000
+install-data-am:
00fe000
+
00fe000
+install-dvi: install-dvi-am
00fe000
+
00fe000
+install-dvi-am:
00fe000
+
00fe000
+install-exec-am:
00fe000
+	@$(NORMAL_INSTALL)
00fe000
+	$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
00fe000
+install-html: install-html-am
00fe000
+
00fe000
+install-html-am:
00fe000
+
00fe000
+install-info: install-info-am
00fe000
+
00fe000
+install-info-am:
00fe000
+
00fe000
+install-man:
00fe000
+
00fe000
+install-pdf: install-pdf-am
00fe000
+
00fe000
+install-pdf-am:
00fe000
+
00fe000
+install-ps: install-ps-am
00fe000
+
00fe000
+install-ps-am:
00fe000
+
00fe000
+installcheck-am:
00fe000
+
00fe000
+maintainer-clean: maintainer-clean-am
00fe000
+	-rm -f Makefile
00fe000
+maintainer-clean-am: distclean-am maintainer-clean-generic
00fe000
+
00fe000
+mostlyclean: mostlyclean-am
00fe000
+
00fe000
+mostlyclean-am: mostlyclean-generic mostlyclean-libtool
00fe000
+
00fe000
+pdf: pdf-am
00fe000
+
00fe000
+pdf-am:
00fe000
+
00fe000
+ps: ps-am
00fe000
+
00fe000
+ps-am:
00fe000
+
00fe000
+uninstall-am:
00fe000
+	@$(NORMAL_INSTALL)
00fe000
+	$(MAKE) $(AM_MAKEFLAGS) uninstall-hook
00fe000
+.MAKE: install-am install-exec-am install-strip uninstall-am
00fe000
+
00fe000
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
00fe000
+	clean-local distclean distclean-generic distclean-libtool \
00fe000
+	distdir dvi dvi-am html html-am info info-am install \
00fe000
+	install-am install-data install-data-am install-dvi \
00fe000
+	install-dvi-am install-exec install-exec-am install-exec-hook \
00fe000
+	install-html install-html-am install-info install-info-am \
00fe000
+	install-man install-pdf install-pdf-am install-ps \
00fe000
+	install-ps-am install-strip installcheck installcheck-am \
00fe000
+	installdirs maintainer-clean maintainer-clean-generic \
00fe000
+	mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
00fe000
+	ps ps-am uninstall uninstall-am uninstall-hook
00fe000
+
00fe000
+all-am: python-build
00fe000
+
00fe000
+python-build: sesearch.c seinfo.c
00fe000
+	@mkdir -p setools
00fe000
+	@cp __init__.py setools
d7380e7
+	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build
00fe000
+
00fe000
+install-exec-hook:
00fe000
+	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
00fe000
+
00fe000
+uninstall-hook: 
00fe000
+	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
00fe000
+
00fe000
+clean-local:
00fe000
+	$(PYTHON) setup.py clean -a 
00fe000
+	rm -f *~
00fe000
+
00fe000
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
00fe000
+# Otherwise a system limit (for SysV at least) may be exceeded.
00fe000
+.NOEXPORT:
764e716
diff -up setools-3.3.7/python/setools/seinfo.c.python setools-3.3.7/python/setools/seinfo.c
764e716
--- setools-3.3.7/python/setools/seinfo.c.python	2010-07-30 15:02:10.000000000 -0400
764e716
+++ setools-3.3.7/python/setools/seinfo.c	2010-08-03 18:07:17.000000000 -0400
764e716
@@ -0,0 +1,769 @@
00fe000
+/**
00fe000
+ *  @file
00fe000
+ *  Command line tool to search TE rules.
00fe000
+ *
00fe000
+ *  @author Frank Mayer  mayerf@tresys.com
00fe000
+ *  @author Jeremy A. Mowery jmowery@tresys.com
00fe000
+ *  @author Paul Rosenfeld  prosenfeld@tresys.com
00fe000
+ *  @author Thomas Liu  <tliu@redhat.com>
00fe000
+ *  @author Dan Walsh  <dwalsh@redhat.com>
00fe000
+ *
00fe000
+ *  Copyright (C) 2003-2008 Tresys Technology, LLC
00fe000
+ *
00fe000
+ *  This program is free software; you can redistribute it and/or modify
00fe000
+ *  it under the terms of the GNU General Public License as published by
00fe000
+ *  the Free Software Foundation; either version 2 of the License, or
00fe000
+ *  (at your option) any later version.
00fe000
+ *
00fe000
+ *  This program is distributed in the hope that it will be useful,
00fe000
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00fe000
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00fe000
+ *  GNU General Public License for more details.
00fe000
+ *
00fe000
+ *  You should have received a copy of the GNU General Public License
00fe000
+ *  along with this program; if not, write to the Free Software
00fe000
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00fe000
+ */
00fe000
+
00fe000
+/**
00fe000
+ * This is a modified version of seinfo to be used as part of a library for
00fe000
+ * Python bindings.
00fe000
+ */
00fe000
+
00fe000
+#include "Python.h"
00fe000
+
00fe000
+/* libapol */
00fe000
+#include <apol/policy.h>
00fe000
+#include <apol/policy-query.h>
00fe000
+#include <apol/render.h>
00fe000
+#include <apol/util.h>
00fe000
+#include <apol/vector.h>
00fe000
+
00fe000
+/* libqpol */
00fe000
+#include <qpol/policy.h>
00fe000
+#include <qpol/util.h>
00fe000
+
00fe000
+/* other */
00fe000
+#include <errno.h>
00fe000
+#include <stdlib.h>
00fe000
+#include <stdio.h>
00fe000
+#include <string.h>
00fe000
+#include <assert.h>
00fe000
+
00fe000
+#define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC"
00fe000
+static char *policy_file = NULL;
00fe000
+
00fe000
+enum input
00fe000
+{
764e716
+	TYPE, ATTRIBUTE, ROLE, USER, PORT,
00fe000
+};
00fe000
+
00fe000
+/**
00fe000
+ * Gets a textual representation of an attribute, and 
00fe000
+ * all of that attribute's types.
00fe000
+ *
00fe000
+ * @param type_datum Reference to sepol type_datum
00fe000
+ * @param policydb Reference to a policy
00fe000
+ */
00fe000
+static PyObject* get_attr(const qpol_type_t * type_datum, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *dict = PyDict_New(); 
00fe000
+	const qpol_type_t *attr_datum = NULL;
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	const char *attr_name = NULL, *type_name = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+	unsigned char isattr;
00fe000
+
00fe000
+	if (qpol_type_get_name(q, type_datum, &attr_name))
00fe000
+		goto cleanup;
00fe000
+	PyObject *obj = PyString_FromString(attr_name);
00fe000
+	PyDict_SetItemString(dict, "name", obj);
00fe000
+	Py_DECREF(obj);
00fe000
+
00fe000
+	/* get an iterator over all types this attribute has */
00fe000
+	if (qpol_type_get_isattr(q, type_datum, &isattr))
00fe000
+		goto cleanup;
00fe000
+	if (isattr) {	       /* sanity check */
00fe000
+		if (qpol_type_get_type_iter(q, type_datum, &iter))
00fe000
+			goto cleanup;
00fe000
+		PyObject *list = PyList_New(0);
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			if (qpol_iterator_get_item(iter, (void **)&attr_datum))
00fe000
+				goto cleanup;
00fe000
+			if (qpol_type_get_name(q, attr_datum, &type_name))
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = PyString_FromString(type_name);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+		qpol_iterator_destroy(&iter);
00fe000
+		PyDict_SetItemString(dict, "types", list);
00fe000
+		Py_DECREF(list);
00fe000
+	} else		       /* this should never happen */
00fe000
+		goto cleanup;
00fe000
+	
00fe000
+	retval = 0;
00fe000
+cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(dict);
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return dict;
00fe000
+}
00fe000
+
00fe000
+/**
00fe000
+ * Gets statistics regarding a policy's attributes.
00fe000
+ * If this function is given a name, it will attempt to
00fe000
+ * get statistics about a particular attribute; otherwise
00fe000
+ * the function gets statistics about all of the policy's
00fe000
+ * attributes.
00fe000
+ *
00fe000
+ * @param name Reference to an attribute's name; if NULL,
00fe000
+ * all object classes will be considered
00fe000
+ * @param policydb Reference to a policy
00fe000
+ *
00fe000
+ * @return 0 on success, < 0 on error.
00fe000
+ */
00fe000
+static PyObject* get_attribs(const char *name, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	apol_attr_query_t *attr_query = NULL;
00fe000
+	apol_vector_t *v = NULL;
00fe000
+	const qpol_type_t *type_datum = NULL;
00fe000
+	size_t n_attrs, i;
00fe000
+
00fe000
+	/* we are only getting information about 1 attribute */
00fe000
+	if (name != NULL) {
00fe000
+		attr_query = apol_attr_query_create();
00fe000
+		if (!attr_query)
00fe000
+			goto cleanup;
00fe000
+		if (apol_attr_query_set_attr(policydb, attr_query, name))
00fe000
+			goto cleanup;
00fe000
+		if (apol_attr_get_by_query(policydb, attr_query, &v))
00fe000
+			goto cleanup;
00fe000
+		apol_attr_query_destroy(&attr_query);
00fe000
+		if (apol_vector_get_size(v) == 0) {
00fe000
+			apol_vector_destroy(&v);
00fe000
+			errno = EINVAL;
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+
00fe000
+		type_datum = apol_vector_get_element(v, (size_t) 0);
00fe000
+		PyObject *obj = get_attr(type_datum, policydb);
00fe000
+		PyList_Append(list, obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	} else {
00fe000
+		attr_query = apol_attr_query_create();
00fe000
+		if (!attr_query)
00fe000
+			goto cleanup;
00fe000
+		if (apol_attr_get_by_query(policydb, attr_query, &v))
00fe000
+			goto cleanup;
00fe000
+		apol_attr_query_destroy(&attr_query);
00fe000
+		n_attrs = apol_vector_get_size(v);
00fe000
+
00fe000
+		for (i = 0; i < n_attrs; i++) {
00fe000
+			/* get qpol_type_t* item from vector */
00fe000
+			type_datum = (qpol_type_t *) apol_vector_get_element(v, (size_t) i);
00fe000
+			if (!type_datum)
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = get_attr(type_datum, policydb);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+	}
00fe000
+	apol_vector_destroy(&v);
00fe000
+
00fe000
+	retval = 0;
00fe000
+      cleanup:
00fe000
+	apol_attr_query_destroy(&attr_query);
00fe000
+	apol_vector_destroy(&v);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(list);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return list;
00fe000
+}
00fe000
+
00fe000
+/**
00fe000
+ * Get a textual representation of a type, and
00fe000
+ * all of that type's attributes.
00fe000
+ *
00fe000
+ * @param type_datum Reference to sepol type_datum
00fe000
+ * @param policydb Reference to a policy
00fe000
+ */
00fe000
+static PyObject* get_type_attrs(const qpol_type_t * type_datum, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	const char *attr_name = NULL;
00fe000
+	const qpol_type_t *attr_datum = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+
00fe000
+	if (qpol_type_get_attr_iter(q, type_datum, &iter))
00fe000
+		goto cleanup;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+		if (qpol_iterator_get_item(iter, (void **)&attr_datum))
00fe000
+			goto cleanup;
00fe000
+		if (qpol_type_get_name(q, attr_datum, &attr_name))
00fe000
+			goto cleanup;
00fe000
+		PyObject *obj = PyString_FromString(attr_name);
00fe000
+		PyList_Append(list, obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	}
00fe000
+
00fe000
+      cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	return list;
00fe000
+}
00fe000
+
00fe000
+static PyObject* get_type( const qpol_type_t * type_datum, const apol_policy_t * policydb) {
00fe000
+
00fe000
+	PyObject *dict = PyDict_New(); 
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+	const char *type_name = NULL;
00fe000
+
00fe000
+	unsigned char isalias, ispermissive, isattr;
00fe000
+
00fe000
+	if (qpol_type_get_name(q, type_datum, &type_name))
00fe000
+		goto cleanup;
00fe000
+	if (qpol_type_get_isalias(q, type_datum, &isalias))
00fe000
+		goto cleanup;
00fe000
+	if (qpol_type_get_isattr(q, type_datum, &isattr))
00fe000
+		goto cleanup;
00fe000
+	if (qpol_type_get_ispermissive(q, type_datum, &ispermissive))
00fe000
+		goto cleanup;
00fe000
+
00fe000
+	PyObject *obj = PyString_FromString(type_name);
00fe000
+	PyDict_SetItemString(dict, "name", obj);
00fe000
+	Py_DECREF(obj);
00fe000
+	obj = PyBool_FromLong(ispermissive);
00fe000
+	PyDict_SetItemString(dict, "permissive", obj);
00fe000
+	Py_DECREF(obj);
00fe000
+	if (!isattr && !isalias) {
00fe000
+		obj = get_type_attrs(type_datum, policydb);
00fe000
+		PyDict_SetItemString(dict, "attributes", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	}
00fe000
+	return dict;
00fe000
+cleanup:
00fe000
+	Py_DECREF(dict);
00fe000
+	return NULL;
00fe000
+}
00fe000
+
00fe000
+/**
00fe000
+ * Gets a textual representation of a user, and
00fe000
+ * all of that user's roles.
00fe000
+ *
00fe000
+ * @param type_datum Reference to sepol type_datum
00fe000
+ * @param policydb Reference to a policy
00fe000
+ * roles
00fe000
+ */
00fe000
+static PyObject* get_user(const qpol_user_t * user_datum, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	PyObject *dict = NULL;
00fe000
+	const qpol_role_t *role_datum = NULL;
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	const qpol_mls_range_t *range = NULL;
00fe000
+	const qpol_mls_level_t *dflt_level = NULL;
00fe000
+	apol_mls_level_t *ap_lvl = NULL;
00fe000
+	apol_mls_range_t *ap_range = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+	char *tmp;
00fe000
+	const char *user_name, *role_name;
00fe000
+
00fe000
+	if (qpol_user_get_name(q, user_datum, &user_name))
00fe000
+		goto cleanup;
00fe000
+
00fe000
+	dict = PyDict_New(); 
00fe000
+	PyObject *obj = PyString_FromString(user_name);
00fe000
+	PyDict_SetItemString(dict, "name", obj);
00fe000
+	Py_DECREF(obj);
00fe000
+
00fe000
+	if (qpol_policy_has_capability(q, QPOL_CAP_MLS)) {
00fe000
+		if (qpol_user_get_dfltlevel(q, user_datum, &dflt_level))
00fe000
+			goto cleanup;
00fe000
+		ap_lvl = apol_mls_level_create_from_qpol_mls_level(policydb, dflt_level);
00fe000
+		tmp = apol_mls_level_render(policydb, ap_lvl);
00fe000
+		if (!tmp)
00fe000
+			goto cleanup;
00fe000
+		obj = PyString_FromString(tmp);
00fe000
+		PyDict_SetItemString(dict, "level", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+		free(tmp);
00fe000
+		/* print default range */
00fe000
+		if (qpol_user_get_range(q, user_datum, &range))
00fe000
+			goto cleanup;
00fe000
+		ap_range = apol_mls_range_create_from_qpol_mls_range(policydb, range);
00fe000
+		tmp = apol_mls_range_render(policydb, ap_range);
00fe000
+		if (!tmp)
00fe000
+			goto cleanup;
00fe000
+		obj = PyString_FromString(tmp);
00fe000
+		PyDict_SetItemString(dict, "range", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+		free(tmp);
00fe000
+	}
00fe000
+	
00fe000
+	if (qpol_user_get_role_iter(q, user_datum, &iter))
00fe000
+		goto cleanup;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+		if (qpol_iterator_get_item(iter, (void **)&role_datum)) {
00fe000
+			Py_DECREF(list);
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		if (qpol_role_get_name(q, role_datum, &role_name)) {
00fe000
+			Py_DECREF(list);
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		PyObject *obj = PyString_FromString(role_name);
00fe000
+		PyList_Append(list, obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	}
00fe000
+	PyDict_SetItemString(dict, "roles", list);
00fe000
+	Py_DECREF(list);
00fe000
+
00fe000
+cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	apol_mls_level_destroy(&ap_lvl);
00fe000
+	apol_mls_range_destroy(&ap_range);
00fe000
+	return dict;
00fe000
+}
00fe000
+
00fe000
+/**
00fe000
+ * Gets statistics regarding a policy's users.
00fe000
+ * If this function is given a name, it will attempt to
00fe000
+ * get statistics about a particular user; otherwise
00fe000
+ * the function gets statistics about all of the policy's
00fe000
+ * users.
00fe000
+ *
00fe000
+ * @param name Reference to a user's name; if NULL,
00fe000
+ * all users will be considered
00fe000
+ * @param policydb Reference to a policy
00fe000
+ *
00fe000
+ * @return 0 on success, < 0 on error.
00fe000
+ */
00fe000
+static PyObject*  get_users(const char *name, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	const qpol_user_t *user_datum = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+
00fe000
+	if (name != NULL) {
00fe000
+		if (qpol_policy_get_user_by_name(q, name, &user_datum)) {
00fe000
+			errno = EINVAL;
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		PyObject *obj = get_user(user_datum, policydb);
00fe000
+		PyList_Append(list, obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	} else {
00fe000
+		if (qpol_policy_get_user_iter(q, &iter))
00fe000
+			goto cleanup;
00fe000
+
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			if (qpol_iterator_get_item(iter, (void **)&user_datum))
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = get_user(user_datum, policydb);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+		qpol_iterator_destroy(&iter);
00fe000
+	}
00fe000
+
00fe000
+	retval = 0;
00fe000
+      cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(list);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return list;
00fe000
+}
00fe000
+
00fe000
+/**
00fe000
+ * get a textual representation of a role, and 
00fe000
+ * all of that role's types.
00fe000
+ *
00fe000
+ * @param type_datum Reference to sepol type_datum
00fe000
+ * @param policydb Reference to a policy
00fe000
+ * types
00fe000
+ */
00fe000
+static PyObject* get_role(const qpol_role_t * role_datum, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *dict = PyDict_New();
00fe000
+	const char *role_name = NULL, *type_name = NULL;
00fe000
+	const qpol_role_t *dom_datum = NULL;
00fe000
+	const qpol_type_t *type_datum = NULL;
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+	size_t n_dom = 0, n_types = 0;
00fe000
+
00fe000
+	if (qpol_role_get_name(q, role_datum, &role_name))
00fe000
+		goto cleanup;
00fe000
+
00fe000
+	PyObject *obj = PyString_FromString(role_name);
00fe000
+	PyDict_SetItemString(dict, "name", obj);
00fe000
+	Py_DECREF(obj);
00fe000
+
00fe000
+	if (qpol_role_get_dominate_iter(q, role_datum, &iter))
00fe000
+		goto cleanup;
00fe000
+	if (qpol_iterator_get_size(iter, &n_dom))
00fe000
+		goto cleanup;
00fe000
+	if ((int)n_dom > 0) {
00fe000
+		PyObject *list = PyList_New(0);
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			if (qpol_iterator_get_item(iter, (void **)&dom_datum))
00fe000
+				goto cleanup;
00fe000
+			if (qpol_role_get_name(q, dom_datum, &role_name))
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = PyString_FromString(role_name);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+		PyDict_SetItemString(dict, "dominate", list);
00fe000
+		Py_DECREF(list);
00fe000
+	}
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	
00fe000
+	if (qpol_role_get_type_iter(q, role_datum, &iter))
00fe000
+		goto cleanup;
00fe000
+	if (qpol_iterator_get_size(iter, &n_types))
00fe000
+		goto cleanup;
00fe000
+	if ((int)n_types > 0) {
00fe000
+		PyObject *list = PyList_New(0);
00fe000
+		/* print types */
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			if (qpol_iterator_get_item(iter, (void **)&type_datum))
00fe000
+				goto cleanup;
00fe000
+			if (qpol_type_get_name(q, type_datum, &type_name))
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = PyString_FromString(type_name);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+		PyDict_SetItemString(dict, "types", list);
00fe000
+		Py_DECREF(list);
00fe000
+	}
00fe000
+
00fe000
+	retval = 0;
00fe000
+cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(dict);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return dict;
00fe000
+}
00fe000
+
00fe000
+/**
764e716
+ * Get statistics regarding a policy's ports.
764e716
+ * If this function is given a name, it will attempt to
764e716
+ * get statistics about a particular port; otherwise
764e716
+ * the function get statistics about all of the policy's ports.
764e716
+ *
764e716
+ * @param name Reference to an port's name; if NULL,
764e716
+ * all ports will be considered
764e716
+ * @param policydb Reference to a policy
764e716
+ *
764e716
+ * @return 0 on success, < 0 on error.
764e716
+ */
764e716
+static PyObject*  get_ports(const char *num, const apol_policy_t * policydb)
764e716
+{
764e716
+	PyObject *list = PyList_New(0);
764e716
+	int retval = -1;
764e716
+	const qpol_portcon_t *portcon = NULL;
764e716
+	qpol_iterator_t *iter = NULL;
764e716
+	uint16_t low_port, high_port;
764e716
+	uint8_t ocon_proto;
764e716
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
764e716
+	const qpol_context_t *ctxt = NULL;
764e716
+	const char *proto_str;
764e716
+	PyObject *dict;
764e716
+	const char *type = NULL;
764e716
+	const apol_mls_range_t *range = NULL;
764e716
+	char *range_str = NULL;
764e716
+	PyObject *obj = NULL;
764e716
+	apol_context_t *c = NULL;
764e716
+
764e716
+	if (qpol_policy_get_portcon_iter(q, &iter))
764e716
+		goto cleanup;
764e716
+
764e716
+	for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
764e716
+		if (qpol_iterator_get_item(iter, (void **)&portcon))
764e716
+			goto cleanup;
764e716
+		if (qpol_portcon_get_low_port(q, portcon, &low_port))
764e716
+			goto cleanup;
764e716
+		if (qpol_portcon_get_high_port(q, portcon, &high_port))
764e716
+			goto cleanup;
764e716
+		if (qpol_portcon_get_protocol(q, portcon, &ocon_proto))
764e716
+			goto cleanup;
764e716
+		if (num) {
764e716
+			if (atoi(num) < low_port || atoi(num) > high_port)
764e716
+				continue;
764e716
+		}
764e716
+
764e716
+		if ((ocon_proto != IPPROTO_TCP) &&
764e716
+		    (ocon_proto != IPPROTO_UDP)) 
764e716
+			goto cleanup;
764e716
+
764e716
+		if (qpol_portcon_get_context(q, portcon, &ctxt)) {
764e716
+			PyErr_SetString(PyExc_RuntimeError, "Could not get for port context.");
764e716
+			goto cleanup;
764e716
+		}
764e716
+
764e716
+		if ((proto_str = apol_protocol_to_str(ocon_proto)) == NULL) {
764e716
+			PyErr_SetString(PyExc_RuntimeError, "Invalid protocol for port");
764e716
+			goto cleanup;
764e716
+		}
764e716
+
764e716
+		if ((c = apol_context_create_from_qpol_context(policydb, ctxt)) == NULL) {
764e716
+			goto cleanup;
764e716
+		}
764e716
+		
764e716
+		if((type = apol_context_get_type(c)) == NULL) {
764e716
+			apol_context_destroy(&c);
764e716
+			goto cleanup;
764e716
+		}
764e716
+			
764e716
+		dict = PyDict_New(); 
764e716
+		obj = PyString_FromString(type);
764e716
+		PyDict_SetItemString(dict, "type", obj);
764e716
+		Py_DECREF(obj);
764e716
+
764e716
+		if((range = apol_context_get_range(c)) == NULL) {
764e716
+			goto cleanup;
764e716
+		}
764e716
+			
764e716
+		range_str = apol_mls_range_render(policydb, range);
764e716
+		if (range_str == NULL) {
764e716
+			goto cleanup;
764e716
+		}
764e716
+		obj = PyString_FromString(range_str);
764e716
+		PyDict_SetItemString(dict, "range", obj);
764e716
+		Py_DECREF(obj);
764e716
+
764e716
+		obj = PyString_FromString(proto_str);
764e716
+		PyDict_SetItemString(dict, "protocol", obj);
764e716
+		Py_DECREF(obj);
764e716
+
764e716
+		obj = PyInt_FromLong(high_port);
764e716
+		PyDict_SetItemString(dict, "high", obj);
764e716
+		Py_DECREF(obj);
764e716
+
764e716
+		obj = PyInt_FromLong(low_port);
764e716
+		PyDict_SetItemString(dict, "low", obj);
764e716
+		Py_DECREF(obj);
764e716
+
764e716
+		PyList_Append(list, dict);
764e716
+		Py_DECREF(dict);
764e716
+	}
764e716
+	retval = 0;
764e716
+      cleanup:
764e716
+	free(range_str);
764e716
+	apol_context_destroy(&c);
764e716
+	qpol_iterator_destroy(&iter);
764e716
+
764e716
+	if (retval) {
764e716
+		Py_DECREF(list);
764e716
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
764e716
+		return NULL;
764e716
+	}
764e716
+	return list;
764e716
+}
764e716
+
764e716
+/**
00fe000
+ * Get statistics regarding a policy's roles.
00fe000
+ * If this function is given a name, it will attempt to
00fe000
+ * get statistics about a particular role; otherwise
00fe000
+ * the function get statistics about all of the policy's roles.
00fe000
+ *
00fe000
+ * @param name Reference to an role's name; if NULL,
00fe000
+ * all roles will be considered
00fe000
+ * @param policydb Reference to a policy
00fe000
+ *
00fe000
+ * @return 0 on success, < 0 on error.
00fe000
+ */
00fe000
+static PyObject*  get_roles(const char *name, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	const qpol_role_t *role_datum = NULL;
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+
00fe000
+	if (name != NULL) {
00fe000
+		if (qpol_policy_get_role_by_name(q, name, &role_datum)) {
00fe000
+			errno = EINVAL;
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		PyObject *obj = get_role(role_datum, policydb);
00fe000
+		PyList_Append(list, obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	} else {
00fe000
+		if (qpol_policy_get_role_iter(q, &iter))
00fe000
+			goto cleanup;
00fe000
+
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			if (qpol_iterator_get_item(iter, (void **)&role_datum))
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = get_role(role_datum, policydb);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+		qpol_iterator_destroy(&iter);
00fe000
+	}
00fe000
+
00fe000
+	retval = 0;
00fe000
+      cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(list);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return list;
00fe000
+}
00fe000
+
00fe000
+/**
00fe000
+ * Get statistics regarding a policy's types.
00fe000
+ * If this function is given a name, it will attempt to
00fe000
+ * print statistics about a particular type; otherwise
00fe000
+ * the function prints statistics about all of the policy's types.
00fe000
+ *
00fe000
+ * @param name Reference to a type's name; if NULL,
00fe000
+ * all object classes will be considered
00fe000
+ * @param policydb Reference to a policy
00fe000
+ *
00fe000
+ * @return 0 on success, < 0 on error.
00fe000
+ */
00fe000
+static PyObject* get_types(const char *name, const apol_policy_t * policydb)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	const qpol_type_t *type_datum = NULL;
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policydb);
00fe000
+
00fe000
+	/* if name was provided, only print that name */
00fe000
+	if (name != NULL) {
00fe000
+		if (qpol_policy_get_type_by_name(q, name, &type_datum)) {
00fe000
+			errno = EINVAL;
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		PyObject *obj = get_type(type_datum, policydb);
00fe000
+		PyList_Append(list, obj);
00fe000
+		Py_DECREF(obj);
00fe000
+	} else {
00fe000
+		if (qpol_policy_get_type_iter(q, &iter))
00fe000
+			goto cleanup;
00fe000
+		/* Print all type names */
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			if (qpol_iterator_get_item(iter, (void **)&type_datum))
00fe000
+				goto cleanup;
00fe000
+			PyObject *obj = get_type(type_datum, policydb);
00fe000
+			PyList_Append(list, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+	}
00fe000
+	retval = 0;
00fe000
+cleanup:
00fe000
+	qpol_iterator_destroy(&iter);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(list);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return list;
00fe000
+}
00fe000
+
00fe000
+PyObject* seinfo(int type, const char *name)
00fe000
+{
00fe000
+	int rt = -1;
00fe000
+
00fe000
+	apol_policy_t *policydb = NULL;
00fe000
+	apol_policy_path_t *pol_path = NULL;
00fe000
+	apol_vector_t *mod_paths = NULL;
00fe000
+	apol_policy_path_type_e path_type = APOL_POLICY_PATH_TYPE_MONOLITHIC;
00fe000
+	PyObject* output = NULL;
00fe000
+
00fe000
+	rt = qpol_default_policy_find(&policy_file);
00fe000
+	if (rt != 0) {
00fe000
+		PyErr_SetString(PyExc_RuntimeError,"No default policy found.");
00fe000
+		return NULL;
00fe000
+	}
00fe000
+
00fe000
+	pol_path = apol_policy_path_create(path_type, policy_file, mod_paths);
00fe000
+	if (!pol_path) {
00fe000
+		free(policy_file);
00fe000
+		apol_vector_destroy(&mod_paths);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(ENOMEM));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	apol_vector_destroy(&mod_paths);
00fe000
+
00fe000
+	int policy_load_options = 0;
00fe000
+	policy_load_options |= QPOL_POLICY_OPTION_MATCH_SYSTEM;
00fe000
+	policydb = apol_policy_create_from_policy_path(pol_path, policy_load_options, NULL, NULL);
00fe000
+	if (!policydb) {
00fe000
+		free(policy_file);
00fe000
+		apol_policy_path_destroy(&pol_path);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	free(policy_file);
00fe000
+
00fe000
+	/* display requested info */
00fe000
+	if (type == TYPE)
00fe000
+		output = get_types(name, policydb);
00fe000
+
00fe000
+	if (type == ATTRIBUTE)
00fe000
+		output = get_attribs(name, policydb);
00fe000
+
00fe000
+	if (type == ROLE)
00fe000
+		output = get_roles(name, policydb);
00fe000
+
00fe000
+	if (type == USER)
00fe000
+		output = get_users(name, policydb);
00fe000
+
764e716
+	if (type == PORT)
764e716
+		output = get_ports(name, policydb);
764e716
+
00fe000
+	apol_policy_destroy(&policydb);
00fe000
+	apol_policy_path_destroy(&pol_path);
00fe000
+	return output;
00fe000
+}
00fe000
+
00fe000
+PyObject *wrap_seinfo(PyObject *self, PyObject *args){
00fe000
+    unsigned int type;
00fe000
+    char *name;
00fe000
+    
00fe000
+    if (!PyArg_ParseTuple(args, "iz", &type, &name))
00fe000
+        return NULL;
00fe000
+
00fe000
+    return Py_BuildValue("O",seinfo(type, name));
00fe000
+
00fe000
+}
00fe000
+
00fe000
+static PyMethodDef methods[] = {
00fe000
+    {"seinfo", (PyCFunction) wrap_seinfo, METH_VARARGS},
00fe000
+    {NULL, NULL, 0, NULL}
00fe000
+};
00fe000
+
00fe000
+void init_seinfo(){
00fe000
+    PyObject *m;
00fe000
+    m = Py_InitModule("_seinfo", methods);
00fe000
+    PyModule_AddIntConstant(m, "ATTRIBUTE", ATTRIBUTE);
764e716
+    PyModule_AddIntConstant(m, "PORT", PORT);
00fe000
+    PyModule_AddIntConstant(m, "ROLE", ROLE);
00fe000
+    PyModule_AddIntConstant(m, "TYPE", TYPE);
00fe000
+    PyModule_AddIntConstant(m, "USER", USER);
00fe000
+}
764e716
diff -up setools-3.3.7/python/setools/sesearch.c.python setools-3.3.7/python/setools/sesearch.c
764e716
--- setools-3.3.7/python/setools/sesearch.c.python	2010-07-30 15:02:10.000000000 -0400
a93aa56
+++ setools-3.3.7/python/setools/sesearch.c	2010-10-14 14:34:47.000000000 -0400
a93aa56
@@ -0,0 +1,478 @@
00fe000
+// Author: Thomas Liu <tliu@redhat.com>
00fe000
+
00fe000
+/**
00fe000
+ *  @file
00fe000
+ *  Command line tool to search TE rules.
00fe000
+ *
00fe000
+ *  @author Frank Mayer  mayerf@tresys.com
00fe000
+ *  @author Jeremy A. Mowery jmowery@tresys.com
00fe000
+ *  @author Paul Rosenfeld  prosenfeld@tresys.com
00fe000
+ *  @author Thomas Liu  <tliu@redhat.com>
00fe000
+ *
00fe000
+ *  Copyright (C) 2003-2008 Tresys Technology, LLC
00fe000
+ *
00fe000
+ *  This program is free software; you can redistribute it and/or modify
00fe000
+ *  it under the terms of the GNU General Public License as published by
00fe000
+ *  the Free Software Foundation; either version 2 of the License, or
00fe000
+ *  (at your option) any later version.
00fe000
+ *
00fe000
+ *  This program is distributed in the hope that it will be useful,
00fe000
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00fe000
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00fe000
+ *  GNU General Public License for more details.
00fe000
+ *
00fe000
+ *  You should have received a copy of the GNU General Public License
00fe000
+ *  along with this program; if not, write to the Free Software
00fe000
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00fe000
+ */
00fe000
+
00fe000
+/**
00fe000
+ * This is a modified version of sesearch to be used as part of a library for
00fe000
+ * Python bindings.
00fe000
+ */
00fe000
+
00fe000
+#include "Python.h"
00fe000
+
00fe000
+/* libapol */
00fe000
+#include <apol/policy.h>
00fe000
+#include <apol/policy-query.h>
00fe000
+#include <apol/render.h>
00fe000
+#include <apol/util.h>
00fe000
+#include <apol/vector.h>
00fe000
+
00fe000
+/* libqpol*/
00fe000
+#include <qpol/policy.h>
00fe000
+#include <qpol/policy_extend.h>
00fe000
+#include <qpol/syn_rule_query.h>
00fe000
+#include <qpol/util.h>
00fe000
+
00fe000
+/* other */
00fe000
+#include <errno.h>
00fe000
+#include <stdlib.h>
00fe000
+#include <stdio.h>
00fe000
+#include <assert.h>
00fe000
+#include <getopt.h>
00fe000
+#include <string.h>
00fe000
+#include <stdbool.h>
00fe000
+
00fe000
+#define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC"
00fe000
+static char *policy_file = NULL;
00fe000
+
00fe000
+enum opt_values
00fe000
+{
00fe000
+	RULE_NEVERALLOW = 256, RULE_AUDIT, RULE_AUDITALLOW, RULE_DONTAUDIT,
00fe000
+	RULE_ROLE_ALLOW, RULE_ROLE_TRANS, RULE_RANGE_TRANS, RULE_ALL,
00fe000
+	EXPR_ROLE_SOURCE, EXPR_ROLE_TARGET
00fe000
+};
00fe000
+
00fe000
+;
00fe000
+
00fe000
+typedef struct options
00fe000
+{
00fe000
+	char *src_name;
00fe000
+	char *tgt_name;
00fe000
+	char *src_role_name;
00fe000
+	char *tgt_role_name;
00fe000
+	char *class_name;
00fe000
+	char *permlist;
00fe000
+	char *bool_name;
00fe000
+	apol_vector_t *class_vector;
00fe000
+	bool all;
00fe000
+	bool lineno;
00fe000
+	bool semantic;
00fe000
+	bool indirect;
00fe000
+	bool allow;
00fe000
+	bool nallow;
00fe000
+	bool auditallow;
00fe000
+	bool dontaudit;
00fe000
+	bool type;
00fe000
+	bool rtrans;
00fe000
+	bool role_allow;
00fe000
+	bool role_trans;
00fe000
+	bool useregex;
00fe000
+	bool show_cond;
00fe000
+	apol_vector_t *perm_vector;
00fe000
+} options_t;
00fe000
+
00fe000
+static int perform_av_query(const apol_policy_t * policy, const options_t * opt, apol_vector_t ** v)
00fe000
+{
00fe000
+	apol_avrule_query_t *avq = NULL;
00fe000
+	unsigned int rules = 0;
00fe000
+	int error = 0;
00fe000
+	char *tmp = NULL, *tok = NULL, *s = NULL;
00fe000
+
00fe000
+	if (!policy || !opt || !v) {
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(EINVAL));
00fe000
+		errno = EINVAL;
00fe000
+		return -1;
00fe000
+	}
00fe000
+
00fe000
+	if (!opt->all && !opt->allow && !opt->nallow && !opt->auditallow && !opt->dontaudit) {
00fe000
+		*v = NULL;
00fe000
+		return 0;	       /* no search to do */
00fe000
+	}
00fe000
+
00fe000
+	avq = apol_avrule_query_create();
00fe000
+	if (!avq) {
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(ENOMEM));
00fe000
+		errno = ENOMEM;
00fe000
+		return -1;
00fe000
+	}
00fe000
+
00fe000
+	if (opt->allow || opt->all)
00fe000
+		rules |= QPOL_RULE_ALLOW;
00fe000
+	if ((opt->nallow || opt->all) && qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_NEVERALLOW))
00fe000
+		rules |= QPOL_RULE_NEVERALLOW;
00fe000
+	if (opt->auditallow || opt->all)
00fe000
+		rules |= QPOL_RULE_AUDITALLOW;
00fe000
+	if (opt->dontaudit || opt->all)
00fe000
+		rules |= QPOL_RULE_DONTAUDIT;
00fe000
+	apol_avrule_query_set_rules(policy, avq, rules);
00fe000
+	apol_avrule_query_set_regex(policy, avq, opt->useregex);
00fe000
+	if (opt->src_name)
00fe000
+		apol_avrule_query_set_source(policy, avq, opt->src_name, opt->indirect);
00fe000
+	if (opt->tgt_name)
00fe000
+		apol_avrule_query_set_target(policy, avq, opt->tgt_name, opt->indirect);
00fe000
+	if (opt->bool_name)
00fe000
+		apol_avrule_query_set_bool(policy, avq, opt->bool_name);
00fe000
+	if (opt->class_name) {
00fe000
+		if (opt->class_vector == NULL) {
00fe000
+			if (apol_avrule_query_append_class(policy, avq, opt->class_name)) {
00fe000
+				error = errno;
00fe000
+				goto err;
00fe000
+			}
00fe000
+		} else {
00fe000
+			size_t i;
00fe000
+            for (i = 0; i < apol_vector_get_size(opt->class_vector); ++i) {
00fe000
+				char *class_name;
00fe000
+				class_name = apol_vector_get_element(opt->class_vector, i);
00fe000
+				if (!class_name)
00fe000
+					continue;
00fe000
+				if (apol_avrule_query_append_class(policy, avq, class_name)) {
00fe000
+					error = errno;
00fe000
+					goto err;
00fe000
+				}
00fe000
+			}
00fe000
+		}
00fe000
+	}
00fe000
+
00fe000
+	if (opt->permlist) {
00fe000
+		tmp = strdup(opt->permlist);
00fe000
+		for (tok = strtok(tmp, ","); tok; tok = strtok(NULL, ",")) {
00fe000
+			if (apol_avrule_query_append_perm(policy, avq, tok)) {
00fe000
+				error = errno;
00fe000
+				goto err;
00fe000
+			}
00fe000
+			if ((s = strdup(tok)) == NULL || apol_vector_append(opt->perm_vector, s) < 0) {
00fe000
+				error = errno;
00fe000
+				goto err;
00fe000
+			}
00fe000
+			s = NULL;
00fe000
+		}
00fe000
+		free(tmp);
00fe000
+	}
00fe000
+
00fe000
+	if (!(opt->semantic) && qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_SYN_RULES)) {
00fe000
+		if (apol_syn_avrule_get_by_query(policy, avq, v)) {
00fe000
+			error = errno;
00fe000
+			goto err;
00fe000
+		}
00fe000
+	} else {
00fe000
+		if (apol_avrule_get_by_query(policy, avq, v)) {
00fe000
+			error = errno;
00fe000
+			goto err;
00fe000
+		}
00fe000
+	}
00fe000
+
00fe000
+	apol_avrule_query_destroy(&avq);
00fe000
+	return 0;
00fe000
+
00fe000
+      err:
00fe000
+	apol_vector_destroy(v);
00fe000
+	apol_avrule_query_destroy(&avq);
00fe000
+	free(tmp);
00fe000
+	free(s);
00fe000
+	PyErr_SetString(PyExc_RuntimeError,strerror(error));
00fe000
+	errno = error;
00fe000
+	return -1;
00fe000
+}
00fe000
+
00fe000
+
00fe000
+
00fe000
+static PyObject* get_av_results(const apol_policy_t * policy, const options_t * opt, const apol_vector_t * v)
00fe000
+{
00fe000
+	int retval = -1;
00fe000
+	PyObject *list = PyList_New(0);
00fe000
+	qpol_policy_t *q = apol_policy_get_qpol(policy);
00fe000
+	size_t i, num_rules = 0;
00fe000
+	const qpol_avrule_t *rule = NULL;
00fe000
+	char *tmp = NULL, *rule_str = NULL, *expr = NULL;
00fe000
+	char enable_char = ' ', branch_char = ' ';
00fe000
+	qpol_iterator_t *iter = NULL;
00fe000
+	uint32_t enabled = 0;
00fe000
+
00fe000
+	if (!policy || !v)
00fe000
+		return NULL;
00fe000
+
00fe000
+	if (!(num_rules = apol_vector_get_size(v)))
00fe000
+		return NULL;
00fe000
+
00fe000
+	for (i = 0; i < num_rules; i++) {
00fe000
+		enable_char = branch_char = ' ';
00fe000
+		if (!(rule = apol_vector_get_element(v, i)))
00fe000
+			goto cleanup;
00fe000
+		
00fe000
+		if (qpol_avrule_get_is_enabled(q, rule, &enabled))
00fe000
+			goto cleanup;
00fe000
+		if (!enabled)
00fe000
+			continue;
00fe000
+        
00fe000
+		const qpol_type_t *type;
00fe000
+		const char *tmp_name;
00fe000
+		uint32_t rule_type = 0;
00fe000
+		
00fe000
+		const qpol_class_t *obj_class = NULL;
00fe000
+		
00fe000
+		PyObject *dict = PyDict_New(); 
00fe000
+		
00fe000
+		qpol_avrule_get_rule_type(q, rule, &rule_type);
00fe000
+		tmp_name = apol_rule_type_to_str(rule_type);
00fe000
+		PyObject *obj = PyString_FromString(tmp_name);
00fe000
+		PyDict_SetItemString(dict, "type", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+		// source
00fe000
+		qpol_avrule_get_source_type(q, rule, &type);
00fe000
+		qpol_type_get_name(q, type, &tmp_name);
00fe000
+		obj = PyString_FromString(tmp_name);
00fe000
+		PyDict_SetItemString(dict, "scontext", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+		
00fe000
+		qpol_avrule_get_target_type(q, rule, &type);
00fe000
+		qpol_type_get_name(q, type, &tmp_name);
00fe000
+		obj = PyString_FromString(tmp_name);
00fe000
+		PyDict_SetItemString(dict, "tcontext", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+		
00fe000
+		qpol_avrule_get_object_class(q, rule, &obj_class);
00fe000
+		qpol_type_get_name(q, type, &tmp_name);
00fe000
+		obj = PyString_FromString(tmp_name);
00fe000
+		PyDict_SetItemString(dict, "class", obj);
00fe000
+		Py_DECREF(obj);
00fe000
+		qpol_avrule_get_perm_iter(q, rule, &iter);
00fe000
+		PyObject *permlist = PyList_New(0);
00fe000
+		for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) {
00fe000
+			const char *perm_name = NULL;
00fe000
+			qpol_iterator_get_item(iter, (void **)&perm_name);
00fe000
+			obj = PyString_FromString(perm_name);
00fe000
+			PyList_Append(permlist, obj);
00fe000
+			Py_DECREF(obj);
00fe000
+		}
00fe000
+		PyDict_SetItemString(dict, "permlist", permlist);
00fe000
+		Py_DECREF(permlist);
00fe000
+		PyList_Append(list, dict); 
00fe000
+		Py_DECREF(dict);
00fe000
+		
00fe000
+		free(rule_str);
00fe000
+		rule_str = NULL;
00fe000
+		free(expr);
00fe000
+		expr = NULL;
00fe000
+	}
00fe000
+	retval = 0;
00fe000
+      cleanup:
00fe000
+	free(tmp);
00fe000
+	free(rule_str);
00fe000
+	free(expr);
00fe000
+	if (retval) {
00fe000
+		Py_DECREF(list);
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	return list;
00fe000
+}
00fe000
+
00fe000
+
00fe000
+PyObject* sesearch(bool allow,
00fe000
+             bool neverallow, 
00fe000
+             bool auditallow,
00fe000
+             bool dontaudit,
00fe000
+             const char *src_name,
00fe000
+             const char *tgt_name,
00fe000
+             const char *class_name,
00fe000
+             const char *permlist
00fe000
+             )
00fe000
+{
00fe000
+	options_t cmd_opts;
00fe000
+	int rt = -1;
00fe000
+	PyObject *output = NULL;
00fe000
+	
00fe000
+	apol_policy_t *policy = NULL;
00fe000
+	apol_vector_t *v = NULL;
00fe000
+	apol_policy_path_t *pol_path = NULL;
00fe000
+	apol_vector_t *mod_paths = NULL;
00fe000
+	apol_policy_path_type_e path_type = APOL_POLICY_PATH_TYPE_MONOLITHIC;
00fe000
+	
00fe000
+	memset(&cmd_opts, 0, sizeof(cmd_opts));
00fe000
+	cmd_opts.indirect = true;
00fe000
+	cmd_opts.allow = allow;
00fe000
+	cmd_opts.nallow = neverallow;
00fe000
+	cmd_opts.auditallow = auditallow;
00fe000
+	cmd_opts.dontaudit = dontaudit;
00fe000
+	if (src_name)
00fe000
+		cmd_opts.src_name = strdup(src_name);
00fe000
+	if (tgt_name)
00fe000
+		cmd_opts.tgt_name = strdup(tgt_name);
00fe000
+	if (class_name)
00fe000
+		cmd_opts.class_name = strdup(class_name);
00fe000
+	if (permlist){
00fe000
+		cmd_opts.perm_vector = apol_vector_create(free);
00fe000
+		cmd_opts.permlist = strdup(permlist);
00fe000
+	}
00fe000
+	int pol_opt = 0;
00fe000
+	if (!(cmd_opts.nallow || cmd_opts.all))
00fe000
+		pol_opt |= QPOL_POLICY_OPTION_NO_NEVERALLOWS;
00fe000
+	
00fe000
+    
00fe000
+	rt = qpol_default_policy_find(&policy_file);
00fe000
+	if (rt) {
00fe000
+		PyErr_SetString(PyExc_RuntimeError,"No default policy found.");
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	pol_opt |= QPOL_POLICY_OPTION_MATCH_SYSTEM;
00fe000
+	
00fe000
+	if (apol_file_is_policy_path_list(policy_file) > 0) {
00fe000
+		pol_path = apol_policy_path_create_from_file(policy_file);
00fe000
+		if (!pol_path) {
00fe000
+			free(policy_file);
00fe000
+			PyErr_SetString(PyExc_RuntimeError,"invalid policy list");
00fe000
+			return NULL;
00fe000
+		}
00fe000
+	}
00fe000
+
00fe000
+	if (!pol_path)
00fe000
+		pol_path = apol_policy_path_create(path_type, policy_file, mod_paths);
00fe000
+	if (!pol_path) {
00fe000
+		free(policy_file);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(ENOMEM));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	free(policy_file);
00fe000
+	apol_vector_destroy(&mod_paths);
00fe000
+	
00fe000
+	policy = apol_policy_create_from_policy_path(pol_path, pol_opt, NULL, NULL);
00fe000
+	if (!policy) {
00fe000
+		apol_policy_path_destroy(&pol_path);
00fe000
+		PyErr_SetString(PyExc_RuntimeError,strerror(errno));
00fe000
+		return NULL;
00fe000
+	}
00fe000
+	/* handle regex for class name */
00fe000
+	if (cmd_opts.useregex && cmd_opts.class_name != NULL) {
00fe000
+		cmd_opts.class_vector = apol_vector_create(NULL);
00fe000
+		apol_vector_t *qpol_matching_classes = NULL;
00fe000
+		apol_class_query_t *regex_match_query = apol_class_query_create();
00fe000
+		apol_class_query_set_regex(policy, regex_match_query, 1);
00fe000
+		apol_class_query_set_class(policy, regex_match_query, cmd_opts.class_name);
00fe000
+		if (apol_class_get_by_query(policy, regex_match_query, &qpol_matching_classes)) {
00fe000
+			apol_class_query_destroy(&regex_match_query);
00fe000
+			PyErr_SetString(PyExc_RuntimeError,"Query failed");
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		const qpol_class_t *class = NULL;
00fe000
+		size_t i;
00fe000
+		for (i = 0; i < apol_vector_get_size(qpol_matching_classes); ++i) {
00fe000
+			const char *class_name;
00fe000
+			class = apol_vector_get_element(qpol_matching_classes, i);
00fe000
+			if (!class)
00fe000
+				break;
00fe000
+			qpol_class_get_name(apol_policy_get_qpol(policy), class, &class_name);
00fe000
+			apol_vector_append(cmd_opts.class_vector, (void *)class_name);
00fe000
+		}
00fe000
+		if (!apol_vector_get_size(qpol_matching_classes)) {
00fe000
+			apol_vector_destroy(&qpol_matching_classes);
00fe000
+			apol_class_query_destroy(&regex_match_query);
00fe000
+			PyErr_SetString(PyExc_RuntimeError,"No classes match expression");
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+		apol_vector_destroy(&qpol_matching_classes);
00fe000
+		apol_class_query_destroy(&regex_match_query);
00fe000
+	}
00fe000
+
00fe000
+	if (!cmd_opts.semantic && qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_SYN_RULES)) {
00fe000
+		if (qpol_policy_build_syn_rule_table(apol_policy_get_qpol(policy))) {
00fe000
+			apol_policy_destroy(&policy);
00fe000
+			PyErr_SetString(PyExc_RuntimeError,"Query failed");
00fe000
+			goto cleanup;
00fe000
+		}
00fe000
+	}
00fe000
+
00fe000
+	/* if syntactic rules are not available always do semantic search */
00fe000
+	if (!qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_SYN_RULES)) {
00fe000
+		cmd_opts.semantic = 1;
00fe000
+	}
00fe000
+
00fe000
+	/* supress line numbers if doing semantic search or not available */
00fe000
+	if (cmd_opts.semantic || !qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_LINE_NUMBERS)) {
00fe000
+		cmd_opts.lineno = 0;
00fe000
+	}
00fe000
+	if (perform_av_query(policy, &cmd_opts, &v)) {
00fe000
+		goto cleanup;
00fe000
+	}
00fe000
+	if (v) {
00fe000
+		output =  get_av_results(policy, &cmd_opts, v);
00fe000
+	}
00fe000
+	apol_vector_destroy(&v);
00fe000
+      cleanup:
00fe000
+	apol_policy_destroy(&policy);
00fe000
+	apol_policy_path_destroy(&pol_path);
00fe000
+	free(cmd_opts.src_name);
00fe000
+	free(cmd_opts.tgt_name);
00fe000
+	free(cmd_opts.class_name);
00fe000
+	free(cmd_opts.permlist);
00fe000
+	free(cmd_opts.bool_name);
00fe000
+	free(cmd_opts.src_role_name);
00fe000
+	free(cmd_opts.tgt_role_name);
00fe000
+	apol_vector_destroy(&cmd_opts.perm_vector);
00fe000
+	apol_vector_destroy(&cmd_opts.class_vector);
764e716
+
764e716
+	if (output) return output;
764e716
+	return Py_None;
00fe000
+}
00fe000
+static int Dict_ContainsInt(PyObject *dict, const char *key){
00fe000
+    PyObject *item = PyDict_GetItemString(dict, key);
00fe000
+    if (item)
00fe000
+        return PyInt_AsLong(item);
00fe000
+    return false;
00fe000
+}
00fe000
+
00fe000
+static const char *Dict_ContainsString(PyObject *dict, const char *key){
00fe000
+    PyObject *item = PyDict_GetItemString(dict, key);
00fe000
+    if (item)
00fe000
+        return PyString_AsString(item);
00fe000
+    return NULL;
00fe000
+}
00fe000
+
00fe000
+PyObject *wrap_sesearch(PyObject *self, PyObject *args){
00fe000
+    PyObject *dict;
00fe000
+    if (!PyArg_ParseTuple(args, "O", &dict))
00fe000
+        return NULL;
00fe000
+    int allow = Dict_ContainsInt(dict, "allow");
00fe000
+    int neverallow = Dict_ContainsInt(dict, "neverallow");
00fe000
+    int auditallow = Dict_ContainsInt(dict, "auditallow");
00fe000
+    int dontaudit = Dict_ContainsInt(dict, "dontaudit"); 
00fe000
+   
00fe000
+    const char *src_name = Dict_ContainsString(dict, "scontext");
00fe000
+    const char *tgt_name = Dict_ContainsString(dict, "tcontext");
00fe000
+    const char *class_name = Dict_ContainsString(dict, "class");
00fe000
+    const char *permlist = Dict_ContainsString(dict, "permlist");
00fe000
+    
00fe000
+    return Py_BuildValue("O",sesearch(allow, neverallow, auditallow, dontaudit, src_name, tgt_name, class_name, permlist));
00fe000
+
00fe000
+}
00fe000
+
00fe000
+static PyMethodDef methods[] = {
00fe000
+    {"sesearch", (PyCFunction) wrap_sesearch, METH_VARARGS},
00fe000
+    {NULL, NULL, 0, NULL}
00fe000
+};
00fe000
+
00fe000
+void init_sesearch(){
00fe000
+    PyObject *m;
00fe000
+    m = Py_InitModule("_sesearch", methods);
00fe000
+}
764e716
diff -up setools-3.3.7/python/setools/setup.py.python setools-3.3.7/python/setools/setup.py
764e716
--- setools-3.3.7/python/setools/setup.py.python	2010-07-30 15:02:10.000000000 -0400
764e716
+++ setools-3.3.7/python/setools/setup.py	2010-07-30 15:02:10.000000000 -0400
d7380e7
@@ -0,0 +1,25 @@
00fe000
+#!/usr/bin/env python
00fe000
+
00fe000
+# Author: Thomas Liu <tliu@redhat.com>
d7380e7
+import os
00fe000
+from distutils.core import setup, Extension
d7380e7
+LIBS=["apol", "qpol"]
d7380e7
+
d7380e7
+try:
d7380e7
+    inc=os.getenv("INCLUDES").split(" ")    
d7380e7
+    INCLUDES=map(lambda x: x[2:], inc)
d7380e7
+    LIBDIRS=map(lambda x: "/".join(x.split("/")[:-1]), os.getenv("LIBS").split())
d7380e7
+except:
d7380e7
+    INCLUDES=""
d7380e7
+    LIBDIRS=""
d7380e7
+
d7380e7
+extension_sesearch = Extension("setools._sesearch", [ "sesearch.c"])
d7380e7
+extension_sesearch.include_dirs=INCLUDES
d7380e7
+extension_sesearch.libraries=LIBS
d7380e7
+extension_sesearch.library_dirs=LIBDIRS
d7380e7
+extension_seinfo = Extension("setools._seinfo", [ "seinfo.c"])
d7380e7
+extension_seinfo.include_dirs=INCLUDES
d7380e7
+extension_seinfo.libraries=LIBS
d7380e7
+extension_seinfo.library_dirs=LIBDIRS
00fe000
+
00fe000
+setup(name = "setools", version="1.0", description="Python setools bindings", author="Thomas Liu", author_email="tliu@redhat.com", ext_modules=[extension_sesearch, extension_seinfo], packages=["setools"])