aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-23 16:11:05 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-06-23 16:11:05 +0400
commite2b6242ef1c90231dccfd5b2bddb4e43dc6e5eed (patch)
treec8f089198822ce14441a2041333bb5e275dae321 /src
parentc36bf0f6a94fc1319a0ff5279ded019e2f4b9c29 (diff)
downloadrspamd-e2b6242ef1c90231dccfd5b2bddb4e43dc6e5eed.tar.gz
rspamd-e2b6242ef1c90231dccfd5b2bddb4e43dc6e5eed.zip
* Add more information about why we drop smtp connection
* Fix mkstemp call
Diffstat (limited to 'src')
-rw-r--r--src/smtp.c4
-rw-r--r--src/smtp_proto.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/src/smtp.c b/src/smtp.c
index 24e453c4f..f630c2428 100644
--- a/src/smtp.c
+++ b/src/smtp.c
@@ -308,6 +308,7 @@ smtp_send_upstream_message (struct smtp_session *session)
session->upstream_state = SMTP_STATE_IN_SENDFILE;
session->state = SMTP_STATE_WAIT_UPSTREAM;
if (! rspamd_dispatcher_sendfile (session->upstream_dispatcher, session->temp_fd, session->temp_size)) {
+ msg_err ("sendfile failed: %s", strerror (errno));
goto err;
}
return TRUE;
@@ -330,6 +331,7 @@ process_smtp_data (struct smtp_session *session)
char *s;
if (fstat (session->temp_fd, &st) == -1) {
+ msg_err ("fstat failed: %s", strerror (errno));
goto err;
}
/* Now mmap temp file if it is small enough */
@@ -344,6 +346,7 @@ process_smtp_data (struct smtp_session *session)
#else
if ((session->task->msg->begin = mmap (NULL, st.st_size, PROT_READ, MAP_SHARED, session->temp_fd, 0)) == MAP_FAILED) {
#endif
+ msg_err ("mmap failed: %s", strerror (errno));
goto err;
}
session->task->msg->len = st.st_size;
@@ -375,6 +378,7 @@ process_smtp_data (struct smtp_session *session)
if (process_message (session->task) == -1) {
msg_err ("cannot process message");
munmap (session->task->msg->begin, st.st_size);
+ msg_err ("process message failed: %s", strerror (errno));
goto err;
}
r = process_filters (session->task);
diff --git a/src/smtp_proto.c b/src/smtp_proto.c
index f499efd7a..ef0190163 100644
--- a/src/smtp_proto.c
+++ b/src/smtp_proto.c
@@ -551,9 +551,9 @@ smtp_upstream_read_socket (f_str_t * in, void *arg)
return FALSE;
}
else if (r == 1) {
- r = strlen (session->cfg->temp_dir) + sizeof ("/rspamd-XXXXXX.tmp");
+ r = strlen (session->cfg->temp_dir) + sizeof ("/rspamd-XXXXXX");
session->temp_name = memory_pool_alloc (session->pool, r);
- snprintf (session->temp_name, r, "%s%crspamd-XXXXXX.tmp", session->cfg->temp_dir, G_DIR_SEPARATOR);
+ snprintf (session->temp_name, r, "%s%crspamd-XXXXXX", session->cfg->temp_dir, G_DIR_SEPARATOR);
#ifdef HAVE_MKSTEMP
/* Umask is set before */
session->temp_fd = mkstemp (session->temp_name);
@@ -561,6 +561,7 @@ smtp_upstream_read_socket (f_str_t * in, void *arg)
session->temp_fd = g_mkstemp_full (session->temp_name, O_RDWR, S_IWUSR | S_IRUSR);
#endif
if (session->temp_fd == -1) {
+ msg_err ("mkstemp error: %s", strerror (errno));
session->error = SMTP_ERROR_FILE;
session->state = SMTP_STATE_CRITICAL_ERROR;
rspamd_dispatcher_restore (session->dispatcher);