mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-10-28 03:25:27 +03:00
selinux: retest selinux after we loaded the policy
This commit is contained in:
parent
990a1abae2
commit
4d4c74866c
@ -33,8 +33,9 @@
|
||||
|
||||
static struct selabel_handle *label_hnd = NULL;
|
||||
|
||||
static int use_selinux_cached = -1;
|
||||
|
||||
static inline bool use_selinux(void) {
|
||||
static int use_selinux_cached = -1;
|
||||
|
||||
if (use_selinux_cached < 0)
|
||||
use_selinux_cached = is_selinux_enabled() > 0;
|
||||
@ -42,6 +43,10 @@ static inline bool use_selinux(void) {
|
||||
return use_selinux_cached;
|
||||
}
|
||||
|
||||
void label_retest_selinux(void) {
|
||||
use_selinux_cached = -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
int label_init(void) {
|
||||
|
@ -43,4 +43,6 @@ int label_get_create_label_from_exe(const char *exe, char **label);
|
||||
|
||||
int label_mkdir(const char *path, mode_t mode);
|
||||
|
||||
void label_retest_selinux(void);
|
||||
|
||||
#endif
|
||||
|
@ -73,6 +73,8 @@ int selinux_setup(bool *loaded_policy) {
|
||||
char timespan[FORMAT_TIMESPAN_MAX];
|
||||
char *label;
|
||||
|
||||
label_retest_selinux();
|
||||
|
||||
/* Transition to the new context */
|
||||
r = label_get_create_label_from_exe(SYSTEMD_BINARY_PATH, &label);
|
||||
if (r < 0 || label == NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user