summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-09-20 16:11:42 +0000
committerStef Walter <stef@memberwebs.com>2004-09-20 16:11:42 +0000
commitdf924a4670bb57435638bf797ea5edb27154cc67 (patch)
treee40a7b332aea5820bf36285409c801d341e9b8d5
parent4e45f085f043f8f44236f2b84cf343d8fa03dc18 (diff)
Complete fix of smtp fail logic
-rw-r--r--common/smtppass.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index 7f2d833..6a30ad8 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -465,6 +465,8 @@ static void connection_loop(int sock)
setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &(g_state.timeout), sizeof(g_state.timeout)) < 0)
sp_message(NULL, LOG_WARNING, "couldn't set timeouts on incoming connection");
+ fcntl(fd, F_SETFD, fcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
+
/* Look for thread and also clean up others */
for(i = 0; i < g_state.max_threads; i++)
{
@@ -1333,7 +1335,7 @@ int sp_fail_data(spctx_t* ctx, const char* smtp_status)
if(pref || crlf)
{
- x = (x > 256 ? 256 : x) + KL(SMTP_REJPREFIX) + KL(CRLF) + 1;
+ x = (len > 256 ? 256 : len) + KL(SMTP_REJPREFIX) + KL(CRLF) + 1;
t = (char*)alloca(x + 1);
/* Note that we truncate long lines */
@@ -1372,8 +1374,17 @@ static int read_server_response(spctx_t* ctx)
return 0;
}
-void sp_setup_env(spctx_t* ctx, int file)
+void sp_setup_forked(spctx_t* ctx, int file)
{
+ /* Signals we've messed with */
+ signal(SIGPIPE, SIG_DFL);
+ signal(SIGHUP, SIG_DFL);
+ signal(SIGINT, SIG_DFL);
+ signal(SIGTERM, SIG_DFL);
+
+ siginterrupt(SIGINT, 0);
+ siginterrupt(SIGTERM, 0);
+
if(ctx->sender)
setenv("SENDER", ctx->sender, 1);