]>
git.saurik.com Git - apple/system_cmds.git/blob - auditd.tproj/audit_warn.c
22657a15aae10a2547c4026a1236112203753da7
2 * Copyright (c) 2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * "Portions Copyright (c) 2004 Apple Computer, Inc. All Rights
7 * Reserved. This file contains Original Code and/or Modifications of
8 * Original Code as defined in and that are subject to the Apple Public
9 * Source License Version 1.0 (the 'License'). You may not use this file
10 * except in compliance with the License. Please obtain a copy of the
11 * License at http://www.apple.com/publicsource and read it before using
14 * The Original Code and all software distributed under the License are
15 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19 * License for the specific language governing rights and limitations
22 * @APPLE_LICENSE_HEADER_END@
25 #include <sys/types.h>
31 /* Write to the audit log. */
32 static int auditwarnlog(char *args
[])
37 loc_args
[0] = AUDITWARN_SCRIPT
;
38 for (i
= 0; args
[i
] != NULL
&& i
< 8; i
++) {
39 loc_args
[i
+1] = args
[i
];
45 return execv(AUDITWARN_SCRIPT
, loc_args
);
48 } else if (pid
== -1) {
56 * Indicates that the hard limit for all filesystems
57 * has been exceeded count times
59 int audit_warn_allhard(int count
)
64 snprintf(intstr
, 12, "%d", count
);
66 args
[0] = HARDLIM_ALL_WARN
;
70 return auditwarnlog(args
);
74 * Indicates that the soft limit for all filesystems
77 int audit_warn_allsoft()
81 args
[0] = SOFTLIM_ALL_WARN
;
84 return auditwarnlog(args
);
88 * Indicates that someone other than the audit daemon
90 * XXX Its not clear at this point how this function will
93 int audit_warn_auditoff()
97 args
[0] = AUDITOFF_WARN
;
100 return auditwarnlog(args
);
104 * Indicates that the audit deammn is already running
106 int audit_warn_ebusy()
110 args
[0] = EBUSY_WARN
;
113 return auditwarnlog(args
);
118 * Indicates that there is a problem getting the directory
121 * XXX Note that we take the filename instead of a count
122 * XXX as the argument here (different from BSM)
124 int audit_warn_getacdir(char *filename
)
128 args
[0] = GETACDIR_WARN
;
132 return auditwarnlog(args
);
137 * Indicates that the hard limit for this file has been
140 int audit_warn_hard(char *filename
)
144 args
[0] = HARDLIM_WARN
;
148 return auditwarnlog(args
);
153 * Indicates that auditing could not be started
155 int audit_warn_nostart()
159 args
[0] = NOSTART_WARN
;
162 return auditwarnlog(args
);
166 * Indicaes that an error occrred during the orderly shutdown
167 * of the audit daemon
169 int audit_warn_postsigterm()
173 args
[0] = POSTSIGTERM_WARN
;
176 return auditwarnlog(args
);
180 * Indicates that the soft limit for this file has been
183 int audit_warn_soft(char *filename
)
187 args
[0] = SOFTLIM_WARN
;
191 return auditwarnlog(args
);
196 * Indicates that the temporary audit file already exists
197 * indicating a fatal error
199 int audit_warn_tmpfile()
203 args
[0] = TMPFILE_WARN
;
206 return auditwarnlog(args
);