2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-09-01 14:55:10 +00:00

- Was previously under the belief that pid="1234" and

magic_token="1245353" were correct syntax from the kernel.
  It turns out this is not the case.
This commit is contained in:
Matt Barringer
2007-08-05 22:54:41 +00:00
parent f4d6d1ab1f
commit ab87fbfb94
10 changed files with 29 additions and 21 deletions

View File

@@ -30,6 +30,9 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #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 */ /* Name of package */
#undef PACKAGE #undef PACKAGE

View File

@@ -1,7 +1,7 @@
AC_INIT(configure.in) AC_INIT(configure.in)
AM_CONFIG_HEADER(config.h) AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(libapparmor1, 2.1) AM_INIT_AUTOMAKE(libapparmor1, 2.2)
AM_PROG_LEX AM_PROG_LEX
AC_PROG_YACC AC_PROG_YACC
@@ -16,9 +16,14 @@ AC_ARG_WITH(python,
[ --with-python enable the python wrapper [[default=no]]], [ --with-python enable the python wrapper [[default=no]]],
[AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)]) [AC_MSG_RESULT($withval)], [AC_MSG_RESULT(no)])
if test "$with_python" = "yes"; then if test "$with_python" = "yes"; then
sinclude(m4/ac_python_devel.m4) AC_PATH_PROG(PYTHON, python, no)
AC_PYTHON_DEVEL if test x$PYTHON = xno; then
AM_PATH_PYTHON enable_python = no
else
sinclude(m4/ac_python_devel.m4)
AC_PYTHON_DEVEL
AM_PATH_PYTHON
fi
fi fi
AC_MSG_CHECKING(Checking for perl) AC_MSG_CHECKING(Checking for perl)
@@ -53,6 +58,7 @@ AM_CONDITIONAL(BUILD_ROOTLIB, test x$enable_rootlib = xyes)
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h stdint.h) AC_CHECK_HEADERS(unistd.h stdint.h)
AM_PROG_CC_C_O
AC_C_CONST AC_C_CONST
AM_PROG_LIBTOOL AM_PROG_LIBTOOL

View File

@@ -5,8 +5,8 @@
%define _unpackaged_files_terminate_build 0 %define _unpackaged_files_terminate_build 0
Name: libapparmor1 Name: libapparmor1
Version: 2.1 Version: 2.2
Release: 2 Release: 1
License: LGPL License: LGPL
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
@@ -24,6 +24,7 @@ Summary: A utility library for AppArmor
%package -n libapparmor-devel %package -n libapparmor-devel
Requires: %{name} = %{version} Requires: %{name} = %{version}
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Provides: libapparmor:/usr/include/sys/apparmor.h
Summary: - Summary: -
%description -n libapparmor-devel %description -n libapparmor-devel

View File

@@ -117,6 +117,7 @@ typedef struct
aa_record_event_type event; /* Event type */ aa_record_event_type event; /* Event type */
long pid; /* PID of the program logging the message */ long pid; /* PID of the program logging the message */
long task; long task;
long magic_token;
int bitmask; /* Bitmask containing "r" "w" "x" etc */ int bitmask; /* Bitmask containing "r" "w" "x" etc */
char *audit_id; char *audit_id;
@@ -127,8 +128,7 @@ typedef struct
char *name; char *name;
char *name2; char *name2;
char *attribute; char *attribute;
char *parent; char *parent;
char *magic_token;
char *info; char *info;
char *active_hat; char *active_hat;
} aa_log_record; } aa_log_record;

View File

@@ -334,12 +334,12 @@ key_list: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
{ ret_record->task = atol($3); free($3);} { ret_record->task = atol($3); free($3);}
| TOK_KEY_PARENT TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_PARENT TOK_EQUALS TOK_QUOTED_STRING
{ ret_record->parent = strdup($3); free($3);} { ret_record->parent = strdup($3); free($3);}
| TOK_KEY_MAGIC_TOKEN TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_MAGIC_TOKEN TOK_EQUALS TOK_DIGITS
{ ret_record->magic_token = strdup($3); free($3);} { ret_record->magic_token = $3;}
| TOK_KEY_INFO TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_INFO TOK_EQUALS TOK_QUOTED_STRING
{ ret_record->info = strdup($3); free($3);} { ret_record->info = strdup($3); free($3);}
| TOK_KEY_PID TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_PID TOK_EQUALS TOK_DIGITS
{ ret_record->pid = atol($3); free($3);} { ret_record->pid = $3;}
| TOK_KEY_PROFILE TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_PROFILE TOK_EQUALS TOK_QUOTED_STRING
{ ret_record->profile = strdup($3); free($3);} { ret_record->profile = strdup($3); free($3);}
; ;

View File

@@ -63,8 +63,6 @@ free_record(aa_log_record *record)
free(record->attribute); free(record->attribute);
if (record->parent != NULL) if (record->parent != NULL)
free(record->parent); free(record->parent);
if (record->magic_token != NULL)
free(record->magic_token);
if (record->info != NULL) if (record->info != NULL)
free(record->info); free(record->info);
if (record->active_hat != NULL) if (record->active_hat != NULL)
@@ -88,6 +86,7 @@ _init_log_record(aa_log_record *record)
record->pid = 0; record->pid = 0;
record->bitmask = 0; record->bitmask = 0;
record->task = 0; record->task = 0;
record->magic_token = 0;
record->audit_id = NULL; record->audit_id = NULL;
record->operation = NULL; record->operation = NULL;
@@ -98,7 +97,6 @@ _init_log_record(aa_log_record *record)
record->name2 = NULL; record->name2 = NULL;
record->attribute = NULL; record->attribute = NULL;
record->parent = NULL; record->parent = NULL;
record->magic_token = NULL;
record->info = NULL; record->info = NULL;
record->active_hat = NULL; record->active_hat = NULL;
return; return;

View File

@@ -1,9 +1,9 @@
if HAVE_PYTHON
BUILT_SOURCES = libapparmor_wrap.c BUILT_SOURCES = libapparmor_wrap.c
SWIG_SOURCES = ../SWIG/libapparmor.i SWIG_SOURCES = ../SWIG/libapparmor.i
if HAVE_PYTHON
pkgpython_PYTHON = LibAppArmor.py pkgpython_PYTHON = LibAppArmor.py
pkgpyexec_LTLIBRARIES = _libapparmor.la pkgpyexec_LTLIBRARIES = _libapparmor.la
_libapparmor_la_SOURCES = libapparmor_wrap.c $(SWIG_SOURCES) _libapparmor_la_SOURCES = libapparmor_wrap.c $(SWIG_SOURCES)

View File

@@ -137,9 +137,9 @@ int print_results(aa_log_record *record)
{ {
printf("Parent: %s\n", record->parent); 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) if (record->info != NULL)
{ {

View File

@@ -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"

View File

@@ -10,6 +10,6 @@ Name: /bin/ping
Name2: ping2 Name2: ping2
Attribute: attr Attribute: attr
Parent: something Parent: something
Token: 29493103210 Token: 29493
Info: Information Info: Information
PID: 31938 PID: 31938