ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
ac3a84
From 0a191f8306b4439049fcac8eea206835c144215e Mon Sep 17 00:00:00 2001
ac3a84
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
ac3a84
Date: Fri, 4 Nov 2022 16:30:57 +0100
ac3a84
Subject: [PATCH] core: update audit messages
ac3a84
ac3a84
Pass getuid() instead of literal `0` as auid, since user session
ac3a84
managers also issue audit messages on SELinux denials.
ac3a84
ac3a84
(cherry picked from commit c826b7ef3272157167a5c9d493e9672f00d84b98)
ac3a84
ac3a84
Related: #2138081
ac3a84
---
ac3a84
 src/core/selinux-access.c | 4 ++--
ac3a84
 1 file changed, 2 insertions(+), 2 deletions(-)
ac3a84
ac3a84
diff --git a/src/core/selinux-access.c b/src/core/selinux-access.c
ac3a84
index c69baa8a1a..c1744cff92 100644
ac3a84
--- a/src/core/selinux-access.c
ac3a84
+++ b/src/core/selinux-access.c
ac3a84
@@ -113,9 +113,9 @@ _printf_(2, 3) static int log_callback(int type, const char *fmt, ...) {
ac3a84
 
ac3a84
                 if (r >= 0) {
ac3a84
                         if (type == SELINUX_AVC)
ac3a84
-                                audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_AVC, buf, NULL, NULL, NULL, 0);
ac3a84
+                                audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_AVC, buf, NULL, NULL, NULL, getuid());
ac3a84
                         else if (type == SELINUX_ERROR)
ac3a84
-                                audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_SELINUX_ERR, buf, NULL, NULL, NULL, 0);
ac3a84
+                                audit_log_user_avc_message(get_audit_fd(), AUDIT_USER_SELINUX_ERR, buf, NULL, NULL, NULL, getuid());
ac3a84
 
ac3a84
                         return 0;
ac3a84
                 }