Skip to contentSkip to conversation

integrity: use audit_log_string

PATCH In review Mimi Zohar 2 participants 2 messages May 5, 2009

Subsystems (3)
lore
Share & tools
lore

Mimi Zohar

author
#0 lore raw

PATCH 1/1 integrity: use audit_log_string

Based on a request from Eric Paris to simplify parsing, replace audit_log_format statements containing "%s" with audit_log_string().

security/integrity/ima/ima_audit.c +4 -13
Index: security-testing-2.6/security/integrity/ima/ima_audit.c
===================================================================
@@ -54,19 +54,10 @@ void integrity_audit_msg(int audit_msgno
 			 audit_get_loginuid(current),
 			 audit_get_sessionid(current));
 	audit_log_task_context(ab);
-	switch (audit_msgno) {
-	case AUDIT_INTEGRITY_DATA:
-	case AUDIT_INTEGRITY_METADATA:
-	case AUDIT_INTEGRITY_PCR:
-	case AUDIT_INTEGRITY_STATUS:
-		audit_log_format(ab, " op=%s cause=%s", op, cause);
-		break;
-	case AUDIT_INTEGRITY_HASH:
-		audit_log_format(ab, " op=%s hash=%s", op, cause);
-		break;
-	default:
-		audit_log_format(ab, " op=%s", op);
-	}
+	audit_log_format(ab, " op=");
+	audit_log_string(ab, op);
+	audit_log_format(ab, " cause=");
+	audit_log_string(ab, cause);
 	audit_log_format(ab, " comm=");
 	audit_log_untrustedstring(ab, current->comm);
 	if (fname) {
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Mimi Zohar

Based on a request from Eric Paris to simplify parsing, replace audit_log_format statements containing "%s" with audit_log_string().

As long as you don't mind that change from hash= to cause= I'm ok with it too:

Quoted 31 lines

Index: security-testing-2.6/security/integrity/ima/ima_audit.c
===================================================================

security/integrity/ima/ima_audit.c +4 -13
@@ -54,19 +54,10 @@ void integrity_audit_msg(int audit_msgno
 			 audit_get_loginuid(current),
 			 audit_get_sessionid(current));
 	audit_log_task_context(ab);
-	switch (audit_msgno) {
-	case AUDIT_INTEGRITY_DATA:
-	case AUDIT_INTEGRITY_METADATA:
-	case AUDIT_INTEGRITY_PCR:
-	case AUDIT_INTEGRITY_STATUS:
-		audit_log_format(ab, " op=%s cause=%s", op, cause);
-		break;
-	case AUDIT_INTEGRITY_HASH:
-		audit_log_format(ab, " op=%s hash=%s", op, cause);
-		break;
-	default:
-		audit_log_format(ab, " op=%s", op);
-	}
+	audit_log_format(ab, " op=");
+	audit_log_string(ab, op);
+	audit_log_format(ab, " cause=");
+	audit_log_string(ab, cause);
 	audit_log_format(ab, " comm=");
 	audit_log_untrustedstring(ab, current->comm);
 	if (fname) {