public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
* [PATCH] audit: log the audit_names record type
@ 2013-05-08 14:32 Jeff Layton
  2013-05-09 13:21 ` Steve Grubb
  2013-05-23 14:48 ` [PATCH v2] " Jeff Layton
  0 siblings, 2 replies; 4+ messages in thread
From: Jeff Layton @ 2013-05-08 14:32 UTC (permalink / raw)
  To: Eric Paris; +Cc: linux-audit, Al Viro

...to make it clear what the intent behind each record's operation was.

In many cases you can infer this, based on the context of the syscall
and the result. In other cases it's not so obvious. For instance, in
the case where you have a file being renamed over another, you'll have
two different records with the same filename but different inode info.
By logging this information we can clearly tell which one was created
and which was deleted.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
 kernel/auditsc.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 8d87439..4f90536 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1575,6 +1575,26 @@ static void audit_log_name(struct audit_context *context, struct audit_names *n,
 		}
 	}
 
+	/* log the audit_names record type */
+	audit_log_format(ab, " nametype=");
+	switch(n->type) {
+	case AUDIT_TYPE_NORMAL:
+		audit_log_format(ab, "NORMAL");
+		break;
+	case AUDIT_TYPE_PARENT:
+		audit_log_format(ab, "PARENT");
+		break;
+	case AUDIT_TYPE_CHILD_DELETE:
+		audit_log_format(ab, "DELETE");
+		break;
+	case AUDIT_TYPE_CHILD_CREATE:
+		audit_log_format(ab, "CREATE");
+		break;
+	default:
+		audit_log_format(ab, "UNKNOWN");
+		break;
+	}
+
 	audit_log_fcaps(ab, n);
 
 	audit_log_end(ab);
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-23 14:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 14:32 [PATCH] audit: log the audit_names record type Jeff Layton
2013-05-09 13:21 ` Steve Grubb
2013-05-09 14:57   ` Jeff Layton
2013-05-23 14:48 ` [PATCH v2] " Jeff Layton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox