2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 10:07:12 +00:00

Rename aa_log_record struct fields (C only) to allow inclusion in C++

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
Ryan Lee 2024-09-30 10:43:28 -07:00
parent 5b141dd580
commit 3f5180527d
4 changed files with 15 additions and 10 deletions

View File

@ -48,6 +48,11 @@ typedef enum
AA_RECORD_STATUS /* Configuration change */ AA_RECORD_STATUS /* Configuration change */
} aa_record_event_type; } aa_record_event_type;
#ifndef __cplusplus
#define class rule_class
#define namespace aa_namespace
#endif
typedef struct typedef struct
{ {
aa_record_syntax_version version; aa_record_syntax_version version;
@ -71,7 +76,7 @@ typedef struct
char *comm; /* Command that triggered msg */ char *comm; /* Command that triggered msg */
char *name; char *name;
char *name2; char *name2;
char *namespace; char *aa_namespace;
char *attribute; char *attribute;
unsigned long parent; unsigned long parent;
char *info; char *info;
@ -98,7 +103,7 @@ typedef struct
char *flags; char *flags;
char *src_name; char *src_name;
char *class; char *rule_class;
char *net_addr; char *net_addr;
char *peer_addr; char *peer_addr;

View File

@ -306,7 +306,7 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
| TOK_KEY_NAME TOK_EQUALS safe_string | TOK_KEY_NAME TOK_EQUALS safe_string
{ ret_record->name = $3;} { ret_record->name = $3;}
| TOK_KEY_NAMESPACE TOK_EQUALS safe_string | TOK_KEY_NAMESPACE TOK_EQUALS safe_string
{ ret_record->namespace = $3;} { ret_record->aa_namespace = $3;}
| TOK_KEY_NAME2 TOK_EQUALS safe_string | TOK_KEY_NAME2 TOK_EQUALS safe_string
{ ret_record->name2 = $3;} { ret_record->name2 = $3;}
| TOK_KEY_MASK TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_MASK TOK_EQUALS TOK_QUOTED_STRING
@ -438,7 +438,7 @@ key: TOK_KEY_OPERATION TOK_EQUALS TOK_QUOTED_STRING
ret_record->info = $1; ret_record->info = $1;
} }
| TOK_KEY_CLASS TOK_EQUALS TOK_QUOTED_STRING | TOK_KEY_CLASS TOK_EQUALS TOK_QUOTED_STRING
{ ret_record->class = $3; } { ret_record->rule_class = $3; }
; ;
apparmor_event: apparmor_event:

View File

@ -92,8 +92,8 @@ void free_record(aa_log_record *record)
free(record->name); free(record->name);
if (record->name2 != NULL) if (record->name2 != NULL)
free(record->name2); free(record->name2);
if (record->namespace != NULL) if (record->aa_namespace != NULL)
free(record->namespace); free(record->aa_namespace);
if (record->attribute != NULL) if (record->attribute != NULL)
free(record->attribute); free(record->attribute);
if (record->info != NULL) if (record->info != NULL)
@ -139,8 +139,8 @@ void free_record(aa_log_record *record)
if (record->execpath != NULL) if (record->execpath != NULL)
free(record->execpath); free(record->execpath);
if (record->class != NULL) if (record->rule_class != NULL)
free(record->class); free(record->rule_class);
free(record); free(record);
} }

View File

@ -107,7 +107,7 @@ int print_results(aa_log_record *record)
print_string("Name", record->name); print_string("Name", record->name);
print_string("Command", record->comm); print_string("Command", record->comm);
print_string("Name2", record->name2); print_string("Name2", record->name2);
print_string("Namespace", record->namespace); print_string("Namespace", record->aa_namespace);
print_string("Attribute", record->attribute); print_string("Attribute", record->attribute);
print_long("Task", record->task, 0); print_long("Task", record->task, 0);
print_long("Parent", record->parent, 0); print_long("Parent", record->parent, 0);
@ -142,7 +142,7 @@ int print_results(aa_log_record *record)
print_string("Execpath", record->execpath); print_string("Execpath", record->execpath);
print_string("Class", record->class); print_string("Class", record->rule_class);
print_long("Epoch", record->epoch, 0); print_long("Epoch", record->epoch, 0);
print_long("Audit subid", (long) record->audit_sub_id, 0); print_long("Audit subid", (long) record->audit_sub_id, 0);