Skip to content

Commit

Permalink
parser: Recognize strange subj fields for more message types
Browse files Browse the repository at this point in the history
Observed: ANOM_ABEND, ADD_USER, ADD_GROUP, USER_CHAUTHOK, presumably
due to AppArmor; there are probably more.
  • Loading branch information
hillu committed Dec 27, 2023
1 parent 47d0007 commit 6799293
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ fn parse_unspec_value<'a>(
) -> IResult<&'a [u8], PValue<'a>> {
// work around apparent AppArmor breakage
match (ty, name) {
(msg_type::SYSCALL, b"subj") | (msg_type::USER_AUTH, b"subj") => {
(_, b"subj") => {
if let Ok((input, s)) = recognize(tuple((
opt(tag("=")),
parse_str_unq,
Expand Down Expand Up @@ -869,6 +869,7 @@ mod test {
do_parse(include_bytes!("testdata/line-daemon-end.txt")).unwrap();
do_parse(include_bytes!("testdata/line-netfilter.txt")).unwrap();
do_parse(include_bytes!("testdata/line-anom-abend.txt")).unwrap();
do_parse(include_bytes!("testdata/line-anom-abend-2.txt")).unwrap();
do_parse(include_bytes!("testdata/line-user-auth.txt")).unwrap();
do_parse(include_bytes!("testdata/line-sockaddr-unix.txt")).unwrap();
do_parse(include_bytes!("testdata/line-user-auth-2.txt")).unwrap();
Expand Down
1 change: 1 addition & 0 deletions src/testdata/line-anom-abend-2.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
type=ANOM_ABEND msg=audit(1703677054.334:4223663): auid=4294967295 uid=0 gid=0 ses=4294967295 subj==/usr/bin/man//&man_groff (enforce) pid=109919 comm="preconv" exe="/usr/bin/preconv" sig=31 res=1AUID="unset" UID="root" GID="root"

0 comments on commit 6799293

Please sign in to comment.