summaryrefslogtreecommitdiff
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
commit9cdab7f42125f4d59c8cb86fcf4d866dc1e07ee2 (patch)
tree004f03d1577095750a3fa14f5b97be9d6e741aa8
parenteb4d31917af2c3f9debec731b1ecb69779b4618b (diff)
Fixed crasher caused when too many connections established.
-rw-r--r--common/smtppass.c20
-rw-r--r--configure.in4
-rw-r--r--src/clamsmtpd.c20
3 files changed, 32 insertions, 12 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);
}
diff --git a/configure.in b/configure.in
index 6582543..f87c179 100644
--- a/configure.in
+++ b/configure.in
@@ -36,8 +36,8 @@ dnl Nate Nielsen <nielsen@memberwebs.com>
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(clamsmtp, 0.7.rc1, nielsen@memberwebs.com)
-AM_INIT_AUTOMAKE(clamsmtp, 0.7.rc1)
+AC_INIT(clamsmtp, 0.6.90, nielsen@memberwebs.com)
+AM_INIT_AUTOMAKE(clamsmtp, 0.6.90)
LDFLAGS="$LDFLAGS -L/usr/local/lib"
CFLAGS="$CFLAGS -I/usr/local/include"
diff --git a/src/clamsmtpd.c b/src/clamsmtpd.c
index a969e74..984744d 100644
--- a/src/clamsmtpd.c
+++ b/src/clamsmtpd.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);
}