OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: lost connection during MAIL FROM

From: Wietse Venema (wietseporcupine.org)
Date: Tue Apr 24 2007 - 16:36:20 CDT


Wietse Venema:
> Victor Duchovni:
> > mail from:<luserexample.com> SIZE=12345 BODY=8BITMIME
> > Connection closed by foreign host.
> >
> > mail from:<luserexample.com> SIZE=12345
> > 250 Requested mail action okay, completed

This patch for inter-operability prevents Postfix from sending
BODY=8BITMIME when no such information was specified by the sender
(with the Postfix sendmail "-B 8BITMIME" command line option, or
with the MAIL FROM command).

The patch makes Postfix more interoperable without sacrificing RFC
compliance.

And now I really have to return to the non-Postfix deadlines.

        Wietse

diff -cr /var/tmp/postfix-2.5-20070423/man/man5/postconf.5 ./man/man5/postconf.5
*** /var/tmp/postfix-2.5-20070423/man/man5/postconf.5 Sun Mar 25 11:18:47 2007
--- ./man/man5/postconf.5 Tue Apr 24 17:07:47 2007
***************
*** 1138,1143 ****
--- 1138,1149 ----
  .PP
  Time units: s (seconds), m (minutes), h (hours), d (days), w (weeks).
  The default time unit is s (seconds).
+ .SH detect_8bitmime_encoding (default: see "postconf -d" output)
+ Automatically detect 8BITMIME body content by looking at the
+ primary Content-Transfer-Encoding: message header; the default
+ setting is system dependent.
+ .PP
+ This feature is available in Postfix 2.5 and later.
  .SH disable_dns_lookups (default: no)
  Disable DNS lookups in the Postfix SMTP and LMTP clients. When
  disabled, hosts are looked up with the getaddrinfo() system
diff -cr /var/tmp/postfix-2.5-20070423/man/man8/cleanup.8 ./man/man8/cleanup.8
*** /var/tmp/postfix-2.5-20070423/man/man8/cleanup.8 Sat Mar 17 13:59:49 2007
--- ./man/man8/cleanup.8 Tue Apr 24 17:07:47 2007
***************
*** 201,206 ****
--- 201,212 ----
  .IP "\fBstrict_mime_encoding_domain (no)\fR"
  Reject mail with invalid Content-Transfer-Encoding: information
  for the message/* or multipart/* MIME content types.
+ .PP
+ Available in Postfix version 2.5 and later:
+ .IP "\fBdetect_8bitmime_encoding (see 'postconf -d' output)\fR"
+ Automatically detect 8BITMIME body content by looking at the
+ primary Content-Transfer-Encoding: message header; the default
+ setting is system dependent.
  .SH "AUTOMATIC BCC RECIPIENT CONTROLS"
  .na
  .nf
diff -cr /var/tmp/postfix-2.5-20070423/src/cleanup/cleanup.c ./src/cleanup/cleanup.c
*** /var/tmp/postfix-2.5-20070423/src/cleanup/cleanup.c Sat Mar 17 13:59:38 2007
--- ./src/cleanup/cleanup.c Tue Apr 24 17:07:27 2007
***************
*** 179,184 ****
--- 179,190 ----
  /* .IP "\fBstrict_mime_encoding_domain (no)\fR"
  /* Reject mail with invalid Content-Transfer-Encoding: information
  /* for the message/* or multipart/* MIME content types.
+ /* .PP
+ /* Available in Postfix version 2.5 and later:
+ /* .IP "\fBdetect_8bitmime_encoding (see 'postconf -d' output)\fR"
+ /* Automatically detect 8BITMIME body content by looking at the
+ /* primary Content-Transfer-Encoding: message header; the default
+ /* setting is system dependent.
  /* AUTOMATIC BCC RECIPIENT CONTROLS
  /* .ad
  /* .fi
diff -cr /var/tmp/postfix-2.5-20070423/src/cleanup/cleanup_init.c ./src/cleanup/cleanup_init.c
*** /var/tmp/postfix-2.5-20070423/src/cleanup/cleanup_init.c Sat Mar 10 18:19:41 2007
--- ./src/cleanup/cleanup_init.c Tue Apr 24 17:10:29 2007
***************
*** 160,165 ****
--- 160,166 ----
  char *var_milt_eod_macros; /* end-of-data macros */
  char *var_milt_unk_macros; /* unknown command macros */
  char *var_cleanup_milters; /* non-SMTP mail */
+ int var_auto_8bitmime; /* auto-detect MIME encoding */
  
  CONFIG_INT_TABLE cleanup_int_table[] = {
      VAR_HOPCOUNT_LIMIT, DEF_HOPCOUNT_LIMIT, &var_hopcount_limit, 1, 0,
***************
*** 174,179 ****
--- 175,181 ----
  CONFIG_BOOL_TABLE cleanup_bool_table[] = {
      VAR_ENABLE_ORCPT, DEF_ENABLE_ORCPT, &var_enable_orcpt,
      VAR_VERP_BOUNCE_OFF, DEF_VERP_BOUNCE_OFF, &var_verp_bounce_off,
+ VAR_AUTO_8BITMIME, DEF_AUTO_8BITMIME, &var_auto_8bitmime,
      0,
  };
  
diff -cr /var/tmp/postfix-2.5-20070423/src/cleanup/cleanup_message.c ./src/cleanup/cleanup_message.c
*** /var/tmp/postfix-2.5-20070423/src/cleanup/cleanup_message.c Sat Mar 10 18:20:29 2007
--- ./src/cleanup/cleanup_message.c Tue Apr 24 17:23:14 2007
***************
*** 512,518 ****
      while (ISSPACE(*hdrval))
          hdrval++;
      /* trimblanks(hdrval, 0)[0] = 0; */
! if (hdr_opts->type == HDR_CONTENT_TRANSFER_ENCODING) {
          for (cmp = code_map; cmp->name != 0; cmp++) {
              if (strcasecmp(hdrval, cmp->name) == 0) {
                  if (strcmp(cmp->encoding, MAIL_ATTR_ENC_8BIT) == 0)
--- 512,518 ----
      while (ISSPACE(*hdrval))
          hdrval++;
      /* trimblanks(hdrval, 0)[0] = 0; */
! if (var_auto_8bitmime && hdr_opts->type == HDR_CONTENT_TRANSFER_ENCODING) {
          for (cmp = code_map; cmp->name != 0; cmp++) {
              if (strcasecmp(hdrval, cmp->name) == 0) {
                  if (strcmp(cmp->encoding, MAIL_ATTR_ENC_8BIT) == 0)
diff -cr /var/tmp/postfix-2.5-20070423/src/global/mail_params.h ./src/global/mail_params.h
*** /var/tmp/postfix-2.5-20070423/src/global/mail_params.h Sat Feb 24 21:15:42 2007
--- ./src/global/mail_params.h Tue Apr 24 17:11:09 2007
***************
*** 2473,2478 ****
--- 2473,2482 ----
  #define DEF_STRICT_ENCODING 0
  extern bool var_strict_encoding;
  
+ #define VAR_AUTO_8BITMIME "detect_8bitmime_encoding"
+ #define DEF_AUTO_8BITMIME 0
+ extern int var_auto_8bitmime;
+
   /*
    * Bizarre.
    */