Blame SOURCES/audit-3.0-user-event.patch

bcda57
diff --git a/src/auditctl.c b/src/auditctl.c
bcda57
index ac08e47..1150911 100644
bcda57
--- a/src/auditctl.c
bcda57
+++ b/src/auditctl.c
bcda57
@@ -809,6 +809,7 @@ static int setopt(int count, int lineno, char *vars[])
bcda57
 			retval = -1;
bcda57
 		} else {
bcda57
 			const char*s = optarg;
bcda57
+			char *umsg;
bcda57
 			while (*s) {
bcda57
 				if (*s < 32) {
bcda57
 					audit_msg(LOG_ERR,
bcda57
@@ -817,11 +818,18 @@ static int setopt(int count, int lineno, char *vars[])
bcda57
 				}
bcda57
 				s++;
bcda57
 			}
bcda57
+			if (asprintf(&umsg, "text=%s", optarg) < 0) {
bcda57
+				audit_msg(LOG_ERR, "Can't create user event");
bcda57
+				return -1;
bcda57
+			}
bcda57
 			if (audit_log_user_message( fd, AUDIT_USER,
bcda57
-					optarg, NULL, NULL, NULL, 1) <= 0)
bcda57
-			retval = -1;
bcda57
-		else
bcda57
-			return -2;  // success - no reply for this
bcda57
+					umsg, NULL, NULL, NULL, 1) <= 0)
bcda57
+				retval = -1;
bcda57
+			else {
bcda57
+				free(umsg);
bcda57
+				return -2;  // success - no reply for this
bcda57
+			}
bcda57
+			free(umsg);
bcda57
 		}
bcda57
 		break;
bcda57
 	case 'R':