chiark / gitweb /
bus: when NULL is specified as property callback, automatically handle serialization...
[elogind.git] / src / journal / journald-server.c
index e03e413aeffba6fc337912d6d56bd77dfca5e9a4..29429f6eadfae1ce4703020ac849afcf6cdac95d 100644 (file)
@@ -51,6 +51,7 @@
 #include "journald-stream.h"
 #include "journald-console.h"
 #include "journald-native.h"
+#include "selinux-util.h"
 
 #ifdef HAVE_ACL
 #include <sys/acl.h>
@@ -629,19 +630,21 @@ static void dispatch_message_real(
                 }
 
 #ifdef HAVE_SELINUX
-                if (label) {
-                        x = alloca(sizeof("_SELINUX_CONTEXT=") + label_len);
+                if (use_selinux()) {
+                        if (label) {
+                                x = alloca(sizeof("_SELINUX_CONTEXT=") + label_len);
 
-                        *((char*) mempcpy(stpcpy(x, "_SELINUX_CONTEXT="), label, label_len)) = 0;
-                        IOVEC_SET_STRING(iovec[n++], x);
-                } else {
-                        security_context_t con;
+                                *((char*) mempcpy(stpcpy(x, "_SELINUX_CONTEXT="), label, label_len)) = 0;
+                                IOVEC_SET_STRING(iovec[n++], x);
+                        } else {
+                                security_context_t con;
 
-                        if (getpidcon(ucred->pid, &con) >= 0) {
-                                x = strappenda("_SELINUX_CONTEXT=", con);
+                                if (getpidcon(ucred->pid, &con) >= 0) {
+                                        x = strappenda("_SELINUX_CONTEXT=", con);
 
-                                freecon(con);
-                                IOVEC_SET_STRING(iovec[n++], x);
+                                        freecon(con);
+                                        IOVEC_SET_STRING(iovec[n++], x);
+                                }
                         }
                 }
 #endif