2 * Copyright (c) 2007 Robert M. M. Watson
5 * This software was developed by Robert N. M. Watson for the TrustedBSD
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, NCIRCLE NETWORK SECURITY,
21 * INC., OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
23 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
25 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
26 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
27 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Confirm that privilege is required to issue an audit control command via
34 * auditon(). We do a simple policy retrieve.
36 * XXXRW: It would be a good idea to also test auditctl(), which also tests
40 #include <sys/types.h>
42 #include <bsm/audit.h>
51 priv_audit_control_setup(int asroot, int injail, struct test *test)
55 * XXXRW: It would be nice if we checked for audit being configured
62 priv_audit_control(int asroot, int injail, struct test *test)
67 error = auditon(A_GETPOLICY, &policy, sizeof(policy));
69 expect("priv_audit_control(asroot, injail)", error, -1,
71 if (asroot && !injail)
72 expect("priv_audit_control(asroot, !injail)", error, 0, 0);
73 if (!asroot && injail)
74 expect("priv_audit_control(!asroot, injail)", error, -1,
76 if (!asroot && !injail)
77 expect("priv_audit_control(!asroot, !injail)", error, -1,
82 priv_audit_control_cleanup(int asroot, int injail, struct test *test)