Several follow-ups for recent SELinux changes (#38161)

This commit is contained in:
Daan De Meyer
2025-07-11 09:01:00 +02:00
committed by GitHub
2 changed files with 7 additions and 5 deletions
+2
View File
@@ -217,6 +217,7 @@ static int check_access(
const char *permission,
struct audit_info *audit_info,
sd_bus_error *error) {
bool enforce = mac_selinux_enforcing();
int r;
@@ -335,6 +336,7 @@ int mac_selinux_access_check_varlink_internal(
const Unit *unit,
const char *permission,
const char *function) {
_cleanup_freecon_ char *fcon = NULL, *scon = NULL;
const char *tclass, *acon;
int r;
+5 -5
View File
@@ -17,14 +17,14 @@ static inline void freeconp(char **p) {
#define _cleanup_freecon_ _cleanup_(freeconp)
#define log_selinux_enforcing(...) \
log_full(mac_selinux_enforcing() ? LOG_ERR : LOG_WARNING, __VA_ARGS__)
/* This accepts 0 error, like _zerook(). */
#define log_selinux_enforcing_errno(error, ...) \
({ \
bool _enforcing = mac_selinux_enforcing(); \
int _level = _enforcing ? LOG_ERR : LOG_WARNING; \
int _e = (error); \
bool _enforcing = mac_selinux_enforcing(); \
int _level = \
ERRNO_VALUE(_e) == 0 ? LOG_DEBUG : \
_enforcing ? LOG_ERR : LOG_WARNING; \
\
int _r = (log_get_max_level() >= LOG_PRI(_level)) \
? log_internal(_level, _e, PROJECT_FILE, __LINE__, __func__, __VA_ARGS__) \