summaryrefslogtreecommitdiff
path: root/src/core/socket.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/core/socket.c
parent0581dac2c146cef0f55841a4c136dc48409c8eaa (diff)
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/core/socket.c')
-rw-r--r--src/core/socket.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/core/socket.c b/src/core/socket.c
index 6c0ac1a898..345601f0ae 100644
--- a/src/core/socket.c
+++ b/src/core/socket.c
@@ -775,12 +775,12 @@ static void socket_apply_socket_options(Socket *s, int fd) {
}
#ifdef HAVE_SMACK
- if (s->smack_ip_in)
+ if (s->smack_ip_in && use_smack())
if (fsetxattr(fd, "security.SMACK64IPIN", s->smack_ip_in, strlen(s->smack_ip_in), 0) < 0)
log_error_unit(UNIT(s)->id,
"fsetxattr(\"security.SMACK64IPIN\"): %m");
- if (s->smack_ip_out)
+ if (s->smack_ip_out && use_smack())
if (fsetxattr(fd, "security.SMACK64IPOUT", s->smack_ip_out, strlen(s->smack_ip_out), 0) < 0)
log_error_unit(UNIT(s)->id,
"fsetxattr(\"security.SMACK64IPOUT\"): %m");
@@ -797,7 +797,7 @@ static void socket_apply_fifo_options(Socket *s, int fd) {
"F_SETPIPE_SZ: %m");
#ifdef HAVE_SMACK
- if (s->smack)
+ if (s->smack && use_smack())
if (fsetxattr(fd, "security.SMACK64", s->smack, strlen(s->smack), 0) < 0)
log_error_unit(UNIT(s)->id,
"fsetxattr(\"security.SMACK64\"): %m");