Skip to content

Commit 9d67bf2

Browse files
committed
Add object for ANOM_LINK event
1 parent e834b70 commit 9d67bf2

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

auparse/normalize.c

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,33 @@ static int normalize_compound(auparse_state_t *au)
12751275
const char *act = normalize_record_map_i2s(otype);
12761276
if (act)
12771277
D.action = strdup(act);
1278-
// FIXME: AUDIT_ANOM_LINK needs an object
1278+
set_file_object(au, 1);
1279+
if (is_unset(D.thing.primary)) {
1280+
int r, num = auparse_get_num_records(au);
1281+
for (r = 1; r <= num; r++) {
1282+
auparse_goto_record_num(au, r);
1283+
if (auparse_get_type(au) == AUDIT_PATH) {
1284+
auparse_first_field(au);
1285+
set_prime_object(au, "name", r);
1286+
D.thing.what = NORM_WHAT_LINK;
1287+
break;
1288+
}
1289+
}
1290+
if (is_unset(D.thing.primary)) {
1291+
auparse_first_record(au);
1292+
f = auparse_find_field(au, "path");
1293+
if (f == NULL)
1294+
f = auparse_find_field(au, "cwd");
1295+
if (f) {
1296+
D.thing.primary = set_record(0,
1297+
auparse_get_record_num(au));
1298+
D.thing.primary =
1299+
set_field(D.thing.primary,
1300+
auparse_get_field_num(au));
1301+
D.thing.what = NORM_WHAT_LINK;
1302+
}
1303+
}
1304+
}
12791305
} else if (otype == AUDIT_CONFIG_CHANGE) {
12801306
auparse_first_record(au);
12811307
f = auparse_find_field(au, "op");

0 commit comments

Comments
 (0)