diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-18 17:16:55 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-06-18 17:16:55 +0400 |
commit | da8c2bff3fb4b959ceb4ce5c8b72d6e83ec81f03 (patch) | |
tree | 1e522055691ab67d036839b5a23238a4daaa2279 /src/smtp.c | |
parent | e4977d9bfe416a230c4b74ecbeab3681a87db404 (diff) | |
download | rspamd-da8c2bff3fb4b959ceb4ce5c8b72d6e83ec81f03.tar.gz rspamd-da8c2bff3fb4b959ceb4ce5c8b72d6e83ec81f03.zip |
* Copy from and rcpt correctly
Diffstat (limited to 'src/smtp.c')
-rw-r--r-- | src/smtp.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/smtp.c b/src/smtp.c index a77c24467..c7e9dc428 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -318,6 +318,8 @@ process_smtp_data (struct smtp_session *session) struct stat st; int r; GList *cur, *t; + f_str_t *f; + char *s; if (fstat (session->temp_fd, &st) == -1) { goto err; @@ -337,29 +339,36 @@ process_smtp_data (struct smtp_session *session) goto err; } session->task->msg->len = st.st_size; - if (process_message (session->task) == -1) { - msg_err ("cannot process message"); - munmap (session->task->msg->begin, st.st_size); - goto err; - } session->task->helo = session->helo; /* Save MAIL FROM */ cur = session->from; - if (cur && (cur = g_list_next (cur))) { - session->task->from = cur->data; + if (cur) { + f = cur->data; + s = memory_pool_alloc (session->pool, f->len + 1); + g_strlcpy (s, f->begin, f->len + 1); + session->task->from = s; } /* Save recipients */ t = session->rcpt; while (t) { cur = t->data; - if (cur && (cur = g_list_next (cur))) { - session->task->rcpt = g_list_prepend (session->task->rcpt, cur->data); + if (cur) { + f = cur->data; + s = memory_pool_alloc (session->pool, f->len + 1); + g_strlcpy (s, f->begin, f->len + 1); + session->task->rcpt = g_list_prepend (session->task->rcpt, s); } t = g_list_next (t); } memcpy (&session->task->from_addr, &session->client_addr, sizeof (struct in_addr)); session->task->cmd = CMD_CHECK; + + if (process_message (session->task) == -1) { + msg_err ("cannot process message"); + munmap (session->task->msg->begin, st.st_size); + goto err; + } r = process_filters (session->task); if (r == -1) { munmap (session->task->msg->begin, st.st_size); |