summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ACKNOWLEDGMENTS1
-rw-r--r--src/src/globals.c2
-rw-r--r--src/src/globals.h1
-rw-r--r--src/src/macros.h1
-rw-r--r--src/src/receive.c9
-rw-r--r--src/src/smtp_in.c18
6 files changed, 28 insertions, 4 deletions
diff --git a/src/ACKNOWLEDGMENTS b/src/ACKNOWLEDGMENTS
index a66512f36..4361d6776 100644
--- a/src/ACKNOWLEDGMENTS
+++ b/src/ACKNOWLEDGMENTS
@@ -98,6 +98,7 @@ Matt Bernstein LMTP over socket
Mike Bethune Help with debugging an elusive ALRM signal bug
Ard Biesheuvel Lookup code for accessing an Interbase database
Richard Birkett Fix for empty -f address crash
+Wolfgang Breyha Logging of 8bitmime reception
Dean Brooks Fix for ratelimit per_rcpt in acl_not_smtp.
Nick Burrett Patch for CONFIGURE_FILE_USE_EUID in exicyclog
Matthew Byng-Maddick Patch for qualify_domain in redirect router
diff --git a/src/src/globals.c b/src/src/globals.c
index bcbe12d82..ba6c8c6ba 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -271,6 +271,7 @@ uschar *acl_wherecodes[] = { US"550", /* RCPT */
BOOL active_local_from_check = FALSE;
BOOL active_local_sender_retain = FALSE;
+int body_8bitmime = 0;
BOOL accept_8bitmime = TRUE; /* deliberately not RFC compliant */
address_item *addr_duplicate = NULL;
@@ -734,6 +735,7 @@ selectors was getting close to filling a 32-bit word. */
/* Note that this list must be in alphabetical order. */
bit_table log_options[] = {
+ { US"8bitmime", LX_8bitmime },
{ US"acl_warn_skipped", LX_acl_warn_skipped },
{ US"address_rewrite", L_address_rewrite },
{ US"all", L_all },
diff --git a/src/src/globals.h b/src/src/globals.h
index 16caa41e9..a27f62cfe 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -133,6 +133,7 @@ extern uschar **address_expansions[ADDRESS_EXPANSIONS_COUNT];
/* General global variables */
extern BOOL accept_8bitmime; /* Allow *BITMIME incoming */
+extern int body_8bitmime; /* sender declared BODY= ; 7=7BIT, 8=8BITMIME */
extern header_line *acl_added_headers; /* Headers added by an ACL */
extern tree_node *acl_anchor; /* Tree of named ACLs */
extern uschar *acl_arg[9]; /* Argument to ACL call */
diff --git a/src/src/macros.h b/src/src/macros.h
index cec4733f6..305200211 100644
--- a/src/src/macros.h
+++ b/src/src/macros.h
@@ -409,6 +409,7 @@ set all the bits in a multi-word selector. */
#define LX_tls_peerdn 0x80400000
#define LX_tls_sni 0x80800000
#define LX_unknown_in_list 0x81000000
+#define LX_8bitmime 0x82000000
#define L_default (L_connection_reject | \
L_delay_delivery | \
diff --git a/src/src/receive.c b/src/src/receive.c
index 7b51805dc..8ac381add 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -3610,6 +3610,15 @@ if (sender_host_authenticated != NULL)
sprintf(CS big_buffer, "%d", msg_size);
s = string_append(s, &size, &sptr, 2, US" S=", big_buffer);
+/* log 8BITMIME mode announced in MAIL_FROM
+ 0 ... no BODY= used
+ 7 ... 7BIT
+ 8 ... 8BITMIME */
+if (log_extra_selector & LX_8bitmime) {
+ sprintf(CS big_buffer, "%d", body_8bitmime);
+ s = string_append(s, &size, &sptr, 2, US" M8S=", big_buffer);
+}
+
/* If an addr-spec in a message-id contains a quoted string, it can contain
any characters except " \ and CR and so in particular it can contain NL!
Therefore, make sure we use a printing-characters only version for the log.
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index b1fea9daf..e3746d99d 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -3320,10 +3320,20 @@ while (done <= 0)
some sites want the action that is provided. We recognize both "8BITMIME"
and "7BIT" as body types, but take no action. */
case ENV_MAIL_OPT_BODY:
- if (accept_8bitmime &&
- (strcmpic(value, US"8BITMIME") == 0 ||
- strcmpic(value, US"7BIT") == 0) )
- break;
+ if (accept_8bitmime) {
+ if (strcmpic(value, US"8BITMIME") == 0) {
+ body_8bitmime = 8;
+ } else if (strcmpic(value, US"7BIT") == 0) {
+ body_8bitmime = 7;
+ } else {
+ body_8bitmime = 0;
+ done = synprot_error(L_smtp_syntax_error, 501, NULL,
+ US"invalid data for BODY");
+ goto COMMAND_LOOP;
+ }
+ DEBUG(D_receive) debug_printf("8BITMIME: %d\n", body_8bitmime);
+ break;
+ }
arg_error = TRUE;
break;