[AUDIT] include audit type in audit message when using printk
authorEric Paris <eparis@redhat.com>
Mon, 7 Jan 2008 19:19:15 +0000 (14:19 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 1 Feb 2008 19:08:14 +0000 (14:08 -0500)
Currently audit drops the audit type when an audit message goes through
printk instead of the audit deamon.  This is a minor annoyance in
that the audit type is no longer part of the message and the information
the audit type conveys needs to be carried in, or derived from the
message data.

The attached patch includes the type number as part of the printk.
Admittedly it isn't the type name that the audit deamon provides but I
think this is better than dropping the type completely.

Signed-pff-by: John Johansen <jjohansen@suse.de>
Signed-off-by: Eric Paris <eparis@redhat.com>
kernel/audit.c

index 801c946dd24b639520e6037b63dd96860c2e60d9..cf669828942657eeb18b8f45a8d5a455575fd0e5 100644 (file)
@@ -1438,7 +1438,8 @@ void audit_log_end(struct audit_buffer *ab)
                        ab->skb = NULL;
                        wake_up_interruptible(&kauditd_wait);
                } else {
-                       printk(KERN_NOTICE "%s\n", ab->skb->data + NLMSG_SPACE(0));
+                       struct nlmsghdr *nlh = nlmsg_hdr(ab->skb);
+                       printk(KERN_NOTICE "type=%d %s\n", nlh->nlmsg_type, ab->skb->data + NLMSG_SPACE(0));
                }
        }
        audit_buffer_free(ab);