summaryrefslogtreecommitdiffstats
path: root/src/cleanup
diff options
context:
space:
mode:
Diffstat (limited to 'src/cleanup')
-rw-r--r--src/cleanup/Makefile.in44
-rw-r--r--src/cleanup/cleanup.c24
-rw-r--r--src/cleanup/cleanup_addr.c6
-rw-r--r--src/cleanup/cleanup_init.c2
-rw-r--r--src/cleanup/cleanup_message.c5
-rw-r--r--src/cleanup/cleanup_milter.c9
-rw-r--r--src/cleanup/cleanup_milter.in18a8
-rw-r--r--src/cleanup/cleanup_milter.in18b8
-rw-r--r--src/cleanup/cleanup_milter.in18c9
-rw-r--r--src/cleanup/cleanup_milter.in18d8
-rw-r--r--src/cleanup/cleanup_milter.ref18a11
-rw-r--r--src/cleanup/cleanup_milter.ref18a229
-rw-r--r--src/cleanup/cleanup_milter.ref18b11
-rw-r--r--src/cleanup/cleanup_milter.ref18b227
-rw-r--r--src/cleanup/cleanup_milter.ref18c11
-rw-r--r--src/cleanup/cleanup_milter.ref18c229
-rw-r--r--src/cleanup/cleanup_milter.ref18d11
-rw-r--r--src/cleanup/cleanup_milter.ref18d227
-rw-r--r--src/cleanup/test-queue-file18bin0 -> 653 bytes
19 files changed, 227 insertions, 12 deletions
diff --git a/src/cleanup/Makefile.in b/src/cleanup/Makefile.in
index 8a3c18c..b74fe0a 100644
--- a/src/cleanup/Makefile.in
+++ b/src/cleanup/Makefile.in
@@ -88,7 +88,9 @@ milter_tests: cleanup_milter_test bug_tests \
cleanup_milter_test15g cleanup_milter_test15h cleanup_milter_test15i \
cleanup_milter_test16a cleanup_milter_test16b cleanup_milter_test17a \
cleanup_milter_test17b cleanup_milter_test17c cleanup_milter_test17d \
- cleanup_milter_test17e cleanup_milter_test17f cleanup_milter_test17g
+ cleanup_milter_test17e cleanup_milter_test17f cleanup_milter_test17g \
+ cleanup_milter_test18a cleanup_milter_test18b cleanup_milter_test18c \
+ cleanup_milter_test18d
root_tests:
@@ -671,6 +673,46 @@ cleanup_milter_test17g: cleanup_milter test-queue-file17 cleanup_milter.in17g \
diff cleanup_milter.ref17g2 cleanup_milter.tmp2
rm -f test-queue-file17g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
+cleanup_milter_test18a: cleanup_milter test-queue-file18 cleanup_milter.in18a \
+ cleanup_milter.ref18a1 ../postcat/postcat cleanup_milter.ref18a2
+ cp test-queue-file18 test-queue-file18a.tmp
+ chmod u+w test-queue-file18a.tmp
+ $(SHLIB_ENV) $(VALGRIND) ./cleanup_milter <cleanup_milter.in18a 2>cleanup_milter.tmp1
+ diff cleanup_milter.ref18a1 cleanup_milter.tmp1
+ $(SHLIB_ENV) $(VALGRIND) ../postcat/postcat -ov test-queue-file18a.tmp 2>/dev/null >cleanup_milter.tmp2
+ diff cleanup_milter.ref18a2 cleanup_milter.tmp2
+ rm -f test-queue-file18a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
+
+cleanup_milter_test18b: cleanup_milter test-queue-file18 cleanup_milter.in18b \
+ cleanup_milter.ref18b1 ../postcat/postcat cleanup_milter.ref18b2
+ cp test-queue-file18 test-queue-file18b.tmp
+ chmod u+w test-queue-file18b.tmp
+ $(SHLIB_ENV) $(VALGRIND) ./cleanup_milter <cleanup_milter.in18b 2>cleanup_milter.tmp1
+ diff cleanup_milter.ref18b1 cleanup_milter.tmp1
+ $(SHLIB_ENV) $(VALGRIND) ../postcat/postcat -ov test-queue-file18b.tmp 2>/dev/null >cleanup_milter.tmp2
+ diff cleanup_milter.ref18b2 cleanup_milter.tmp2
+ rm -f test-queue-file18b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
+
+cleanup_milter_test18c: cleanup_milter test-queue-file18 cleanup_milter.in18c \
+ cleanup_milter.ref18c1 ../postcat/postcat cleanup_milter.ref18c2
+ cp test-queue-file18 test-queue-file18c.tmp
+ chmod u+w test-queue-file18c.tmp
+ $(SHLIB_ENV) $(VALGRIND) ./cleanup_milter <cleanup_milter.in18c 2>cleanup_milter.tmp1
+ diff cleanup_milter.ref18c1 cleanup_milter.tmp1
+ $(SHLIB_ENV) $(VALGRIND) ../postcat/postcat -ov test-queue-file18c.tmp 2>/dev/null >cleanup_milter.tmp2
+ diff cleanup_milter.ref18c2 cleanup_milter.tmp2
+ rm -f test-queue-file18c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
+
+cleanup_milter_test18d: cleanup_milter test-queue-file18 cleanup_milter.in18d \
+ cleanup_milter.ref18d1 ../postcat/postcat cleanup_milter.ref18d2
+ cp test-queue-file18 test-queue-file18d.tmp
+ chmod u+w test-queue-file18d.tmp
+ $(SHLIB_ENV) $(VALGRIND) ./cleanup_milter <cleanup_milter.in18d 2>cleanup_milter.tmp1
+ diff cleanup_milter.ref18d1 cleanup_milter.tmp1
+ $(SHLIB_ENV) $(VALGRIND) ../postcat/postcat -ov test-queue-file18d.tmp 2>/dev/null >cleanup_milter.tmp2
+ diff cleanup_milter.ref18d2 cleanup_milter.tmp2
+ rm -f test-queue-file18d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
+
depend: $(MAKES)
(sed '1,/^# do not edit/!d' Makefile.in; \
set -e; for i in [a-z][a-z0-9]*.c; do \
diff --git a/src/cleanup/cleanup.c b/src/cleanup/cleanup.c
index 6fe61f8..5db42bd 100644
--- a/src/cleanup/cleanup.c
+++ b/src/cleanup/cleanup.c
@@ -262,10 +262,10 @@
/* Available in Postfix version 2.1 and later:
/* .IP "\fBsender_bcc_maps (empty)\fR"
/* Optional BCC (blind carbon-copy) address lookup tables, indexed
-/* by sender address.
+/* by envelope sender address.
/* .IP "\fBrecipient_bcc_maps (empty)\fR"
/* Optional BCC (blind carbon-copy) address lookup tables, indexed by
-/* recipient address.
+/* envelope recipient address.
/* ADDRESS TRANSFORMATION CONTROLS
/* .ad
/* .fi
@@ -303,8 +303,9 @@
/* .PP
/* Available in Postfix version 2.0 and later:
/* .IP "\fBvirtual_alias_maps ($virtual_maps)\fR"
-/* Optional lookup tables that alias specific mail addresses or domains
-/* to other local or remote address.
+/* Optional lookup tables with aliases that apply to all recipients:
+/* \fBlocal\fR(8), virtual, and remote; this is unlike alias_maps that apply
+/* only to \fBlocal\fR(8) recipients.
/* .PP
/* Available in Postfix version 2.2 and later:
/* .IP "\fBcanonical_classes (envelope_sender, envelope_recipient, header_sender, header_recipient)\fR"
@@ -316,9 +317,10 @@
/* What addresses are subject to sender_canonical_maps address
/* mapping.
/* .IP "\fBremote_header_rewrite_domain (empty)\fR"
-/* Don't rewrite message headers from remote clients at all when
-/* this parameter is empty; otherwise, rewrite message headers and
-/* append the specified domain name to incomplete addresses.
+/* Rewrite or add message headers in mail from remote clients if
+/* the remote_header_rewrite_domain parameter value is non-empty,
+/* updating incomplete addresses with the domain specified in the
+/* remote_header_rewrite_domain parameter, and adding missing headers.
/* RESOURCE AND RATE CONTROLS
/* .ad
/* .fi
@@ -365,7 +367,7 @@
/* Preliminary SMTPUTF8 support is introduced with Postfix 3.0.
/* .IP "\fBsmtputf8_enable (yes)\fR"
/* Enable preliminary SMTPUTF8 support for the protocols described
-/* in RFC 6531..6533.
+/* in RFC 6531, RFC 6532, and RFC 6533.
/* .IP "\fBsmtputf8_autodetect_classes (sendmail, verify)\fR"
/* Detect that a message requires SMTPUTF8 support for the specified
/* mail origin classes.
@@ -433,6 +435,12 @@
/* .IP "\fBinfo_log_address_format (external)\fR"
/* The email address form that will be used in non-debug logging
/* (info, warning, etc.).
+/* .PP
+/* Available in Postfix 3.9 and later:
+/* .IP "\fBforce_mime_input_conversion (no)\fR"
+/* Convert body content that claims to be 8-bit into quoted-printable,
+/* before header_checks, body_checks, Milters, and before after-queue
+/* content filters.
/* FILES
/* /etc/postfix/canonical*, canonical mapping table
/* /etc/postfix/virtual*, virtual mapping table
diff --git a/src/cleanup/cleanup_addr.c b/src/cleanup/cleanup_addr.c
index fd8a511..f5e7d91 100644
--- a/src/cleanup/cleanup_addr.c
+++ b/src/cleanup/cleanup_addr.c
@@ -148,7 +148,7 @@ off_t cleanup_addr_sender(CLEANUP_STATE *state, const char *buf)
}
/* Fix 20140711: Auto-detect an UTF8 sender. */
if (var_smtputf8_enable && *STR(clean_addr) && !allascii(STR(clean_addr))
- && valid_utf8_string(STR(clean_addr), LEN(clean_addr))) {
+ && valid_utf8_stringz(STR(clean_addr))) {
state->smtputf8 |= SMTPUTF8_FLAG_SENDER;
/* Fix 20140713: request SMTPUTF8 support selectively. */
if (state->flags & CLEANUP_FLAG_AUTOUTF8)
@@ -216,7 +216,7 @@ void cleanup_addr_recipient(CLEANUP_STATE *state, const char *buf)
}
/* Fix 20140711: Auto-detect an UTF8 recipient. */
if (var_smtputf8_enable && *STR(clean_addr) && !allascii(STR(clean_addr))
- && valid_utf8_string(STR(clean_addr), LEN(clean_addr))) {
+ && valid_utf8_stringz(STR(clean_addr))) {
/* Fix 20140713: request SMTPUTF8 support selectively. */
if (state->flags & CLEANUP_FLAG_AUTOUTF8)
state->smtputf8 |= SMTPUTF8_FLAG_REQUESTED;
@@ -275,7 +275,7 @@ void cleanup_addr_bcc_dsn(CLEANUP_STATE *state, const char *bcc,
}
/* Fix 20140711: Auto-detect an UTF8 recipient. */
if (var_smtputf8_enable && *STR(clean_addr) && !allascii(STR(clean_addr))
- && valid_utf8_string(STR(clean_addr), LEN(clean_addr))) {
+ && valid_utf8_stringz(STR(clean_addr))) {
/* Fix 20140713: request SMTPUTF8 support selectively. */
if (state->flags & CLEANUP_FLAG_AUTOUTF8)
state->smtputf8 |= SMTPUTF8_FLAG_REQUESTED;
diff --git a/src/cleanup/cleanup_init.c b/src/cleanup/cleanup_init.c
index 369a019..446ddf2 100644
--- a/src/cleanup/cleanup_init.c
+++ b/src/cleanup/cleanup_init.c
@@ -174,6 +174,7 @@ int var_auto_8bit_enc_hdr; /* auto-detect 8bit encoding header */
int var_always_add_hdrs; /* always add missing headers */
int var_virt_addrlen_limit; /* stop exponential growth */
char *var_hfrom_format; /* header_from_format */
+int var_force_mime_iconv; /* force mime downgrade on input */
int var_cleanup_mask_stray_cr_lf; /* replace stray CR or LF with space */
const CONFIG_INT_TABLE cleanup_int_table[] = {
@@ -191,6 +192,7 @@ const CONFIG_BOOL_TABLE cleanup_bool_table[] = {
VAR_VERP_BOUNCE_OFF, DEF_VERP_BOUNCE_OFF, &var_verp_bounce_off,
VAR_AUTO_8BIT_ENC_HDR, DEF_AUTO_8BIT_ENC_HDR, &var_auto_8bit_enc_hdr,
VAR_ALWAYS_ADD_HDRS, DEF_ALWAYS_ADD_HDRS, &var_always_add_hdrs,
+ VAR_FORCE_MIME_ICONV, DEF_FORCE_MIME_ICONV, &var_force_mime_iconv,
VAR_CLEANUP_MASK_STRAY_CR_LF, DEF_CLEANUP_MASK_STRAY_CR_LF, &var_cleanup_mask_stray_cr_lf,
0,
};
diff --git a/src/cleanup/cleanup_message.c b/src/cleanup/cleanup_message.c
index 1ee0a52..0d31598 100644
--- a/src/cleanup/cleanup_message.c
+++ b/src/cleanup/cleanup_message.c
@@ -1069,6 +1069,9 @@ void cleanup_message(CLEANUP_STATE *state, int type, const char *buf, ssize_t
*/
mime_options = 0;
if (var_disable_mime_input) {
+ if (var_force_mime_iconv)
+ msg_fatal("do not specify both %s=yes and %s=yes",
+ VAR_DISABLE_MIME_INPUT, VAR_FORCE_MIME_ICONV);
mime_options |= MIME_OPT_DISABLE_MIME;
} else {
/* Turn off content checks if bouncing or forwarding mail. */
@@ -1085,6 +1088,8 @@ void cleanup_message(CLEANUP_STATE *state, int type, const char *buf, ssize_t
|| *var_nesthdr_checks)
mime_options |= MIME_OPT_REPORT_NESTING;
}
+ if (var_force_mime_iconv)
+ mime_options |= MIME_OPT_DOWNGRADE;
}
state->mime_state = mime_state_alloc(mime_options,
cleanup_header_callback,
diff --git a/src/cleanup/cleanup_milter.c b/src/cleanup/cleanup_milter.c
index 491de25..a35344c 100644
--- a/src/cleanup/cleanup_milter.c
+++ b/src/cleanup/cleanup_milter.c
@@ -2444,6 +2444,7 @@ static void open_queue_file(CLEANUP_STATE *state, const char *path)
long data_offset;
long rcpt_count;
long qmgr_opts;
+ const HEADER_OPTS *opts;
if (state->dst != 0) {
msg_warn("closing %s", cleanup_path);
@@ -2455,6 +2456,7 @@ static void open_queue_file(CLEANUP_STATE *state, const char *path)
if ((state->dst = vstream_fopen(path, O_RDWR, 0)) == 0) {
msg_warn("open %s: %m", path);
} else {
+ var_drop_hdrs = "";
cleanup_path = mystrdup(path);
for (;;) {
if ((curr_offset = vstream_ftell(state->dst)) < 0)
@@ -2511,9 +2513,16 @@ static void open_queue_file(CLEANUP_STATE *state, const char *path)
msg_fatal("file %s: vstream_ftell: %m", cleanup_path);
}
}
+ } else if (rec_type == REC_TYPE_NORM && state->hop_count == 0
+ && (opts = header_opts_find(STR(buf))) != 0
+ && opts->type == HDR_RECEIVED) {
+ state->hop_count += 1;
+ /* XXX Only the first line of the first Received: header. */
+ argv_add(state->auto_hdrs, STR(buf), ARGV_END);
}
if (state->append_rcpt_pt_offset > 0
&& state->append_hdr_pt_offset > 0
+ && state->hop_count > 0
&& (rec_type == REC_TYPE_END
|| state->append_meta_pt_offset > 0))
break;
diff --git a/src/cleanup/cleanup_milter.in18a b/src/cleanup/cleanup_milter.in18a
new file mode 100644
index 0000000..4e60fe4
--- /dev/null
+++ b/src/cleanup/cleanup_milter.in18a
@@ -0,0 +1,8 @@
+#verbose on
+open test-queue-file18a.tmp
+#
+# Update a prepended header.
+#
+upd_header 1 Header-Label new-header-value
+
+close
diff --git a/src/cleanup/cleanup_milter.in18b b/src/cleanup/cleanup_milter.in18b
new file mode 100644
index 0000000..5f8c12d
--- /dev/null
+++ b/src/cleanup/cleanup_milter.in18b
@@ -0,0 +1,8 @@
+#verbose on
+open test-queue-file18b.tmp
+#
+# Delete a prepended header.
+#
+del_header 1 Header-Label
+
+close
diff --git a/src/cleanup/cleanup_milter.in18c b/src/cleanup/cleanup_milter.in18c
new file mode 100644
index 0000000..bb78c94
--- /dev/null
+++ b/src/cleanup/cleanup_milter.in18c
@@ -0,0 +1,9 @@
+#verbose on
+open test-queue-file18c.tmp
+#
+# Update the first Received: header. This adds a new header, because
+# there is no header that was exposed to the Milter.
+#
+upd_header 1 Received whatever
+
+close
diff --git a/src/cleanup/cleanup_milter.in18d b/src/cleanup/cleanup_milter.in18d
new file mode 100644
index 0000000..607014d
--- /dev/null
+++ b/src/cleanup/cleanup_milter.in18d
@@ -0,0 +1,8 @@
+#verbose on
+open test-queue-file18d.tmp
+#
+# Delete our Received: header. This should do nothing.
+#
+del_header 1 Received
+
+close
diff --git a/src/cleanup/cleanup_milter.ref18a1 b/src/cleanup/cleanup_milter.ref18a1
new file mode 100644
index 0000000..eab5a83
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18a1
@@ -0,0 +1 @@
+./cleanup_milter: flags = enable_header_body_filter enable_milters
diff --git a/src/cleanup/cleanup_milter.ref18a2 b/src/cleanup/cleanup_milter.ref18a2
new file mode 100644
index 0000000..b5c0477
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18a2
@@ -0,0 +1,29 @@
+*** ENVELOPE RECORDS test-queue-file18a.tmp ***
+ 0 message_size: 342 290 1 0 342 0
+ 97 message_arrival_time: Tue Dec 12 14:29:04 2023
+ 116 create_time: Tue Dec 12 14:29:04 2023
+ 140 named_attribute: rewrite_context=local
+ 163 sender_fullname: Wietse Venema
+ 178 sender: user@example.com
+ 196 named_attribute: dsn_orig_rcpt=rfc822;user@example.com
+ 235 original_recipient: user@example.com
+ 253 recipient: user@example.com
+ 271 pointer_record: 0
+ 288 *** MESSAGE CONTENTS test-queue-file18a.tmp ***
+ 290 pointer_record: 653
+ 653 regular_text: Header-Label: new-header-value
+ 685 pointer_record: 318
+ 318 regular_text: Received: by wzv.porcupine.org (Postfix, from userid 1000)
+ 378 regular_text: id 4SqTFD6TVpz4w4n; Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 438 regular_text: Subject: test
+ 453 padding: 0
+ 456 regular_text: Message-Id: <4SqTFD6TVpz4w4n@wzv.porcupine.org>
+ 505 regular_text: Date: Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 550 regular_text: From: Wietse Venema <user@example.com>
+ 590 pointer_record: 0
+ 607 regular_text:
+ 609 regular_text: test
+ 615 pointer_record: 0
+ 632 *** HEADER EXTRACTED test-queue-file18a.tmp ***
+ 634 pointer_record: 0
+ 651 *** MESSAGE FILE END test-queue-file18a.tmp ***
diff --git a/src/cleanup/cleanup_milter.ref18b1 b/src/cleanup/cleanup_milter.ref18b1
new file mode 100644
index 0000000..eab5a83
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18b1
@@ -0,0 +1 @@
+./cleanup_milter: flags = enable_header_body_filter enable_milters
diff --git a/src/cleanup/cleanup_milter.ref18b2 b/src/cleanup/cleanup_milter.ref18b2
new file mode 100644
index 0000000..d3b4ed3
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18b2
@@ -0,0 +1,27 @@
+*** ENVELOPE RECORDS test-queue-file18b.tmp ***
+ 0 message_size: 342 290 1 0 342 0
+ 97 message_arrival_time: Tue Dec 12 14:29:04 2023
+ 116 create_time: Tue Dec 12 14:29:04 2023
+ 140 named_attribute: rewrite_context=local
+ 163 sender_fullname: Wietse Venema
+ 178 sender: user@example.com
+ 196 named_attribute: dsn_orig_rcpt=rfc822;user@example.com
+ 235 original_recipient: user@example.com
+ 253 recipient: user@example.com
+ 271 pointer_record: 0
+ 288 *** MESSAGE CONTENTS test-queue-file18b.tmp ***
+ 290 pointer_record: 318
+ 318 regular_text: Received: by wzv.porcupine.org (Postfix, from userid 1000)
+ 378 regular_text: id 4SqTFD6TVpz4w4n; Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 438 regular_text: Subject: test
+ 453 padding: 0
+ 456 regular_text: Message-Id: <4SqTFD6TVpz4w4n@wzv.porcupine.org>
+ 505 regular_text: Date: Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 550 regular_text: From: Wietse Venema <user@example.com>
+ 590 pointer_record: 0
+ 607 regular_text:
+ 609 regular_text: test
+ 615 pointer_record: 0
+ 632 *** HEADER EXTRACTED test-queue-file18b.tmp ***
+ 634 pointer_record: 0
+ 651 *** MESSAGE FILE END test-queue-file18b.tmp ***
diff --git a/src/cleanup/cleanup_milter.ref18c1 b/src/cleanup/cleanup_milter.ref18c1
new file mode 100644
index 0000000..eab5a83
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18c1
@@ -0,0 +1 @@
+./cleanup_milter: flags = enable_header_body_filter enable_milters
diff --git a/src/cleanup/cleanup_milter.ref18c2 b/src/cleanup/cleanup_milter.ref18c2
new file mode 100644
index 0000000..84a3449
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18c2
@@ -0,0 +1,29 @@
+*** ENVELOPE RECORDS test-queue-file18c.tmp ***
+ 0 message_size: 342 290 1 0 342 0
+ 97 message_arrival_time: Tue Dec 12 14:29:04 2023
+ 116 create_time: Tue Dec 12 14:29:04 2023
+ 140 named_attribute: rewrite_context=local
+ 163 sender_fullname: Wietse Venema
+ 178 sender: user@example.com
+ 196 named_attribute: dsn_orig_rcpt=rfc822;user@example.com
+ 235 original_recipient: user@example.com
+ 253 recipient: user@example.com
+ 271 pointer_record: 0
+ 288 *** MESSAGE CONTENTS test-queue-file18c.tmp ***
+ 290 regular_text: Header-Label: header-value
+ 318 regular_text: Received: by wzv.porcupine.org (Postfix, from userid 1000)
+ 378 regular_text: id 4SqTFD6TVpz4w4n; Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 438 regular_text: Subject: test
+ 453 padding: 0
+ 456 regular_text: Message-Id: <4SqTFD6TVpz4w4n@wzv.porcupine.org>
+ 505 regular_text: Date: Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 550 regular_text: From: Wietse Venema <user@example.com>
+ 590 pointer_record: 653
+ 653 regular_text: Received: whatever
+ 673 pointer_record: 607
+ 607 regular_text:
+ 609 regular_text: test
+ 615 pointer_record: 0
+ 632 *** HEADER EXTRACTED test-queue-file18c.tmp ***
+ 634 pointer_record: 0
+ 651 *** MESSAGE FILE END test-queue-file18c.tmp ***
diff --git a/src/cleanup/cleanup_milter.ref18d1 b/src/cleanup/cleanup_milter.ref18d1
new file mode 100644
index 0000000..eab5a83
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18d1
@@ -0,0 +1 @@
+./cleanup_milter: flags = enable_header_body_filter enable_milters
diff --git a/src/cleanup/cleanup_milter.ref18d2 b/src/cleanup/cleanup_milter.ref18d2
new file mode 100644
index 0000000..b436ba2
--- /dev/null
+++ b/src/cleanup/cleanup_milter.ref18d2
@@ -0,0 +1,27 @@
+*** ENVELOPE RECORDS test-queue-file18d.tmp ***
+ 0 message_size: 342 290 1 0 342 0
+ 97 message_arrival_time: Tue Dec 12 14:29:04 2023
+ 116 create_time: Tue Dec 12 14:29:04 2023
+ 140 named_attribute: rewrite_context=local
+ 163 sender_fullname: Wietse Venema
+ 178 sender: user@example.com
+ 196 named_attribute: dsn_orig_rcpt=rfc822;user@example.com
+ 235 original_recipient: user@example.com
+ 253 recipient: user@example.com
+ 271 pointer_record: 0
+ 288 *** MESSAGE CONTENTS test-queue-file18d.tmp ***
+ 290 regular_text: Header-Label: header-value
+ 318 regular_text: Received: by wzv.porcupine.org (Postfix, from userid 1000)
+ 378 regular_text: id 4SqTFD6TVpz4w4n; Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 438 regular_text: Subject: test
+ 453 padding: 0
+ 456 regular_text: Message-Id: <4SqTFD6TVpz4w4n@wzv.porcupine.org>
+ 505 regular_text: Date: Tue, 12 Dec 2023 14:29:04 -0500 (EST)
+ 550 regular_text: From: Wietse Venema <user@example.com>
+ 590 pointer_record: 0
+ 607 regular_text:
+ 609 regular_text: test
+ 615 pointer_record: 0
+ 632 *** HEADER EXTRACTED test-queue-file18d.tmp ***
+ 634 pointer_record: 0
+ 651 *** MESSAGE FILE END test-queue-file18d.tmp ***
diff --git a/src/cleanup/test-queue-file18 b/src/cleanup/test-queue-file18
new file mode 100644
index 0000000..42c46f1
--- /dev/null
+++ b/src/cleanup/test-queue-file18
Binary files differ