Page MenuHomeFreeBSD

Separate the tests for auditon(2) based on individual commands
ClosedPublic

Authored by aniketp on Jul 13 2018, 1:36 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 23 2023, 1:28 PM
Unknown Object (File)
Dec 22 2023, 10:01 PM
Unknown Object (File)
Dec 20 2023, 7:05 AM
Unknown Object (File)
Dec 10 2023, 8:51 PM
Unknown Object (File)
Nov 29 2023, 1:55 AM
Unknown Object (File)
Oct 3 2023, 5:57 PM
Unknown Object (File)
Aug 31 2023, 11:12 PM
Unknown Object (File)
Aug 14 2023, 1:07 PM
Subscribers

Details

Summary

This revision introduces tests for auditon(2) based on indivual cmd arguments
as they are categorized as separate audit events

The commands for which tests are introduced in this diff are:

  • A_SETPOLICY
  • A_GETPOLICY
  • A_SETKMASK
  • A_GETKMASK
  • A_SETQCTRL
  • A_GETQCTRL
  • A_SETCOND
  • A_GETCOND
  • A_SETCLASS
  • A_GETCLASS

Please NOTE: auditon(2) has more such events. I'll collect them and add their tests in the next batch.

Test Plan

Execute make && make install from test/sys/audit.
Execute kyua test from /usr/tests/sys/audit. All testcases should succeed.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 18036
Build 17786: arc lint + arc unit

Event Timeline

asomers requested changes to this revision.Jul 13 2018, 2:34 PM
asomers added inline comments.
tests/sys/audit/administrative.c
752

Why are you using malloc for a single int? Better to put it on the stack.

805

As we discussed in your other review, the argument to sizeof is wrong here.

This revision now requires changes to proceed.Jul 13 2018, 2:34 PM

Store auditinfo in stack instead of allocating heap memory

tests/sys/audit/administrative.c
800

You missed a few mallocs.

  • Same change as above for the missed mallocs
asomers requested changes to this revision.Jul 15 2018, 8:53 PM

administrative:auditon_setcond_success fails for me every time, probably because you haven't yet fixed the problem with unbuffered I/O in au_read_rec. How's that coming?

This revision now requires changes to proceed.Jul 15 2018, 8:53 PM
tests/sys/audit/administrative.c
800

If you change this into a uint64_t, then it will function as a regression test for the bug you found in A_SETPOLICY.

This revision is now accepted and ready to land.Jul 20 2018, 5:34 PM
asomers requested changes to this revision.Jul 20 2018, 5:46 PM

auditon_setcond_success still fails everytime, and this is why: you pair A_GETCOND with A_SETCOND, but put setup() in the middle. If auditd isn't already running, then setup starts it. However, if auditd wasn't already running, then A_GETCOND will return AUC_DISABLED, and you set that value with auditon. So you should either move A_GETCOND to be after setup, or stop pairing A_GETCOND with A_SETCOND.

This revision now requires changes to proceed.Jul 20 2018, 5:46 PM
  • Fix the above described bug in auditon_setcond_success
  • Comment describing the latest change in auditon_setcond_success
This revision is now accepted and ready to land.Jul 20 2018, 6:57 PM
This revision was automatically updated to reflect the committed changes.