diff options
| author | perry <perry@NetBSD.org> | 2000-05-31 15:18:05 +0000 |
|---|---|---|
| committer | perry <perry@NetBSD.org> | 2000-05-31 15:18:05 +0000 |
| commit | 4fd5f44605bf8bc7f61099fef23d8e400c35f2cc (patch) | |
| tree | b08234f0df8fec63bad26c8f0979a67180139dfa /gnu | |
| parent | b60b3fb997ac66a54143c73906a61c0d273e1ae2 (diff) | |
import patchlevel 8. bugfixes, plus adds the ability to filter on
regular expressions applied to message bodies.
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/dist/postfix/HISTORY | 19 | ||||
| -rw-r--r-- | gnu/dist/postfix/RELEASE_NOTES | 8 | ||||
| -rw-r--r-- | gnu/dist/postfix/cleanup/cleanup.c | 15 | ||||
| -rw-r--r-- | gnu/dist/postfix/cleanup/cleanup.h | 1 | ||||
| -rw-r--r-- | gnu/dist/postfix/cleanup/cleanup_envelope.c | 12 | ||||
| -rw-r--r-- | gnu/dist/postfix/cleanup/cleanup_masquerade.c | 4 | ||||
| -rw-r--r-- | gnu/dist/postfix/cleanup/cleanup_message.c | 24 | ||||
| -rw-r--r-- | gnu/dist/postfix/conf/sample-filter.cf | 24 | ||||
| -rw-r--r-- | gnu/dist/postfix/global/mail_params.h | 4 | ||||
| -rw-r--r-- | gnu/dist/postfix/global/mail_version.h | 2 | ||||
| -rw-r--r-- | gnu/dist/postfix/html/cleanup.8.html | 46 | ||||
| -rw-r--r-- | gnu/dist/postfix/man/man8/cleanup.8 | 9 |
12 files changed, 141 insertions, 27 deletions
diff --git a/gnu/dist/postfix/HISTORY b/gnu/dist/postfix/HISTORY index 9c58863eca1..2e72e9f7b97 100644 --- a/gnu/dist/postfix/HISTORY +++ b/gnu/dist/postfix/HISTORY @@ -3713,3 +3713,22 @@ Apologies for any names omitted. Bugfix: Postfix would incorrectly reject domain names with adjacent - characters. File: util/valid_hostname.c. + +20000520 + + Robustness: upon receipt of mail, map the mailer-daemon + sender address back into the magic null string. File: + cleanup/cleanup_envelope.c. + +20000524 + + Bugfix: the code for masquerade_exceptions was case sensitive. + Reported by Eduard Vopicka. File: cleanup/cleanup_masquerade.c. + +20000528 + + Feature: specify "body_checks=regexp:/file/name" for a very + crude one line at a time message body content filter. This + feature uses the same filtering syntax as the header_checks + feature. File: cleanup/cleanup_message.c. See also the + conf/sample-filter.cf file. diff --git a/gnu/dist/postfix/RELEASE_NOTES b/gnu/dist/postfix/RELEASE_NOTES index cd45aea21f7..45af05a56bf 100644 --- a/gnu/dist/postfix/RELEASE_NOTES +++ b/gnu/dist/postfix/RELEASE_NOTES @@ -1,3 +1,11 @@ +Major changes with postfix-19991231-pl08: +========================================= + +Specify "body_checks = regexp:/etc/postfix/body_checks" for a quick +and dirty emergency content filter that looks at non-header lines +one line at a time (including MIME headers inside the message body). +Details in conf/sample-filter.cf. + Incompatible changes with postfix-19991231-pl07: ================================================ diff --git a/gnu/dist/postfix/cleanup/cleanup.c b/gnu/dist/postfix/cleanup/cleanup.c index a47e7d916cd..f20dc687895 100644 --- a/gnu/dist/postfix/cleanup/cleanup.c +++ b/gnu/dist/postfix/cleanup/cleanup.c @@ -60,6 +60,15 @@ /* this program. See the Postfix \fBmain.cf\fR file for syntax details /* and for default values. Use the \fBpostfix reload\fR command after /* a configuration change. +/* .SH Content filtering +/* .IP \fBbody_checks\fR +/* Lookup tables with content filters for message body lines. +/* These filters see physical lines one at a time, in chunks of +/* at most line_length_limit bytes. +/* .IP \fBheader_checks\fR +/* Lookup tables with content filters for message header lines. +/* These filters see logical headers one at a time, including headers +/* that span multiple lines. /* .SH Miscellaneous /* .ad /* .fi @@ -175,6 +184,7 @@ char *var_virtual_maps; /* virtual maps */ char *var_masq_domains; /* masquerade domains */ char *var_masq_exceptions; /* users not masqueraded */ char *var_header_checks; /* any header checks */ +char *var_body_checks; /* any body checks */ int var_dup_filter_limit; /* recipient dup filter */ char *var_empty_addr; /* destination of bounced bounces */ int var_delay_warn_time; /* delay that triggers warning */ @@ -189,6 +199,7 @@ MAPS *cleanup_comm_canon_maps; MAPS *cleanup_send_canon_maps; MAPS *cleanup_rcpt_canon_maps; MAPS *cleanup_header_checks; +MAPS *cleanup_body_checks; MAPS *cleanup_virtual_maps; ARGV *cleanup_masq_domains; @@ -420,6 +431,9 @@ static void pre_jail_init(char *unused_name, char **unused_argv) if (*var_header_checks) cleanup_header_checks = maps_create(VAR_HEADER_CHECKS, var_header_checks, DICT_FLAG_LOCK); + if (*var_body_checks) + cleanup_body_checks = + maps_create(VAR_BODY_CHECKS, var_body_checks, DICT_FLAG_LOCK); } /* pre_accept - see if tables have changed */ @@ -473,6 +487,7 @@ int main(int argc, char **argv) VAR_EMPTY_ADDR, DEF_EMPTY_ADDR, &var_empty_addr, 1, 0, VAR_MASQ_EXCEPTIONS, DEF_MASQ_EXCEPTIONS, &var_masq_exceptions, 0, 0, VAR_HEADER_CHECKS, DEF_HEADER_CHECKS, &var_header_checks, 0, 0, + VAR_BODY_CHECKS, DEF_BODY_CHECKS, &var_body_checks, 0, 0, VAR_PROP_EXTENSION, DEF_PROP_EXTENSION, &var_prop_extension, 0, 0, VAR_ALWAYS_BCC, DEF_ALWAYS_BCC, &var_always_bcc, 0, 0, VAR_RCPT_WITHELD, DEF_RCPT_WITHELD, &var_rcpt_witheld, 1, 0, diff --git a/gnu/dist/postfix/cleanup/cleanup.h b/gnu/dist/postfix/cleanup/cleanup.h index 69fc0142988..79c3d3184fc 100644 --- a/gnu/dist/postfix/cleanup/cleanup.h +++ b/gnu/dist/postfix/cleanup/cleanup.h @@ -62,6 +62,7 @@ extern MAPS *cleanup_comm_canon_maps; extern MAPS *cleanup_send_canon_maps; extern MAPS *cleanup_rcpt_canon_maps; extern MAPS *cleanup_header_checks; +extern MAPS *cleanup_body_checks; extern MAPS *cleanup_virtual_maps; extern ARGV *cleanup_masq_domains; diff --git a/gnu/dist/postfix/cleanup/cleanup_envelope.c b/gnu/dist/postfix/cleanup/cleanup_envelope.c index dab3525e043..3f72e5388bc 100644 --- a/gnu/dist/postfix/cleanup/cleanup_envelope.c +++ b/gnu/dist/postfix/cleanup/cleanup_envelope.c @@ -30,6 +30,10 @@ #include <string.h> #include <stdlib.h> +#ifdef STRCASECMP_IN_STRINGS_H +#include <strings.h> +#endif + /* Utility library. */ #include <msg.h> @@ -45,6 +49,8 @@ #include <tok822.h> #include <mail_params.h> #include <ext_prop.h> +#include <mail_addr.h> +#include <canon_addr.h> /* Application-specific. */ @@ -106,6 +112,12 @@ void cleanup_envelope(void) cleanup_fullname = mystrdup(STR(cleanup_inbuf)); } else if (type == REC_TYPE_FROM) { cleanup_rewrite_internal(clean_addr, STR(cleanup_inbuf)); + if (strncasecmp(STR(clean_addr), MAIL_ADDR_MAIL_DAEMON "@", + sizeof(MAIL_ADDR_MAIL_DAEMON)) == 0) { + canon_addr_internal(cleanup_temp1, MAIL_ADDR_MAIL_DAEMON); + if (strcasecmp(STR(clean_addr), STR(cleanup_temp1)) == 0) + vstring_strcpy(clean_addr, ""); + } if (cleanup_send_canon_maps) cleanup_map11_internal(clean_addr, cleanup_send_canon_maps, cleanup_ext_prop_mask & EXT_PROP_CANONICAL); diff --git a/gnu/dist/postfix/cleanup/cleanup_masquerade.c b/gnu/dist/postfix/cleanup/cleanup_masquerade.c index d00ecb79582..b742e25ca91 100644 --- a/gnu/dist/postfix/cleanup/cleanup_masquerade.c +++ b/gnu/dist/postfix/cleanup/cleanup_masquerade.c @@ -99,7 +99,7 @@ void cleanup_masquerade_external(VSTRING *addr, ARGV *masq_domains) masq_except_table = htable_create(5); ptr = saved_names = mystrdup(var_masq_exceptions); while ((name = mystrtok(&ptr, ", \t\r\n")) != 0) - htable_enter(masq_except_table, name, (char *) 0); + htable_enter(masq_except_table, lowercase(name), (char *) 0); myfree(saved_names); } @@ -116,7 +116,7 @@ void cleanup_masquerade_external(VSTRING *addr, ARGV *masq_domains) */ if (masq_except_table) { name = mystrndup(STR(addr), domain - 1 - STR(addr)); - excluded = (htable_locate(masq_except_table, name) != 0); + excluded = (htable_locate(masq_except_table, lowercase(name)) != 0); myfree(name); if (excluded) return; diff --git a/gnu/dist/postfix/cleanup/cleanup_message.c b/gnu/dist/postfix/cleanup/cleanup_message.c index 324f961fe21..938045f7c36 100644 --- a/gnu/dist/postfix/cleanup/cleanup_message.c +++ b/gnu/dist/postfix/cleanup/cleanup_message.c @@ -240,7 +240,7 @@ static void cleanup_header(void) if ((value = maps_find(cleanup_header_checks, header, 0)) != 0) { if (strcasecmp(value, "REJECT") == 0) { - msg_warn("%s: reject: header %.100s", cleanup_queue_id, header); + msg_warn("%s: reject: header %.200s", cleanup_queue_id, header); cleanup_errs |= CLEANUP_STAT_CONT; } } @@ -460,6 +460,28 @@ void cleanup_message(void) if (in_header) { vstring_strcpy(cleanup_header_buf, start); } else { + + /* + * Crude message body content filter for emergencies. This + * code has several problems: it sees one line at a time, and + * therefore does not recognize multi-line MIME headers in + * the body; it looks at long lines only in chunks of + * line_length_limit (2048) characters; it is easily bypassed + * with encodings and with multi-line tricks. + */ + if ((cleanup_flags & CLEANUP_FLAG_FILTER) + && cleanup_body_checks) { + char *body = vstring_str(cleanup_inbuf); + const char *value; + + if ((value = maps_find(cleanup_body_checks, body, 0)) != 0) { + if (strcasecmp(value, "REJECT") == 0) { + msg_warn("%s: reject: body %.200s", + cleanup_queue_id, body); + cleanup_errs |= CLEANUP_STAT_CONT; + } + } + } CLEANUP_OUT_BUF(type, cleanup_inbuf); } } diff --git a/gnu/dist/postfix/conf/sample-filter.cf b/gnu/dist/postfix/conf/sample-filter.cf new file mode 100644 index 00000000000..5c27373d03b --- /dev/null +++ b/gnu/dist/postfix/conf/sample-filter.cf @@ -0,0 +1,24 @@ +# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE STUFF +# HERE JUST SERVES AS AN EXAMPLE. +# +# This file contains example settings for miscellaneous Postfix +# content filtering parameters. + +# The header_checks parameter specifies an optional table with patterns +# that each logical message header is matched against, including +# headers that span multiple physical lines. Patterns are matched +# in the specified order, and the search stops upon the first match. +# When a pattern matches, and the associated action is REJECT, the +# entire message is rejected. +# +header_checks = regexp:/etc/postfix/header_checks + +# The body_checks parameter specifies an optional table with patterns +# that each physical non-header line is matched against (including +# MIME headers inside the message body). Lines are matched one at +# a time. Long lines are matched in chunks of at most $line_length_limit +# characters. Patterns are matched in the specified order, and the +# search stops upon the first match. When a pattern matches, and +# the associated action is REJECT, the entire message is rejected. +# +body_checks = regexp:/etc/postfix/body_checks diff --git a/gnu/dist/postfix/global/mail_params.h b/gnu/dist/postfix/global/mail_params.h index 382c9b9ad6a..5ac06e6f7bc 100644 --- a/gnu/dist/postfix/global/mail_params.h +++ b/gnu/dist/postfix/global/mail_params.h @@ -661,6 +661,10 @@ extern int var_queue_minfree; #define DEF_HEADER_CHECKS "" extern char *var_header_checks; +#define VAR_BODY_CHECKS "body_checks" +#define DEF_BODY_CHECKS "" +extern char *var_body_checks; + /* * Bounce service: truncate bounce message that exceed $bounce_size_limit. */ diff --git a/gnu/dist/postfix/global/mail_version.h b/gnu/dist/postfix/global/mail_version.h index 42436105c56..1aac4851679 100644 --- a/gnu/dist/postfix/global/mail_version.h +++ b/gnu/dist/postfix/global/mail_version.h @@ -15,7 +15,7 @@ * Version of this program. */ #define VAR_MAIL_VERSION "mail_version" -#define DEF_MAIL_VERSION "Postfix-19991231-pl07" +#define DEF_MAIL_VERSION "Postfix-19991231-pl08" extern char *var_mail_version; /* LICENSE diff --git a/gnu/dist/postfix/html/cleanup.8.html b/gnu/dist/postfix/html/cleanup.8.html index 022d979edc7..01827927a48 100644 --- a/gnu/dist/postfix/html/cleanup.8.html +++ b/gnu/dist/postfix/html/cleanup.8.html @@ -84,6 +84,18 @@ CLEANUP(8) CLEANUP(8) details and for default values. Use the <b>postfix</b> <b>reload</b> command after a configuration change. +<b>Content</b> <b>filtering</b> + <b>body</b><i>_</i><b>checks</b> + Lookup tables with content filters for message body + lines. These filters see physical lines one at a + time, in chunks of at most line_length_limit bytes. + + <b>header</b><i>_</i><b>checks</b> + Lookup tables with content filters for message + header lines. These filters see logical headers + one at a time, including headers that span multiple + lines. + <b>Miscellaneous</b> <b>always</b><i>_</i><b>bcc</b> Address to send a copy of each message that enters @@ -113,30 +125,30 @@ CLEANUP(8) CLEANUP(8) <b>sender</b><i>_</i><b>canonical</b><i>_</i><b>maps</b> Address mapping lookup table for envelope and - header sender addresses. - <b>masquerade</b><i>_</i><b>domains</b> - List of domains that hide their subdomain struc- - ture. - <b>masquerade</b><i>_</i><b>exceptions</b> - List of user names that are not subject to address - masquerading. - <b>virtual</b><i>_</i><b>maps</b> - Address mapping lookup table for envelope recipient + 2 - 2 +CLEANUP(8) CLEANUP(8) + header sender addresses. -CLEANUP(8) CLEANUP(8) + <b>masquerade</b><i>_</i><b>domains</b> + List of domains that hide their subdomain struc- + ture. + <b>masquerade</b><i>_</i><b>exceptions</b> + List of user names that are not subject to address + masquerading. + <b>virtual</b><i>_</i><b>maps</b> + Address mapping lookup table for envelope recipient addresses. <b>Resource</b> <b>controls</b> @@ -182,18 +194,6 @@ CLEANUP(8) CLEANUP(8) - - - - - - - - - - - - 3 diff --git a/gnu/dist/postfix/man/man8/cleanup.8 b/gnu/dist/postfix/man/man8/cleanup.8 index d8591b088ab..498f197fa01 100644 --- a/gnu/dist/postfix/man/man8/cleanup.8 +++ b/gnu/dist/postfix/man/man8/cleanup.8 @@ -74,6 +74,15 @@ The following \fBmain.cf\fR parameters are especially relevant to this program. See the Postfix \fBmain.cf\fR file for syntax details and for default values. Use the \fBpostfix reload\fR command after a configuration change. +.SH Content filtering +.IP \fBbody_checks\fR +Lookup tables with content filters for message body lines. +These filters see physical lines one at a time, in chunks of +at most line_length_limit bytes. +.IP \fBheader_checks\fR +Lookup tables with content filters for message header lines. +These filters see logical headers one at a time, including headers +that span multiple lines. .SH Miscellaneous .ad .fi |
