From dac3240ef6da39b5e332d9d5cbe7aca215cc5d43 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 21 Feb 2011 21:19:07 +0300 Subject: [PATCH] Fix patch for exim. Fix parsing of wrong headers. --- contrib/exim/patch-exim-src_spam.c.diff | 17 +++++++++++++---- src/message.c | 1 + 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/contrib/exim/patch-exim-src_spam.c.diff b/contrib/exim/patch-exim-src_spam.c.diff index 528c06328..1109874b5 100644 --- a/contrib/exim/patch-exim-src_spam.c.diff +++ b/contrib/exim/patch-exim-src_spam.c.diff @@ -1,5 +1,5 @@ --- src/spam.c.orig 2011-01-20 19:29:51.179597017 +0300 -+++ src/spam.c 2011-01-20 19:40:42.818516872 +0300 ++++ src/spam.c 2011-02-21 21:17:15.051230555 +0300 @@ -21,6 +21,9 @@ int spam_ok = 0; int spam_rc = 0; @@ -25,12 +25,12 @@ + + r = 0; + r += push_line(request_v, request_p++, "REPORT SPAMC/1.2\r\n"); -+ r += push_line(request_v, request_p++, "Content-length: " OFF_T_FMT "\r\n", mbox_size); ++ r += push_line(request_v, request_p++, "Content-length: %lu\r\n", mbox_size); + r += push_line(request_v, request_p++, "Queue-Id: %s\r\n", message_id); -+ r += push_line(request_v, request_p++, "From: %s\r\n", sender_address); ++ r += push_line(request_v, request_p++, "From: <%s>\r\n", sender_address); + r += push_line(request_v, request_p++, "Recipient-Number: %d\r\n", recipients_count); + for (i = 0; i < recipients_count; i ++) -+ r += push_line(request_v, request_p++, "Rcpt: %s\r\n", recipients_list[i].address); ++ r += push_line(request_v, request_p++, "Rcpt: <%s>\r\n", recipients_list[i].address); + if ((helo = expand_string(US"$sender_helo_name")) != NULL && *helo != '\0') + r += push_line(request_v, request_p++, "Helo: %s\r\n", helo); + if (sender_host_address != NULL) @@ -43,6 +43,15 @@ (void)close(spamd_sock); log_write(0, LOG_MAIN|LOG_PANIC, "spam acl condition: spamd send failed: %s", strerror(errno)); +@@ -329,7 +344,7 @@ + (void)close(spamd_sock); + + /* dig in the spamd output and put the report in a multiline header, if requested */ +- if( sscanf(CS spamd_buffer,"SPAMD/%7s 0 EX_OK\r\nContent-length: %*u\r\n\r\n%lf/%lf\r\n%n", ++ if( sscanf(CS spamd_buffer,"SPAMD/%7s 0 EX_OK\r\n\r\nSpam: %*s ; %lf / %lf\r\nContent-length: %*u\r\n\r\n%n", + spamd_version,&spamd_score,&spamd_threshold,&spamd_report_offset) != 3 ) { + + /* try to fall back to pre-2.50 spamd output */ @@ -420,4 +435,31 @@ }; } diff --git a/src/message.c b/src/message.c index 2df435eb8..bf2896009 100644 --- a/src/message.c +++ b/src/message.c @@ -616,6 +616,7 @@ process_raw_headers (struct worker_task *task) if (*(p + 1) == '\r') { p ++; } + p ++; state = next_state; } else { -- 2.39.5