selinux: always try to load the full selinux db
https://github.com/systemd/systemd/pull/2508#issuecomment-190901170 Maybe fixes https://bugzilla.redhat.com/show_bug.cgi?id=1308771.
This commit is contained in:
@@ -80,31 +80,23 @@ void mac_selinux_retest(void) {
|
||||
#endif
|
||||
}
|
||||
|
||||
int mac_selinux_init(const char *prefix) {
|
||||
int mac_selinux_init(void) {
|
||||
int r = 0;
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
usec_t before_timestamp, after_timestamp;
|
||||
struct mallinfo before_mallinfo, after_mallinfo;
|
||||
|
||||
if (!mac_selinux_use())
|
||||
if (label_hnd)
|
||||
return 0;
|
||||
|
||||
if (label_hnd)
|
||||
if (!mac_selinux_use())
|
||||
return 0;
|
||||
|
||||
before_mallinfo = mallinfo();
|
||||
before_timestamp = now(CLOCK_MONOTONIC);
|
||||
|
||||
if (prefix) {
|
||||
struct selinux_opt options[] = {
|
||||
{ .type = SELABEL_OPT_SUBSET, .value = prefix },
|
||||
};
|
||||
|
||||
label_hnd = selabel_open(SELABEL_CTX_FILE, options, ELEMENTSOF(options));
|
||||
} else
|
||||
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
|
||||
|
||||
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
|
||||
if (!label_hnd) {
|
||||
log_enforcing("Failed to initialize SELinux context: %m");
|
||||
r = security_getenforce() == 1 ? -errno : 0;
|
||||
|
||||
@@ -29,7 +29,7 @@ bool mac_selinux_use(void);
|
||||
bool mac_selinux_have(void);
|
||||
void mac_selinux_retest(void);
|
||||
|
||||
int mac_selinux_init(const char *prefix);
|
||||
int mac_selinux_init(void);
|
||||
void mac_selinux_finish(void);
|
||||
|
||||
int mac_selinux_fix(const char *path, bool ignore_enoent, bool ignore_erofs);
|
||||
|
||||
Reference in New Issue
Block a user