summaryrefslogtreecommitdiff
path: root/src/execute.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-06-16 16:25:42 +0200
committerLennart Poettering <lennart@poettering.net>2010-06-16 16:27:24 +0200
commitdf1f0afe0c0d044a42ee726fa03730291d7082ee (patch)
treeec9aba0611608c2666aabac5ebc1b41b1c2508bd /src/execute.c
parent0213c3f8102bdc934c629d11a44ca0b408762287 (diff)
tcpwrap: execute tcpwrap check in forked client, to avoid blocking name lookups in main systemd process
Diffstat (limited to 'src/execute.c')
-rw-r--r--src/execute.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/execute.c b/src/execute.c
index 1b37f2efe4..b61c1f838b 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -46,6 +46,7 @@
#include "securebits.h"
#include "cgroup.h"
#include "namespace.h"
+#include "tcpwrap.h"
/* This assumes there is a 'tty' group */
#define TTY_MODE 0620
@@ -803,6 +804,12 @@ int exec_spawn(ExecCommand *command,
goto fail;
}
+ if (socket_fd >= 0 && context->tcpwrap_name)
+ if (!socket_tcpwrap(socket_fd, context->tcpwrap_name)) {
+ r = EXIT_TCPWRAP;
+ goto fail;
+ }
+
if (confirm_spawn) {
char response;
@@ -1111,6 +1118,9 @@ void exec_context_done(ExecContext *c) {
free(c->tty_path);
c->tty_path = NULL;
+ free(c->tcpwrap_name);
+ c->tcpwrap_name = NULL;
+
free(c->syslog_identifier);
c->syslog_identifier = NULL;
@@ -1209,6 +1219,11 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) {
for (e = c->environment; *e; e++)
fprintf(f, "%sEnvironment: %s\n", prefix, *e);
+ if (c->tcpwrap_name)
+ fprintf(f,
+ "%sTCPWrapName: %s\n",
+ prefix, c->tcpwrap_name);
+
if (c->nice_set)
fprintf(f,
"%sNice: %i\n",
@@ -1595,6 +1610,9 @@ const char* exit_status_to_string(ExitStatus status) {
case EXIT_STDERR:
return "STDERR";
+ case EXIT_TCPWRAP:
+ return "TCPWRAP";
+
default:
return NULL;
}