2 * Copyright (c) 2005 , Red Hat, Inc.
3 * Copyright (c) 2005 , Tomasz Kłoczko
4 * Copyright (c) 2008 , Nicolas François
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the copyright holders or contributors may not be used to
16 * endorse or promote products derived from this software without
17 * specific prior written permission.
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
22 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * Audit helper functions used throughout shadow
47 #include "prototypes.h"
50 void audit_help_open (void)
52 audit_fd = audit_open ();
54 /* You get these only when the kernel doesn't have
55 * audit compiled in. */
56 if ( (errno == EINVAL)
57 || (errno == EPROTONOSUPPORT)
58 || (errno == EAFNOSUPPORT)) {
61 (void) fputs (_("Cannot open audit interface - aborting.\n"),
68 * This function will log a message to the audit system using a predefined
69 * message format. Parameter usage is as follows:
71 * type - type of message: AUDIT_USER_CHAUTHTOK for changing any account
73 * pgname - program's name
74 * op - operation. "adding user", "changing finger info", "deleting group"
75 * name - user's account or group name. If not available use NULL.
76 * id - uid or gid that the operation is being performed on. This is used
77 * only when user is NULL.
79 void audit_logger (int type, const char *pgname, const char *op,
80 const char *name, unsigned int id,
81 shadow_audit_result result)
86 audit_log_acct_message (audit_fd, type, NULL, op, name, id,
87 NULL, NULL, NULL, (int) result);
91 void audit_logger_message (const char *message, shadow_audit_result result)
96 audit_log_user_message (audit_fd,
106 #else /* WITH_AUDIT */
107 extern int errno; /* warning: ANSI C forbids an empty source file */
108 #endif /* WITH_AUDIT */