1 /* deprecated.c -- This file is the trash heap of things about to leave
2 * Copyright 2006-07,2009 Red Hat Inc., Durham, North Carolina.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 * Steve Grubb <sgrubb@redhat.com>
36 * This function will send a user space message to the kernel.
37 * It returns the sequence number which is > 0 on success
38 * or <= 0 on error. (pam uses this) This is the main audit sending
41 int audit_send_user_message(int fd, int type, hide_t hide_error,
47 rc = audit_send(fd, type, message, strlen(message)+1);
48 if (rc == -ECONNREFUSED) {
49 /* This is here to let people that build their own kernel
50 and disable the audit system get in. ECONNREFUSED is
51 issued by the kernel when there is "no on listening". */
53 } else if (rc == -EPERM && getuid() != 0 && hide_error == HIDE_IT) {
54 /* If we get this, then the kernel supports auditing
55 * but we don't have enough privilege to write to the
56 * socket. Therefore, we have already been authenticated
57 * and we are a common user. Just act as though auditing
58 * is not enabled. Any other error we take seriously.
59 * This is here basically to satisfy Xscreensaver. */
61 } else if (rc == -EINVAL) {
62 /* If we get this, the kernel doesn't understand the
63 * netlink message type. This is most likely due to
64 * being an old kernel. Use the old message type. */
65 if (type >= AUDIT_FIRST_USER_MSG &&
66 type <= AUDIT_LAST_USER_MSG && !retry_cnt) {
76 hidden_def(audit_send_user_message)