tctx.u.fd = fileno(fp);
tctx.tblock = &tb;
- tctx.options = topt;
+ tctx.options = topt | topt_truncate_headers;
tb.add_headers = dsnnotifyhdr;
/*XXX no checking for failure! buggy! */
fflush(f);
/* header only as required by RFC. only failure DSN needs to honor RET=FULL */
tctx.u.fd = fileno(f);
-tctx.options = topt_add_return_path | topt_no_body;
+tctx.options = topt_add_return_path | topt_truncate_headers | topt_no_body;
transport_filter_argv = NULL; /* Just in case */
return_path = sender_address; /* In case not previously set */
/* Write the original email out */
/*XXX no checking for failure! buggy! */
-/*XXX overlong headers in the original become overlong body lines here*/
transport_write_message(&tctx, 0);
fflush(f);
/* Write the original email out */
tctx.u.fd = fd;
- tctx.options = topt_add_return_path | topt_no_body;
+ tctx.options = topt_add_return_path | topt_truncate_headers | topt_no_body;
/*XXX hmm, FALSE(fail) retval ignored.
Could error for any number of reasons, and they are not handled. */
transport_write_message(&tctx, 0);
/* Options for transport_write_message */
-#define topt_add_return_path 0x0001
-#define topt_add_delivery_date 0x0002
-#define topt_add_envelope_to 0x0004
-#define topt_escape_headers 0x0008 /* Apply escape check to headers */
-#define topt_use_crlf 0x0010 /* Terminate lines with CRLF */
-#define topt_no_headers 0x0020 /* Omit headers */
-#define topt_no_body 0x0040 /* Omit body */
-#define topt_end_dot 0x0080 /* Send terminating dot line */
-#define topt_no_flush 0x0100 /* more data expected after message (eg QUIT) */
-#define topt_use_bdat 0x0200 /* prepend chunks with RFC3030 BDAT header */
-#define topt_output_string 0x0400 /* create string rather than write to fd */
-#define topt_continuation 0x0800 /* do not reset buffer */
-#define topt_not_socket 0x1000 /* cannot do socket-only syscalls */
+#define topt_add_return_path BIT(0)
+#define topt_add_delivery_date BIT(1)
+#define topt_add_envelope_to BIT(2)
+#define topt_escape_headers BIT(3) /* Apply escape check to headers */
+#define topt_truncate_headers BIT(4) /* Truncate header lines at 998 chars */
+#define topt_use_crlf BIT(5) /* Terminate lines with CRLF */
+#define topt_no_headers BIT(6) /* Omit headers */
+#define topt_no_body BIT(7) /* Omit body */
+#define topt_end_dot BIT(8) /* Send terminating dot line */
+#define topt_no_flush BIT(9) /* more data expected after message (eg QUIT) */
+#define topt_use_bdat BIT(10) /* prepend chunks with RFC3030 BDAT header */
+#define topt_output_string BIT(11) /* create string rather than write to fd */
+#define topt_continuation BIT(12) /* do not reset buffer */
+#define topt_not_socket BIT(13) /* cannot do socket-only syscalls */
/* Options for smtp_write_command */
transport_headers_send(transport_ctx * tctx,
BOOL (*sendfn)(transport_ctx * tctx, uschar * s, int len))
{
-const uschar *list;
+const uschar * list;
transport_instance * tblock = tctx ? tctx->tblock : NULL;
address_item * addr = tctx ? tctx->addr : NULL;
if (include_header)
{
+ int len;
if (tblock && tblock->rewrite_rules)
{
rmark reset_point = store_mark();
- header_line *hh;
+ header_line * hh;
if ((hh = rewrite_header(h, NULL, NULL, tblock->rewrite_rules,
tblock->rewrite_existflags, FALSE)))
{
- if (!sendfn(tctx, hh->text, hh->slen)) return FALSE;
+ len = hh->slen;
+ if (tctx->options & topt_truncate_headers && len > 998) len = 998;
+ if (!sendfn(tctx, hh->text, len)) return FALSE;
store_reset(reset_point);
continue; /* With the next header line */
}
/* Either no rewriting rules, or it didn't get rewritten */
- if (!sendfn(tctx, h->text, h->slen)) return FALSE;
+ len = h->slen;
+ if (tctx->options & topt_truncate_headers && len > 998) len = 998;
+ if (!sendfn(tctx, h->text, len)) return FALSE;
}
/* Header removed */
Message-Id: <E10HmaX-0005vi-00@myhost.ex>
From: CALLER_NAME <CALLER@myhost.ex>
Date: Tue, 2 Mar 1999 09:44:33 +0000
-References: <0.ZERO.78901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.ONE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.TWO.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.THREE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.FOUR.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.FIVE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.SIX.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.SEVEN.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.EIGHT.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.NINE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.TEN.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.ELEVEN.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.TWELVE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net>
-
+References: <0.ZERO.78901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.ONE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.TWO.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.THREE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.FOUR.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.FIVE.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.SIX.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.SEVEN.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.EIGHT.678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678@f.net> <0.NIN
This is a test message.
--NNNNNNNNNN-eximdsn-MMMMMMMMMM--