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:
Zbigniew Jędrzejewski-Szmek
2016-03-01 20:39:30 -05:00
parent 114761866a
commit c3dacc8bbf
15 changed files with 18 additions and 26 deletions
+4 -12
View File
@@ -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;
+1 -1
View File
@@ -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);