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)
Sun, Nov 24, 1:59 PM
Unknown Object (File)
Sun, Nov 24, 12:15 PM
Unknown Object (File)
Sun, Nov 24, 11:54 AM
Unknown Object (File)
Sun, Nov 24, 4:11 AM
Unknown Object (File)
Sat, Nov 23, 1:44 AM
Unknown Object (File)
Thu, Nov 21, 6:41 AM
Unknown Object (File)
Wed, Nov 20, 2:42 AM
Unknown Object (File)
Tue, Nov 19, 4:59 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 18212
Build 17944: 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.