Skip to content

Commit 768e988

Browse files
committed
Clarified how AVC parsing works
1 parent e03fb84 commit 768e988

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/ausearch-parse.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ static int audit_avc_init(search_items *s)
7979
}
8080

8181
/*
82-
* This function will take the list and extract the searchable fields from it.
82+
* This function will take the audit event as a list and extract the
83+
* searchable fields from it. It does this by iterating over each record
84+
* in the event and branching to the right parser for each record type.
8385
* It returns 0 on success and 1 on failure.
8486
*/
8587
int extract_search_items(llist *l)
@@ -1938,8 +1940,11 @@ static int parse_integrity(const lnode *n, search_items *s)
19381940
}
19391941

19401942

1941-
/* FIXME: If they are in permissive mode or hit an auditallow, there can
1942-
* be more than 1 avc in the same syscall. For now, we pickup just the first.
1943+
/*
1944+
* If they are in permissive mode or hit an auditallow, there can be
1945+
* more than 1 avc in the same syscall/event. Each one will be it's own
1946+
* record. We will see each AVC one record at a time. The first one will
1947+
* initialize the anode list and subsequent ones will just add to it.
19431948
*/
19441949
static int parse_avc(const lnode *n, search_items *s)
19451950
{
@@ -2041,7 +2046,7 @@ static int parse_avc(const lnode *n, search_items *s)
20412046
*term = 0;
20422047
s->comm = strdup(str);
20432048
*term = '"';
2044-
} else {
2049+
} else {
20452050
s->comm = unescape(str);
20462051
if (s->comm == NULL) {
20472052
rc = 11;
@@ -2116,6 +2121,7 @@ static int parse_avc(const lnode *n, search_items *s)
21162121
if (term)
21172122
*term = ' ';
21182123

2124+
// This can be called multiple times. Only first time it initializes.
21192125
if (audit_avc_init(s) == 0) {
21202126
alist_append(s->avc, &an);
21212127
} else {

0 commit comments

Comments
 (0)