apparmor: move dlopen() into mac_apparmor_use() check
This mirrors what we do for mac_selinux_use(), which also loads libselinux.
This commit is contained in:
@@ -20,16 +20,10 @@ int mac_apparmor_setup(void) {
|
||||
int r;
|
||||
|
||||
if (!mac_apparmor_use()) {
|
||||
log_debug("Skipping AppArmor initialization: not supported by the kernel or disabled.");
|
||||
log_debug("Skipping AppArmor initialization: not supported by the kernel, is disabled or libapparmor is not installed.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = dlopen_libapparmor();
|
||||
if (ERRNO_IS_NEG_NOT_SUPPORTED(r))
|
||||
return 0;
|
||||
if (r < 0)
|
||||
return log_error_errno(r, "Failed to load libapparmor: %m");
|
||||
|
||||
/* To honor LSM stacking, check per-LSM subdirectory first, and then the generic one as fallback. */
|
||||
FOREACH_STRING(current_file, "/proc/self/attr/apparmor/current", "/proc/self/attr/current") {
|
||||
r = read_one_line_file(current_file, ¤t_profile);
|
||||
|
||||
Reference in New Issue
Block a user