2 * Copyright (c) 2005-2009 Apple Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 * $P4: //depot/projects/trustedbsd/openbsm/bin/auditd/audit_warn.c#11 $
32 #include <sys/types.h>
41 * Write an audit-related error to the system log via syslog(3).
44 auditwarnlog(char *args[])
50 loc_args[0] = AUDITWARN_SCRIPT;
51 for (i = 0; args[i] != NULL && i < 8; i++)
52 loc_args[i+1] = args[i];
62 execv(AUDITWARN_SCRIPT, loc_args);
63 syslog(LOG_ERR, "Could not exec %s (%m)\n",
74 * Indicates that the hard limit for all filesystems has been exceeded.
77 audit_warn_allhard(void)
81 args[0] = HARDLIM_ALL_WARN;
84 return (auditwarnlog(args));
88 * Indicates that the soft limit for all filesystems has been exceeded.
91 audit_warn_allsoft(void)
95 args[0] = SOFTLIM_ALL_WARN;
98 return (auditwarnlog(args));
102 * Indicates that someone other than the audit daemon turned off auditing.
103 * XXX Its not clear at this point how this function will be invoked.
105 * XXXRW: This function is not used.
108 audit_warn_auditoff(void)
112 args[0] = AUDITOFF_WARN;
115 return (auditwarnlog(args));
119 * Indicate that a trail file has been closed, so can now be post-processed.
122 audit_warn_closefile(char *filename)
126 args[0] = CLOSEFILE_WARN;
130 return (auditwarnlog(args));
134 * Indicates that the audit deammn is already running
137 audit_warn_ebusy(void)
141 args[0] = EBUSY_WARN;
144 return (auditwarnlog(args));
148 * Indicates that there is a problem getting the directory from
151 * XXX Note that we take the filename instead of a count as the argument here
152 * (different from BSM).
155 audit_warn_getacdir(char *filename)
159 args[0] = GETACDIR_WARN;
163 return (auditwarnlog(args));
167 * Indicates that the hard limit for this file has been exceeded.
170 audit_warn_hard(char *filename)
174 args[0] = HARDLIM_WARN;
178 return (auditwarnlog(args));
182 * Indicates that auditing could not be started.
185 audit_warn_nostart(void)
189 args[0] = NOSTART_WARN;
192 return (auditwarnlog(args));
196 * Indicaes that an error occrred during the orderly shutdown of the audit
200 audit_warn_postsigterm(void)
204 args[0] = POSTSIGTERM_WARN;
207 return (auditwarnlog(args));
211 * Indicates that the soft limit for this file has been exceeded.
214 audit_warn_soft(char *filename)
218 args[0] = SOFTLIM_WARN;
222 return (auditwarnlog(args));
226 * Indicates that the temporary audit file already exists indicating a fatal
230 audit_warn_tmpfile(void)
234 args[0] = TMPFILE_WARN;
237 return (auditwarnlog(args));
241 * Indicates that this trail file has expired and was removed.
244 audit_warn_expired(char *filename)
248 args[0] = EXPIRED_WARN;
252 return (auditwarnlog(args));