smack: label /etc/passwd and friends as '_' smack label when --with-smack-run-label' is enabled

systemd-sysusers.service unit creates system users and groups and it
could update /etc/passwd, /etc/group, /etc/shadow and /etc/gshadow.
Those files should have '_' smack label because of accessibility.

However, if systemd has its own smack label using '--with-smack-run-label'
configuration, systemd-sysusers process spawned by systemd(pid:1) has
its parent smack label and eventually updated files also is set as its
parent smack label.

This patch fixes that bug by labeling updated files as '_' smack label
when --with-smack-run-label' is enabled.
This commit is contained in:
Sangjung Woo
2015-10-07 16:37:25 +09:00
parent 69b8a8ebae
commit c02e7b1ecc
3 changed files with 25 additions and 15 deletions
-3
View File
@@ -29,9 +29,6 @@
#include "fileio.h"
#include "smack-util.h"
#define SMACK_FLOOR_LABEL "_"
#define SMACK_STAR_LABEL "*"
#ifdef HAVE_SMACK
bool mac_smack_use(void) {
static int cached_use = -1;
+3
View File
@@ -27,6 +27,9 @@
#include "macro.h"
#define SMACK_FLOOR_LABEL "_"
#define SMACK_STAR_LABEL "*"
typedef enum SmackAttr {
SMACK_ATTR_ACCESS = 0,
SMACK_ATTR_EXEC = 1,