Subject: Postfix 19991231 Patch 05 available

From: [email-masked] (Wietse Venema)
Date: Thu, 9 Mar 2000 15:34:00 -0500 (EST)

This patch combines several fixes that were mailed to the postfix
list in the past few weeks.

In order of decreasing seriousness, the changes are:

  - The SMTP server's "User unknown" test didn't notice LDAP etc.
    dictionary access errors. The code now reports a 450 status
    (try again instead of bounce) if the reply is not definitive.
    File:  smtp/smtpd_check.c.

  - The SMTP server would produce a cryptic message when a queue
    file write error happened before it had written any recipients.

  - The postconf command reported some parameters more than once
    because the parameter extracting script didn't recognize lines
    that differ in whitespace only.

  - The SMTP client now logs log host+port when it is unable to
    connect to a non-MX host, just like it logs host+port when
    unable to connect to an MX host. This answers any questions
    whether Postfix tries all A records before giving up.

A fully-patched version of the source code is being made available
via the usual FTP servers, primary site:

    ftp://ftp.porcupine.org/mirrors/postfix-release/official/

Or, if you use a web browser,

    ftp://ftp.porcupine.org/mirrors/postfix-release/index.html

Happy Postfixing.

        Wietse

diff -cr ../postfix-19991231-pl04/global/mail_version.h ./global/mail_version.h
*** ../postfix-19991231-pl04/global/mail_version.h	Sat Jan 29 18:57:01 2000
--- ./global/mail_version.h	Wed Mar  8 18:18:30 2000
***************
*** 15,21 ****
    * Version of this program.
    */
  #define VAR_MAIL_VERSION	"mail_version"
! #define DEF_MAIL_VERSION	"Postfix-19991231-pl04"
  extern char *var_mail_version;
  
  /* LICENSE
--- 15,21 ----
    * Version of this program.
    */
  #define VAR_MAIL_VERSION	"mail_version"
! #define DEF_MAIL_VERSION	"Postfix-19991231-pl05"
  extern char *var_mail_version;
  
  /* LICENSE
diff -cr ../postfix-19991231-pl04/HISTORY ./HISTORY
*** ../postfix-19991231-pl04/HISTORY	Sun Jan 30 13:27:48 2000
--- ./HISTORY	Wed Mar  8 19:02:52 2000
***************
*** 3616,3618 ****
--- 3616,3645 ----
  
  	Bugfix: the too long header fix of 20000115-22 lost mail
  	without (blank line + message body).
+ 
+ 20000214
+ 
+ 	Bugfix: postconf reported some parameters more than once
+ 	because the parameter extracting script didn't recognize
+ 	lines that differ in whitespace only. File: postconf/extract.awk.
+ 	Reported by Kenn Martin.
+ 
+ 20000221
+ 
+ 	Logging: the SMTP client now logs log host+port when it is
+ 	unable to connect to a non-MX host, just like it logs
+ 	host+port when unable to connect to an MX host.
+ 
+ 20000226
+ 
+ 	Bugfix: the SMTP server's "User unknown" test didn't notice
+ 	LDAP etc. dictionary access errors. The code now reports
+ 	a 450 status (try again instead of bounce) if the reply is
+ 	not definitive.  File: smtp/smtpd_check.c.
+ 
+ 20000308
+ 
+ 	Bugfix: the SMTP server would produce a cryptic message
+ 	when a queue file write error happened before it had written
+ 	any recipients.  Keith Stevenson. File: smtpd/smtpd.c.
+ 
diff -cr ../postfix-19991231-pl04/postconf/extract.awk ./postconf/extract.awk
*** ../postfix-19991231-pl04/postconf/extract.awk	Sun Nov 14 17:23:00 1999
--- ./postconf/extract.awk	Wed Mar  8 18:40:43 2000
***************
*** 1,21 ****
  # Extract initialization tables from actual source code.
  
! /static CONFIG_INT_TABLE/,/};/ { 
      if ($1 ~ /VAR/) {
  	print "int " substr($3,2,length($3)-2) ";" > "int_vars.h"
! 	print | "sort -u >int_table.h" 
      }
  }
! /static CONFIG_STR_TABLE/,/};/ { 
      if ($1 ~ /VAR/) {
  	print "char *" substr($3,2,length($3)-2) ";" > "str_vars.h"
! 	print | "sort -u >str_table.h" 
      }
  }
! /static CONFIG_BOOL_TABLE/,/};/ { 
      if ($1 ~ /VAR/) {
  	print "int " substr($3,2,length($3)-2) ";" > "bool_vars.h"
! 	print | "sort -u >bool_table.h" 
      }
  }
  
--- 1,21 ----
  # Extract initialization tables from actual source code.
  
! /^(static| )*CONFIG_INT_TABLE .*{/,/};/ { 
      if ($1 ~ /VAR/) {
  	print "int " substr($3,2,length($3)-2) ";" > "int_vars.h"
! 	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >int_table.h" 
      }
  }
! /^(static| )*CONFIG_STR_TABLE .*{/,/};/ { 
      if ($1 ~ /VAR/) {
  	print "char *" substr($3,2,length($3)-2) ";" > "str_vars.h"
! 	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >str_table.h" 
      }
  }
! /^(static| )*CONFIG_BOOL_TABLE .*{/,/};/ { 
      if ($1 ~ /VAR/) {
  	print "int " substr($3,2,length($3)-2) ";" > "bool_vars.h"
! 	print | "sed 's/[ 	][ 	]*/ /g' | sort -u >bool_table.h" 
      }
  }
  
diff -cr ../postfix-19991231-pl04/smtp/smtp_connect.c ./smtp/smtp_connect.c
*** ../postfix-19991231-pl04/smtp/smtp_connect.c	Thu Nov 18 21:52:57 1999
--- ./smtp/smtp_connect.c	Wed Mar  8 19:05:13 2000
***************
*** 250,255 ****
--- 250,256 ----
  	    session->best = 1;
  	    break;
  	}
+ 	msg_info("%s (port %d)", vstring_str(why), ntohs(port));
      }
      dns_rr_free(addr_list);
      return (session);
diff -cr ../postfix-19991231-pl04/smtpd/smtpd.c ./smtpd/smtpd.c
*** ../postfix-19991231-pl04/smtpd/smtpd.c	Thu Mar  9 14:33:12 2000
--- ./smtpd/smtpd.c	Wed Mar  8 18:48:58 2000
***************
*** 860,868 ****
      } else if ((state->err & CLEANUP_STAT_BAD) != 0) {
  	state->error_mask |= MAIL_ERROR_SOFTWARE;
  	smtpd_chat_reply(state, "451 Error: internal error %d", state->err);
-     } else if ((state->err & CLEANUP_STAT_RCPT) != 0) {
- 	state->error_mask |= MAIL_ERROR_SOFTWARE;
- 	smtpd_chat_reply(state, "451 Error: internal error %d", state->err);
      } else if ((state->err & CLEANUP_STAT_SIZE) != 0) {
  	state->error_mask |= MAIL_ERROR_BOUNCE;
  	smtpd_chat_reply(state, "552 Error: message too large");
--- 860,865 ----
***************
*** 875,880 ****
--- 872,880 ----
      } else if ((state->err & CLEANUP_STAT_WRITE) != 0) {
  	state->error_mask |= MAIL_ERROR_RESOURCE;
  	smtpd_chat_reply(state, "451 Error: queue file write error");
+     } else if ((state->err & CLEANUP_STAT_RCPT) != 0) {
+ 	state->error_mask |= MAIL_ERROR_SOFTWARE;
+ 	smtpd_chat_reply(state, "451 Error: internal error %d", state->err);
      } else {
  	msg_panic("data_cmd: unknown status %d", state->err);
      }
diff -cr ../postfix-19991231-pl04/smtpd/smtpd_check.c ./smtpd/smtpd_check.c
*** ../postfix-19991231-pl04/smtpd/smtpd_check.c	Thu Mar  9 14:33:40 2000
--- ./smtpd/smtpd_check.c	Wed Mar  8 18:45:25 2000
***************
*** 1969,1984 ****
  	    msg_warn("page and in the FAQ entry for virtual domains");
  	    SMTPD_CHECK_RCPT_RETURN(0);
  	}
  	if (*var_local_rcpt_maps
  	    && !mail_addr_find(rcpt_canon_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(canonical_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(relocated_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(local_rcpt_maps, STR(reply.recipient), NOP)) {
  	    (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
! 				      "550 <%s>: User unknown", recipient);
  	    SMTPD_CHECK_RCPT_RETURN(STR(error_text));
  	}
      } else {
  	if (*var_virtual_maps
  	    && !mail_addr_find(rcpt_canon_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(canonical_maps, STR(reply.recipient), NOP)
--- 1969,1987 ----
  	    msg_warn("page and in the FAQ entry for virtual domains");
  	    SMTPD_CHECK_RCPT_RETURN(0);
  	}
+ 	dict_errno = 0;
  	if (*var_local_rcpt_maps
  	    && !mail_addr_find(rcpt_canon_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(canonical_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(relocated_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(local_rcpt_maps, STR(reply.recipient), NOP)) {
  	    (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
! 				      "%d <%s>: User unknown",
! 				      dict_errno ? 450 : 550, recipient);
  	    SMTPD_CHECK_RCPT_RETURN(STR(error_text));
  	}
      } else {
+ 	dict_errno = 0;
  	if (*var_virtual_maps
  	    && !mail_addr_find(rcpt_canon_maps, STR(reply.recipient), NOP)
  	    && !mail_addr_find(canonical_maps, STR(reply.recipient), NOP)
***************
*** 1986,1992 ****
  	    && !mail_addr_find(virtual_maps, STR(reply.recipient), NOP)
  	    && maps_find(virtual_maps, domain, 0)) {
  	    (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
! 				      "550 <%s>: User unknown", recipient);
  	    SMTPD_CHECK_RCPT_RETURN(STR(error_text));
  	}
      }
--- 1989,1996 ----
  	    && !mail_addr_find(virtual_maps, STR(reply.recipient), NOP)
  	    && maps_find(virtual_maps, domain, 0)) {
  	    (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE,
! 				      "%d <%s>: User unknown",
! 				      dict_errno ? 450 : 550, recipient);
  	    SMTPD_CHECK_RCPT_RETURN(STR(error_text));
  	}
      }