summaryrefslogtreecommitdiffstats
path: root/src/journal/journald-native.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-10-10 16:35:44 +0200
committerLennart Poettering <lennart@poettering.net>2013-10-10 16:35:44 +0200
commitd682b3a7e7c7c2941a4d3e193f1e330dbc9fae89 (patch)
treef9e0c1c2af7b0756af89db0864a0708076a55144 /src/journal/journald-native.c
parentlogin: make sd_session_get_vt() actually work (diff)
downloadsystemd-d682b3a7e7c7c2941a4d3e193f1e330dbc9fae89.tar.xz
systemd-d682b3a7e7c7c2941a4d3e193f1e330dbc9fae89.zip
security: rework selinux, smack, ima, apparmor detection logic
Always cache the results, and bypass low-level security calls when the respective subsystem is not enabled.
Diffstat (limited to 'src/journal/journald-native.c')
-rw-r--r--src/journal/journald-native.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/journal/journald-native.c b/src/journal/journald-native.c
index c50cf64f5c..2c91cba16d 100644
--- a/src/journal/journald-native.c
+++ b/src/journal/journald-native.c
@@ -25,6 +25,7 @@
#include "socket-util.h"
#include "path-util.h"
+#include "selinux-util.h"
#include "journald-server.h"
#include "journald-native.h"
#include "journald-kmsg.h"
@@ -404,10 +405,12 @@ int server_open_native_socket(Server*s) {
}
#ifdef HAVE_SELINUX
- one = 1;
- r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
- if (r < 0)
- log_warning("SO_PASSSEC failed: %m");
+ if (use_selinux()) {
+ one = 1;
+ r = setsockopt(s->native_fd, SOL_SOCKET, SO_PASSSEC, &one, sizeof(one));
+ if (r < 0)
+ log_warning("SO_PASSSEC failed: %m");
+ }
#endif
one = 1;