From 40a8223b142eb3ed9d63869b5dc447b0ede4ebf3 Mon Sep 17 00:00:00 2001
From: Zdenek Pytela <zpytela@redhat.com>
Date: Fri, 28 Jan 2022 17:04:07 +0100
Subject: [PATCH] Allow timedatex dbus chat with xdm

Reference: https://gitbub.com/fedora-selinux/selinux-policy/commit/40a8223b142eb3ed9d63869b5dc447b0ede4ebf3
Conflict: NA

Addresses the following USER_AVC denial:

type=USER_AVC msg=audit(1642064568.655:164): pid=942 uid=81 auid=4294967295 ses=4294967295 subj=system_u:system_r:system_dbusd_t:s0-s0:c0.c1023 msg='avc:  denied  { send_msg } for msgtype=method_call interface=org.freedesktop.timedate1 member=SetTimezone dest=:1.201 spid=6469 tpid=6505 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:system_r:timedatex_t:s0 tclass=dbus permissive=0  exe="/usr/bin/dbus-daemon" sauid=81 hostname=? addr=? terminal=?'^]UID="dbus" AUID="unset" SAUID="dbus"

Resolves: rhbz#2040214
Signed-off-by: lujie54 <lujie54@huawei.com>
---
 policy/modules/contrib/timedatex.te | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/policy/modules/contrib/timedatex.te b/policy/modules/contrib/timedatex.te
index 003c4c3..3a2e4db 100644
--- a/policy/modules/contrib/timedatex.te
+++ b/policy/modules/contrib/timedatex.te
@@ -57,6 +57,10 @@ optional_policy(`
     init_dbus_chat(timedatex_t)
 
     policykit_dbus_chat(timedatex_t)
+
+	optional_policy(`
+		xserver_dbus_chat_xdm(timedatex_t)
+	')
 ')
 
 optional_policy(`
-- 
1.8.3.1

