diff --git a/changehat/libapparmor/config.h.in b/changehat/libapparmor/config.h.in index cde24fcc0..219971ddd 100644 --- a/changehat/libapparmor/config.h.in +++ b/changehat/libapparmor/config.h.in @@ -30,6 +30,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + /* Name of package */ #undef PACKAGE diff --git a/changehat/libapparmor/configure.in b/changehat/libapparmor/configure.in index 1c0f0aeca..4e06029cf 100644 --- a/changehat/libapparmor/configure.in +++ b/changehat/libapparmor/configure.in @@ -1,7 +1,7 @@ AC_INIT(configure.in) AM_CONFIG_HEADER(config.h) -AM_INIT_AUTOMAKE(libapparmor1, 2.1) +AM_INIT_AUTOMAKE(libapparmor1, 2.2) AM_PROG_LEX AC_PROG_YACC @@ -16,9 +16,14 @@ AC_ARG_WITH(python, [ --with-python enable the python wrapper [[default=no]]], [AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)]) if test "$with_python" = "yes"; then - sinclude(m4/ac_python_devel.m4) - AC_PYTHON_DEVEL - AM_PATH_PYTHON + AC_PATH_PROG(PYTHON, python, no) + if test x$PYTHON = xno; then + enable_python = no + else + sinclude(m4/ac_python_devel.m4) + AC_PYTHON_DEVEL + AM_PATH_PYTHON + fi fi AC_MSG_CHECKING(Checking for perl) @@ -53,6 +58,7 @@ AM_CONDITIONAL(BUILD_ROOTLIB, test x$enable_rootlib = xyes) AC_HEADER_STDC AC_CHECK_HEADERS(unistd.h stdint.h) +AM_PROG_CC_C_O AC_C_CONST AM_PROG_LIBTOOL diff --git a/changehat/libapparmor/libapparmor1.spec b/changehat/libapparmor/libapparmor1.spec index 6167aec2a..ced4aeba0 100644 --- a/changehat/libapparmor/libapparmor1.spec +++ b/changehat/libapparmor/libapparmor1.spec @@ -5,8 +5,8 @@ %define _unpackaged_files_terminate_build 0 Name: libapparmor1 -Version: 2.1 -Release: 2 +Version: 2.2 +Release: 1 License: LGPL Group: Development/Libraries/C and C++ BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -24,6 +24,7 @@ Summary: A utility library for AppArmor %package -n libapparmor-devel Requires: %{name} = %{version} Group: Development/Libraries/C and C++ +Provides: libapparmor:/usr/include/sys/apparmor.h Summary: - %description -n libapparmor-devel diff --git a/changehat/libapparmor/src/aalogparse.h b/changehat/libapparmor/src/aalogparse.h index ad4b692d8..97b1dab33 100644 --- a/changehat/libapparmor/src/aalogparse.h +++ b/changehat/libapparmor/src/aalogparse.h @@ -117,6 +117,7 @@ typedef struct aa_record_event_type event; /* Event type */ long pid; /* PID of the program logging the message */ long task; + long magic_token; int bitmask; /* Bitmask containing "r" "w" "x" etc */ char *audit_id; @@ -127,8 +128,7 @@ typedef struct char *name; char *name2; char *attribute; - char *parent; - char *magic_token; + char *parent; char *info; char *active_hat; } aa_log_record; diff --git a/changehat/libapparmor/src/grammar.y b/changehat/libapparmor/src/grammar.y index a3bcec4bd..41bd1441b 100644 --- a/changehat/libapparmor/src/grammar.y +++ b/changehat/libapparmor/src/grammar.y @@ -334,12 +334,12 @@ key_list: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING { ret_record->task = atol($3); free($3);} | TOK_KEY_PARENT TOK_EQUALS TOK_QUOTED_STRING { ret_record->parent = strdup($3); free($3);} - | TOK_KEY_MAGIC_TOKEN TOK_EQUALS TOK_QUOTED_STRING - { ret_record->magic_token = strdup($3); free($3);} + | TOK_KEY_MAGIC_TOKEN TOK_EQUALS TOK_DIGITS + { ret_record->magic_token = $3;} | TOK_KEY_INFO TOK_EQUALS TOK_QUOTED_STRING { ret_record->info = strdup($3); free($3);} - | TOK_KEY_PID TOK_EQUALS TOK_QUOTED_STRING - { ret_record->pid = atol($3); free($3);} + | TOK_KEY_PID TOK_EQUALS TOK_DIGITS + { ret_record->pid = $3;} | TOK_KEY_PROFILE TOK_EQUALS TOK_QUOTED_STRING { ret_record->profile = strdup($3); free($3);} ; diff --git a/changehat/libapparmor/src/libaalogparse.c b/changehat/libapparmor/src/libaalogparse.c index b5ad76d7e..cffc4f164 100644 --- a/changehat/libapparmor/src/libaalogparse.c +++ b/changehat/libapparmor/src/libaalogparse.c @@ -63,8 +63,6 @@ free_record(aa_log_record *record) free(record->attribute); if (record->parent != NULL) free(record->parent); - if (record->magic_token != NULL) - free(record->magic_token); if (record->info != NULL) free(record->info); if (record->active_hat != NULL) @@ -88,6 +86,7 @@ _init_log_record(aa_log_record *record) record->pid = 0; record->bitmask = 0; record->task = 0; + record->magic_token = 0; record->audit_id = NULL; record->operation = NULL; @@ -98,7 +97,6 @@ _init_log_record(aa_log_record *record) record->name2 = NULL; record->attribute = NULL; record->parent = NULL; - record->magic_token = NULL; record->info = NULL; record->active_hat = NULL; return; diff --git a/changehat/libapparmor/swig/python/Makefile.am b/changehat/libapparmor/swig/python/Makefile.am index cab3c4992..caeffb52e 100644 --- a/changehat/libapparmor/swig/python/Makefile.am +++ b/changehat/libapparmor/swig/python/Makefile.am @@ -1,9 +1,9 @@ -if HAVE_PYTHON - BUILT_SOURCES = libapparmor_wrap.c SWIG_SOURCES = ../SWIG/libapparmor.i +if HAVE_PYTHON + pkgpython_PYTHON = LibAppArmor.py pkgpyexec_LTLIBRARIES = _libapparmor.la _libapparmor_la_SOURCES = libapparmor_wrap.c $(SWIG_SOURCES) diff --git a/changehat/libapparmor/testsuite/test_multi.c b/changehat/libapparmor/testsuite/test_multi.c index 6b517014f..c2a3c9404 100644 --- a/changehat/libapparmor/testsuite/test_multi.c +++ b/changehat/libapparmor/testsuite/test_multi.c @@ -137,9 +137,9 @@ int print_results(aa_log_record *record) { printf("Parent: %s\n", record->parent); } - if (record->magic_token != NULL) + if (record->magic_token != 0) { - printf("Token: %s\n", record->magic_token); + printf("Token: %i\n", record->magic_token); } if (record->info != NULL) { diff --git a/changehat/libapparmor/testsuite/test_multi/testcase1.in b/changehat/libapparmor/testsuite/test_multi/testcase1.in index 054990397..8f5b56e1f 100644 --- a/changehat/libapparmor/testsuite/test_multi/testcase1.in +++ b/changehat/libapparmor/testsuite/test_multi/testcase1.in @@ -1 +1 @@ -type=APPARMOR_DENIED msg=audit(1181057184.959:7): operation="exec" denied_mask="x" name="/bin/ping" pid="31938" profile="/bin/ping" name2="ping2" requested_mask="rwx" attribute="attr" task="something" parent="something" magic_token="29493103210" info="Information" +type=APPARMOR_DENIED msg=audit(1181057184.959:7): operation="exec" denied_mask="x" name="/bin/ping" pid=31938 profile="/bin/ping" name2="ping2" requested_mask="rwx" attribute="attr" task="something" parent="something" magic_token=29493 info="Information" diff --git a/changehat/libapparmor/testsuite/test_multi/testcase1.out b/changehat/libapparmor/testsuite/test_multi/testcase1.out index a29d8d8a4..beca382ad 100644 --- a/changehat/libapparmor/testsuite/test_multi/testcase1.out +++ b/changehat/libapparmor/testsuite/test_multi/testcase1.out @@ -10,6 +10,6 @@ Name: /bin/ping Name2: ping2 Attribute: attr Parent: something -Token: 29493103210 +Token: 29493 Info: Information PID: 31938