X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/f05da2e8b55f18554ebbcf97523fd54fb03d071e..b2f5a03200c914f601bc9d28c6e069316a3b20eb:/src/src/filter.c diff --git a/src/src/filter.c b/src/src/filter.c index c876a8a68..c9ff215dd 100644 --- a/src/src/filter.c +++ b/src/src/filter.c @@ -1,10 +1,10 @@ -/* $Cambridge: exim/src/src/filter.c,v 1.2 2004/11/25 13:54:31 ph10 Exp $ */ +/* $Cambridge: exim/src/src/filter.c,v 1.5 2005/10/03 11:26:21 ph10 Exp $ */ /************************************************* * Exim - an Internet mail transport agent * *************************************************/ -/* Copyright (c) University of Cambridge 1995 - 2004 */ +/* Copyright (c) University of Cambridge 1995 - 2005 */ /* See the file NOTICE for conditions of use and distribution. */ @@ -1907,7 +1907,7 @@ while (commands != NULL) if (log_mode == -1) log_mode = 0600; if (log_fd >= 0) { - close(log_fd); + (void)close(log_fd); log_fd = -1; } log_filename = expargs[0]; @@ -2321,14 +2321,42 @@ header_line *h; int to_count = 2; int from_count = 9; -/* If any header line in the message starts with "List-", it is not -a personal message. */ +/* If any header line in the message is a defined "List-" header field, it is +not a personal message. We used to check for any header line that started with +"List-", but this was tightened up for release 4.54. The check is now for +"List-Id", defined in RFC 2929, or "List-Help", "List-Subscribe", "List- +Unsubscribe", "List-Post", "List-Owner" or "List-Archive", all of which are +defined in RFC 2369. We also scan for "Auto-Submitted"; if it is found to +contain any value other than "no", the message is not personal (RFC 3834). +Previously the test was for "auto-". */ for (h = header_list; h != NULL; h = h->next) { - if (h->type != htype_old && h->slen > 5 && - strncmpic(h->text, US"List-", 5) == 0) - return FALSE; + uschar *s; + if (h->type == htype_old) continue; + + if (strncmpic(h->text, US"List-", 5) == 0) + { + s = h->text + 5; + if (strncmpic(s, US"Id:", 3) == 0 || + strncmpic(s, US"Help:", 5) == 0 || + strncmpic(s, US"Subscribe:", 10) == 0 || + strncmpic(s, US"Unsubscribe:", 12) == 0 || + strncmpic(s, US"Post:", 5) == 0 || + strncmpic(s, US"Owner:", 6) == 0 || + strncmpic(s, US"Archive:", 8) == 0) + return FALSE; + } + + else if (strncmpic(h->text, US"Auto-submitted:", 15) == 0) + { + s = h->text + 15; + while (isspace(*s)) s++; + if (strncmpic(s, US"no", 2) != 0) return FALSE; + s += 2; + while (isspace(*s)) s++; + if (*s != 0) return FALSE; + } } /* Set up "my" address */ @@ -2384,7 +2412,6 @@ yield = "^daemon@", "^root@", "^listserv@", "^majordomo@", "^.*?-request@", "^owner-[^@]+@", self, self_from, psself, psself_from) && - header_match(US"auto-submitted:", FALSE, FALSE, NULL, 1, "auto-") && header_match(US"precedence:", FALSE, FALSE, NULL, 3, "bulk","list","junk") && (sender_address == NULL || sender_address[0] != 0); @@ -2500,7 +2527,7 @@ if (filter_test != FTEST_NONE || (debug_selector & D_filter) != 0) /* Close the log file if it was opened, and kill off any numerical variables before returning. Reset the header decoding charset. */ -if (log_fd >= 0) close(log_fd); +if (log_fd >= 0) (void)close(log_fd); expand_nmax = -1; filter_running = FALSE; headers_charset = save_headers_charset;