summaryrefslogtreecommitdiff
path: root/common/smtppass.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-08-26 17:43:41 +0000
committerStef Walter <stef@memberwebs.com>2004-08-26 17:43:41 +0000
commite734abdf2f06000bbbb254df239f7c932ea80e1f (patch)
tree67900c82f446a02c16837fc06e093d8fe542ef29 /common/smtppass.c
parentccc145652935afed1466e34c141ccbbcd7357cff (diff)
Fixed crasher caused when too many connections established.
Diffstat (limited to 'common/smtppass.c')
-rw-r--r--common/smtppass.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index a969e74..984744d 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -524,9 +524,8 @@ static void connection_loop(int sock)
/* Check to make sure we have a thread */
if(fd != -1)
{
- messagex(NULL, LOG_ERR, "too many connections open (max %d)", g_maxthreads);
+ messagex(NULL, LOG_ERR, "too many connections open (max %d). sent 554 response", g_maxthreads);
- /* TODO: Respond with a too many connections message */
write_data(NULL, &fd, SMTP_STARTBUSY);
shutdown(fd, SHUT_RDWR);
close(fd);
@@ -764,6 +763,16 @@ static int smtp_passthru(clamsmtp_context_t* ctx)
}
/*
+ * We need our response to HELO to be modified in order
+ * to prevent complaints about mail loops
+ */
+ else if(is_first_word(ctx->line, HELO_CMD, KL(HELO_CMD)))
+ {
+ /* A new message line */
+ logline[0] = 0;
+ }
+
+ /*
* We don't like these commands. Filter them out. We should have
* filtered out their service extensions earlier in the EHLO response.
* This is just for errant clients.
@@ -789,8 +798,7 @@ static int smtp_passthru(clamsmtp_context_t* ctx)
add_to_logline(logline, "to=", ctx->line + r);
/* Reset log line */
- else if(is_first_word(ctx->line, RSET_CMD, KL(RSET_CMD)) ||
- is_first_word(ctx->line, HELO_CMD, KL(HELO_CMD)))
+ else if(is_first_word(ctx->line, RSET_CMD, KL(RSET_CMD)))
logline[0] = 0;
/* All other commands just get passed through to server */
@@ -1589,6 +1597,8 @@ static int write_data(clamsmtp_context_t* ctx, int* fd, unsigned char* buf)
return -1;
}
- log_fd_data(ctx, buf, fd, 0);
+ if(ctx != NULL)
+ log_fd_data(ctx, buf, fd, 0);
+
return write_data_raw(ctx, fd, buf, len);
}