diff options
author | Mark Hatle <mark.hatle@windriver.com> | 2013-09-19 11:56:25 -0500 |
---|---|---|
committer | Joe MacDonald <joe@deserted.net> | 2013-10-02 13:24:46 -0400 |
commit | 212b3d08226fc50ace52dd2a316ee52fad121a7b (patch) | |
tree | a43db1832f6f8fc45955f9f7b9dc5b741a2ba3ba | |
parent | 19dfedb322bcf0f5c911009914968f41832452ef (diff) | |
download | meta-selinux-212b3d08226fc50ace52dd2a316ee52fad121a7b.tar.gz |
setools: Uprev setools
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Signed-off-by: Joe MacDonald <joe@deserted.net>
-rw-r--r-- | recipes-security/setools/setools/setools-Add-seinfo-and-sesearch-python-bindings.patch | 2775 | ||||
-rw-r--r-- | recipes-security/setools/setools_3.3.8.bb (renamed from recipes-security/setools/setools_3.3.7.bb) | 22 |
2 files changed, 10 insertions, 2787 deletions
diff --git a/recipes-security/setools/setools/setools-Add-seinfo-and-sesearch-python-bindings.patch b/recipes-security/setools/setools/setools-Add-seinfo-and-sesearch-python-bindings.patch deleted file mode 100644 index 5a37c64..0000000 --- a/recipes-security/setools/setools/setools-Add-seinfo-and-sesearch-python-bindings.patch +++ /dev/null | |||
@@ -1,2775 +0,0 @@ | |||
1 | From 41602f02ffa15d55f6ec8d6cc22ca9c945bfad1f Mon Sep 17 00:00:00 2001 | ||
2 | From: Xin Ouyang <Xin.Ouyang@windriver.com> | ||
3 | Date: Wed, 7 Mar 2012 10:44:44 +0800 | ||
4 | Subject: [PATCH 1/7] setools: Add seinfo and sesearch python bindings. | ||
5 | |||
6 | Integrated from Fedora: | ||
7 | https://community.dev.fedoraproject.org/packages/setools/sources/patches/ | ||
8 | --- | ||
9 | Makefile.am | 2 +- | ||
10 | configure.ac | 14 +- | ||
11 | python/Makefile.am | 1 + | ||
12 | python/Makefile.in | 716 +++++++++++++++++++++++++++++++++++++++++ | ||
13 | python/setools/Makefile.am | 36 ++ | ||
14 | python/setools/Makefile.in | 550 +++++++++++++++++++++++++++++++ | ||
15 | python/setools/__init__.py | 50 +++ | ||
16 | python/setools/seinfo.c | 769 ++++++++++++++++++++++++++++++++++++++++++++ | ||
17 | python/setools/sesearch.c | 478 +++++++++++++++++++++++++++ | ||
18 | python/setools/setup.py | 25 ++ | ||
19 | 10 files changed, 2635 insertions(+), 6 deletions(-) | ||
20 | create mode 100644 python/Makefile.am | ||
21 | create mode 100644 python/Makefile.in | ||
22 | create mode 100644 python/setools/Makefile.am | ||
23 | create mode 100644 python/setools/Makefile.in | ||
24 | create mode 100644 python/setools/__init__.py | ||
25 | create mode 100644 python/setools/seinfo.c | ||
26 | create mode 100644 python/setools/sesearch.c | ||
27 | create mode 100644 python/setools/setup.py | ||
28 | |||
29 | diff --git a/Makefile.am b/Makefile.am | ||
30 | index 5dc1b5d..176c8ea 100644 | ||
31 | --- a/Makefile.am | ||
32 | +++ b/Makefile.am | ||
33 | @@ -10,7 +10,7 @@ if BUILD_GUI | ||
34 | endif | ||
35 | # sediffx is also built conditionally, from sediffx/Makefile.am | ||
36 | |||
37 | -SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) | ||
38 | +SUBDIRS = libqpol libapol libsefs libpoldiff libseaudit secmds sechecker sediff man packages debian $(MAYBE_APOL) $(MAYBE_GUI) python | ||
39 | |||
40 | #old indent opts | ||
41 | #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 | ||
42 | diff --git a/configure.ac b/configure.ac | ||
43 | index b885981..e837e03 100644 | ||
44 | --- a/configure.ac | ||
45 | +++ b/configure.ac | ||
46 | @@ -194,7 +194,7 @@ AC_ARG_ENABLE(swig-java, | ||
47 | enable_jswig="$enableval") | ||
48 | if test "x${enable_jswig}" = xyes; then | ||
49 | if test ${do_swigify} = no; then | ||
50 | - AC_PROG_SWIG(1.3.28) | ||
51 | + AC_PROG_SWIG(2.0.0) | ||
52 | fi | ||
53 | AC_JAVA_OPTIONS | ||
54 | if test "x$JAVAPREFIX" = x; then | ||
55 | @@ -216,21 +216,23 @@ if test "x${enable_jswig}" = xyes; then | ||
56 | do_swigify_java=yes | ||
57 | do_swigify=yes | ||
58 | fi | ||
59 | + | ||
60 | +AM_PATH_PYTHON(2.7) | ||
61 | + | ||
62 | AC_ARG_ENABLE(swig-python, | ||
63 | AC_HELP_STRING([--enable-swig-python], | ||
64 | [build SWIG interfaces for Python]), | ||
65 | enable_pyswig="$enableval") | ||
66 | if test "x${enable_pyswig}" = xyes; then | ||
67 | if test ${do_swigify} = no; then | ||
68 | - AC_PROG_SWIG(1.3.28) | ||
69 | + AC_PROG_SWIG(2.0.0) | ||
70 | fi | ||
71 | - AM_PATH_PYTHON(2.3) | ||
72 | SWIG_PYTHON | ||
73 | do_swigify_python=yes | ||
74 | do_swigify=yes | ||
75 | fi | ||
76 | if test ${do_swigify} = "yes"; then | ||
77 | - AC_PROG_SWIG(1.3.28) | ||
78 | + AC_PROG_SWIG(2.0.0) | ||
79 | fi | ||
80 | build_apol=yes | ||
81 | AC_ARG_ENABLE(swig-tcl, | ||
82 | @@ -239,7 +241,7 @@ AC_ARG_ENABLE(swig-tcl, | ||
83 | enable_tclswig="$enableval", enable_tclswig="yes") | ||
84 | if test "x${enable_tclswig}" = xyes; then | ||
85 | if test ${do_swigify} = no; then | ||
86 | - AC_PROG_SWIG(1.3.28) | ||
87 | + AC_PROG_SWIG(2.0.0) | ||
88 | fi | ||
89 | TEA_INIT(3.5) | ||
90 | TEA_PATH_TCLCONFIG | ||
91 | @@ -888,6 +890,8 @@ AC_CONFIG_FILES([Makefile VERSION \ | ||
92 | sediff/Makefile \ | ||
93 | man/Makefile \ | ||
94 | debian/Makefile \ | ||
95 | + python/Makefile \ | ||
96 | + python/setools/Makefile \ | ||
97 | packages/Makefile packages/rpm/Makefile \ | ||
98 | packages/libqpol.pc packages/libapol.pc packages/libpoldiff.pc packages/libseaudit.pc packages/libsefs.pc]) | ||
99 | |||
100 | diff --git a/python/Makefile.am b/python/Makefile.am | ||
101 | new file mode 100644 | ||
102 | index 0000000..a1510c8 | ||
103 | --- /dev/null | ||
104 | +++ b/python/Makefile.am | ||
105 | @@ -0,0 +1 @@ | ||
106 | +SUBDIRS = setools | ||
107 | diff --git a/python/Makefile.in b/python/Makefile.in | ||
108 | new file mode 100644 | ||
109 | index 0000000..48c87ab | ||
110 | --- /dev/null | ||
111 | +++ b/python/Makefile.in | ||
112 | @@ -0,0 +1,716 @@ | ||
113 | +# Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
114 | +# @configure_input@ | ||
115 | + | ||
116 | +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
117 | +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
118 | +# Inc. | ||
119 | +# This Makefile.in is free software; the Free Software Foundation | ||
120 | +# gives unlimited permission to copy and/or distribute it, | ||
121 | +# with or without modifications, as long as this notice is preserved. | ||
122 | + | ||
123 | +# This program is distributed in the hope that it will be useful, | ||
124 | +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
125 | +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
126 | +# PARTICULAR PURPOSE. | ||
127 | + | ||
128 | +@SET_MAKE@ | ||
129 | +VPATH = @srcdir@ | ||
130 | +pkgdatadir = $(datadir)/@PACKAGE@ | ||
131 | +pkgincludedir = $(includedir)/@PACKAGE@ | ||
132 | +pkglibdir = $(libdir)/@PACKAGE@ | ||
133 | +pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
134 | +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
135 | +install_sh_DATA = $(install_sh) -c -m 644 | ||
136 | +install_sh_PROGRAM = $(install_sh) -c | ||
137 | +install_sh_SCRIPT = $(install_sh) -c | ||
138 | +INSTALL_HEADER = $(INSTALL_DATA) | ||
139 | +transform = $(program_transform_name) | ||
140 | +NORMAL_INSTALL = : | ||
141 | +PRE_INSTALL = : | ||
142 | +POST_INSTALL = : | ||
143 | +NORMAL_UNINSTALL = : | ||
144 | +PRE_UNINSTALL = : | ||
145 | +POST_UNINSTALL = : | ||
146 | +build_triplet = @build@ | ||
147 | +host_triplet = @host@ | ||
148 | +subdir = python | ||
149 | +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in | ||
150 | +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
151 | +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_classpath.m4 \ | ||
152 | + $(top_srcdir)/m4/ac_java_options.m4 \ | ||
153 | + $(top_srcdir)/m4/ac_pkg_swig.m4 \ | ||
154 | + $(top_srcdir)/m4/ac_prog_jar.m4 \ | ||
155 | + $(top_srcdir)/m4/ac_prog_java.m4 \ | ||
156 | + $(top_srcdir)/m4/ac_prog_java_works.m4 \ | ||
157 | + $(top_srcdir)/m4/ac_prog_javac.m4 \ | ||
158 | + $(top_srcdir)/m4/ac_prog_javac_works.m4 \ | ||
159 | + $(top_srcdir)/m4/ac_python_devel.m4 $(top_srcdir)/m4/c.m4 \ | ||
160 | + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ | ||
161 | + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ | ||
162 | + $(top_srcdir)/m4/lt~obsolete.m4 \ | ||
163 | + $(top_srcdir)/m4/swig_python.m4 $(top_srcdir)/m4/tcl.m4 \ | ||
164 | + $(top_srcdir)/configure.ac | ||
165 | +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
166 | + $(ACLOCAL_M4) | ||
167 | +mkinstalldirs = $(install_sh) -d | ||
168 | +CONFIG_HEADER = $(top_builddir)/config.h | ||
169 | +CONFIG_CLEAN_FILES = | ||
170 | +CONFIG_CLEAN_VPATH_FILES = | ||
171 | +SOURCES = | ||
172 | +DIST_SOURCES = | ||
173 | +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ | ||
174 | + html-recursive info-recursive install-data-recursive \ | ||
175 | + install-dvi-recursive install-exec-recursive \ | ||
176 | + install-html-recursive install-info-recursive \ | ||
177 | + install-pdf-recursive install-ps-recursive install-recursive \ | ||
178 | + installcheck-recursive installdirs-recursive pdf-recursive \ | ||
179 | + ps-recursive uninstall-recursive | ||
180 | +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ | ||
181 | + distclean-recursive maintainer-clean-recursive | ||
182 | +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ | ||
183 | + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ | ||
184 | + distdir | ||
185 | +ETAGS = etags | ||
186 | +CTAGS = ctags | ||
187 | +DIST_SUBDIRS = $(SUBDIRS) | ||
188 | +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
189 | +am__relativize = \ | ||
190 | + dir0=`pwd`; \ | ||
191 | + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ | ||
192 | + sed_rest='s,^[^/]*/*,,'; \ | ||
193 | + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ | ||
194 | + sed_butlast='s,/*[^/]*$$,,'; \ | ||
195 | + while test -n "$$dir1"; do \ | ||
196 | + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ | ||
197 | + if test "$$first" != "."; then \ | ||
198 | + if test "$$first" = ".."; then \ | ||
199 | + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ | ||
200 | + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ | ||
201 | + else \ | ||
202 | + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ | ||
203 | + if test "$$first2" = "$$first"; then \ | ||
204 | + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ | ||
205 | + else \ | ||
206 | + dir2="../$$dir2"; \ | ||
207 | + fi; \ | ||
208 | + dir0="$$dir0"/"$$first"; \ | ||
209 | + fi; \ | ||
210 | + fi; \ | ||
211 | + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ | ||
212 | + done; \ | ||
213 | + reldir="$$dir2" | ||
214 | +ACLOCAL = @ACLOCAL@ | ||
215 | +AMTAR = @AMTAR@ | ||
216 | +APOL_CFLAGS = @APOL_CFLAGS@ | ||
217 | +APOL_LIB_FLAG = @APOL_LIB_FLAG@ | ||
218 | +AR = @AR@ | ||
219 | +AUTOCONF = @AUTOCONF@ | ||
220 | +AUTOHEADER = @AUTOHEADER@ | ||
221 | +AUTOMAKE = @AUTOMAKE@ | ||
222 | +AWK = @AWK@ | ||
223 | +BWIDGET_DESTDIR = @BWIDGET_DESTDIR@ | ||
224 | +CC = @CC@ | ||
225 | +CCDEPMODE = @CCDEPMODE@ | ||
226 | +CFLAGS = @CFLAGS@ | ||
227 | +CPP = @CPP@ | ||
228 | +CPPFLAGS = @CPPFLAGS@ | ||
229 | +CUNIT_LIB_FLAG = @CUNIT_LIB_FLAG@ | ||
230 | +CXX = @CXX@ | ||
231 | +CXXCPP = @CXXCPP@ | ||
232 | +CXXDEPMODE = @CXXDEPMODE@ | ||
233 | +CXXFLAGS = @CXXFLAGS@ | ||
234 | +CYGPATH = @CYGPATH@ | ||
235 | +CYGPATH_W = @CYGPATH_W@ | ||
236 | +DEBUGCFLAGS = @DEBUGCFLAGS@ | ||
237 | +DEBUGCXXFLAGS = @DEBUGCXXFLAGS@ | ||
238 | +DEBUGJFLAGS = @DEBUGJFLAGS@ | ||
239 | +DEBUGLDFLAGS = @DEBUGLDFLAGS@ | ||
240 | +DEFS = @DEFS@ | ||
241 | +DEPDIR = @DEPDIR@ | ||
242 | +DSYMUTIL = @DSYMUTIL@ | ||
243 | +DUMPBIN = @DUMPBIN@ | ||
244 | +ECHO_C = @ECHO_C@ | ||
245 | +ECHO_N = @ECHO_N@ | ||
246 | +ECHO_T = @ECHO_T@ | ||
247 | +EGREP = @EGREP@ | ||
248 | +EXEEXT = @EXEEXT@ | ||
249 | +FGREP = @FGREP@ | ||
250 | +GLADE_CFLAGS = @GLADE_CFLAGS@ | ||
251 | +GLADE_LIBS = @GLADE_LIBS@ | ||
252 | +GREP = @GREP@ | ||
253 | +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ | ||
254 | +GTHREAD_LIBS = @GTHREAD_LIBS@ | ||
255 | +GTK_CFLAGS = @GTK_CFLAGS@ | ||
256 | +GTK_LIBS = @GTK_LIBS@ | ||
257 | +INSTALL = @INSTALL@ | ||
258 | +INSTALL_DATA = @INSTALL_DATA@ | ||
259 | +INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
260 | +INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
261 | +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
262 | +JAR = @JAR@ | ||
263 | +JAVA = @JAVA@ | ||
264 | +JAVAC = @JAVAC@ | ||
265 | +JAVACFLAGS = @JAVACFLAGS@ | ||
266 | +JAVAFLAGS = @JAVAFLAGS@ | ||
267 | +JAVAPREFIX = @JAVAPREFIX@ | ||
268 | +LD = @LD@ | ||
269 | +LDFLAGS = @LDFLAGS@ | ||
270 | +LEX = @LEX@ | ||
271 | +LEXLIB = @LEXLIB@ | ||
272 | +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ | ||
273 | +LIBOBJS = @LIBOBJS@ | ||
274 | +LIBS = @LIBS@ | ||
275 | +LIBTOOL = @LIBTOOL@ | ||
276 | +LIPO = @LIPO@ | ||
277 | +LN_S = @LN_S@ | ||
278 | +LTLIBOBJS = @LTLIBOBJS@ | ||
279 | +MAKEINFO = @MAKEINFO@ | ||
280 | +MKDIR_P = @MKDIR_P@ | ||
281 | +NM = @NM@ | ||
282 | +NMEDIT = @NMEDIT@ | ||
283 | +OBJDUMP = @OBJDUMP@ | ||
284 | +OBJEXT = @OBJEXT@ | ||
285 | +OTOOL = @OTOOL@ | ||
286 | +OTOOL64 = @OTOOL64@ | ||
287 | +PACKAGE = @PACKAGE@ | ||
288 | +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
289 | +PACKAGE_NAME = @PACKAGE_NAME@ | ||
290 | +PACKAGE_STRING = @PACKAGE_STRING@ | ||
291 | +PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
292 | +PACKAGE_URL = @PACKAGE_URL@ | ||
293 | +PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
294 | +PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
295 | +PIXBUF_CFLAGS = @PIXBUF_CFLAGS@ | ||
296 | +PIXBUF_LIBS = @PIXBUF_LIBS@ | ||
297 | +PKG_CFLAGS = @PKG_CFLAGS@ | ||
298 | +PKG_HEADERS = @PKG_HEADERS@ | ||
299 | +PKG_INCLUDES = @PKG_INCLUDES@ | ||
300 | +PKG_LIBS = @PKG_LIBS@ | ||
301 | +PKG_LIB_FILE = @PKG_LIB_FILE@ | ||
302 | +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ | ||
303 | +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ | ||
304 | +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ | ||
305 | +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ | ||
306 | +POLDIFF_CFLAGS = @POLDIFF_CFLAGS@ | ||
307 | +POLDIFF_LIB_FLAG = @POLDIFF_LIB_FLAG@ | ||
308 | +PROFILECFLAGS = @PROFILECFLAGS@ | ||
309 | +PROFILELDFLAGS = @PROFILELDFLAGS@ | ||
310 | +PYTHON = @PYTHON@ | ||
311 | +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ | ||
312 | +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ | ||
313 | +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ | ||
314 | +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ | ||
315 | +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ | ||
316 | +PYTHON_PLATFORM = @PYTHON_PLATFORM@ | ||
317 | +PYTHON_PREFIX = @PYTHON_PREFIX@ | ||
318 | +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ | ||
319 | +PYTHON_VERSION = @PYTHON_VERSION@ | ||
320 | +QPOL_CFLAGS = @QPOL_CFLAGS@ | ||
321 | +QPOL_LIB_FLAG = @QPOL_LIB_FLAG@ | ||
322 | +RANLIB = @RANLIB@ | ||
323 | +SEAUDIT_CFLAGS = @SEAUDIT_CFLAGS@ | ||
324 | +SEAUDIT_LIB_FLAG = @SEAUDIT_LIB_FLAG@ | ||
325 | +SED = @SED@ | ||
326 | +SEFS_CFLAGS = @SEFS_CFLAGS@ | ||
327 | +SEFS_LIB_FLAG = @SEFS_LIB_FLAG@ | ||
328 | +SELINUX_CFLAGS = @SELINUX_CFLAGS@ | ||
329 | +SELINUX_LIB_FLAG = @SELINUX_LIB_FLAG@ | ||
330 | +SET_MAKE = @SET_MAKE@ | ||
331 | +SHELL = @SHELL@ | ||
332 | +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ | ||
333 | +SQLITE3_LIBS = @SQLITE3_LIBS@ | ||
334 | +STRIP = @STRIP@ | ||
335 | +SWIG = @SWIG@ | ||
336 | +SWIG_JAVA_CFLAGS = @SWIG_JAVA_CFLAGS@ | ||
337 | +SWIG_JAVA_OPT = @SWIG_JAVA_OPT@ | ||
338 | +SWIG_LIB = @SWIG_LIB@ | ||
339 | +SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@ | ||
340 | +SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ | ||
341 | +SWIG_TCL_CFLAGS = @SWIG_TCL_CFLAGS@ | ||
342 | +SWIG_TCL_OPT = @SWIG_TCL_OPT@ | ||
343 | +TCLSH_PROG = @TCLSH_PROG@ | ||
344 | +TCL_AUTOPATH = @TCL_AUTOPATH@ | ||
345 | +TCL_BIN_DIR = @TCL_BIN_DIR@ | ||
346 | +TCL_DEFS = @TCL_DEFS@ | ||
347 | +TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@ | ||
348 | +TCL_INCLUDES = @TCL_INCLUDES@ | ||
349 | +TCL_LD_FLAGS = @TCL_LD_FLAGS@ | ||
350 | +TCL_LIBS = @TCL_LIBS@ | ||
351 | +TCL_LIB_FILE = @TCL_LIB_FILE@ | ||
352 | +TCL_LIB_FLAG = @TCL_LIB_FLAG@ | ||
353 | +TCL_LIB_SPEC = @TCL_LIB_SPEC@ | ||
354 | +TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ | ||
355 | +TCL_SRC_DIR = @TCL_SRC_DIR@ | ||
356 | +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ | ||
357 | +TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ | ||
358 | +TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ | ||
359 | +TCL_VERSION = @TCL_VERSION@ | ||
360 | +TK_BIN_DIR = @TK_BIN_DIR@ | ||
361 | +TK_INCLUDES = @TK_INCLUDES@ | ||
362 | +TK_LIBS = @TK_LIBS@ | ||
363 | +TK_LIB_FILE = @TK_LIB_FILE@ | ||
364 | +TK_LIB_FLAG = @TK_LIB_FLAG@ | ||
365 | +TK_LIB_SPEC = @TK_LIB_SPEC@ | ||
366 | +TK_SRC_DIR = @TK_SRC_DIR@ | ||
367 | +TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ | ||
368 | +TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@ | ||
369 | +TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@ | ||
370 | +TK_VERSION = @TK_VERSION@ | ||
371 | +TK_XINCLUDES = @TK_XINCLUDES@ | ||
372 | +VERSION = @VERSION@ | ||
373 | +WARNCFLAGS = @WARNCFLAGS@ | ||
374 | +WARNCXXFLAGS = @WARNCXXFLAGS@ | ||
375 | +WARNJFLAGS = @WARNJFLAGS@ | ||
376 | +WARNLDFLAGS = @WARNLDFLAGS@ | ||
377 | +WISH_PROG = @WISH_PROG@ | ||
378 | +XMKMF = @XMKMF@ | ||
379 | +XML_CFLAGS = @XML_CFLAGS@ | ||
380 | +XML_LIBS = @XML_LIBS@ | ||
381 | +YACC = @YACC@ | ||
382 | +YFLAGS = @YFLAGS@ | ||
383 | +abs_builddir = @abs_builddir@ | ||
384 | +abs_srcdir = @abs_srcdir@ | ||
385 | +abs_top_builddir = @abs_top_builddir@ | ||
386 | +abs_top_srcdir = @abs_top_srcdir@ | ||
387 | +ac_ct_CC = @ac_ct_CC@ | ||
388 | +ac_ct_CXX = @ac_ct_CXX@ | ||
389 | +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
390 | +am__include = @am__include@ | ||
391 | +am__leading_dot = @am__leading_dot@ | ||
392 | +am__quote = @am__quote@ | ||
393 | +am__tar = @am__tar@ | ||
394 | +am__untar = @am__untar@ | ||
395 | +bindir = @bindir@ | ||
396 | +build = @build@ | ||
397 | +build_alias = @build_alias@ | ||
398 | +build_cpu = @build_cpu@ | ||
399 | +build_os = @build_os@ | ||
400 | +build_vendor = @build_vendor@ | ||
401 | +builddir = @builddir@ | ||
402 | +datadir = @datadir@ | ||
403 | +datarootdir = @datarootdir@ | ||
404 | +docdir = @docdir@ | ||
405 | +dvidir = @dvidir@ | ||
406 | +exec_prefix = @exec_prefix@ | ||
407 | +has_pkg_config = @has_pkg_config@ | ||
408 | +host = @host@ | ||
409 | +host_alias = @host_alias@ | ||
410 | +host_cpu = @host_cpu@ | ||
411 | +host_os = @host_os@ | ||
412 | +host_vendor = @host_vendor@ | ||
413 | +htmldir = @htmldir@ | ||
414 | +includedir = @includedir@ | ||
415 | +infodir = @infodir@ | ||
416 | +install_sh = @install_sh@ | ||
417 | +javadir = @javadir@ | ||
418 | +libapol_jswig_soname = @libapol_jswig_soname@ | ||
419 | +libapol_pyswig_soname = @libapol_pyswig_soname@ | ||
420 | +libapol_soname = @libapol_soname@ | ||
421 | +libapol_soversion = @libapol_soversion@ | ||
422 | +libapol_tswig_soname = @libapol_tswig_soname@ | ||
423 | +libapol_version = @libapol_version@ | ||
424 | +libdir = @libdir@ | ||
425 | +libexecdir = @libexecdir@ | ||
426 | +libpoldiff_jswig_soname = @libpoldiff_jswig_soname@ | ||
427 | +libpoldiff_pyswig_soname = @libpoldiff_pyswig_soname@ | ||
428 | +libpoldiff_soname = @libpoldiff_soname@ | ||
429 | +libpoldiff_soversion = @libpoldiff_soversion@ | ||
430 | +libpoldiff_tswig_soname = @libpoldiff_tswig_soname@ | ||
431 | +libpoldiff_version = @libpoldiff_version@ | ||
432 | +libqpol_jswig_soname = @libqpol_jswig_soname@ | ||
433 | +libqpol_pyswig_soname = @libqpol_pyswig_soname@ | ||
434 | +libqpol_soname = @libqpol_soname@ | ||
435 | +libqpol_soversion = @libqpol_soversion@ | ||
436 | +libqpol_tswig_soname = @libqpol_tswig_soname@ | ||
437 | +libqpol_version = @libqpol_version@ | ||
438 | +libseaudit_jswig_soname = @libseaudit_jswig_soname@ | ||
439 | +libseaudit_pyswig_soname = @libseaudit_pyswig_soname@ | ||
440 | +libseaudit_soname = @libseaudit_soname@ | ||
441 | +libseaudit_soversion = @libseaudit_soversion@ | ||
442 | +libseaudit_tswig_soname = @libseaudit_tswig_soname@ | ||
443 | +libseaudit_version = @libseaudit_version@ | ||
444 | +libsefs_jswig_soname = @libsefs_jswig_soname@ | ||
445 | +libsefs_pyswig_soname = @libsefs_pyswig_soname@ | ||
446 | +libsefs_soname = @libsefs_soname@ | ||
447 | +libsefs_soversion = @libsefs_soversion@ | ||
448 | +libsefs_tswig_soname = @libsefs_tswig_soname@ | ||
449 | +libsefs_version = @libsefs_version@ | ||
450 | +localedir = @localedir@ | ||
451 | +localstatedir = @localstatedir@ | ||
452 | +lt_ECHO = @lt_ECHO@ | ||
453 | +mandir = @mandir@ | ||
454 | +mkdir_p = @mkdir_p@ | ||
455 | +oldincludedir = @oldincludedir@ | ||
456 | +pdfdir = @pdfdir@ | ||
457 | +pkgpyexecdir = @pkgpyexecdir@ | ||
458 | +pkgpythondir = @pkgpythondir@ | ||
459 | +prefix = @prefix@ | ||
460 | +profile_install_dir = @profile_install_dir@ | ||
461 | +program_transform_name = @program_transform_name@ | ||
462 | +psdir = @psdir@ | ||
463 | +pyexecdir = @pyexecdir@ | ||
464 | +pythondir = @pythondir@ | ||
465 | +sbindir = @sbindir@ | ||
466 | +selinux_default_policy = @selinux_default_policy@ | ||
467 | +selinux_policy_dir = @selinux_policy_dir@ | ||
468 | +sepol_srcdir = @sepol_srcdir@ | ||
469 | +setoolsdir = @setoolsdir@ | ||
470 | +sharedstatedir = @sharedstatedir@ | ||
471 | +srcdir = @srcdir@ | ||
472 | +sysconfdir = @sysconfdir@ | ||
473 | +target_alias = @target_alias@ | ||
474 | +top_build_prefix = @top_build_prefix@ | ||
475 | +top_builddir = @top_builddir@ | ||
476 | +top_srcdir = @top_srcdir@ | ||
477 | +uudecode = @uudecode@ | ||
478 | +SUBDIRS = setools | ||
479 | +all: all-recursive | ||
480 | + | ||
481 | +.SUFFIXES: | ||
482 | +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
483 | + @for dep in $?; do \ | ||
484 | + case '$(am__configure_deps)' in \ | ||
485 | + *$$dep*) \ | ||
486 | + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
487 | + && { if test -f $@; then exit 0; else break; fi; }; \ | ||
488 | + exit 1;; \ | ||
489 | + esac; \ | ||
490 | + done; \ | ||
491 | + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/Makefile'; \ | ||
492 | + $(am__cd) $(top_srcdir) && \ | ||
493 | + $(AUTOMAKE) --gnu python/Makefile | ||
494 | +.PRECIOUS: Makefile | ||
495 | +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
496 | + @case '$?' in \ | ||
497 | + *config.status*) \ | ||
498 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
499 | + *) \ | ||
500 | + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
501 | + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
502 | + esac; | ||
503 | + | ||
504 | +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
505 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
506 | + | ||
507 | +$(top_srcdir)/configure: $(am__configure_deps) | ||
508 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
509 | +$(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
510 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
511 | +$(am__aclocal_m4_deps): | ||
512 | + | ||
513 | +mostlyclean-libtool: | ||
514 | + -rm -f *.lo | ||
515 | + | ||
516 | +clean-libtool: | ||
517 | + -rm -rf .libs _libs | ||
518 | + | ||
519 | +# This directory's subdirectories are mostly independent; you can cd | ||
520 | +# into them and run `make' without going through this Makefile. | ||
521 | +# To change the values of `make' variables: instead of editing Makefiles, | ||
522 | +# (1) if the variable is set in `config.status', edit `config.status' | ||
523 | +# (which will cause the Makefiles to be regenerated when you run `make'); | ||
524 | +# (2) otherwise, pass the desired values on the `make' command line. | ||
525 | +$(RECURSIVE_TARGETS): | ||
526 | + @fail= failcom='exit 1'; \ | ||
527 | + for f in x $$MAKEFLAGS; do \ | ||
528 | + case $$f in \ | ||
529 | + *=* | --[!k]*);; \ | ||
530 | + *k*) failcom='fail=yes';; \ | ||
531 | + esac; \ | ||
532 | + done; \ | ||
533 | + dot_seen=no; \ | ||
534 | + target=`echo $@ | sed s/-recursive//`; \ | ||
535 | + list='$(SUBDIRS)'; for subdir in $$list; do \ | ||
536 | + echo "Making $$target in $$subdir"; \ | ||
537 | + if test "$$subdir" = "."; then \ | ||
538 | + dot_seen=yes; \ | ||
539 | + local_target="$$target-am"; \ | ||
540 | + else \ | ||
541 | + local_target="$$target"; \ | ||
542 | + fi; \ | ||
543 | + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | ||
544 | + || eval $$failcom; \ | ||
545 | + done; \ | ||
546 | + if test "$$dot_seen" = "no"; then \ | ||
547 | + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ | ||
548 | + fi; test -z "$$fail" | ||
549 | + | ||
550 | +$(RECURSIVE_CLEAN_TARGETS): | ||
551 | + @fail= failcom='exit 1'; \ | ||
552 | + for f in x $$MAKEFLAGS; do \ | ||
553 | + case $$f in \ | ||
554 | + *=* | --[!k]*);; \ | ||
555 | + *k*) failcom='fail=yes';; \ | ||
556 | + esac; \ | ||
557 | + done; \ | ||
558 | + dot_seen=no; \ | ||
559 | + case "$@" in \ | ||
560 | + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ | ||
561 | + *) list='$(SUBDIRS)' ;; \ | ||
562 | + esac; \ | ||
563 | + rev=''; for subdir in $$list; do \ | ||
564 | + if test "$$subdir" = "."; then :; else \ | ||
565 | + rev="$$subdir $$rev"; \ | ||
566 | + fi; \ | ||
567 | + done; \ | ||
568 | + rev="$$rev ."; \ | ||
569 | + target=`echo $@ | sed s/-recursive//`; \ | ||
570 | + for subdir in $$rev; do \ | ||
571 | + echo "Making $$target in $$subdir"; \ | ||
572 | + if test "$$subdir" = "."; then \ | ||
573 | + local_target="$$target-am"; \ | ||
574 | + else \ | ||
575 | + local_target="$$target"; \ | ||
576 | + fi; \ | ||
577 | + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ | ||
578 | + || eval $$failcom; \ | ||
579 | + done && test -z "$$fail" | ||
580 | +tags-recursive: | ||
581 | + list='$(SUBDIRS)'; for subdir in $$list; do \ | ||
582 | + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ | ||
583 | + done | ||
584 | +ctags-recursive: | ||
585 | + list='$(SUBDIRS)'; for subdir in $$list; do \ | ||
586 | + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ | ||
587 | + done | ||
588 | + | ||
589 | +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) | ||
590 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
591 | + unique=`for i in $$list; do \ | ||
592 | + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
593 | + done | \ | ||
594 | + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
595 | + END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
596 | + mkid -fID $$unique | ||
597 | +tags: TAGS | ||
598 | + | ||
599 | +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
600 | + $(TAGS_FILES) $(LISP) | ||
601 | + set x; \ | ||
602 | + here=`pwd`; \ | ||
603 | + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ | ||
604 | + include_option=--etags-include; \ | ||
605 | + empty_fix=.; \ | ||
606 | + else \ | ||
607 | + include_option=--include; \ | ||
608 | + empty_fix=; \ | ||
609 | + fi; \ | ||
610 | + list='$(SUBDIRS)'; for subdir in $$list; do \ | ||
611 | + if test "$$subdir" = .; then :; else \ | ||
612 | + test ! -f $$subdir/TAGS || \ | ||
613 | + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ | ||
614 | + fi; \ | ||
615 | + done; \ | ||
616 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
617 | + unique=`for i in $$list; do \ | ||
618 | + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
619 | + done | \ | ||
620 | + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
621 | + END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
622 | + shift; \ | ||
623 | + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ | ||
624 | + test -n "$$unique" || unique=$$empty_fix; \ | ||
625 | + if test $$# -gt 0; then \ | ||
626 | + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
627 | + "$$@" $$unique; \ | ||
628 | + else \ | ||
629 | + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ | ||
630 | + $$unique; \ | ||
631 | + fi; \ | ||
632 | + fi | ||
633 | +ctags: CTAGS | ||
634 | +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ | ||
635 | + $(TAGS_FILES) $(LISP) | ||
636 | + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ | ||
637 | + unique=`for i in $$list; do \ | ||
638 | + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ | ||
639 | + done | \ | ||
640 | + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ | ||
641 | + END { if (nonempty) { for (i in files) print i; }; }'`; \ | ||
642 | + test -z "$(CTAGS_ARGS)$$unique" \ | ||
643 | + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ | ||
644 | + $$unique | ||
645 | + | ||
646 | +GTAGS: | ||
647 | + here=`$(am__cd) $(top_builddir) && pwd` \ | ||
648 | + && $(am__cd) $(top_srcdir) \ | ||
649 | + && gtags -i $(GTAGS_ARGS) "$$here" | ||
650 | + | ||
651 | +distclean-tags: | ||
652 | + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags | ||
653 | + | ||
654 | +distdir: $(DISTFILES) | ||
655 | + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
656 | + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
657 | + list='$(DISTFILES)'; \ | ||
658 | + dist_files=`for file in $$list; do echo $$file; done | \ | ||
659 | + sed -e "s|^$$srcdirstrip/||;t" \ | ||
660 | + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
661 | + case $$dist_files in \ | ||
662 | + */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
663 | + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
664 | + sort -u` ;; \ | ||
665 | + esac; \ | ||
666 | + for file in $$dist_files; do \ | ||
667 | + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
668 | + if test -d $$d/$$file; then \ | ||
669 | + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
670 | + if test -d "$(distdir)/$$file"; then \ | ||
671 | + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
672 | + fi; \ | ||
673 | + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
674 | + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
675 | + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
676 | + fi; \ | ||
677 | + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
678 | + else \ | ||
679 | + test -f "$(distdir)/$$file" \ | ||
680 | + || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
681 | + || exit 1; \ | ||
682 | + fi; \ | ||
683 | + done | ||
684 | + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ | ||
685 | + if test "$$subdir" = .; then :; else \ | ||
686 | + test -d "$(distdir)/$$subdir" \ | ||
687 | + || $(MKDIR_P) "$(distdir)/$$subdir" \ | ||
688 | + || exit 1; \ | ||
689 | + fi; \ | ||
690 | + done | ||
691 | + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ | ||
692 | + if test "$$subdir" = .; then :; else \ | ||
693 | + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ | ||
694 | + $(am__relativize); \ | ||
695 | + new_distdir=$$reldir; \ | ||
696 | + dir1=$$subdir; dir2="$(top_distdir)"; \ | ||
697 | + $(am__relativize); \ | ||
698 | + new_top_distdir=$$reldir; \ | ||
699 | + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ | ||
700 | + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ | ||
701 | + ($(am__cd) $$subdir && \ | ||
702 | + $(MAKE) $(AM_MAKEFLAGS) \ | ||
703 | + top_distdir="$$new_top_distdir" \ | ||
704 | + distdir="$$new_distdir" \ | ||
705 | + am__remove_distdir=: \ | ||
706 | + am__skip_length_check=: \ | ||
707 | + am__skip_mode_fix=: \ | ||
708 | + distdir) \ | ||
709 | + || exit 1; \ | ||
710 | + fi; \ | ||
711 | + done | ||
712 | +check-am: all-am | ||
713 | +check: check-recursive | ||
714 | +all-am: Makefile | ||
715 | +installdirs: installdirs-recursive | ||
716 | +installdirs-am: | ||
717 | +install: install-recursive | ||
718 | +install-exec: install-exec-recursive | ||
719 | +install-data: install-data-recursive | ||
720 | +uninstall: uninstall-recursive | ||
721 | + | ||
722 | +install-am: all-am | ||
723 | + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
724 | + | ||
725 | +installcheck: installcheck-recursive | ||
726 | +install-strip: | ||
727 | + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
728 | + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
729 | + `test -z '$(STRIP)' || \ | ||
730 | + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
731 | +mostlyclean-generic: | ||
732 | + | ||
733 | +clean-generic: | ||
734 | + | ||
735 | +distclean-generic: | ||
736 | + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
737 | + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
738 | + | ||
739 | +maintainer-clean-generic: | ||
740 | + @echo "This command is intended for maintainers to use" | ||
741 | + @echo "it deletes files that may require special tools to rebuild." | ||
742 | +clean: clean-recursive | ||
743 | + | ||
744 | +clean-am: clean-generic clean-libtool mostlyclean-am | ||
745 | + | ||
746 | +distclean: distclean-recursive | ||
747 | + -rm -f Makefile | ||
748 | +distclean-am: clean-am distclean-generic distclean-tags | ||
749 | + | ||
750 | +dvi: dvi-recursive | ||
751 | + | ||
752 | +dvi-am: | ||
753 | + | ||
754 | +html: html-recursive | ||
755 | + | ||
756 | +html-am: | ||
757 | + | ||
758 | +info: info-recursive | ||
759 | + | ||
760 | +info-am: | ||
761 | + | ||
762 | +install-data-am: | ||
763 | + | ||
764 | +install-dvi: install-dvi-recursive | ||
765 | + | ||
766 | +install-dvi-am: | ||
767 | + | ||
768 | +install-exec-am: | ||
769 | + | ||
770 | +install-html: install-html-recursive | ||
771 | + | ||
772 | +install-html-am: | ||
773 | + | ||
774 | +install-info: install-info-recursive | ||
775 | + | ||
776 | +install-info-am: | ||
777 | + | ||
778 | +install-man: | ||
779 | + | ||
780 | +install-pdf: install-pdf-recursive | ||
781 | + | ||
782 | +install-pdf-am: | ||
783 | + | ||
784 | +install-ps: install-ps-recursive | ||
785 | + | ||
786 | +install-ps-am: | ||
787 | + | ||
788 | +installcheck-am: | ||
789 | + | ||
790 | +maintainer-clean: maintainer-clean-recursive | ||
791 | + -rm -f Makefile | ||
792 | +maintainer-clean-am: distclean-am maintainer-clean-generic | ||
793 | + | ||
794 | +mostlyclean: mostlyclean-recursive | ||
795 | + | ||
796 | +mostlyclean-am: mostlyclean-generic mostlyclean-libtool | ||
797 | + | ||
798 | +pdf: pdf-recursive | ||
799 | + | ||
800 | +pdf-am: | ||
801 | + | ||
802 | +ps: ps-recursive | ||
803 | + | ||
804 | +ps-am: | ||
805 | + | ||
806 | +uninstall-am: | ||
807 | + | ||
808 | +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ | ||
809 | + install-am install-strip tags-recursive | ||
810 | + | ||
811 | +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ | ||
812 | + all all-am check check-am clean clean-generic clean-libtool \ | ||
813 | + ctags ctags-recursive distclean distclean-generic \ | ||
814 | + distclean-libtool distclean-tags distdir dvi dvi-am html \ | ||
815 | + html-am info info-am install install-am install-data \ | ||
816 | + install-data-am install-dvi install-dvi-am install-exec \ | ||
817 | + install-exec-am install-html install-html-am install-info \ | ||
818 | + install-info-am install-man install-pdf install-pdf-am \ | ||
819 | + install-ps install-ps-am install-strip installcheck \ | ||
820 | + installcheck-am installdirs installdirs-am maintainer-clean \ | ||
821 | + maintainer-clean-generic mostlyclean mostlyclean-generic \ | ||
822 | + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ | ||
823 | + uninstall uninstall-am | ||
824 | + | ||
825 | + | ||
826 | +# Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
827 | +# Otherwise a system limit (for SysV at least) may be exceeded. | ||
828 | +.NOEXPORT: | ||
829 | diff --git a/python/setools/Makefile.am b/python/setools/Makefile.am | ||
830 | new file mode 100644 | ||
831 | index 0000000..c4635fb | ||
832 | --- /dev/null | ||
833 | +++ b/python/setools/Makefile.am | ||
834 | @@ -0,0 +1,36 @@ | ||
835 | +EXTRA_DIST = \ | ||
836 | + sesearch.c \ | ||
837 | + seinfo.c \ | ||
838 | + __init__.py \ | ||
839 | + setup.py \ | ||
840 | + $(NULL) | ||
841 | + | ||
842 | +AM_CFLAGS = @DEBUGCFLAGS@ @WARNCFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \ | ||
843 | + @QPOL_CFLAGS@ @APOL_CFLAGS@ | ||
844 | +AM_CXXFLAGS = @DEBUGCXXFLAGS@ @WARNCXXFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \ | ||
845 | + @QPOL_CFLAGS@ @APOL_CFLAGS@ @SEFS_CFLAGS@ | ||
846 | +AM_LDFLAGS = @DEBUGLDFLAGS@ @WARNLDFLAGS@ @PROFILELDFLAGS@ | ||
847 | + | ||
848 | +LDADD = @SELINUX_LIB_FLAG@ @APOL_LIB_FLAG@ @QPOL_LIB_FLAG@ | ||
849 | +DEPENDENCIES = $(top_builddir)/libapol/src/libapol.so $(top_builddir)/libqpol/src/libqpol.so | ||
850 | +all-am: python-build | ||
851 | + | ||
852 | +seinfo_SOURCES = seinfo.c | ||
853 | + | ||
854 | +sesearch_SOURCES = sesearch.c | ||
855 | + | ||
856 | +python-build: sesearch.c seinfo.c | ||
857 | + @mkdir -p setools | ||
858 | + @cp __init__.py setools | ||
859 | + LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build | ||
860 | + | ||
861 | +install-exec-hook: | ||
862 | + $(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` | ||
863 | + | ||
864 | +uninstall-hook: | ||
865 | + $(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` | ||
866 | + | ||
867 | +clean-local: | ||
868 | + $(PYTHON) setup.py clean -a | ||
869 | + rm -f *~ | ||
870 | + | ||
871 | diff --git a/python/setools/Makefile.in b/python/setools/Makefile.in | ||
872 | new file mode 100644 | ||
873 | index 0000000..704ffc7 | ||
874 | --- /dev/null | ||
875 | +++ b/python/setools/Makefile.in | ||
876 | @@ -0,0 +1,550 @@ | ||
877 | +# Makefile.in generated by automake 1.11.1 from Makefile.am. | ||
878 | +# @configure_input@ | ||
879 | + | ||
880 | +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, | ||
881 | +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, | ||
882 | +# Inc. | ||
883 | +# This Makefile.in is free software; the Free Software Foundation | ||
884 | +# gives unlimited permission to copy and/or distribute it, | ||
885 | +# with or without modifications, as long as this notice is preserved. | ||
886 | + | ||
887 | +# This program is distributed in the hope that it will be useful, | ||
888 | +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without | ||
889 | +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A | ||
890 | +# PARTICULAR PURPOSE. | ||
891 | + | ||
892 | +@SET_MAKE@ | ||
893 | +VPATH = @srcdir@ | ||
894 | +pkgdatadir = $(datadir)/@PACKAGE@ | ||
895 | +pkgincludedir = $(includedir)/@PACKAGE@ | ||
896 | +pkglibdir = $(libdir)/@PACKAGE@ | ||
897 | +pkglibexecdir = $(libexecdir)/@PACKAGE@ | ||
898 | +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd | ||
899 | +install_sh_DATA = $(install_sh) -c -m 644 | ||
900 | +install_sh_PROGRAM = $(install_sh) -c | ||
901 | +install_sh_SCRIPT = $(install_sh) -c | ||
902 | +INSTALL_HEADER = $(INSTALL_DATA) | ||
903 | +transform = $(program_transform_name) | ||
904 | +NORMAL_INSTALL = : | ||
905 | +PRE_INSTALL = : | ||
906 | +POST_INSTALL = : | ||
907 | +NORMAL_UNINSTALL = : | ||
908 | +PRE_UNINSTALL = : | ||
909 | +POST_UNINSTALL = : | ||
910 | +build_triplet = @build@ | ||
911 | +host_triplet = @host@ | ||
912 | +subdir = python/setools | ||
913 | +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in | ||
914 | +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 | ||
915 | +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_check_classpath.m4 \ | ||
916 | + $(top_srcdir)/m4/ac_java_options.m4 \ | ||
917 | + $(top_srcdir)/m4/ac_pkg_swig.m4 \ | ||
918 | + $(top_srcdir)/m4/ac_prog_jar.m4 \ | ||
919 | + $(top_srcdir)/m4/ac_prog_java.m4 \ | ||
920 | + $(top_srcdir)/m4/ac_prog_java_works.m4 \ | ||
921 | + $(top_srcdir)/m4/ac_prog_javac.m4 \ | ||
922 | + $(top_srcdir)/m4/ac_prog_javac_works.m4 \ | ||
923 | + $(top_srcdir)/m4/ac_python_devel.m4 $(top_srcdir)/m4/c.m4 \ | ||
924 | + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ | ||
925 | + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ | ||
926 | + $(top_srcdir)/m4/lt~obsolete.m4 \ | ||
927 | + $(top_srcdir)/m4/swig_python.m4 $(top_srcdir)/m4/tcl.m4 \ | ||
928 | + $(top_srcdir)/configure.ac | ||
929 | +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ | ||
930 | + $(ACLOCAL_M4) | ||
931 | +mkinstalldirs = $(install_sh) -d | ||
932 | +CONFIG_HEADER = $(top_builddir)/config.h | ||
933 | +CONFIG_CLEAN_FILES = | ||
934 | +CONFIG_CLEAN_VPATH_FILES = | ||
935 | +SOURCES = | ||
936 | +DIST_SOURCES = | ||
937 | +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) | ||
938 | +ACLOCAL = @ACLOCAL@ | ||
939 | +AMTAR = @AMTAR@ | ||
940 | +APOL_CFLAGS = @APOL_CFLAGS@ | ||
941 | +APOL_LIB_FLAG = @APOL_LIB_FLAG@ | ||
942 | +AR = @AR@ | ||
943 | +AUTOCONF = @AUTOCONF@ | ||
944 | +AUTOHEADER = @AUTOHEADER@ | ||
945 | +AUTOMAKE = @AUTOMAKE@ | ||
946 | +AWK = @AWK@ | ||
947 | +BWIDGET_DESTDIR = @BWIDGET_DESTDIR@ | ||
948 | +CC = @CC@ | ||
949 | +CCDEPMODE = @CCDEPMODE@ | ||
950 | +CFLAGS = @CFLAGS@ | ||
951 | +CPP = @CPP@ | ||
952 | +CPPFLAGS = @CPPFLAGS@ | ||
953 | +CUNIT_LIB_FLAG = @CUNIT_LIB_FLAG@ | ||
954 | +CXX = @CXX@ | ||
955 | +CXXCPP = @CXXCPP@ | ||
956 | +CXXDEPMODE = @CXXDEPMODE@ | ||
957 | +CXXFLAGS = @CXXFLAGS@ | ||
958 | +CYGPATH = @CYGPATH@ | ||
959 | +CYGPATH_W = @CYGPATH_W@ | ||
960 | +DEBUGCFLAGS = @DEBUGCFLAGS@ | ||
961 | +DEBUGCXXFLAGS = @DEBUGCXXFLAGS@ | ||
962 | +DEBUGJFLAGS = @DEBUGJFLAGS@ | ||
963 | +DEBUGLDFLAGS = @DEBUGLDFLAGS@ | ||
964 | +DEFS = @DEFS@ | ||
965 | +DEPDIR = @DEPDIR@ | ||
966 | +DSYMUTIL = @DSYMUTIL@ | ||
967 | +DUMPBIN = @DUMPBIN@ | ||
968 | +ECHO_C = @ECHO_C@ | ||
969 | +ECHO_N = @ECHO_N@ | ||
970 | +ECHO_T = @ECHO_T@ | ||
971 | +EGREP = @EGREP@ | ||
972 | +EXEEXT = @EXEEXT@ | ||
973 | +FGREP = @FGREP@ | ||
974 | +GLADE_CFLAGS = @GLADE_CFLAGS@ | ||
975 | +GLADE_LIBS = @GLADE_LIBS@ | ||
976 | +GREP = @GREP@ | ||
977 | +GTHREAD_CFLAGS = @GTHREAD_CFLAGS@ | ||
978 | +GTHREAD_LIBS = @GTHREAD_LIBS@ | ||
979 | +GTK_CFLAGS = @GTK_CFLAGS@ | ||
980 | +GTK_LIBS = @GTK_LIBS@ | ||
981 | +INSTALL = @INSTALL@ | ||
982 | +INSTALL_DATA = @INSTALL_DATA@ | ||
983 | +INSTALL_PROGRAM = @INSTALL_PROGRAM@ | ||
984 | +INSTALL_SCRIPT = @INSTALL_SCRIPT@ | ||
985 | +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ | ||
986 | +JAR = @JAR@ | ||
987 | +JAVA = @JAVA@ | ||
988 | +JAVAC = @JAVAC@ | ||
989 | +JAVACFLAGS = @JAVACFLAGS@ | ||
990 | +JAVAFLAGS = @JAVAFLAGS@ | ||
991 | +JAVAPREFIX = @JAVAPREFIX@ | ||
992 | +LD = @LD@ | ||
993 | +LDFLAGS = @LDFLAGS@ | ||
994 | +LEX = @LEX@ | ||
995 | +LEXLIB = @LEXLIB@ | ||
996 | +LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ | ||
997 | +LIBOBJS = @LIBOBJS@ | ||
998 | +LIBS = @LIBS@ | ||
999 | +LIBTOOL = @LIBTOOL@ | ||
1000 | +LIPO = @LIPO@ | ||
1001 | +LN_S = @LN_S@ | ||
1002 | +LTLIBOBJS = @LTLIBOBJS@ | ||
1003 | +MAKEINFO = @MAKEINFO@ | ||
1004 | +MKDIR_P = @MKDIR_P@ | ||
1005 | +NM = @NM@ | ||
1006 | +NMEDIT = @NMEDIT@ | ||
1007 | +OBJDUMP = @OBJDUMP@ | ||
1008 | +OBJEXT = @OBJEXT@ | ||
1009 | +OTOOL = @OTOOL@ | ||
1010 | +OTOOL64 = @OTOOL64@ | ||
1011 | +PACKAGE = @PACKAGE@ | ||
1012 | +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ | ||
1013 | +PACKAGE_NAME = @PACKAGE_NAME@ | ||
1014 | +PACKAGE_STRING = @PACKAGE_STRING@ | ||
1015 | +PACKAGE_TARNAME = @PACKAGE_TARNAME@ | ||
1016 | +PACKAGE_URL = @PACKAGE_URL@ | ||
1017 | +PACKAGE_VERSION = @PACKAGE_VERSION@ | ||
1018 | +PATH_SEPARATOR = @PATH_SEPARATOR@ | ||
1019 | +PIXBUF_CFLAGS = @PIXBUF_CFLAGS@ | ||
1020 | +PIXBUF_LIBS = @PIXBUF_LIBS@ | ||
1021 | +PKG_CFLAGS = @PKG_CFLAGS@ | ||
1022 | +PKG_HEADERS = @PKG_HEADERS@ | ||
1023 | +PKG_INCLUDES = @PKG_INCLUDES@ | ||
1024 | +PKG_LIBS = @PKG_LIBS@ | ||
1025 | +PKG_LIB_FILE = @PKG_LIB_FILE@ | ||
1026 | +PKG_STUB_LIB_FILE = @PKG_STUB_LIB_FILE@ | ||
1027 | +PKG_STUB_OBJECTS = @PKG_STUB_OBJECTS@ | ||
1028 | +PKG_STUB_SOURCES = @PKG_STUB_SOURCES@ | ||
1029 | +PKG_TCL_SOURCES = @PKG_TCL_SOURCES@ | ||
1030 | +POLDIFF_CFLAGS = @POLDIFF_CFLAGS@ | ||
1031 | +POLDIFF_LIB_FLAG = @POLDIFF_LIB_FLAG@ | ||
1032 | +PROFILECFLAGS = @PROFILECFLAGS@ | ||
1033 | +PROFILELDFLAGS = @PROFILELDFLAGS@ | ||
1034 | +PYTHON = @PYTHON@ | ||
1035 | +PYTHON_CPPFLAGS = @PYTHON_CPPFLAGS@ | ||
1036 | +PYTHON_EXEC_PREFIX = @PYTHON_EXEC_PREFIX@ | ||
1037 | +PYTHON_EXTRA_LDFLAGS = @PYTHON_EXTRA_LDFLAGS@ | ||
1038 | +PYTHON_EXTRA_LIBS = @PYTHON_EXTRA_LIBS@ | ||
1039 | +PYTHON_LDFLAGS = @PYTHON_LDFLAGS@ | ||
1040 | +PYTHON_PLATFORM = @PYTHON_PLATFORM@ | ||
1041 | +PYTHON_PREFIX = @PYTHON_PREFIX@ | ||
1042 | +PYTHON_SITE_PKG = @PYTHON_SITE_PKG@ | ||
1043 | +PYTHON_VERSION = @PYTHON_VERSION@ | ||
1044 | +QPOL_CFLAGS = @QPOL_CFLAGS@ | ||
1045 | +QPOL_LIB_FLAG = @QPOL_LIB_FLAG@ | ||
1046 | +RANLIB = @RANLIB@ | ||
1047 | +SEAUDIT_CFLAGS = @SEAUDIT_CFLAGS@ | ||
1048 | +SEAUDIT_LIB_FLAG = @SEAUDIT_LIB_FLAG@ | ||
1049 | +SED = @SED@ | ||
1050 | +SEFS_CFLAGS = @SEFS_CFLAGS@ | ||
1051 | +SEFS_LIB_FLAG = @SEFS_LIB_FLAG@ | ||
1052 | +SELINUX_CFLAGS = @SELINUX_CFLAGS@ | ||
1053 | +SELINUX_LIB_FLAG = @SELINUX_LIB_FLAG@ | ||
1054 | +SET_MAKE = @SET_MAKE@ | ||
1055 | +SHELL = @SHELL@ | ||
1056 | +SQLITE3_CFLAGS = @SQLITE3_CFLAGS@ | ||
1057 | +SQLITE3_LIBS = @SQLITE3_LIBS@ | ||
1058 | +STRIP = @STRIP@ | ||
1059 | +SWIG = @SWIG@ | ||
1060 | +SWIG_JAVA_CFLAGS = @SWIG_JAVA_CFLAGS@ | ||
1061 | +SWIG_JAVA_OPT = @SWIG_JAVA_OPT@ | ||
1062 | +SWIG_LIB = @SWIG_LIB@ | ||
1063 | +SWIG_PYTHON_CPPFLAGS = @SWIG_PYTHON_CPPFLAGS@ | ||
1064 | +SWIG_PYTHON_OPT = @SWIG_PYTHON_OPT@ | ||
1065 | +SWIG_TCL_CFLAGS = @SWIG_TCL_CFLAGS@ | ||
1066 | +SWIG_TCL_OPT = @SWIG_TCL_OPT@ | ||
1067 | +TCLSH_PROG = @TCLSH_PROG@ | ||
1068 | +TCL_AUTOPATH = @TCL_AUTOPATH@ | ||
1069 | +TCL_BIN_DIR = @TCL_BIN_DIR@ | ||
1070 | +TCL_DEFS = @TCL_DEFS@ | ||
1071 | +TCL_EXTRA_CFLAGS = @TCL_EXTRA_CFLAGS@ | ||
1072 | +TCL_INCLUDES = @TCL_INCLUDES@ | ||
1073 | +TCL_LD_FLAGS = @TCL_LD_FLAGS@ | ||
1074 | +TCL_LIBS = @TCL_LIBS@ | ||
1075 | +TCL_LIB_FILE = @TCL_LIB_FILE@ | ||
1076 | +TCL_LIB_FLAG = @TCL_LIB_FLAG@ | ||
1077 | +TCL_LIB_SPEC = @TCL_LIB_SPEC@ | ||
1078 | +TCL_SHLIB_LD_LIBS = @TCL_SHLIB_LD_LIBS@ | ||
1079 | +TCL_SRC_DIR = @TCL_SRC_DIR@ | ||
1080 | +TCL_STUB_LIB_FILE = @TCL_STUB_LIB_FILE@ | ||
1081 | +TCL_STUB_LIB_FLAG = @TCL_STUB_LIB_FLAG@ | ||
1082 | +TCL_STUB_LIB_SPEC = @TCL_STUB_LIB_SPEC@ | ||
1083 | +TCL_VERSION = @TCL_VERSION@ | ||
1084 | +TK_BIN_DIR = @TK_BIN_DIR@ | ||
1085 | +TK_INCLUDES = @TK_INCLUDES@ | ||
1086 | +TK_LIBS = @TK_LIBS@ | ||
1087 | +TK_LIB_FILE = @TK_LIB_FILE@ | ||
1088 | +TK_LIB_FLAG = @TK_LIB_FLAG@ | ||
1089 | +TK_LIB_SPEC = @TK_LIB_SPEC@ | ||
1090 | +TK_SRC_DIR = @TK_SRC_DIR@ | ||
1091 | +TK_STUB_LIB_FILE = @TK_STUB_LIB_FILE@ | ||
1092 | +TK_STUB_LIB_FLAG = @TK_STUB_LIB_FLAG@ | ||
1093 | +TK_STUB_LIB_SPEC = @TK_STUB_LIB_SPEC@ | ||
1094 | +TK_VERSION = @TK_VERSION@ | ||
1095 | +TK_XINCLUDES = @TK_XINCLUDES@ | ||
1096 | +VERSION = @VERSION@ | ||
1097 | +WARNCFLAGS = @WARNCFLAGS@ | ||
1098 | +WARNCXXFLAGS = @WARNCXXFLAGS@ | ||
1099 | +WARNJFLAGS = @WARNJFLAGS@ | ||
1100 | +WARNLDFLAGS = @WARNLDFLAGS@ | ||
1101 | +WISH_PROG = @WISH_PROG@ | ||
1102 | +XMKMF = @XMKMF@ | ||
1103 | +XML_CFLAGS = @XML_CFLAGS@ | ||
1104 | +XML_LIBS = @XML_LIBS@ | ||
1105 | +YACC = @YACC@ | ||
1106 | +YFLAGS = @YFLAGS@ | ||
1107 | +abs_builddir = @abs_builddir@ | ||
1108 | +abs_srcdir = @abs_srcdir@ | ||
1109 | +abs_top_builddir = @abs_top_builddir@ | ||
1110 | +abs_top_srcdir = @abs_top_srcdir@ | ||
1111 | +ac_ct_CC = @ac_ct_CC@ | ||
1112 | +ac_ct_CXX = @ac_ct_CXX@ | ||
1113 | +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ | ||
1114 | +am__include = @am__include@ | ||
1115 | +am__leading_dot = @am__leading_dot@ | ||
1116 | +am__quote = @am__quote@ | ||
1117 | +am__tar = @am__tar@ | ||
1118 | +am__untar = @am__untar@ | ||
1119 | +bindir = @bindir@ | ||
1120 | +build = @build@ | ||
1121 | +build_alias = @build_alias@ | ||
1122 | +build_cpu = @build_cpu@ | ||
1123 | +build_os = @build_os@ | ||
1124 | +build_vendor = @build_vendor@ | ||
1125 | +builddir = @builddir@ | ||
1126 | +datadir = @datadir@ | ||
1127 | +datarootdir = @datarootdir@ | ||
1128 | +docdir = @docdir@ | ||
1129 | +dvidir = @dvidir@ | ||
1130 | +exec_prefix = @exec_prefix@ | ||
1131 | +has_pkg_config = @has_pkg_config@ | ||
1132 | +host = @host@ | ||
1133 | +host_alias = @host_alias@ | ||
1134 | +host_cpu = @host_cpu@ | ||
1135 | +host_os = @host_os@ | ||
1136 | +host_vendor = @host_vendor@ | ||
1137 | +htmldir = @htmldir@ | ||
1138 | +includedir = @includedir@ | ||
1139 | +infodir = @infodir@ | ||
1140 | +install_sh = @install_sh@ | ||
1141 | +javadir = @javadir@ | ||
1142 | +libapol_jswig_soname = @libapol_jswig_soname@ | ||
1143 | +libapol_pyswig_soname = @libapol_pyswig_soname@ | ||
1144 | +libapol_soname = @libapol_soname@ | ||
1145 | +libapol_soversion = @libapol_soversion@ | ||
1146 | +libapol_tswig_soname = @libapol_tswig_soname@ | ||
1147 | +libapol_version = @libapol_version@ | ||
1148 | +libdir = @libdir@ | ||
1149 | +libexecdir = @libexecdir@ | ||
1150 | +libpoldiff_jswig_soname = @libpoldiff_jswig_soname@ | ||
1151 | +libpoldiff_pyswig_soname = @libpoldiff_pyswig_soname@ | ||
1152 | +libpoldiff_soname = @libpoldiff_soname@ | ||
1153 | +libpoldiff_soversion = @libpoldiff_soversion@ | ||
1154 | +libpoldiff_tswig_soname = @libpoldiff_tswig_soname@ | ||
1155 | +libpoldiff_version = @libpoldiff_version@ | ||
1156 | +libqpol_jswig_soname = @libqpol_jswig_soname@ | ||
1157 | +libqpol_pyswig_soname = @libqpol_pyswig_soname@ | ||
1158 | +libqpol_soname = @libqpol_soname@ | ||
1159 | +libqpol_soversion = @libqpol_soversion@ | ||
1160 | +libqpol_tswig_soname = @libqpol_tswig_soname@ | ||
1161 | +libqpol_version = @libqpol_version@ | ||
1162 | +libseaudit_jswig_soname = @libseaudit_jswig_soname@ | ||
1163 | +libseaudit_pyswig_soname = @libseaudit_pyswig_soname@ | ||
1164 | +libseaudit_soname = @libseaudit_soname@ | ||
1165 | +libseaudit_soversion = @libseaudit_soversion@ | ||
1166 | +libseaudit_tswig_soname = @libseaudit_tswig_soname@ | ||
1167 | +libseaudit_version = @libseaudit_version@ | ||
1168 | +libsefs_jswig_soname = @libsefs_jswig_soname@ | ||
1169 | +libsefs_pyswig_soname = @libsefs_pyswig_soname@ | ||
1170 | +libsefs_soname = @libsefs_soname@ | ||
1171 | +libsefs_soversion = @libsefs_soversion@ | ||
1172 | +libsefs_tswig_soname = @libsefs_tswig_soname@ | ||
1173 | +libsefs_version = @libsefs_version@ | ||
1174 | +localedir = @localedir@ | ||
1175 | +localstatedir = @localstatedir@ | ||
1176 | +lt_ECHO = @lt_ECHO@ | ||
1177 | +mandir = @mandir@ | ||
1178 | +mkdir_p = @mkdir_p@ | ||
1179 | +oldincludedir = @oldincludedir@ | ||
1180 | +pdfdir = @pdfdir@ | ||
1181 | +pkgpyexecdir = @pkgpyexecdir@ | ||
1182 | +pkgpythondir = @pkgpythondir@ | ||
1183 | +prefix = @prefix@ | ||
1184 | +profile_install_dir = @profile_install_dir@ | ||
1185 | +program_transform_name = @program_transform_name@ | ||
1186 | +psdir = @psdir@ | ||
1187 | +pyexecdir = @pyexecdir@ | ||
1188 | +pythondir = @pythondir@ | ||
1189 | +sbindir = @sbindir@ | ||
1190 | +selinux_default_policy = @selinux_default_policy@ | ||
1191 | +selinux_policy_dir = @selinux_policy_dir@ | ||
1192 | +sepol_srcdir = @sepol_srcdir@ | ||
1193 | +setoolsdir = @setoolsdir@ | ||
1194 | +sharedstatedir = @sharedstatedir@ | ||
1195 | +srcdir = @srcdir@ | ||
1196 | +sysconfdir = @sysconfdir@ | ||
1197 | +target_alias = @target_alias@ | ||
1198 | +top_build_prefix = @top_build_prefix@ | ||
1199 | +top_builddir = @top_builddir@ | ||
1200 | +top_srcdir = @top_srcdir@ | ||
1201 | +uudecode = @uudecode@ | ||
1202 | +EXTRA_DIST = \ | ||
1203 | + sesearch.c \ | ||
1204 | + seinfo.c \ | ||
1205 | + __init__.py \ | ||
1206 | + setup.py \ | ||
1207 | + $(NULL) | ||
1208 | + | ||
1209 | +AM_CFLAGS = @DEBUGCFLAGS@ @WARNCFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \ | ||
1210 | + @QPOL_CFLAGS@ @APOL_CFLAGS@ | ||
1211 | + | ||
1212 | +AM_CXXFLAGS = @DEBUGCXXFLAGS@ @WARNCXXFLAGS@ @PROFILECFLAGS@ @SELINUX_CFLAGS@ \ | ||
1213 | + @QPOL_CFLAGS@ @APOL_CFLAGS@ @SEFS_CFLAGS@ | ||
1214 | + | ||
1215 | +AM_LDFLAGS = @DEBUGLDFLAGS@ @WARNLDFLAGS@ @PROFILELDFLAGS@ | ||
1216 | +LDADD = @SELINUX_LIB_FLAG@ @APOL_LIB_FLAG@ @QPOL_LIB_FLAG@ | ||
1217 | +DEPENDENCIES = $(top_builddir)/libapol/src/libapol.so $(top_builddir)/libqpol/src/libqpol.so | ||
1218 | +seinfo_SOURCES = seinfo.c | ||
1219 | +sesearch_SOURCES = sesearch.c | ||
1220 | +all: all-am | ||
1221 | + | ||
1222 | +.SUFFIXES: | ||
1223 | +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) | ||
1224 | + @for dep in $?; do \ | ||
1225 | + case '$(am__configure_deps)' in \ | ||
1226 | + *$$dep*) \ | ||
1227 | + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ | ||
1228 | + && { if test -f $@; then exit 0; else break; fi; }; \ | ||
1229 | + exit 1;; \ | ||
1230 | + esac; \ | ||
1231 | + done; \ | ||
1232 | + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu python/setools/Makefile'; \ | ||
1233 | + $(am__cd) $(top_srcdir) && \ | ||
1234 | + $(AUTOMAKE) --gnu python/setools/Makefile | ||
1235 | +.PRECIOUS: Makefile | ||
1236 | +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status | ||
1237 | + @case '$?' in \ | ||
1238 | + *config.status*) \ | ||
1239 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ | ||
1240 | + *) \ | ||
1241 | + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ | ||
1242 | + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ | ||
1243 | + esac; | ||
1244 | + | ||
1245 | +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) | ||
1246 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
1247 | + | ||
1248 | +$(top_srcdir)/configure: $(am__configure_deps) | ||
1249 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
1250 | +$(ACLOCAL_M4): $(am__aclocal_m4_deps) | ||
1251 | + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh | ||
1252 | +$(am__aclocal_m4_deps): | ||
1253 | + | ||
1254 | +mostlyclean-libtool: | ||
1255 | + -rm -f *.lo | ||
1256 | + | ||
1257 | +clean-libtool: | ||
1258 | + -rm -rf .libs _libs | ||
1259 | +tags: TAGS | ||
1260 | +TAGS: | ||
1261 | + | ||
1262 | +ctags: CTAGS | ||
1263 | +CTAGS: | ||
1264 | + | ||
1265 | + | ||
1266 | +distdir: $(DISTFILES) | ||
1267 | + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
1268 | + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ | ||
1269 | + list='$(DISTFILES)'; \ | ||
1270 | + dist_files=`for file in $$list; do echo $$file; done | \ | ||
1271 | + sed -e "s|^$$srcdirstrip/||;t" \ | ||
1272 | + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ | ||
1273 | + case $$dist_files in \ | ||
1274 | + */*) $(MKDIR_P) `echo "$$dist_files" | \ | ||
1275 | + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ | ||
1276 | + sort -u` ;; \ | ||
1277 | + esac; \ | ||
1278 | + for file in $$dist_files; do \ | ||
1279 | + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ | ||
1280 | + if test -d $$d/$$file; then \ | ||
1281 | + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ | ||
1282 | + if test -d "$(distdir)/$$file"; then \ | ||
1283 | + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
1284 | + fi; \ | ||
1285 | + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ | ||
1286 | + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ | ||
1287 | + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ | ||
1288 | + fi; \ | ||
1289 | + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ | ||
1290 | + else \ | ||
1291 | + test -f "$(distdir)/$$file" \ | ||
1292 | + || cp -p $$d/$$file "$(distdir)/$$file" \ | ||
1293 | + || exit 1; \ | ||
1294 | + fi; \ | ||
1295 | + done | ||
1296 | +check-am: all-am | ||
1297 | +check: check-am | ||
1298 | +all-am: Makefile | ||
1299 | +installdirs: | ||
1300 | +install: install-am | ||
1301 | +install-exec: install-exec-am | ||
1302 | +install-data: install-data-am | ||
1303 | +uninstall: uninstall-am | ||
1304 | + | ||
1305 | +install-am: all-am | ||
1306 | + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am | ||
1307 | + | ||
1308 | +installcheck: installcheck-am | ||
1309 | +install-strip: | ||
1310 | + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ | ||
1311 | + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ | ||
1312 | + `test -z '$(STRIP)' || \ | ||
1313 | + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install | ||
1314 | +mostlyclean-generic: | ||
1315 | + | ||
1316 | +clean-generic: | ||
1317 | + | ||
1318 | +distclean-generic: | ||
1319 | + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) | ||
1320 | + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) | ||
1321 | + | ||
1322 | +maintainer-clean-generic: | ||
1323 | + @echo "This command is intended for maintainers to use" | ||
1324 | + @echo "it deletes files that may require special tools to rebuild." | ||
1325 | +clean: clean-am | ||
1326 | + | ||
1327 | +clean-am: clean-generic clean-libtool clean-local mostlyclean-am | ||
1328 | + | ||
1329 | +distclean: distclean-am | ||
1330 | + -rm -f Makefile | ||
1331 | +distclean-am: clean-am distclean-generic | ||
1332 | + | ||
1333 | +dvi: dvi-am | ||
1334 | + | ||
1335 | +dvi-am: | ||
1336 | + | ||
1337 | +html: html-am | ||
1338 | + | ||
1339 | +html-am: | ||
1340 | + | ||
1341 | +info: info-am | ||
1342 | + | ||
1343 | +info-am: | ||
1344 | + | ||
1345 | +install-data-am: | ||
1346 | + | ||
1347 | +install-dvi: install-dvi-am | ||
1348 | + | ||
1349 | +install-dvi-am: | ||
1350 | + | ||
1351 | +install-exec-am: | ||
1352 | + @$(NORMAL_INSTALL) | ||
1353 | + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook | ||
1354 | +install-html: install-html-am | ||
1355 | + | ||
1356 | +install-html-am: | ||
1357 | + | ||
1358 | +install-info: install-info-am | ||
1359 | + | ||
1360 | +install-info-am: | ||
1361 | + | ||
1362 | +install-man: | ||
1363 | + | ||
1364 | +install-pdf: install-pdf-am | ||
1365 | + | ||
1366 | +install-pdf-am: | ||
1367 | + | ||
1368 | +install-ps: install-ps-am | ||
1369 | + | ||
1370 | +install-ps-am: | ||
1371 | + | ||
1372 | +installcheck-am: | ||
1373 | + | ||
1374 | +maintainer-clean: maintainer-clean-am | ||
1375 | + -rm -f Makefile | ||
1376 | +maintainer-clean-am: distclean-am maintainer-clean-generic | ||
1377 | + | ||
1378 | +mostlyclean: mostlyclean-am | ||
1379 | + | ||
1380 | +mostlyclean-am: mostlyclean-generic mostlyclean-libtool | ||
1381 | + | ||
1382 | +pdf: pdf-am | ||
1383 | + | ||
1384 | +pdf-am: | ||
1385 | + | ||
1386 | +ps: ps-am | ||
1387 | + | ||
1388 | +ps-am: | ||
1389 | + | ||
1390 | +uninstall-am: | ||
1391 | + @$(NORMAL_INSTALL) | ||
1392 | + $(MAKE) $(AM_MAKEFLAGS) uninstall-hook | ||
1393 | +.MAKE: install-am install-exec-am install-strip uninstall-am | ||
1394 | + | ||
1395 | +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ | ||
1396 | + clean-local distclean distclean-generic distclean-libtool \ | ||
1397 | + distdir dvi dvi-am html html-am info info-am install \ | ||
1398 | + install-am install-data install-data-am install-dvi \ | ||
1399 | + install-dvi-am install-exec install-exec-am install-exec-hook \ | ||
1400 | + install-html install-html-am install-info install-info-am \ | ||
1401 | + install-man install-pdf install-pdf-am install-ps \ | ||
1402 | + install-ps-am install-strip installcheck installcheck-am \ | ||
1403 | + installdirs maintainer-clean maintainer-clean-generic \ | ||
1404 | + mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ | ||
1405 | + ps ps-am uninstall uninstall-am uninstall-hook | ||
1406 | + | ||
1407 | +all-am: python-build | ||
1408 | + | ||
1409 | +python-build: sesearch.c seinfo.c | ||
1410 | + @mkdir -p setools | ||
1411 | + @cp __init__.py setools | ||
1412 | + LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build | ||
1413 | + | ||
1414 | +install-exec-hook: | ||
1415 | + $(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` | ||
1416 | + | ||
1417 | +uninstall-hook: | ||
1418 | + $(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)` | ||
1419 | + | ||
1420 | +clean-local: | ||
1421 | + $(PYTHON) setup.py clean -a | ||
1422 | + rm -f *~ | ||
1423 | + | ||
1424 | +# Tell versions [3.59,3.63) of GNU make to not export all variables. | ||
1425 | +# Otherwise a system limit (for SysV at least) may be exceeded. | ||
1426 | +.NOEXPORT: | ||
1427 | diff --git a/python/setools/__init__.py b/python/setools/__init__.py | ||
1428 | new file mode 100644 | ||
1429 | index 0000000..6f075c4 | ||
1430 | --- /dev/null | ||
1431 | +++ b/python/setools/__init__.py | ||
1432 | @@ -0,0 +1,50 @@ | ||
1433 | +#!/usr/bin/env python | ||
1434 | + | ||
1435 | +# Author: Thomas Liu <tliu@redhat.com> | ||
1436 | + | ||
1437 | +import _sesearch | ||
1438 | +import _seinfo | ||
1439 | +import types | ||
1440 | + | ||
1441 | +TYPE = _seinfo.TYPE | ||
1442 | +ROLE = _seinfo.ROLE | ||
1443 | +ATTRIBUTE = _seinfo.ATTRIBUTE | ||
1444 | +PORT = _seinfo.PORT | ||
1445 | +USER = _seinfo.USER | ||
1446 | + | ||
1447 | +ALLOW = 'allow' | ||
1448 | +AUDITALLOW = 'auditallow' | ||
1449 | +NEVERALLOW = 'neverallow' | ||
1450 | +DONTAUDIT = 'dontaudit' | ||
1451 | +SCONTEXT = 'scontext' | ||
1452 | +TCONTEXT = 'tcontext' | ||
1453 | +PERMS = 'permlist' | ||
1454 | +CLASS = 'class' | ||
1455 | + | ||
1456 | +def sesearch(types, info): | ||
1457 | + valid_types = [ALLOW, AUDITALLOW, NEVERALLOW, DONTAUDIT] | ||
1458 | + for type in types: | ||
1459 | + if type not in valid_types: | ||
1460 | + raise ValueError("Type has to be in %s" % valid_types) | ||
1461 | + info[type] = True | ||
1462 | + | ||
1463 | + perms = [] | ||
1464 | + if PERMS in info: | ||
1465 | + perms = info[PERMS] | ||
1466 | + info[PERMS] = ",".join(info[PERMS]) | ||
1467 | + | ||
1468 | + | ||
1469 | + dict_list = _sesearch.sesearch(info) | ||
1470 | + if dict_list and len(perms) != 0: | ||
1471 | + dict_list = filter(lambda x: dict_has_perms(x, perms), dict_list) | ||
1472 | + return dict_list | ||
1473 | + | ||
1474 | +def dict_has_perms(dict, perms): | ||
1475 | + for perm in perms: | ||
1476 | + if perm not in dict[PERMS]: | ||
1477 | + return False | ||
1478 | + return True | ||
1479 | + | ||
1480 | +def seinfo(setype, name=None): | ||
1481 | + dict_list = _seinfo.seinfo(setype, name) | ||
1482 | + return dict_list | ||
1483 | diff --git a/python/setools/seinfo.c b/python/setools/seinfo.c | ||
1484 | new file mode 100644 | ||
1485 | index 0000000..211930a | ||
1486 | --- /dev/null | ||
1487 | +++ b/python/setools/seinfo.c | ||
1488 | @@ -0,0 +1,769 @@ | ||
1489 | +/** | ||
1490 | + * @file | ||
1491 | + * Command line tool to search TE rules. | ||
1492 | + * | ||
1493 | + * @author Frank Mayer mayerf@tresys.com | ||
1494 | + * @author Jeremy A. Mowery jmowery@tresys.com | ||
1495 | + * @author Paul Rosenfeld prosenfeld@tresys.com | ||
1496 | + * @author Thomas Liu <tliu@redhat.com> | ||
1497 | + * @author Dan Walsh <dwalsh@redhat.com> | ||
1498 | + * | ||
1499 | + * Copyright (C) 2003-2008 Tresys Technology, LLC | ||
1500 | + * | ||
1501 | + * This program is free software; you can redistribute it and/or modify | ||
1502 | + * it under the terms of the GNU General Public License as published by | ||
1503 | + * the Free Software Foundation; either version 2 of the License, or | ||
1504 | + * (at your option) any later version. | ||
1505 | + * | ||
1506 | + * This program is distributed in the hope that it will be useful, | ||
1507 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1508 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1509 | + * GNU General Public License for more details. | ||
1510 | + * | ||
1511 | + * You should have received a copy of the GNU General Public License | ||
1512 | + * along with this program; if not, write to the Free Software | ||
1513 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
1514 | + */ | ||
1515 | + | ||
1516 | +/** | ||
1517 | + * This is a modified version of seinfo to be used as part of a library for | ||
1518 | + * Python bindings. | ||
1519 | + */ | ||
1520 | + | ||
1521 | +#include "Python.h" | ||
1522 | + | ||
1523 | +/* libapol */ | ||
1524 | +#include <apol/policy.h> | ||
1525 | +#include <apol/policy-query.h> | ||
1526 | +#include <apol/render.h> | ||
1527 | +#include <apol/util.h> | ||
1528 | +#include <apol/vector.h> | ||
1529 | + | ||
1530 | +/* libqpol */ | ||
1531 | +#include <qpol/policy.h> | ||
1532 | +#include <qpol/util.h> | ||
1533 | + | ||
1534 | +/* other */ | ||
1535 | +#include <errno.h> | ||
1536 | +#include <stdlib.h> | ||
1537 | +#include <stdio.h> | ||
1538 | +#include <string.h> | ||
1539 | +#include <assert.h> | ||
1540 | + | ||
1541 | +#define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC" | ||
1542 | +static char *policy_file = NULL; | ||
1543 | + | ||
1544 | +enum input | ||
1545 | +{ | ||
1546 | + TYPE, ATTRIBUTE, ROLE, USER, PORT, | ||
1547 | +}; | ||
1548 | + | ||
1549 | +/** | ||
1550 | + * Gets a textual representation of an attribute, and | ||
1551 | + * all of that attribute's types. | ||
1552 | + * | ||
1553 | + * @param type_datum Reference to sepol type_datum | ||
1554 | + * @param policydb Reference to a policy | ||
1555 | + */ | ||
1556 | +static PyObject* get_attr(const qpol_type_t * type_datum, const apol_policy_t * policydb) | ||
1557 | +{ | ||
1558 | + int retval = -1; | ||
1559 | + PyObject *dict = PyDict_New(); | ||
1560 | + const qpol_type_t *attr_datum = NULL; | ||
1561 | + qpol_iterator_t *iter = NULL; | ||
1562 | + const char *attr_name = NULL, *type_name = NULL; | ||
1563 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1564 | + unsigned char isattr; | ||
1565 | + | ||
1566 | + if (qpol_type_get_name(q, type_datum, &attr_name)) | ||
1567 | + goto cleanup; | ||
1568 | + PyObject *obj = PyString_FromString(attr_name); | ||
1569 | + PyDict_SetItemString(dict, "name", obj); | ||
1570 | + Py_DECREF(obj); | ||
1571 | + | ||
1572 | + /* get an iterator over all types this attribute has */ | ||
1573 | + if (qpol_type_get_isattr(q, type_datum, &isattr)) | ||
1574 | + goto cleanup; | ||
1575 | + if (isattr) { /* sanity check */ | ||
1576 | + if (qpol_type_get_type_iter(q, type_datum, &iter)) | ||
1577 | + goto cleanup; | ||
1578 | + PyObject *list = PyList_New(0); | ||
1579 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1580 | + if (qpol_iterator_get_item(iter, (void **)&attr_datum)) | ||
1581 | + goto cleanup; | ||
1582 | + if (qpol_type_get_name(q, attr_datum, &type_name)) | ||
1583 | + goto cleanup; | ||
1584 | + PyObject *obj = PyString_FromString(type_name); | ||
1585 | + PyList_Append(list, obj); | ||
1586 | + Py_DECREF(obj); | ||
1587 | + } | ||
1588 | + qpol_iterator_destroy(&iter); | ||
1589 | + PyDict_SetItemString(dict, "types", list); | ||
1590 | + Py_DECREF(list); | ||
1591 | + } else /* this should never happen */ | ||
1592 | + goto cleanup; | ||
1593 | + | ||
1594 | + retval = 0; | ||
1595 | +cleanup: | ||
1596 | + qpol_iterator_destroy(&iter); | ||
1597 | + if (retval) { | ||
1598 | + Py_DECREF(dict); | ||
1599 | + return NULL; | ||
1600 | + } | ||
1601 | + return dict; | ||
1602 | +} | ||
1603 | + | ||
1604 | +/** | ||
1605 | + * Gets statistics regarding a policy's attributes. | ||
1606 | + * If this function is given a name, it will attempt to | ||
1607 | + * get statistics about a particular attribute; otherwise | ||
1608 | + * the function gets statistics about all of the policy's | ||
1609 | + * attributes. | ||
1610 | + * | ||
1611 | + * @param name Reference to an attribute's name; if NULL, | ||
1612 | + * all object classes will be considered | ||
1613 | + * @param policydb Reference to a policy | ||
1614 | + * | ||
1615 | + * @return 0 on success, < 0 on error. | ||
1616 | + */ | ||
1617 | +static PyObject* get_attribs(const char *name, const apol_policy_t * policydb) | ||
1618 | +{ | ||
1619 | + int retval = -1; | ||
1620 | + PyObject *list = PyList_New(0); | ||
1621 | + apol_attr_query_t *attr_query = NULL; | ||
1622 | + apol_vector_t *v = NULL; | ||
1623 | + const qpol_type_t *type_datum = NULL; | ||
1624 | + size_t n_attrs, i; | ||
1625 | + | ||
1626 | + /* we are only getting information about 1 attribute */ | ||
1627 | + if (name != NULL) { | ||
1628 | + attr_query = apol_attr_query_create(); | ||
1629 | + if (!attr_query) | ||
1630 | + goto cleanup; | ||
1631 | + if (apol_attr_query_set_attr(policydb, attr_query, name)) | ||
1632 | + goto cleanup; | ||
1633 | + if (apol_attr_get_by_query(policydb, attr_query, &v)) | ||
1634 | + goto cleanup; | ||
1635 | + apol_attr_query_destroy(&attr_query); | ||
1636 | + if (apol_vector_get_size(v) == 0) { | ||
1637 | + apol_vector_destroy(&v); | ||
1638 | + errno = EINVAL; | ||
1639 | + goto cleanup; | ||
1640 | + } | ||
1641 | + | ||
1642 | + type_datum = apol_vector_get_element(v, (size_t) 0); | ||
1643 | + PyObject *obj = get_attr(type_datum, policydb); | ||
1644 | + PyList_Append(list, obj); | ||
1645 | + Py_DECREF(obj); | ||
1646 | + } else { | ||
1647 | + attr_query = apol_attr_query_create(); | ||
1648 | + if (!attr_query) | ||
1649 | + goto cleanup; | ||
1650 | + if (apol_attr_get_by_query(policydb, attr_query, &v)) | ||
1651 | + goto cleanup; | ||
1652 | + apol_attr_query_destroy(&attr_query); | ||
1653 | + n_attrs = apol_vector_get_size(v); | ||
1654 | + | ||
1655 | + for (i = 0; i < n_attrs; i++) { | ||
1656 | + /* get qpol_type_t* item from vector */ | ||
1657 | + type_datum = (qpol_type_t *) apol_vector_get_element(v, (size_t) i); | ||
1658 | + if (!type_datum) | ||
1659 | + goto cleanup; | ||
1660 | + PyObject *obj = get_attr(type_datum, policydb); | ||
1661 | + PyList_Append(list, obj); | ||
1662 | + Py_DECREF(obj); | ||
1663 | + } | ||
1664 | + } | ||
1665 | + apol_vector_destroy(&v); | ||
1666 | + | ||
1667 | + retval = 0; | ||
1668 | + cleanup: | ||
1669 | + apol_attr_query_destroy(&attr_query); | ||
1670 | + apol_vector_destroy(&v); | ||
1671 | + if (retval) { | ||
1672 | + Py_DECREF(list); | ||
1673 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
1674 | + return NULL; | ||
1675 | + } | ||
1676 | + return list; | ||
1677 | +} | ||
1678 | + | ||
1679 | +/** | ||
1680 | + * Get a textual representation of a type, and | ||
1681 | + * all of that type's attributes. | ||
1682 | + * | ||
1683 | + * @param type_datum Reference to sepol type_datum | ||
1684 | + * @param policydb Reference to a policy | ||
1685 | + */ | ||
1686 | +static PyObject* get_type_attrs(const qpol_type_t * type_datum, const apol_policy_t * policydb) | ||
1687 | +{ | ||
1688 | + qpol_iterator_t *iter = NULL; | ||
1689 | + const char *attr_name = NULL; | ||
1690 | + const qpol_type_t *attr_datum = NULL; | ||
1691 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1692 | + | ||
1693 | + if (qpol_type_get_attr_iter(q, type_datum, &iter)) | ||
1694 | + goto cleanup; | ||
1695 | + PyObject *list = PyList_New(0); | ||
1696 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1697 | + if (qpol_iterator_get_item(iter, (void **)&attr_datum)) | ||
1698 | + goto cleanup; | ||
1699 | + if (qpol_type_get_name(q, attr_datum, &attr_name)) | ||
1700 | + goto cleanup; | ||
1701 | + PyObject *obj = PyString_FromString(attr_name); | ||
1702 | + PyList_Append(list, obj); | ||
1703 | + Py_DECREF(obj); | ||
1704 | + } | ||
1705 | + | ||
1706 | + cleanup: | ||
1707 | + qpol_iterator_destroy(&iter); | ||
1708 | + return list; | ||
1709 | +} | ||
1710 | + | ||
1711 | +static PyObject* get_type( const qpol_type_t * type_datum, const apol_policy_t * policydb) { | ||
1712 | + | ||
1713 | + PyObject *dict = PyDict_New(); | ||
1714 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1715 | + const char *type_name = NULL; | ||
1716 | + | ||
1717 | + unsigned char isalias, ispermissive, isattr; | ||
1718 | + | ||
1719 | + if (qpol_type_get_name(q, type_datum, &type_name)) | ||
1720 | + goto cleanup; | ||
1721 | + if (qpol_type_get_isalias(q, type_datum, &isalias)) | ||
1722 | + goto cleanup; | ||
1723 | + if (qpol_type_get_isattr(q, type_datum, &isattr)) | ||
1724 | + goto cleanup; | ||
1725 | + if (qpol_type_get_ispermissive(q, type_datum, &ispermissive)) | ||
1726 | + goto cleanup; | ||
1727 | + | ||
1728 | + PyObject *obj = PyString_FromString(type_name); | ||
1729 | + PyDict_SetItemString(dict, "name", obj); | ||
1730 | + Py_DECREF(obj); | ||
1731 | + obj = PyBool_FromLong(ispermissive); | ||
1732 | + PyDict_SetItemString(dict, "permissive", obj); | ||
1733 | + Py_DECREF(obj); | ||
1734 | + if (!isattr && !isalias) { | ||
1735 | + obj = get_type_attrs(type_datum, policydb); | ||
1736 | + PyDict_SetItemString(dict, "attributes", obj); | ||
1737 | + Py_DECREF(obj); | ||
1738 | + } | ||
1739 | + return dict; | ||
1740 | +cleanup: | ||
1741 | + Py_DECREF(dict); | ||
1742 | + return NULL; | ||
1743 | +} | ||
1744 | + | ||
1745 | +/** | ||
1746 | + * Gets a textual representation of a user, and | ||
1747 | + * all of that user's roles. | ||
1748 | + * | ||
1749 | + * @param type_datum Reference to sepol type_datum | ||
1750 | + * @param policydb Reference to a policy | ||
1751 | + * roles | ||
1752 | + */ | ||
1753 | +static PyObject* get_user(const qpol_user_t * user_datum, const apol_policy_t * policydb) | ||
1754 | +{ | ||
1755 | + PyObject *dict = NULL; | ||
1756 | + const qpol_role_t *role_datum = NULL; | ||
1757 | + qpol_iterator_t *iter = NULL; | ||
1758 | + const qpol_mls_range_t *range = NULL; | ||
1759 | + const qpol_mls_level_t *dflt_level = NULL; | ||
1760 | + apol_mls_level_t *ap_lvl = NULL; | ||
1761 | + apol_mls_range_t *ap_range = NULL; | ||
1762 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1763 | + char *tmp; | ||
1764 | + const char *user_name, *role_name; | ||
1765 | + | ||
1766 | + if (qpol_user_get_name(q, user_datum, &user_name)) | ||
1767 | + goto cleanup; | ||
1768 | + | ||
1769 | + dict = PyDict_New(); | ||
1770 | + PyObject *obj = PyString_FromString(user_name); | ||
1771 | + PyDict_SetItemString(dict, "name", obj); | ||
1772 | + Py_DECREF(obj); | ||
1773 | + | ||
1774 | + if (qpol_policy_has_capability(q, QPOL_CAP_MLS)) { | ||
1775 | + if (qpol_user_get_dfltlevel(q, user_datum, &dflt_level)) | ||
1776 | + goto cleanup; | ||
1777 | + ap_lvl = apol_mls_level_create_from_qpol_mls_level(policydb, dflt_level); | ||
1778 | + tmp = apol_mls_level_render(policydb, ap_lvl); | ||
1779 | + if (!tmp) | ||
1780 | + goto cleanup; | ||
1781 | + obj = PyString_FromString(tmp); | ||
1782 | + PyDict_SetItemString(dict, "level", obj); | ||
1783 | + Py_DECREF(obj); | ||
1784 | + free(tmp); | ||
1785 | + /* print default range */ | ||
1786 | + if (qpol_user_get_range(q, user_datum, &range)) | ||
1787 | + goto cleanup; | ||
1788 | + ap_range = apol_mls_range_create_from_qpol_mls_range(policydb, range); | ||
1789 | + tmp = apol_mls_range_render(policydb, ap_range); | ||
1790 | + if (!tmp) | ||
1791 | + goto cleanup; | ||
1792 | + obj = PyString_FromString(tmp); | ||
1793 | + PyDict_SetItemString(dict, "range", obj); | ||
1794 | + Py_DECREF(obj); | ||
1795 | + free(tmp); | ||
1796 | + } | ||
1797 | + | ||
1798 | + if (qpol_user_get_role_iter(q, user_datum, &iter)) | ||
1799 | + goto cleanup; | ||
1800 | + PyObject *list = PyList_New(0); | ||
1801 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1802 | + if (qpol_iterator_get_item(iter, (void **)&role_datum)) { | ||
1803 | + Py_DECREF(list); | ||
1804 | + goto cleanup; | ||
1805 | + } | ||
1806 | + if (qpol_role_get_name(q, role_datum, &role_name)) { | ||
1807 | + Py_DECREF(list); | ||
1808 | + goto cleanup; | ||
1809 | + } | ||
1810 | + PyObject *obj = PyString_FromString(role_name); | ||
1811 | + PyList_Append(list, obj); | ||
1812 | + Py_DECREF(obj); | ||
1813 | + } | ||
1814 | + PyDict_SetItemString(dict, "roles", list); | ||
1815 | + Py_DECREF(list); | ||
1816 | + | ||
1817 | +cleanup: | ||
1818 | + qpol_iterator_destroy(&iter); | ||
1819 | + apol_mls_level_destroy(&ap_lvl); | ||
1820 | + apol_mls_range_destroy(&ap_range); | ||
1821 | + return dict; | ||
1822 | +} | ||
1823 | + | ||
1824 | +/** | ||
1825 | + * Gets statistics regarding a policy's users. | ||
1826 | + * If this function is given a name, it will attempt to | ||
1827 | + * get statistics about a particular user; otherwise | ||
1828 | + * the function gets statistics about all of the policy's | ||
1829 | + * users. | ||
1830 | + * | ||
1831 | + * @param name Reference to a user's name; if NULL, | ||
1832 | + * all users will be considered | ||
1833 | + * @param policydb Reference to a policy | ||
1834 | + * | ||
1835 | + * @return 0 on success, < 0 on error. | ||
1836 | + */ | ||
1837 | +static PyObject* get_users(const char *name, const apol_policy_t * policydb) | ||
1838 | +{ | ||
1839 | + int retval = -1; | ||
1840 | + PyObject *list = PyList_New(0); | ||
1841 | + qpol_iterator_t *iter = NULL; | ||
1842 | + const qpol_user_t *user_datum = NULL; | ||
1843 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1844 | + | ||
1845 | + if (name != NULL) { | ||
1846 | + if (qpol_policy_get_user_by_name(q, name, &user_datum)) { | ||
1847 | + errno = EINVAL; | ||
1848 | + goto cleanup; | ||
1849 | + } | ||
1850 | + PyObject *obj = get_user(user_datum, policydb); | ||
1851 | + PyList_Append(list, obj); | ||
1852 | + Py_DECREF(obj); | ||
1853 | + } else { | ||
1854 | + if (qpol_policy_get_user_iter(q, &iter)) | ||
1855 | + goto cleanup; | ||
1856 | + | ||
1857 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1858 | + if (qpol_iterator_get_item(iter, (void **)&user_datum)) | ||
1859 | + goto cleanup; | ||
1860 | + PyObject *obj = get_user(user_datum, policydb); | ||
1861 | + PyList_Append(list, obj); | ||
1862 | + Py_DECREF(obj); | ||
1863 | + } | ||
1864 | + qpol_iterator_destroy(&iter); | ||
1865 | + } | ||
1866 | + | ||
1867 | + retval = 0; | ||
1868 | + cleanup: | ||
1869 | + qpol_iterator_destroy(&iter); | ||
1870 | + if (retval) { | ||
1871 | + Py_DECREF(list); | ||
1872 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
1873 | + return NULL; | ||
1874 | + } | ||
1875 | + return list; | ||
1876 | +} | ||
1877 | + | ||
1878 | +/** | ||
1879 | + * get a textual representation of a role, and | ||
1880 | + * all of that role's types. | ||
1881 | + * | ||
1882 | + * @param type_datum Reference to sepol type_datum | ||
1883 | + * @param policydb Reference to a policy | ||
1884 | + * types | ||
1885 | + */ | ||
1886 | +static PyObject* get_role(const qpol_role_t * role_datum, const apol_policy_t * policydb) | ||
1887 | +{ | ||
1888 | + int retval = -1; | ||
1889 | + PyObject *dict = PyDict_New(); | ||
1890 | + const char *role_name = NULL, *type_name = NULL; | ||
1891 | + const qpol_role_t *dom_datum = NULL; | ||
1892 | + const qpol_type_t *type_datum = NULL; | ||
1893 | + qpol_iterator_t *iter = NULL; | ||
1894 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1895 | + size_t n_dom = 0, n_types = 0; | ||
1896 | + | ||
1897 | + if (qpol_role_get_name(q, role_datum, &role_name)) | ||
1898 | + goto cleanup; | ||
1899 | + | ||
1900 | + PyObject *obj = PyString_FromString(role_name); | ||
1901 | + PyDict_SetItemString(dict, "name", obj); | ||
1902 | + Py_DECREF(obj); | ||
1903 | + | ||
1904 | + if (qpol_role_get_dominate_iter(q, role_datum, &iter)) | ||
1905 | + goto cleanup; | ||
1906 | + if (qpol_iterator_get_size(iter, &n_dom)) | ||
1907 | + goto cleanup; | ||
1908 | + if ((int)n_dom > 0) { | ||
1909 | + PyObject *list = PyList_New(0); | ||
1910 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1911 | + if (qpol_iterator_get_item(iter, (void **)&dom_datum)) | ||
1912 | + goto cleanup; | ||
1913 | + if (qpol_role_get_name(q, dom_datum, &role_name)) | ||
1914 | + goto cleanup; | ||
1915 | + PyObject *obj = PyString_FromString(role_name); | ||
1916 | + PyList_Append(list, obj); | ||
1917 | + Py_DECREF(obj); | ||
1918 | + } | ||
1919 | + PyDict_SetItemString(dict, "dominate", list); | ||
1920 | + Py_DECREF(list); | ||
1921 | + } | ||
1922 | + qpol_iterator_destroy(&iter); | ||
1923 | + | ||
1924 | + if (qpol_role_get_type_iter(q, role_datum, &iter)) | ||
1925 | + goto cleanup; | ||
1926 | + if (qpol_iterator_get_size(iter, &n_types)) | ||
1927 | + goto cleanup; | ||
1928 | + if ((int)n_types > 0) { | ||
1929 | + PyObject *list = PyList_New(0); | ||
1930 | + /* print types */ | ||
1931 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1932 | + if (qpol_iterator_get_item(iter, (void **)&type_datum)) | ||
1933 | + goto cleanup; | ||
1934 | + if (qpol_type_get_name(q, type_datum, &type_name)) | ||
1935 | + goto cleanup; | ||
1936 | + PyObject *obj = PyString_FromString(type_name); | ||
1937 | + PyList_Append(list, obj); | ||
1938 | + Py_DECREF(obj); | ||
1939 | + } | ||
1940 | + PyDict_SetItemString(dict, "types", list); | ||
1941 | + Py_DECREF(list); | ||
1942 | + } | ||
1943 | + | ||
1944 | + retval = 0; | ||
1945 | +cleanup: | ||
1946 | + qpol_iterator_destroy(&iter); | ||
1947 | + if (retval) { | ||
1948 | + Py_DECREF(dict); | ||
1949 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
1950 | + return NULL; | ||
1951 | + } | ||
1952 | + return dict; | ||
1953 | +} | ||
1954 | + | ||
1955 | +/** | ||
1956 | + * Get statistics regarding a policy's ports. | ||
1957 | + * If this function is given a name, it will attempt to | ||
1958 | + * get statistics about a particular port; otherwise | ||
1959 | + * the function get statistics about all of the policy's ports. | ||
1960 | + * | ||
1961 | + * @param name Reference to an port's name; if NULL, | ||
1962 | + * all ports will be considered | ||
1963 | + * @param policydb Reference to a policy | ||
1964 | + * | ||
1965 | + * @return 0 on success, < 0 on error. | ||
1966 | + */ | ||
1967 | +static PyObject* get_ports(const char *num, const apol_policy_t * policydb) | ||
1968 | +{ | ||
1969 | + PyObject *list = PyList_New(0); | ||
1970 | + int retval = -1; | ||
1971 | + const qpol_portcon_t *portcon = NULL; | ||
1972 | + qpol_iterator_t *iter = NULL; | ||
1973 | + uint16_t low_port, high_port; | ||
1974 | + uint8_t ocon_proto; | ||
1975 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
1976 | + const qpol_context_t *ctxt = NULL; | ||
1977 | + const char *proto_str; | ||
1978 | + PyObject *dict; | ||
1979 | + const char *type = NULL; | ||
1980 | + const apol_mls_range_t *range = NULL; | ||
1981 | + char *range_str = NULL; | ||
1982 | + PyObject *obj = NULL; | ||
1983 | + apol_context_t *c = NULL; | ||
1984 | + | ||
1985 | + if (qpol_policy_get_portcon_iter(q, &iter)) | ||
1986 | + goto cleanup; | ||
1987 | + | ||
1988 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
1989 | + if (qpol_iterator_get_item(iter, (void **)&portcon)) | ||
1990 | + goto cleanup; | ||
1991 | + if (qpol_portcon_get_low_port(q, portcon, &low_port)) | ||
1992 | + goto cleanup; | ||
1993 | + if (qpol_portcon_get_high_port(q, portcon, &high_port)) | ||
1994 | + goto cleanup; | ||
1995 | + if (qpol_portcon_get_protocol(q, portcon, &ocon_proto)) | ||
1996 | + goto cleanup; | ||
1997 | + if (num) { | ||
1998 | + if (atoi(num) < low_port || atoi(num) > high_port) | ||
1999 | + continue; | ||
2000 | + } | ||
2001 | + | ||
2002 | + if ((ocon_proto != IPPROTO_TCP) && | ||
2003 | + (ocon_proto != IPPROTO_UDP)) | ||
2004 | + goto cleanup; | ||
2005 | + | ||
2006 | + if (qpol_portcon_get_context(q, portcon, &ctxt)) { | ||
2007 | + PyErr_SetString(PyExc_RuntimeError, "Could not get for port context."); | ||
2008 | + goto cleanup; | ||
2009 | + } | ||
2010 | + | ||
2011 | + if ((proto_str = apol_protocol_to_str(ocon_proto)) == NULL) { | ||
2012 | + PyErr_SetString(PyExc_RuntimeError, "Invalid protocol for port"); | ||
2013 | + goto cleanup; | ||
2014 | + } | ||
2015 | + | ||
2016 | + if ((c = apol_context_create_from_qpol_context(policydb, ctxt)) == NULL) { | ||
2017 | + goto cleanup; | ||
2018 | + } | ||
2019 | + | ||
2020 | + if((type = apol_context_get_type(c)) == NULL) { | ||
2021 | + apol_context_destroy(&c); | ||
2022 | + goto cleanup; | ||
2023 | + } | ||
2024 | + | ||
2025 | + dict = PyDict_New(); | ||
2026 | + obj = PyString_FromString(type); | ||
2027 | + PyDict_SetItemString(dict, "type", obj); | ||
2028 | + Py_DECREF(obj); | ||
2029 | + | ||
2030 | + if((range = apol_context_get_range(c)) == NULL) { | ||
2031 | + goto cleanup; | ||
2032 | + } | ||
2033 | + | ||
2034 | + range_str = apol_mls_range_render(policydb, range); | ||
2035 | + if (range_str == NULL) { | ||
2036 | + goto cleanup; | ||
2037 | + } | ||
2038 | + obj = PyString_FromString(range_str); | ||
2039 | + PyDict_SetItemString(dict, "range", obj); | ||
2040 | + Py_DECREF(obj); | ||
2041 | + | ||
2042 | + obj = PyString_FromString(proto_str); | ||
2043 | + PyDict_SetItemString(dict, "protocol", obj); | ||
2044 | + Py_DECREF(obj); | ||
2045 | + | ||
2046 | + obj = PyInt_FromLong(high_port); | ||
2047 | + PyDict_SetItemString(dict, "high", obj); | ||
2048 | + Py_DECREF(obj); | ||
2049 | + | ||
2050 | + obj = PyInt_FromLong(low_port); | ||
2051 | + PyDict_SetItemString(dict, "low", obj); | ||
2052 | + Py_DECREF(obj); | ||
2053 | + | ||
2054 | + PyList_Append(list, dict); | ||
2055 | + Py_DECREF(dict); | ||
2056 | + } | ||
2057 | + retval = 0; | ||
2058 | + cleanup: | ||
2059 | + free(range_str); | ||
2060 | + apol_context_destroy(&c); | ||
2061 | + qpol_iterator_destroy(&iter); | ||
2062 | + | ||
2063 | + if (retval) { | ||
2064 | + Py_DECREF(list); | ||
2065 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
2066 | + return NULL; | ||
2067 | + } | ||
2068 | + return list; | ||
2069 | +} | ||
2070 | + | ||
2071 | +/** | ||
2072 | + * Get statistics regarding a policy's roles. | ||
2073 | + * If this function is given a name, it will attempt to | ||
2074 | + * get statistics about a particular role; otherwise | ||
2075 | + * the function get statistics about all of the policy's roles. | ||
2076 | + * | ||
2077 | + * @param name Reference to an role's name; if NULL, | ||
2078 | + * all roles will be considered | ||
2079 | + * @param policydb Reference to a policy | ||
2080 | + * | ||
2081 | + * @return 0 on success, < 0 on error. | ||
2082 | + */ | ||
2083 | +static PyObject* get_roles(const char *name, const apol_policy_t * policydb) | ||
2084 | +{ | ||
2085 | + int retval = -1; | ||
2086 | + PyObject *list = PyList_New(0); | ||
2087 | + const qpol_role_t *role_datum = NULL; | ||
2088 | + qpol_iterator_t *iter = NULL; | ||
2089 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
2090 | + | ||
2091 | + if (name != NULL) { | ||
2092 | + if (qpol_policy_get_role_by_name(q, name, &role_datum)) { | ||
2093 | + errno = EINVAL; | ||
2094 | + goto cleanup; | ||
2095 | + } | ||
2096 | + PyObject *obj = get_role(role_datum, policydb); | ||
2097 | + PyList_Append(list, obj); | ||
2098 | + Py_DECREF(obj); | ||
2099 | + } else { | ||
2100 | + if (qpol_policy_get_role_iter(q, &iter)) | ||
2101 | + goto cleanup; | ||
2102 | + | ||
2103 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
2104 | + if (qpol_iterator_get_item(iter, (void **)&role_datum)) | ||
2105 | + goto cleanup; | ||
2106 | + PyObject *obj = get_role(role_datum, policydb); | ||
2107 | + PyList_Append(list, obj); | ||
2108 | + Py_DECREF(obj); | ||
2109 | + } | ||
2110 | + qpol_iterator_destroy(&iter); | ||
2111 | + } | ||
2112 | + | ||
2113 | + retval = 0; | ||
2114 | + cleanup: | ||
2115 | + qpol_iterator_destroy(&iter); | ||
2116 | + if (retval) { | ||
2117 | + Py_DECREF(list); | ||
2118 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
2119 | + return NULL; | ||
2120 | + } | ||
2121 | + return list; | ||
2122 | +} | ||
2123 | + | ||
2124 | +/** | ||
2125 | + * Get statistics regarding a policy's types. | ||
2126 | + * If this function is given a name, it will attempt to | ||
2127 | + * print statistics about a particular type; otherwise | ||
2128 | + * the function prints statistics about all of the policy's types. | ||
2129 | + * | ||
2130 | + * @param name Reference to a type's name; if NULL, | ||
2131 | + * all object classes will be considered | ||
2132 | + * @param policydb Reference to a policy | ||
2133 | + * | ||
2134 | + * @return 0 on success, < 0 on error. | ||
2135 | + */ | ||
2136 | +static PyObject* get_types(const char *name, const apol_policy_t * policydb) | ||
2137 | +{ | ||
2138 | + int retval = -1; | ||
2139 | + PyObject *list = PyList_New(0); | ||
2140 | + const qpol_type_t *type_datum = NULL; | ||
2141 | + qpol_iterator_t *iter = NULL; | ||
2142 | + qpol_policy_t *q = apol_policy_get_qpol(policydb); | ||
2143 | + | ||
2144 | + /* if name was provided, only print that name */ | ||
2145 | + if (name != NULL) { | ||
2146 | + if (qpol_policy_get_type_by_name(q, name, &type_datum)) { | ||
2147 | + errno = EINVAL; | ||
2148 | + goto cleanup; | ||
2149 | + } | ||
2150 | + PyObject *obj = get_type(type_datum, policydb); | ||
2151 | + PyList_Append(list, obj); | ||
2152 | + Py_DECREF(obj); | ||
2153 | + } else { | ||
2154 | + if (qpol_policy_get_type_iter(q, &iter)) | ||
2155 | + goto cleanup; | ||
2156 | + /* Print all type names */ | ||
2157 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
2158 | + if (qpol_iterator_get_item(iter, (void **)&type_datum)) | ||
2159 | + goto cleanup; | ||
2160 | + PyObject *obj = get_type(type_datum, policydb); | ||
2161 | + PyList_Append(list, obj); | ||
2162 | + Py_DECREF(obj); | ||
2163 | + } | ||
2164 | + } | ||
2165 | + retval = 0; | ||
2166 | +cleanup: | ||
2167 | + qpol_iterator_destroy(&iter); | ||
2168 | + if (retval) { | ||
2169 | + Py_DECREF(list); | ||
2170 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
2171 | + return NULL; | ||
2172 | + } | ||
2173 | + return list; | ||
2174 | +} | ||
2175 | + | ||
2176 | +PyObject* seinfo(int type, const char *name) | ||
2177 | +{ | ||
2178 | + int rt = -1; | ||
2179 | + | ||
2180 | + apol_policy_t *policydb = NULL; | ||
2181 | + apol_policy_path_t *pol_path = NULL; | ||
2182 | + apol_vector_t *mod_paths = NULL; | ||
2183 | + apol_policy_path_type_e path_type = APOL_POLICY_PATH_TYPE_MONOLITHIC; | ||
2184 | + PyObject* output = NULL; | ||
2185 | + | ||
2186 | + rt = qpol_default_policy_find(&policy_file); | ||
2187 | + if (rt != 0) { | ||
2188 | + PyErr_SetString(PyExc_RuntimeError,"No default policy found."); | ||
2189 | + return NULL; | ||
2190 | + } | ||
2191 | + | ||
2192 | + pol_path = apol_policy_path_create(path_type, policy_file, mod_paths); | ||
2193 | + if (!pol_path) { | ||
2194 | + free(policy_file); | ||
2195 | + apol_vector_destroy(&mod_paths); | ||
2196 | + PyErr_SetString(PyExc_RuntimeError,strerror(ENOMEM)); | ||
2197 | + return NULL; | ||
2198 | + } | ||
2199 | + apol_vector_destroy(&mod_paths); | ||
2200 | + | ||
2201 | + int policy_load_options = 0; | ||
2202 | + policy_load_options |= QPOL_POLICY_OPTION_MATCH_SYSTEM; | ||
2203 | + policydb = apol_policy_create_from_policy_path(pol_path, policy_load_options, NULL, NULL); | ||
2204 | + if (!policydb) { | ||
2205 | + free(policy_file); | ||
2206 | + apol_policy_path_destroy(&pol_path); | ||
2207 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
2208 | + return NULL; | ||
2209 | + } | ||
2210 | + free(policy_file); | ||
2211 | + | ||
2212 | + /* display requested info */ | ||
2213 | + if (type == TYPE) | ||
2214 | + output = get_types(name, policydb); | ||
2215 | + | ||
2216 | + if (type == ATTRIBUTE) | ||
2217 | + output = get_attribs(name, policydb); | ||
2218 | + | ||
2219 | + if (type == ROLE) | ||
2220 | + output = get_roles(name, policydb); | ||
2221 | + | ||
2222 | + if (type == USER) | ||
2223 | + output = get_users(name, policydb); | ||
2224 | + | ||
2225 | + if (type == PORT) | ||
2226 | + output = get_ports(name, policydb); | ||
2227 | + | ||
2228 | + apol_policy_destroy(&policydb); | ||
2229 | + apol_policy_path_destroy(&pol_path); | ||
2230 | + return output; | ||
2231 | +} | ||
2232 | + | ||
2233 | +PyObject *wrap_seinfo(PyObject *self, PyObject *args){ | ||
2234 | + unsigned int type; | ||
2235 | + char *name; | ||
2236 | + | ||
2237 | + if (!PyArg_ParseTuple(args, "iz", &type, &name)) | ||
2238 | + return NULL; | ||
2239 | + | ||
2240 | + return Py_BuildValue("O",seinfo(type, name)); | ||
2241 | + | ||
2242 | +} | ||
2243 | + | ||
2244 | +static PyMethodDef methods[] = { | ||
2245 | + {"seinfo", (PyCFunction) wrap_seinfo, METH_VARARGS}, | ||
2246 | + {NULL, NULL, 0, NULL} | ||
2247 | +}; | ||
2248 | + | ||
2249 | +void init_seinfo(){ | ||
2250 | + PyObject *m; | ||
2251 | + m = Py_InitModule("_seinfo", methods); | ||
2252 | + PyModule_AddIntConstant(m, "ATTRIBUTE", ATTRIBUTE); | ||
2253 | + PyModule_AddIntConstant(m, "PORT", PORT); | ||
2254 | + PyModule_AddIntConstant(m, "ROLE", ROLE); | ||
2255 | + PyModule_AddIntConstant(m, "TYPE", TYPE); | ||
2256 | + PyModule_AddIntConstant(m, "USER", USER); | ||
2257 | +} | ||
2258 | diff --git a/python/setools/sesearch.c b/python/setools/sesearch.c | ||
2259 | new file mode 100644 | ||
2260 | index 0000000..faaf8b7 | ||
2261 | --- /dev/null | ||
2262 | +++ b/python/setools/sesearch.c | ||
2263 | @@ -0,0 +1,478 @@ | ||
2264 | +// Author: Thomas Liu <tliu@redhat.com> | ||
2265 | + | ||
2266 | +/** | ||
2267 | + * @file | ||
2268 | + * Command line tool to search TE rules. | ||
2269 | + * | ||
2270 | + * @author Frank Mayer mayerf@tresys.com | ||
2271 | + * @author Jeremy A. Mowery jmowery@tresys.com | ||
2272 | + * @author Paul Rosenfeld prosenfeld@tresys.com | ||
2273 | + * @author Thomas Liu <tliu@redhat.com> | ||
2274 | + * | ||
2275 | + * Copyright (C) 2003-2008 Tresys Technology, LLC | ||
2276 | + * | ||
2277 | + * This program is free software; you can redistribute it and/or modify | ||
2278 | + * it under the terms of the GNU General Public License as published by | ||
2279 | + * the Free Software Foundation; either version 2 of the License, or | ||
2280 | + * (at your option) any later version. | ||
2281 | + * | ||
2282 | + * This program is distributed in the hope that it will be useful, | ||
2283 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
2284 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
2285 | + * GNU General Public License for more details. | ||
2286 | + * | ||
2287 | + * You should have received a copy of the GNU General Public License | ||
2288 | + * along with this program; if not, write to the Free Software | ||
2289 | + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
2290 | + */ | ||
2291 | + | ||
2292 | +/** | ||
2293 | + * This is a modified version of sesearch to be used as part of a library for | ||
2294 | + * Python bindings. | ||
2295 | + */ | ||
2296 | + | ||
2297 | +#include "Python.h" | ||
2298 | + | ||
2299 | +/* libapol */ | ||
2300 | +#include <apol/policy.h> | ||
2301 | +#include <apol/policy-query.h> | ||
2302 | +#include <apol/render.h> | ||
2303 | +#include <apol/util.h> | ||
2304 | +#include <apol/vector.h> | ||
2305 | + | ||
2306 | +/* libqpol*/ | ||
2307 | +#include <qpol/policy.h> | ||
2308 | +#include <qpol/policy_extend.h> | ||
2309 | +#include <qpol/syn_rule_query.h> | ||
2310 | +#include <qpol/util.h> | ||
2311 | + | ||
2312 | +/* other */ | ||
2313 | +#include <errno.h> | ||
2314 | +#include <stdlib.h> | ||
2315 | +#include <stdio.h> | ||
2316 | +#include <assert.h> | ||
2317 | +#include <getopt.h> | ||
2318 | +#include <string.h> | ||
2319 | +#include <stdbool.h> | ||
2320 | + | ||
2321 | +#define COPYRIGHT_INFO "Copyright (C) 2003-2007 Tresys Technology, LLC" | ||
2322 | +static char *policy_file = NULL; | ||
2323 | + | ||
2324 | +enum opt_values | ||
2325 | +{ | ||
2326 | + RULE_NEVERALLOW = 256, RULE_AUDIT, RULE_AUDITALLOW, RULE_DONTAUDIT, | ||
2327 | + RULE_ROLE_ALLOW, RULE_ROLE_TRANS, RULE_RANGE_TRANS, RULE_ALL, | ||
2328 | + EXPR_ROLE_SOURCE, EXPR_ROLE_TARGET | ||
2329 | +}; | ||
2330 | + | ||
2331 | +; | ||
2332 | + | ||
2333 | +typedef struct options | ||
2334 | +{ | ||
2335 | + char *src_name; | ||
2336 | + char *tgt_name; | ||
2337 | + char *src_role_name; | ||
2338 | + char *tgt_role_name; | ||
2339 | + char *class_name; | ||
2340 | + char *permlist; | ||
2341 | + char *bool_name; | ||
2342 | + apol_vector_t *class_vector; | ||
2343 | + bool all; | ||
2344 | + bool lineno; | ||
2345 | + bool semantic; | ||
2346 | + bool indirect; | ||
2347 | + bool allow; | ||
2348 | + bool nallow; | ||
2349 | + bool auditallow; | ||
2350 | + bool dontaudit; | ||
2351 | + bool type; | ||
2352 | + bool rtrans; | ||
2353 | + bool role_allow; | ||
2354 | + bool role_trans; | ||
2355 | + bool useregex; | ||
2356 | + bool show_cond; | ||
2357 | + apol_vector_t *perm_vector; | ||
2358 | +} options_t; | ||
2359 | + | ||
2360 | +static int perform_av_query(const apol_policy_t * policy, const options_t * opt, apol_vector_t ** v) | ||
2361 | +{ | ||
2362 | + apol_avrule_query_t *avq = NULL; | ||
2363 | + unsigned int rules = 0; | ||
2364 | + int error = 0; | ||
2365 | + char *tmp = NULL, *tok = NULL, *s = NULL; | ||
2366 | + | ||
2367 | + if (!policy || !opt || !v) { | ||
2368 | + PyErr_SetString(PyExc_RuntimeError,strerror(EINVAL)); | ||
2369 | + errno = EINVAL; | ||
2370 | + return -1; | ||
2371 | + } | ||
2372 | + | ||
2373 | + if (!opt->all && !opt->allow && !opt->nallow && !opt->auditallow && !opt->dontaudit) { | ||
2374 | + *v = NULL; | ||
2375 | + return 0; /* no search to do */ | ||
2376 | + } | ||
2377 | + | ||
2378 | + avq = apol_avrule_query_create(); | ||
2379 | + if (!avq) { | ||
2380 | + PyErr_SetString(PyExc_RuntimeError,strerror(ENOMEM)); | ||
2381 | + errno = ENOMEM; | ||
2382 | + return -1; | ||
2383 | + } | ||
2384 | + | ||
2385 | + if (opt->allow || opt->all) | ||
2386 | + rules |= QPOL_RULE_ALLOW; | ||
2387 | + if ((opt->nallow || opt->all) && qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_NEVERALLOW)) | ||
2388 | + rules |= QPOL_RULE_NEVERALLOW; | ||
2389 | + if (opt->auditallow || opt->all) | ||
2390 | + rules |= QPOL_RULE_AUDITALLOW; | ||
2391 | + if (opt->dontaudit || opt->all) | ||
2392 | + rules |= QPOL_RULE_DONTAUDIT; | ||
2393 | + apol_avrule_query_set_rules(policy, avq, rules); | ||
2394 | + apol_avrule_query_set_regex(policy, avq, opt->useregex); | ||
2395 | + if (opt->src_name) | ||
2396 | + apol_avrule_query_set_source(policy, avq, opt->src_name, opt->indirect); | ||
2397 | + if (opt->tgt_name) | ||
2398 | + apol_avrule_query_set_target(policy, avq, opt->tgt_name, opt->indirect); | ||
2399 | + if (opt->bool_name) | ||
2400 | + apol_avrule_query_set_bool(policy, avq, opt->bool_name); | ||
2401 | + if (opt->class_name) { | ||
2402 | + if (opt->class_vector == NULL) { | ||
2403 | + if (apol_avrule_query_append_class(policy, avq, opt->class_name)) { | ||
2404 | + error = errno; | ||
2405 | + goto err; | ||
2406 | + } | ||
2407 | + } else { | ||
2408 | + size_t i; | ||
2409 | + for (i = 0; i < apol_vector_get_size(opt->class_vector); ++i) { | ||
2410 | + char *class_name; | ||
2411 | + class_name = apol_vector_get_element(opt->class_vector, i); | ||
2412 | + if (!class_name) | ||
2413 | + continue; | ||
2414 | + if (apol_avrule_query_append_class(policy, avq, class_name)) { | ||
2415 | + error = errno; | ||
2416 | + goto err; | ||
2417 | + } | ||
2418 | + } | ||
2419 | + } | ||
2420 | + } | ||
2421 | + | ||
2422 | + if (opt->permlist) { | ||
2423 | + tmp = strdup(opt->permlist); | ||
2424 | + for (tok = strtok(tmp, ","); tok; tok = strtok(NULL, ",")) { | ||
2425 | + if (apol_avrule_query_append_perm(policy, avq, tok)) { | ||
2426 | + error = errno; | ||
2427 | + goto err; | ||
2428 | + } | ||
2429 | + if ((s = strdup(tok)) == NULL || apol_vector_append(opt->perm_vector, s) < 0) { | ||
2430 | + error = errno; | ||
2431 | + goto err; | ||
2432 | + } | ||
2433 | + s = NULL; | ||
2434 | + } | ||
2435 | + free(tmp); | ||
2436 | + } | ||
2437 | + | ||
2438 | + if (!(opt->semantic) && qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_SYN_RULES)) { | ||
2439 | + if (apol_syn_avrule_get_by_query(policy, avq, v)) { | ||
2440 | + error = errno; | ||
2441 | + goto err; | ||
2442 | + } | ||
2443 | + } else { | ||
2444 | + if (apol_avrule_get_by_query(policy, avq, v)) { | ||
2445 | + error = errno; | ||
2446 | + goto err; | ||
2447 | + } | ||
2448 | + } | ||
2449 | + | ||
2450 | + apol_avrule_query_destroy(&avq); | ||
2451 | + return 0; | ||
2452 | + | ||
2453 | + err: | ||
2454 | + apol_vector_destroy(v); | ||
2455 | + apol_avrule_query_destroy(&avq); | ||
2456 | + free(tmp); | ||
2457 | + free(s); | ||
2458 | + PyErr_SetString(PyExc_RuntimeError,strerror(error)); | ||
2459 | + errno = error; | ||
2460 | + return -1; | ||
2461 | +} | ||
2462 | + | ||
2463 | + | ||
2464 | + | ||
2465 | +static PyObject* get_av_results(const apol_policy_t * policy, const options_t * opt, const apol_vector_t * v) | ||
2466 | +{ | ||
2467 | + int retval = -1; | ||
2468 | + PyObject *list = PyList_New(0); | ||
2469 | + qpol_policy_t *q = apol_policy_get_qpol(policy); | ||
2470 | + size_t i, num_rules = 0; | ||
2471 | + const qpol_avrule_t *rule = NULL; | ||
2472 | + char *tmp = NULL, *rule_str = NULL, *expr = NULL; | ||
2473 | + char enable_char = ' ', branch_char = ' '; | ||
2474 | + qpol_iterator_t *iter = NULL; | ||
2475 | + uint32_t enabled = 0; | ||
2476 | + | ||
2477 | + if (!policy || !v) | ||
2478 | + return NULL; | ||
2479 | + | ||
2480 | + if (!(num_rules = apol_vector_get_size(v))) | ||
2481 | + return NULL; | ||
2482 | + | ||
2483 | + for (i = 0; i < num_rules; i++) { | ||
2484 | + enable_char = branch_char = ' '; | ||
2485 | + if (!(rule = apol_vector_get_element(v, i))) | ||
2486 | + goto cleanup; | ||
2487 | + | ||
2488 | + if (qpol_avrule_get_is_enabled(q, rule, &enabled)) | ||
2489 | + goto cleanup; | ||
2490 | + if (!enabled) | ||
2491 | + continue; | ||
2492 | + | ||
2493 | + const qpol_type_t *type; | ||
2494 | + const char *tmp_name; | ||
2495 | + uint32_t rule_type = 0; | ||
2496 | + | ||
2497 | + const qpol_class_t *obj_class = NULL; | ||
2498 | + | ||
2499 | + PyObject *dict = PyDict_New(); | ||
2500 | + | ||
2501 | + qpol_avrule_get_rule_type(q, rule, &rule_type); | ||
2502 | + tmp_name = apol_rule_type_to_str(rule_type); | ||
2503 | + PyObject *obj = PyString_FromString(tmp_name); | ||
2504 | + PyDict_SetItemString(dict, "type", obj); | ||
2505 | + Py_DECREF(obj); | ||
2506 | + // source | ||
2507 | + qpol_avrule_get_source_type(q, rule, &type); | ||
2508 | + qpol_type_get_name(q, type, &tmp_name); | ||
2509 | + obj = PyString_FromString(tmp_name); | ||
2510 | + PyDict_SetItemString(dict, "scontext", obj); | ||
2511 | + Py_DECREF(obj); | ||
2512 | + | ||
2513 | + qpol_avrule_get_target_type(q, rule, &type); | ||
2514 | + qpol_type_get_name(q, type, &tmp_name); | ||
2515 | + obj = PyString_FromString(tmp_name); | ||
2516 | + PyDict_SetItemString(dict, "tcontext", obj); | ||
2517 | + Py_DECREF(obj); | ||
2518 | + | ||
2519 | + qpol_avrule_get_object_class(q, rule, &obj_class); | ||
2520 | + qpol_type_get_name(q, type, &tmp_name); | ||
2521 | + obj = PyString_FromString(tmp_name); | ||
2522 | + PyDict_SetItemString(dict, "class", obj); | ||
2523 | + Py_DECREF(obj); | ||
2524 | + qpol_avrule_get_perm_iter(q, rule, &iter); | ||
2525 | + PyObject *permlist = PyList_New(0); | ||
2526 | + for (; !qpol_iterator_end(iter); qpol_iterator_next(iter)) { | ||
2527 | + const char *perm_name = NULL; | ||
2528 | + qpol_iterator_get_item(iter, (void **)&perm_name); | ||
2529 | + obj = PyString_FromString(perm_name); | ||
2530 | + PyList_Append(permlist, obj); | ||
2531 | + Py_DECREF(obj); | ||
2532 | + } | ||
2533 | + PyDict_SetItemString(dict, "permlist", permlist); | ||
2534 | + Py_DECREF(permlist); | ||
2535 | + PyList_Append(list, dict); | ||
2536 | + Py_DECREF(dict); | ||
2537 | + | ||
2538 | + free(rule_str); | ||
2539 | + rule_str = NULL; | ||
2540 | + free(expr); | ||
2541 | + expr = NULL; | ||
2542 | + } | ||
2543 | + retval = 0; | ||
2544 | + cleanup: | ||
2545 | + free(tmp); | ||
2546 | + free(rule_str); | ||
2547 | + free(expr); | ||
2548 | + if (retval) { | ||
2549 | + Py_DECREF(list); | ||
2550 | + return NULL; | ||
2551 | + } | ||
2552 | + return list; | ||
2553 | +} | ||
2554 | + | ||
2555 | + | ||
2556 | +PyObject* sesearch(bool allow, | ||
2557 | + bool neverallow, | ||
2558 | + bool auditallow, | ||
2559 | + bool dontaudit, | ||
2560 | + const char *src_name, | ||
2561 | + const char *tgt_name, | ||
2562 | + const char *class_name, | ||
2563 | + const char *permlist | ||
2564 | + ) | ||
2565 | +{ | ||
2566 | + options_t cmd_opts; | ||
2567 | + int rt = -1; | ||
2568 | + PyObject *output = NULL; | ||
2569 | + | ||
2570 | + apol_policy_t *policy = NULL; | ||
2571 | + apol_vector_t *v = NULL; | ||
2572 | + apol_policy_path_t *pol_path = NULL; | ||
2573 | + apol_vector_t *mod_paths = NULL; | ||
2574 | + apol_policy_path_type_e path_type = APOL_POLICY_PATH_TYPE_MONOLITHIC; | ||
2575 | + | ||
2576 | + memset(&cmd_opts, 0, sizeof(cmd_opts)); | ||
2577 | + cmd_opts.indirect = true; | ||
2578 | + cmd_opts.allow = allow; | ||
2579 | + cmd_opts.nallow = neverallow; | ||
2580 | + cmd_opts.auditallow = auditallow; | ||
2581 | + cmd_opts.dontaudit = dontaudit; | ||
2582 | + if (src_name) | ||
2583 | + cmd_opts.src_name = strdup(src_name); | ||
2584 | + if (tgt_name) | ||
2585 | + cmd_opts.tgt_name = strdup(tgt_name); | ||
2586 | + if (class_name) | ||
2587 | + cmd_opts.class_name = strdup(class_name); | ||
2588 | + if (permlist){ | ||
2589 | + cmd_opts.perm_vector = apol_vector_create(free); | ||
2590 | + cmd_opts.permlist = strdup(permlist); | ||
2591 | + } | ||
2592 | + int pol_opt = 0; | ||
2593 | + if (!(cmd_opts.nallow || cmd_opts.all)) | ||
2594 | + pol_opt |= QPOL_POLICY_OPTION_NO_NEVERALLOWS; | ||
2595 | + | ||
2596 | + | ||
2597 | + rt = qpol_default_policy_find(&policy_file); | ||
2598 | + if (rt) { | ||
2599 | + PyErr_SetString(PyExc_RuntimeError,"No default policy found."); | ||
2600 | + return NULL; | ||
2601 | + } | ||
2602 | + pol_opt |= QPOL_POLICY_OPTION_MATCH_SYSTEM; | ||
2603 | + | ||
2604 | + if (apol_file_is_policy_path_list(policy_file) > 0) { | ||
2605 | + pol_path = apol_policy_path_create_from_file(policy_file); | ||
2606 | + if (!pol_path) { | ||
2607 | + free(policy_file); | ||
2608 | + PyErr_SetString(PyExc_RuntimeError,"invalid policy list"); | ||
2609 | + return NULL; | ||
2610 | + } | ||
2611 | + } | ||
2612 | + | ||
2613 | + if (!pol_path) | ||
2614 | + pol_path = apol_policy_path_create(path_type, policy_file, mod_paths); | ||
2615 | + if (!pol_path) { | ||
2616 | + free(policy_file); | ||
2617 | + PyErr_SetString(PyExc_RuntimeError,strerror(ENOMEM)); | ||
2618 | + return NULL; | ||
2619 | + } | ||
2620 | + free(policy_file); | ||
2621 | + apol_vector_destroy(&mod_paths); | ||
2622 | + | ||
2623 | + policy = apol_policy_create_from_policy_path(pol_path, pol_opt, NULL, NULL); | ||
2624 | + if (!policy) { | ||
2625 | + apol_policy_path_destroy(&pol_path); | ||
2626 | + PyErr_SetString(PyExc_RuntimeError,strerror(errno)); | ||
2627 | + return NULL; | ||
2628 | + } | ||
2629 | + /* handle regex for class name */ | ||
2630 | + if (cmd_opts.useregex && cmd_opts.class_name != NULL) { | ||
2631 | + cmd_opts.class_vector = apol_vector_create(NULL); | ||
2632 | + apol_vector_t *qpol_matching_classes = NULL; | ||
2633 | + apol_class_query_t *regex_match_query = apol_class_query_create(); | ||
2634 | + apol_class_query_set_regex(policy, regex_match_query, 1); | ||
2635 | + apol_class_query_set_class(policy, regex_match_query, cmd_opts.class_name); | ||
2636 | + if (apol_class_get_by_query(policy, regex_match_query, &qpol_matching_classes)) { | ||
2637 | + apol_class_query_destroy(®ex_match_query); | ||
2638 | + PyErr_SetString(PyExc_RuntimeError,"Query failed"); | ||
2639 | + goto cleanup; | ||
2640 | + } | ||
2641 | + const qpol_class_t *class = NULL; | ||
2642 | + size_t i; | ||
2643 | + for (i = 0; i < apol_vector_get_size(qpol_matching_classes); ++i) { | ||
2644 | + const char *class_name; | ||
2645 | + class = apol_vector_get_element(qpol_matching_classes, i); | ||
2646 | + if (!class) | ||
2647 | + break; | ||
2648 | + qpol_class_get_name(apol_policy_get_qpol(policy), class, &class_name); | ||
2649 | + apol_vector_append(cmd_opts.class_vector, (void *)class_name); | ||
2650 | + } | ||
2651 | + if (!apol_vector_get_size(qpol_matching_classes)) { | ||
2652 | + apol_vector_destroy(&qpol_matching_classes); | ||
2653 | + apol_class_query_destroy(®ex_match_query); | ||
2654 | + PyErr_SetString(PyExc_RuntimeError,"No classes match expression"); | ||
2655 | + goto cleanup; | ||
2656 | + } | ||
2657 | + apol_vector_destroy(&qpol_matching_classes); | ||
2658 | + apol_class_query_destroy(®ex_match_query); | ||
2659 | + } | ||
2660 | + | ||
2661 | + if (!cmd_opts.semantic && qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_SYN_RULES)) { | ||
2662 | + if (qpol_policy_build_syn_rule_table(apol_policy_get_qpol(policy))) { | ||
2663 | + apol_policy_destroy(&policy); | ||
2664 | + PyErr_SetString(PyExc_RuntimeError,"Query failed"); | ||
2665 | + goto cleanup; | ||
2666 | + } | ||
2667 | + } | ||
2668 | + | ||
2669 | + /* if syntactic rules are not available always do semantic search */ | ||
2670 | + if (!qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_SYN_RULES)) { | ||
2671 | + cmd_opts.semantic = 1; | ||
2672 | + } | ||
2673 | + | ||
2674 | + /* supress line numbers if doing semantic search or not available */ | ||
2675 | + if (cmd_opts.semantic || !qpol_policy_has_capability(apol_policy_get_qpol(policy), QPOL_CAP_LINE_NUMBERS)) { | ||
2676 | + cmd_opts.lineno = 0; | ||
2677 | + } | ||
2678 | + if (perform_av_query(policy, &cmd_opts, &v)) { | ||
2679 | + goto cleanup; | ||
2680 | + } | ||
2681 | + if (v) { | ||
2682 | + output = get_av_results(policy, &cmd_opts, v); | ||
2683 | + } | ||
2684 | + apol_vector_destroy(&v); | ||
2685 | + cleanup: | ||
2686 | + apol_policy_destroy(&policy); | ||
2687 | + apol_policy_path_destroy(&pol_path); | ||
2688 | + free(cmd_opts.src_name); | ||
2689 | + free(cmd_opts.tgt_name); | ||
2690 | + free(cmd_opts.class_name); | ||
2691 | + free(cmd_opts.permlist); | ||
2692 | + free(cmd_opts.bool_name); | ||
2693 | + free(cmd_opts.src_role_name); | ||
2694 | + free(cmd_opts.tgt_role_name); | ||
2695 | + apol_vector_destroy(&cmd_opts.perm_vector); | ||
2696 | + apol_vector_destroy(&cmd_opts.class_vector); | ||
2697 | + | ||
2698 | + if (output) return output; | ||
2699 | + return Py_None; | ||
2700 | +} | ||
2701 | +static int Dict_ContainsInt(PyObject *dict, const char *key){ | ||
2702 | + PyObject *item = PyDict_GetItemString(dict, key); | ||
2703 | + if (item) | ||
2704 | + return PyInt_AsLong(item); | ||
2705 | + return false; | ||
2706 | +} | ||
2707 | + | ||
2708 | +static const char *Dict_ContainsString(PyObject *dict, const char *key){ | ||
2709 | + PyObject *item = PyDict_GetItemString(dict, key); | ||
2710 | + if (item) | ||
2711 | + return PyString_AsString(item); | ||
2712 | + return NULL; | ||
2713 | +} | ||
2714 | + | ||
2715 | +PyObject *wrap_sesearch(PyObject *self, PyObject *args){ | ||
2716 | + PyObject *dict; | ||
2717 | + if (!PyArg_ParseTuple(args, "O", &dict)) | ||
2718 | + return NULL; | ||
2719 | + int allow = Dict_ContainsInt(dict, "allow"); | ||
2720 | + int neverallow = Dict_ContainsInt(dict, "neverallow"); | ||
2721 | + int auditallow = Dict_ContainsInt(dict, "auditallow"); | ||
2722 | + int dontaudit = Dict_ContainsInt(dict, "dontaudit"); | ||
2723 | + | ||
2724 | + const char *src_name = Dict_ContainsString(dict, "scontext"); | ||
2725 | + const char *tgt_name = Dict_ContainsString(dict, "tcontext"); | ||
2726 | + const char *class_name = Dict_ContainsString(dict, "class"); | ||
2727 | + const char *permlist = Dict_ContainsString(dict, "permlist"); | ||
2728 | + | ||
2729 | + return Py_BuildValue("O",sesearch(allow, neverallow, auditallow, dontaudit, src_name, tgt_name, class_name, permlist)); | ||
2730 | + | ||
2731 | +} | ||
2732 | + | ||
2733 | +static PyMethodDef methods[] = { | ||
2734 | + {"sesearch", (PyCFunction) wrap_sesearch, METH_VARARGS}, | ||
2735 | + {NULL, NULL, 0, NULL} | ||
2736 | +}; | ||
2737 | + | ||
2738 | +void init_sesearch(){ | ||
2739 | + PyObject *m; | ||
2740 | + m = Py_InitModule("_sesearch", methods); | ||
2741 | +} | ||
2742 | diff --git a/python/setools/setup.py b/python/setools/setup.py | ||
2743 | new file mode 100644 | ||
2744 | index 0000000..053b885 | ||
2745 | --- /dev/null | ||
2746 | +++ b/python/setools/setup.py | ||
2747 | @@ -0,0 +1,25 @@ | ||
2748 | +#!/usr/bin/env python | ||
2749 | + | ||
2750 | +# Author: Thomas Liu <tliu@redhat.com> | ||
2751 | +import os | ||
2752 | +from distutils.core import setup, Extension | ||
2753 | +LIBS=["apol", "qpol"] | ||
2754 | + | ||
2755 | +try: | ||
2756 | + inc=os.getenv("INCLUDES").split(" ") | ||
2757 | + INCLUDES=map(lambda x: x[2:], inc) | ||
2758 | + LIBDIRS=map(lambda x: "/".join(x.split("/")[:-1]), os.getenv("LIBS").split()) | ||
2759 | +except: | ||
2760 | + INCLUDES="" | ||
2761 | + LIBDIRS="" | ||
2762 | + | ||
2763 | +extension_sesearch = Extension("setools._sesearch", [ "sesearch.c"]) | ||
2764 | +extension_sesearch.include_dirs=INCLUDES | ||
2765 | +extension_sesearch.libraries=LIBS | ||
2766 | +extension_sesearch.library_dirs=LIBDIRS | ||
2767 | +extension_seinfo = Extension("setools._seinfo", [ "seinfo.c"]) | ||
2768 | +extension_seinfo.include_dirs=INCLUDES | ||
2769 | +extension_seinfo.libraries=LIBS | ||
2770 | +extension_seinfo.library_dirs=LIBDIRS | ||
2771 | + | ||
2772 | +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"]) | ||
2773 | -- | ||
2774 | 1.7.5.4 | ||
2775 | |||
diff --git a/recipes-security/setools/setools_3.3.7.bb b/recipes-security/setools/setools_3.3.8.bb index 9a87a99..78ed06d 100644 --- a/recipes-security/setools/setools_3.3.7.bb +++ b/recipes-security/setools/setools_3.3.8.bb | |||
@@ -7,20 +7,14 @@ This meta-package depends upon the main packages necessary to run \ | |||
7 | SETools." | 7 | SETools." |
8 | SECTION = "base" | 8 | SECTION = "base" |
9 | LICENSE = "GPLv2 & LGPLv2.1" | 9 | LICENSE = "GPLv2 & LGPLv2.1" |
10 | PR = "r2" | ||
11 | 10 | ||
12 | SRC_URI = "http://oss.tresys.com/projects/setools/chrome/site/dists/setools-${PV}/setools-${PV}.tar.bz2;" | 11 | SRC_URI = "http://oss.tresys.com/projects/setools/chrome/site/dists/setools-${PV}/setools-${PV}.tar.bz2;" |
13 | SRC_URI[md5sum] = "0377d7a06028825434cd7b41a80865a5" | 12 | SRC_URI[md5sum] = "d68d0d4e4da0f01da0f208782ff04b91" |
14 | SRC_URI[sha256sum] = "2bfa0918746bdcc910b16b26a51109a4ffd07404c306141ada584cb36e3c895a" | 13 | SRC_URI[sha256sum] = "44387ecc9a231ec536a937783440cd8960a72c51f14bffc1604b7525e341e999" |
15 | 14 | ||
16 | SRC_URI += "file://setools-Add-seinfo-and-sesearch-python-bindings.patch" | ||
17 | SRC_URI += "file://setools-seinfo-should-exit-with-correct-errno.patch" | ||
18 | SRC_URI += "file://setools-neverallow-rules-all-always-fail.patch" | 15 | SRC_URI += "file://setools-neverallow-rules-all-always-fail.patch" |
19 | SRC_URI += "file://setools-Fix-man-pages-and-getoptions.patch" | ||
20 | SRC_URI += "file://setools-Fix-sepol-calls-to-work-with-latest-libsepol.patch" | 16 | SRC_URI += "file://setools-Fix-sepol-calls-to-work-with-latest-libsepol.patch" |
21 | SRC_URI += "file://setools-Changes-to-support-named-file_trans-rules.patch" | 17 | #SRC_URI += "file://setools-Changes-to-support-named-file_trans-rules.patch" |
22 | SRC_URI += "file://setools-Remove-unused-variables.patch" | ||
23 | SRC_URI += "file://setools-Fix-output-to-match-policy-lines.patch" | ||
24 | 18 | ||
25 | SRC_URI += "file://setools-Don-t-check-selinux-policies-if-disabled.patch" | 19 | SRC_URI += "file://setools-Don-t-check-selinux-policies-if-disabled.patch" |
26 | SRC_URI += "file://setools-configure-ac.patch" | 20 | SRC_URI += "file://setools-configure-ac.patch" |
@@ -35,7 +29,9 @@ LIC_FILES_CHKSUM = "file://${S}/COPYING;md5=26035c503c68ae1098177934ac0cc795 \ | |||
35 | 29 | ||
36 | DEPENDS += "python libsepol libselinux libxml2" | 30 | DEPENDS += "python libsepol libselinux libxml2" |
37 | 31 | ||
38 | PACKAGES += "${PN}-libs ${PN}-console" | 32 | PACKAGE_BEFORE_PN += "${PN}-libs" |
33 | |||
34 | RPROVIDES_${PN} += "${PN}-console" | ||
39 | 35 | ||
40 | FILES_${PN}-dbg += "\ | 36 | FILES_${PN}-dbg += "\ |
41 | ${libdir}/python${PYTHON_BASEVERSION}/site-packages/setools/.debug \ | 37 | ${libdir}/python${PYTHON_BASEVERSION}/site-packages/setools/.debug \ |
@@ -52,7 +48,7 @@ FILES_${PN}-libs = "\ | |||
52 | ${libdir}/python${PYTHON_BASEVERSION}/site-packages/setools/*.py* \ | 48 | ${libdir}/python${PYTHON_BASEVERSION}/site-packages/setools/*.py* \ |
53 | " | 49 | " |
54 | 50 | ||
55 | FILES_${PN}-console = "\ | 51 | FILES_${PN} += "\ |
56 | ${bindir}/seinfo \ | 52 | ${bindir}/seinfo \ |
57 | ${bindir}/sesearch \ | 53 | ${bindir}/sesearch \ |
58 | ${bindir}/indexcon \ | 54 | ${bindir}/indexcon \ |
@@ -60,7 +56,7 @@ FILES_${PN}-console = "\ | |||
60 | ${bindir}/replcon \ | 56 | ${bindir}/replcon \ |
61 | ${bindir}/sechecker \ | 57 | ${bindir}/sechecker \ |
62 | ${bindir}/sediff \ | 58 | ${bindir}/sediff \ |
63 | ${datadir}/setools-3.3/sechecker-profiles/* \ | 59 | ${datadir}/setools-3.3/sechecker-profiles \ |
64 | ${datadir}/setools-3.3/sechecker_help.txt \ | 60 | ${datadir}/setools-3.3/sechecker_help.txt \ |
65 | ${datadir}/setools-3.3/sediff_help.txt \ | 61 | ${datadir}/setools-3.3/sediff_help.txt \ |
66 | ${datadir}/setools-3.3/sediffx* \ | 62 | ${datadir}/setools-3.3/sediffx* \ |
@@ -99,3 +95,5 @@ do_configure() { | |||
99 | do_install_append() { | 95 | do_install_append() { |
100 | rm -f ${D}/${libdir}/*.a | 96 | rm -f ${D}/${libdir}/*.a |
101 | } | 97 | } |
98 | |||
99 | BBCLASSEXTEND = "native" | ||