OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
PATCH: Mail to recipients ending in a "."

From: Wietse Venema (wietseporcupine.org)
Date: Mon Jun 30 2003 - 08:49:19 CDT


Ralf Hildebrandt:
> * Ralf Hildebrandt <Ralf.Hildebrandtcharite.de>:
>
> > > > noesmtp unix - - - - - smtp
> > > > -o smtp_never_send_ehlo=yes
> > > > -o smtp_always_send_ehlo=no
> > > > -o smtp_disable_dot_quoting=yes
> > > > # Dieser SMTP Sender spricht NIE ESMTP!
> > >
> > > RFC 821 quoting is all or nothing, I am afraid. Turning off
> > > individual element results in code that is just gross.
> >
> > I could have guessed.
> >
> > > However, not today. I was going to catch up reading and I already
> > > find I'm spending hours doing code and patches today.
> >
> > Well, it *WOULD* contribute to sendmail compatability.
>
> Just today a ghost of days gone past came back to haunt me (see
> above). Any news on that? OTOH, I have the user that mail cannot be
> sent to ask the support of doctors.org.uk directly.

Although this is a very small change, I suggest you test this before
doing full deployment.

This patch adds a new parameter "smtp_quote_rfc821_envelope" that
controls whether the SMTP client follows RFC 821 in MAIL FROM and
RCPT TO commands. Use with a master.cf entry like this:

    noquote ... ... .. ... ... . ... smtp -o smtp_quote_rfc821_envelope=no

and a corresponding transport map entry for the losing domain.

        Wietse

diff -cr /tmp/postfix-2.0.13-20030630/src/global/mail_params.h src/global/mail_params.h
*** /tmp/postfix-2.0.13-20030630/src/global/mail_params.h Tue Jun 24 14:52:16 2003
--- src/global/mail_params.h Mon Jun 30 09:34:00 2003
***************
*** 763,768 ****
--- 763,772 ----
  #define DEF_SMTP_QUIT_TMOUT "300s"
  extern int var_smtp_quit_tmout;
  
+ #define VAR_SMTP_QUOTE_821_ENV "smtp_quote_rfc821_envelope"
+ #define DEF_SMTP_QUOTE_821_ENV 1
+ extern int var_smtp_quote_821_env;
+
  #define VAR_SMTP_SKIP_4XX "smtp_skip_4xx_greeting"
  #define DEF_SMTP_SKIP_4XX 1
  extern bool var_smtp_skip_4xx_greeting;
diff -cr /tmp/postfix-2.0.13-20030630/src/smtp/smtp.c src/smtp/smtp.c
*** /tmp/postfix-2.0.13-20030630/src/smtp/smtp.c Thu Apr 17 17:07:21 2003
--- src/smtp/smtp.c Mon Jun 30 09:41:04 2003
***************
*** 118,123 ****
--- 118,126 ----
  /* Some SMTP servers misbehave on long lines.
  /* .IP \fBsmtp_helo_name\fR
  /* The hostname to be used in HELO and EHLO commands.
+ /* .IP \fBsmtp_quote_rfc821_envelope\fR
+ /* Whether or not to quote MAIL FROM and RCPT TO addresses as
+ /* per the rules laid out in RFC 821.
  /* .IP \fBsmtp_skip_4xx_greeting\fR
  /* Skip servers that greet us with a 4xx status code.
  /* .IP \fBsmtp_skip_5xx_greeting\fR
***************
*** 298,303 ****
--- 301,307 ----
  int var_smtp_line_limit;
  char *var_smtp_helo_name;
  char *var_smtp_host_lookup;
+ int var_smtp_quote_821_env;
  
   /*
    * Global variables. smtp_errno is set by the address lookup routines and by
***************
*** 509,514 ****
--- 513,519 ----
          VAR_SMTP_NEVER_EHLO, DEF_SMTP_NEVER_EHLO, &var_smtp_never_ehlo,
          VAR_SMTP_SASL_ENABLE, DEF_SMTP_SASL_ENABLE, &var_smtp_sasl_enable,
          VAR_SMTP_RAND_ADDR, DEF_SMTP_RAND_ADDR, &var_smtp_rand_addr,
+ VAR_SMTP_QUOTE_821_ENV, DEF_SMTP_QUOTE_821_ENV, &var_smtp_quote_821_env,
          0,
      };
  
diff -cr /tmp/postfix-2.0.13-20030630/src/smtp/smtp_proto.c src/smtp/smtp_proto.c
*** /tmp/postfix-2.0.13-20030630/src/smtp/smtp_proto.c Fri Apr 18 10:17:27 2003
--- src/smtp/smtp_proto.c Mon Jun 30 09:36:27 2003
***************
*** 379,385 ****
       * Macros for readability.
       */
  #define REWRITE_ADDRESS(dst, mid, src) do { \
! if (*(src)) { \
              quote_821_local(mid, src); \
              smtp_unalias_addr(dst, vstring_str(mid)); \
          } else { \
--- 379,385 ----
       * Macros for readability.
       */
  #define REWRITE_ADDRESS(dst, mid, src) do { \
! if (*(src) && var_smtp_quote_821_env) { \
              quote_821_local(mid, src); \
              smtp_unalias_addr(dst, vstring_str(mid)); \
          } else { \
***************
*** 388,394 ****
      } while (0)
  
  #define QUOTE_ADDRESS(dst, src) do { \
! if (*(src)) { \
              quote_821_local(dst, src); \
          } else { \
              vstring_strcpy(dst, src); \
--- 388,394 ----
      } while (0)
  
  #define QUOTE_ADDRESS(dst, src) do { \
! if (*(src) && var_smtp_quote_821_env) { \
              quote_821_local(dst, src); \
          } else { \
              vstring_strcpy(dst, src); \