Module Name:    src
Committed By:   riz
Date:           Tue Aug  9 18:58:18 UTC 2011

Modified Files:
        src/external/ibm-public/postfix/dist [netbsd-5]: HISTORY makedefs
            postfix-install
        src/external/ibm-public/postfix/dist/src/cleanup [netbsd-5]:
            cleanup_milter.c
        src/external/ibm-public/postfix/dist/src/global [netbsd-5]: abounce.c
            abounce.h mail_version.h
        src/external/ibm-public/postfix/dist/src/local [netbsd-5]: Makefile.in
            bounce_workaround.c mailbox.c unknown.c
        src/external/ibm-public/postfix/dist/src/master [netbsd-5]:
            master_ent.c
        src/external/ibm-public/postfix/dist/src/milter [netbsd-5]: milter8.c
        src/external/ibm-public/postfix/dist/src/oqmgr [netbsd-5]:
            qmgr_active.c
        src/external/ibm-public/postfix/dist/src/postdrop [netbsd-5]:
            postdrop.c
        src/external/ibm-public/postfix/dist/src/qmgr [netbsd-5]: qmgr_active.c
        src/external/ibm-public/postfix/dist/src/smtpd [netbsd-5]:
            smtpd_check.c
        src/external/ibm-public/postfix/dist/src/util [netbsd-5]: sys_defs.h

Log Message:
Apply patches (requested by tron in ticket #1653):
external/ibm-public/postfix/dist/HISTORY        patch
external/ibm-public/postfix/dist/makedefs       patch
external/ibm-public/postfix/dist/postfix-install patch
external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c patch
external/ibm-public/postfix/dist/src/global/abounce.c patch
external/ibm-public/postfix/dist/src/global/abounce.h patch
external/ibm-public/postfix/dist/src/global/mail_version.h patch
external/ibm-public/postfix/dist/src/local/Makefile.in patch
external/ibm-public/postfix/dist/src/local/bounce_workaround.c patch
external/ibm-public/postfix/dist/src/local/mailbox.c patch
external/ibm-public/postfix/dist/src/local/unknown.c patch
external/ibm-public/postfix/dist/src/master/master_ent.c patch
external/ibm-public/postfix/dist/src/milter/milter8.c patch
external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c patch
external/ibm-public/postfix/dist/src/postdrop/postdrop.c patch
external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c patch
external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c patch
external/ibm-public/postfix/dist/src/util/sys_defs.h patch

        Update Postfix to version 2.7.5. Changes since version 2.7.4:
        - Performance: a high load of DSN success notification requests could
          slow down the queue manager. Solution: make the trace client
          asynchronous, just like the bounce and defer clients.
        - The local(8) delivery agent ignored table lookup errors in
          mailbox_command_maps, mailbox_transport_maps,
          fallback_transport_maps and (while bouncing mail to alias) alias
          owner lookup.
        - Workaround: dbl.spamhaus.org rejects lookups with "No IP queries"
          even if the name has an alphanumerical prefix. We play safe, and
          skip both RHSBL and RHSWL queries for names ending in a numerical
          suffix.
        - The Postfix Milter client reported a temporary error instead of
          "file too large" in three cases.
        - The "sendmail -t" command reported "protocol error" instead of
          "file too large", "no space left on device" etc.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2.2.6 -r1.1.1.2.2.7 \
    src/external/ibm-public/postfix/dist/HISTORY
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
    src/external/ibm-public/postfix/dist/makedefs
cvs rdiff -u -r1.2.2.2 -r1.2.2.3 \
    src/external/ibm-public/postfix/dist/postfix-install
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
    src/external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
    src/external/ibm-public/postfix/dist/src/global/abounce.c \
    src/external/ibm-public/postfix/dist/src/global/abounce.h
cvs rdiff -u -r1.1.1.2.2.6 -r1.1.1.2.2.7 \
    src/external/ibm-public/postfix/dist/src/global/mail_version.h
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
    src/external/ibm-public/postfix/dist/src/local/Makefile.in \
    src/external/ibm-public/postfix/dist/src/local/bounce_workaround.c \
    src/external/ibm-public/postfix/dist/src/local/mailbox.c \
    src/external/ibm-public/postfix/dist/src/local/unknown.c
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
    src/external/ibm-public/postfix/dist/src/master/master_ent.c
cvs rdiff -u -r1.1.1.2.2.4 -r1.1.1.2.2.5 \
    src/external/ibm-public/postfix/dist/src/milter/milter8.c
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
    src/external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c
cvs rdiff -u -r1.1.1.1.2.4 -r1.1.1.1.2.5 \
    src/external/ibm-public/postfix/dist/src/postdrop/postdrop.c
cvs rdiff -u -r1.1.1.1.2.3 -r1.1.1.1.2.4 \
    src/external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c
cvs rdiff -u -r1.1.1.2.2.4 -r1.1.1.2.2.5 \
    src/external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c
cvs rdiff -u -r1.1.1.1.2.5 -r1.1.1.1.2.6 \
    src/external/ibm-public/postfix/dist/src/util/sys_defs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/ibm-public/postfix/dist/HISTORY
diff -u src/external/ibm-public/postfix/dist/HISTORY:1.1.1.2.2.6 src/external/ibm-public/postfix/dist/HISTORY:1.1.1.2.2.7
--- src/external/ibm-public/postfix/dist/HISTORY:1.1.1.2.2.6	Fri Jul 15 22:29:30 2011
+++ src/external/ibm-public/postfix/dist/HISTORY	Tue Aug  9 18:58:15 2011
@@ -15891,3 +15891,54 @@
 	reuse a server SASL handle after authentication failure.
 	Problem reported by Thomas Jarosch of Intra2net AG. File:
 	smtpd/smtpd_proto.c.
+
+20110418
+
+	Bugfix (introduced Postfix 2.3 and Postfix 2.7): the Milter
+	client reported some "file too large" errors as temporary
+	errors. Problem reported by Michael Tokarev. Files:
+	milter/milter8.c, cleanup/cleanup_milter.c.
+
+20110420
+
+	Performance: a high load of DSN success notification requests
+	could slow down the queue manager. Solution: make the trace
+	client asynchronous, just like the bounce and defer clients.
+	Problem reported by Eduardo M. Stelmaszczyk of terra.com.br.
+	Files: global/abounce.[hc], *qmgr/qmgr_active.c (the
+	qmgr_active.c files are identical).
+
+20110426
+
+	Bugfix (introduced in Postfix 1.1, duplicated in Postfix
+	2.3, unrelated mistake in Postfix 2.7): the local(8) delivery
+	agent ignored table lookup errors in mailbox_command_maps,
+	mailbox_transport_maps, fallback_transport_maps and (while
+	bouncing mail to alias) alias owner lookup. Problem reported
+	by William Ono. Files: local/command.c, local/mailbox.c,
+	local/unknown.c, local/bounce_workaround.c.
+
+20110601
+
+	Bugfix (introduced Postfix 2.6 with master_service_disable)
+	loop control error when parsing a malformed master.cf file.
+	Found by Coverity. File: master/master_ent.c.
+
+20110602
+
+	Bugfix (introduced: Postfix 2.7): "sendmail -t" reported
+	"protocol error" after queue file write error.  File:
+	postdrop/postdrop.c.
+
+20110614
+
+	Linux kernel version 3 support. Linus Torvalds has reset
+	the counters for reasons not related to changes in code.
+	Files: makedefs, util/sys_defs.h.
+
+20110615
+
+	Workaround: some Spamhaus RHSBL rejects lookups with "No
+	IP queries" even if the name has an alphanumerical prefix.
+	We play safe, and skip RHSBL queries for names ending in a
+	numerical suffix.  File: smtpd/smtpd_check.c.

Index: src/external/ibm-public/postfix/dist/makedefs
diff -u src/external/ibm-public/postfix/dist/makedefs:1.1.1.1.2.4 src/external/ibm-public/postfix/dist/makedefs:1.1.1.1.2.5
--- src/external/ibm-public/postfix/dist/makedefs:1.1.1.1.2.4	Thu Mar 24 19:54:07 2011
+++ src/external/ibm-public/postfix/dist/makedefs	Tue Aug  9 18:58:15 2011
@@ -340,6 +340,33 @@
 		       fi;;
 		esac
 		;;
+    Linux.3*)	SYSTYPE=LINUX3
+		if [ -f /usr/include/db.h ]
+		then
+		    : we are all set
+		elif [ -f /usr/include/db/db.h ]
+		then
+		    CCARGS="$CCARGS -I/usr/include/db"
+		else
+		    # On a properly installed system, Postfix builds
+		    # by including <db.h> and by linking with -ldb
+		    echo "No <db.h> include file found." 1>&2
+		    echo "Install the appropriate db*-devel package first." 1>&2
+		    echo "See the RELEASE_NOTES file for more information." 1>&2
+		    exit 1
+		fi
+		SYSLIBS="-ldb"
+		for name in nsl resolv
+		do
+		    for lib in /usr/lib64 /lib64 /usr/lib /lib
+		    do
+			test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
+			    SYSLIBS="$SYSLIBS -l$name"
+			    break
+			}
+		    done
+		done
+		;;
      GNU.0*|GNU/kFreeBSD.[567]*)
      		SYSTYPE=GNU0
 		# Postfix no longer needs DB 1.85 compatibility

Index: src/external/ibm-public/postfix/dist/postfix-install
diff -u src/external/ibm-public/postfix/dist/postfix-install:1.2.2.2 src/external/ibm-public/postfix/dist/postfix-install:1.2.2.3
--- src/external/ibm-public/postfix/dist/postfix-install:1.2.2.2	Tue Sep 15 06:01:42 2009
+++ src/external/ibm-public/postfix/dist/postfix-install	Tue Aug  9 18:58:15 2011
@@ -305,7 +305,7 @@
 
 install_root_prompt="the prefix for installed file names. Specify
 this ONLY if you are building ready-to-install packages for
-distribution to other machines."
+distribution to OTHER machines. See PACKAGE_README for instructions."
 
 tempdir_prompt="a directory for scratch files while installing
 Postfix.  You must have write permission in this directory."

Index: src/external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c
diff -u src/external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c:1.1.1.1.2.4 src/external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c:1.1.1.1.2.5
--- src/external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c:1.1.1.1.2.4	Fri Jan  7 01:24:00 2011
+++ src/external/ibm-public/postfix/dist/src/cleanup/cleanup_milter.c	Tue Aug  9 18:58:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cleanup_milter.c,v 1.1.1.1.2.4 2011/01/07 01:24:00 riz Exp $	*/
+/*	$NetBSD: cleanup_milter.c,v 1.1.1.1.2.5 2011/08/09 18:58:16 riz Exp $	*/
 
 /*++
 /* NAME
@@ -216,6 +216,8 @@
 
 /*#define msg_verbose	2*/
 
+static void cleanup_milter_set_error(CLEANUP_STATE *, int);
+
 #define STR(x)		vstring_str(x)
 #define LEN(x)		VSTRING_LEN(x)
 
@@ -433,8 +435,7 @@
      * later.
      */
     if ((new_meta_offset = vstream_fseek(state->dst, (off_t) 0, SEEK_END)) < 0) {
-	msg_warn("%s: seek file %s: %m", myname, cleanup_path);
-	state->errs |= CLEANUP_STAT_WRITE;
+	cleanup_milter_set_error(state, errno);
 	return;
     }
     if (state->filter != 0)
@@ -454,8 +455,7 @@
      * value with the location of the new meta record.
      */
     if (vstream_fseek(state->dst, state->append_meta_pt_offset, SEEK_SET) < 0) {
-	msg_warn("%s: seek file %s: %m", myname, cleanup_path);
-	state->errs |= CLEANUP_STAT_WRITE;
+	cleanup_milter_set_error(state, errno);
 	return;
     }
     cleanup_out_format(state, REC_TYPE_PTR, REC_TYPE_PTR_FORMAT,

Index: src/external/ibm-public/postfix/dist/src/global/abounce.c
diff -u src/external/ibm-public/postfix/dist/src/global/abounce.c:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/global/abounce.c:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/global/abounce.c:1.1.1.1.2.3	Fri Jan  7 01:24:01 2011
+++ src/external/ibm-public/postfix/dist/src/global/abounce.c	Tue Aug  9 18:58:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: abounce.c,v 1.1.1.1.2.3 2011/01/07 01:24:01 riz Exp $	*/
+/*	$NetBSD: abounce.c,v 1.1.1.1.2.4 2011/08/09 18:58:16 riz Exp $	*/
 
 /*++
 /* NAME
@@ -69,9 +69,21 @@
 /*	int	dsn_ret;
 /*	void	(*callback)(int status, char *context);
 /*	char	*context;
+/*
+/*	void	atrace_flush(flags, queue, id, encoding, sender,
+/*				dsn_envid, dsn_ret, callback, context)
+/*	int	flags;
+/*	const char *queue;
+/*	const char *id;
+/*	const char *encoding;
+/*	const char *sender;
+/*	const char *dsn_envid;
+/*	int	dsn_ret;
+/*	void	(*callback)(int status, char *context);
+/*	char	*context;
 /* DESCRIPTION
 /*	This module implements an asynchronous interface to the
-/*	bounce/defer service for submitting sender notifications
+/*	bounce/defer/trace service for submitting sender notifications
 /*	without waiting for completion of the request.
 /*
 /*	abounce_flush() bounces the specified message to
@@ -94,6 +106,10 @@
 /*	the specified sender, including the defer log that was
 /*	built with defer_append().
 /*
+/*	atrace_flush() returns the specified message to the specified
+/*	sender, including the message delivery record log that was
+/*	built with vtrace_append().
+/*
 /*	Arguments:
 /* .IP flags
 /*	The bitwise OR of zero or more of the following (specify
@@ -361,3 +377,15 @@
 		    flags, queue, id, encoding, sender, dsn_envid, dsn_ret,
 		    callback, context);
 }
+
+/* atrace_flush - asynchronous trace flush */
+
+void    atrace_flush(int flags, const char *queue, const char *id,
+		             const char *encoding, const char *sender,
+		             const char *dsn_envid, int dsn_ret,
+		             ABOUNCE_FN callback, char *context)
+{
+    abounce_request(MAIL_CLASS_PRIVATE, var_trace_service, BOUNCE_CMD_TRACE,
+		    flags, queue, id, encoding, sender, dsn_envid, dsn_ret,
+		    callback, context);
+}
Index: src/external/ibm-public/postfix/dist/src/global/abounce.h
diff -u src/external/ibm-public/postfix/dist/src/global/abounce.h:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/global/abounce.h:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/global/abounce.h:1.1.1.1.2.3	Fri Jan  7 01:24:01 2011
+++ src/external/ibm-public/postfix/dist/src/global/abounce.h	Tue Aug  9 18:58:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: abounce.h,v 1.1.1.1.2.3 2011/01/07 01:24:01 riz Exp $	*/
+/*	$NetBSD: abounce.h,v 1.1.1.1.2.4 2011/08/09 18:58:16 riz Exp $	*/
 
 #ifndef _ABOUNCE_H_INCLUDED_
 #define _ABOUNCE_H_INCLUDED_
@@ -26,6 +26,7 @@
 extern void abounce_flush(int, const char *, const char *, const char *, const char *, const char *, int, ABOUNCE_FN, char *);
 extern void adefer_flush(int, const char *, const char *, const char *, const char *, const char *, int, ABOUNCE_FN, char *);
 extern void adefer_warn(int, const char *, const char *, const char *, const char *, const char *, int, ABOUNCE_FN, char *);
+extern void atrace_flush(int, const char *, const char *, const char *, const char *, const char *, int, ABOUNCE_FN, char *);
 
 extern void abounce_flush_verp(int, const char *, const char *, const char *, const char *, const char *, int, const char *, ABOUNCE_FN, char *);
 extern void adefer_flush_verp(int, const char *, const char *, const char *, const char *, const char *, int, const char *, ABOUNCE_FN, char *);

Index: src/external/ibm-public/postfix/dist/src/global/mail_version.h
diff -u src/external/ibm-public/postfix/dist/src/global/mail_version.h:1.1.1.2.2.6 src/external/ibm-public/postfix/dist/src/global/mail_version.h:1.1.1.2.2.7
--- src/external/ibm-public/postfix/dist/src/global/mail_version.h:1.1.1.2.2.6	Fri Jul 15 22:29:31 2011
+++ src/external/ibm-public/postfix/dist/src/global/mail_version.h	Tue Aug  9 18:58:16 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mail_version.h,v 1.1.1.2.2.6 2011/07/15 22:29:31 riz Exp $	*/
+/*	$NetBSD: mail_version.h,v 1.1.1.2.2.7 2011/08/09 18:58:16 riz Exp $	*/
 
 #ifndef _MAIL_VERSION_H_INCLUDED_
 #define _MAIL_VERSION_H_INCLUDED_
@@ -22,8 +22,8 @@
   * Patches change both the patchlevel and the release date. Snapshots have no
   * patchlevel; they change the release date only.
   */
-#define MAIL_RELEASE_DATE	"20110509"
-#define MAIL_VERSION_NUMBER	"2.7.4"
+#define MAIL_RELEASE_DATE	"20110707"
+#define MAIL_VERSION_NUMBER	"2.7.5"
 
 #ifdef SNAPSHOT
 # define MAIL_VERSION_DATE	"-" MAIL_RELEASE_DATE

Index: src/external/ibm-public/postfix/dist/src/local/Makefile.in
diff -u src/external/ibm-public/postfix/dist/src/local/Makefile.in:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/local/Makefile.in:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/local/Makefile.in:1.1.1.1.2.3	Sun Nov 21 18:31:31 2010
+++ src/external/ibm-public/postfix/dist/src/local/Makefile.in	Tue Aug  9 18:58:16 2011
@@ -106,6 +106,7 @@
 bounce_workaround.o: ../../include/been_here.h
 bounce_workaround.o: ../../include/bounce.h
 bounce_workaround.o: ../../include/canon_addr.h
+bounce_workaround.o: ../../include/defer.h
 bounce_workaround.o: ../../include/deliver_request.h
 bounce_workaround.o: ../../include/delivered_hdr.h
 bounce_workaround.o: ../../include/dict.h
Index: src/external/ibm-public/postfix/dist/src/local/bounce_workaround.c
diff -u src/external/ibm-public/postfix/dist/src/local/bounce_workaround.c:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/local/bounce_workaround.c:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/local/bounce_workaround.c:1.1.1.1.2.3	Fri Jan  7 01:24:06 2011
+++ src/external/ibm-public/postfix/dist/src/local/bounce_workaround.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bounce_workaround.c,v 1.1.1.1.2.3 2011/01/07 01:24:06 riz Exp $	*/
+/*	$NetBSD: bounce_workaround.c,v 1.1.1.1.2.4 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -79,6 +79,7 @@
 #include <strip_addr.h>
 #include <stringops.h>
 #include <bounce.h>
+#include <defer.h>
 #include <split_addr.h>
 #include <canon_addr.h>
 
@@ -99,6 +100,7 @@
 	char   *stripped_recipient;
 	char   *owner_alias;
 	const char *owner_expansion;
+	int     saved_dict_errno;
 
 #define FIND_OWNER(lhs, rhs, addr) { \
 	lhs = concatenate("owner-", addr, (char *) 0); \
@@ -106,8 +108,9 @@
 	rhs = maps_find(alias_maps, lhs, DICT_FLAG_NONE); \
     }
 
+	dict_errno = 0;
 	FIND_OWNER(owner_alias, owner_expansion, state.msg_attr.rcpt.address);
-	if (owner_expansion == 0
+	if ((saved_dict_errno = dict_errno) == 0 && owner_expansion == 0
 	    && (stripped_recipient = strip_addr(state.msg_attr.rcpt.address,
 						(char **) 0,
 						*var_rcpt_delim)) != 0) {
@@ -115,13 +118,17 @@
 	    FIND_OWNER(owner_alias, owner_expansion, stripped_recipient);
 	    myfree(stripped_recipient);
 	}
-	if (owner_expansion != 0) {
+	if ((saved_dict_errno = dict_errno) == 0 && owner_expansion != 0) {
 	    canon_owner = canon_addr_internal(vstring_alloc(10),
 					      var_exp_own_alias ?
 					      owner_expansion : owner_alias);
 	    SET_OWNER_ATTR(state.msg_attr, STR(canon_owner), state.level);
 	}
 	myfree(owner_alias);
+	if (saved_dict_errno != 0)
+	    /* At this point, canon_owner == 0. */
+	    return (defer_append(BOUNCE_FLAGS(state.request),
+				 BOUNCE_ATTR(state.msg_attr)));
     }
 
     /*
Index: src/external/ibm-public/postfix/dist/src/local/mailbox.c
diff -u src/external/ibm-public/postfix/dist/src/local/mailbox.c:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/local/mailbox.c:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/local/mailbox.c:1.1.1.1.2.3	Fri Jan  7 01:24:06 2011
+++ src/external/ibm-public/postfix/dist/src/local/mailbox.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mailbox.c,v 1.1.1.1.2.3 2011/01/07 01:24:06 riz Exp $	*/
+/*	$NetBSD: mailbox.c,v 1.1.1.1.2.4 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -280,6 +280,7 @@
 	transp_maps = maps_create(VAR_MBOX_TRANSP_MAPS, var_mbox_transp_maps,
 				  DICT_FLAG_LOCK | DICT_FLAG_NO_REGSUB);
     /* The -1 is a hint for the down-stream deliver_completed() function. */
+    dict_errno = 0;
     if (*var_mbox_transp_maps
 	&& (map_transport = maps_find(transp_maps, state.msg_attr.user,
 				      DICT_FLAG_NONE)) != 0) {
@@ -287,6 +288,11 @@
 	*statusp = deliver_pass(MAIL_CLASS_PRIVATE, map_transport,
 				state.request, &state.msg_attr.rcpt);
 	return (YES);
+    } else if (dict_errno != 0) {
+	/* Details in the logfile. */
+	dsb_simple(state.msg_attr.why, "4.3.0", "table lookup failure");
+	*statusp = DEL_STAT_DEFER;
+	return (YES);
     }
     if (*var_mailbox_transport) {
 	state.msg_attr.rcpt.offset = -1L;
@@ -321,10 +327,15 @@
 	cmd_maps = maps_create(VAR_MAILBOX_CMD_MAPS, var_mailbox_cmd_maps,
 			       DICT_FLAG_LOCK | DICT_FLAG_PARANOID);
 
+    dict_errno = 0;
     if (*var_mailbox_cmd_maps
 	&& (map_command = maps_find(cmd_maps, state.msg_attr.user,
 				    DICT_FLAG_NONE)) != 0) {
 	status = deliver_command(state, usr_attr, map_command);
+    } else if (dict_errno != 0) {
+	/* Details in the logfile. */
+	dsb_simple(state.msg_attr.why, "4.3.0", "table lookup failure");
+	status = DEL_STAT_DEFER;
     } else if (*var_mailbox_command) {
 	status = deliver_command(state, usr_attr, var_mailbox_command);
     } else if (*var_home_mailbox && LAST_CHAR(var_home_mailbox) == '/') {
Index: src/external/ibm-public/postfix/dist/src/local/unknown.c
diff -u src/external/ibm-public/postfix/dist/src/local/unknown.c:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/local/unknown.c:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/local/unknown.c:1.1.1.1.2.3	Fri Jan  7 01:24:06 2011
+++ src/external/ibm-public/postfix/dist/src/local/unknown.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: unknown.c,v 1.1.1.1.2.3 2011/01/07 01:24:06 riz Exp $	*/
+/*	$NetBSD: unknown.c,v 1.1.1.1.2.4 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -112,12 +112,17 @@
 	transp_maps = maps_create(VAR_FBCK_TRANSP_MAPS, var_fbck_transp_maps,
 				  DICT_FLAG_LOCK | DICT_FLAG_NO_REGSUB);
     /* The -1 is a hint for the down-stream deliver_completed() function. */
+    dict_errno = 0;
     if (*var_fbck_transp_maps
 	&& (map_transport = maps_find(transp_maps, state.msg_attr.user,
 				      DICT_FLAG_NONE)) != 0) {
 	state.msg_attr.rcpt.offset = -1L;
 	return (deliver_pass(MAIL_CLASS_PRIVATE, map_transport,
 			     state.request, &state.msg_attr.rcpt));
+    } else if (dict_errno != 0) {
+	/* Details in the logfile. */
+	dsb_simple(state.msg_attr.why, "4.3.0", "table lookup failure");
+	return (DEL_STAT_DEFER);
     }
     if (*var_fallback_transport) {
 	state.msg_attr.rcpt.offset = -1L;

Index: src/external/ibm-public/postfix/dist/src/master/master_ent.c
diff -u src/external/ibm-public/postfix/dist/src/master/master_ent.c:1.1.1.1.2.4 src/external/ibm-public/postfix/dist/src/master/master_ent.c:1.1.1.1.2.5
--- src/external/ibm-public/postfix/dist/src/master/master_ent.c:1.1.1.1.2.4	Fri Jan  7 01:24:07 2011
+++ src/external/ibm-public/postfix/dist/src/master/master_ent.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: master_ent.c,v 1.1.1.1.2.4 2011/01/07 01:24:07 riz Exp $	*/
+/*	$NetBSD: master_ent.c,v 1.1.1.1.2.5 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -274,7 +274,7 @@
     /*
      * Skip blank lines and comment lines.
      */
-    do {
+    for (;;) {
 	if (readlline(buf, master_fp, &master_line) == 0) {
 	    vstring_free(buf);
 	    vstring_free(junk);
@@ -286,7 +286,9 @@
 	name = cp;
 	transport = get_str_ent(&bufp, "transport type", (char *) 0);
 	vstring_sprintf(junk, "%s.%s", name, transport);
-    } while (match_service_match(master_disable, vstring_str(junk)) != 0);
+	if (match_service_match(master_disable, vstring_str(junk)) == 0)
+	    break;
+    }
 
     /*
      * Parse one logical line from the configuration file. Initialize service

Index: src/external/ibm-public/postfix/dist/src/milter/milter8.c
diff -u src/external/ibm-public/postfix/dist/src/milter/milter8.c:1.1.1.2.2.4 src/external/ibm-public/postfix/dist/src/milter/milter8.c:1.1.1.2.2.5
--- src/external/ibm-public/postfix/dist/src/milter/milter8.c:1.1.1.2.2.4	Fri Jan  7 01:24:07 2011
+++ src/external/ibm-public/postfix/dist/src/milter/milter8.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: milter8.c,v 1.1.1.2.2.4 2011/01/07 01:24:07 riz Exp $	*/
+/*	$NetBSD: milter8.c,v 1.1.1.2.2.5 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -2464,6 +2464,7 @@
     int     mime_errs = 0;
     MILTER_MSG_CONTEXT msg_ctx;
     VSTRING *buf;
+    int     saved_errno;
 
     switch (milter->state) {
     case MILTER8_STAT_ERROR:
@@ -2477,8 +2478,12 @@
 	if (msg_verbose)
 	    msg_info("%s: message to milter %s", myname, milter->m.name);
 	if (vstream_fseek(qfile, data_offset, SEEK_SET) < 0) {
+	    saved_errno = errno;
 	    msg_warn("%s: vstream_fseek %s: %m", myname, VSTREAM_PATH(qfile));
-	    return ("450 4.3.0 Queue file write error");
+	    /* XXX This should be available from cleanup_strerror.c. */
+	    return (saved_errno == EFBIG ?
+		    "552 5.3.4 Message file too big" :
+		    "451 4.3.0 Queue file write error");
 	}
 	msg_ctx.milter = milter;
 	msg_ctx.eoh_macros = eoh_macros;

Index: src/external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c
diff -u src/external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c:1.1.1.1.2.3	Fri Jan  7 01:24:07 2011
+++ src/external/ibm-public/postfix/dist/src/oqmgr/qmgr_active.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: qmgr_active.c,v 1.1.1.1.2.3 2011/01/07 01:24:07 riz Exp $	*/
+/*	$NetBSD: qmgr_active.c,v 1.1.1.1.2.4 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -118,6 +118,8 @@
   */
 static void qmgr_active_done_2_bounce_flush(int, char *);
 static void qmgr_active_done_2_generic(QMGR_MESSAGE *);
+static void qmgr_active_done_25_trace_flush(int, char *);
+static void qmgr_active_done_25_generic(QMGR_MESSAGE *);
 static void qmgr_active_done_3_defer_flush(int, char *);
 static void qmgr_active_done_3_defer_warn(int, char *);
 static void qmgr_active_done_3_generic(QMGR_MESSAGE *);
@@ -338,10 +340,8 @@
 
 static void qmgr_active_done_2_generic(QMGR_MESSAGE *message)
 {
-    const char *myname = "qmgr_active_done_2_generic";
     const char *path;
     struct stat st;
-    int     status;
 
     /*
      * A delivery agent marks a queue file as corrupt by changing its
@@ -374,10 +374,6 @@
     }
 
     /*
-     * As a temporary implementation, synchronously inform the sender of
-     * trace information. This will block for 10 seconds when the qmgr FIFO
-     * is full.
-     * 
      * XXX With multi-recipient mail, some recipients may have NOTIFY=SUCCESS
      * and others not. Depending on what subset of recipients are delivered,
      * a trace file may or may not be created. Even when the last partial
@@ -390,19 +386,46 @@
      */
     if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD))
 	|| (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) {
-	status = trace_flush(message->tflags,
-			     message->queue_name,
-			     message->queue_id,
-			     message->encoding,
-			     message->sender,
-			     message->dsn_envid,
-			     message->dsn_ret);
-	if (status == 0 && message->tflags_offset)
-	    qmgr_message_kill_record(message, message->tflags_offset);
-	message->flags |= status;
+	atrace_flush(message->tflags,
+		     message->queue_name,
+		     message->queue_id,
+		     message->encoding,
+		     message->sender,
+		     message->dsn_envid,
+		     message->dsn_ret,
+		     qmgr_active_done_25_trace_flush,
+		     (char *) message);
+	return;
     }
 
     /*
+     * Asynchronous processing does not reach this point.
+     */
+    qmgr_active_done_25_generic(message);
+}
+
+/* qmgr_active_done_25_trace_flush - continue after atrace_flush() completion */
+
+static void qmgr_active_done_25_trace_flush(int status, char *context)
+{
+    QMGR_MESSAGE *message = (QMGR_MESSAGE *) context;
+
+    /*
+     * Process atrace_flush() status and continue processing.
+     */
+    if (status == 0 && message->tflags_offset)
+	qmgr_message_kill_record(message, message->tflags_offset);
+    message->flags |= status;
+    qmgr_active_done_25_generic(message);
+}
+
+/* qmgr_active_done_25_generic - continue processing */
+
+static void qmgr_active_done_25_generic(QMGR_MESSAGE *message)
+{
+    const char *myname = "qmgr_active_done_25_generic";
+
+    /*
      * If we get to this point we have tried all recipients for this message.
      * If the message is too old, try to bounce it.
      * 

Index: src/external/ibm-public/postfix/dist/src/postdrop/postdrop.c
diff -u src/external/ibm-public/postfix/dist/src/postdrop/postdrop.c:1.1.1.1.2.4 src/external/ibm-public/postfix/dist/src/postdrop/postdrop.c:1.1.1.1.2.5
--- src/external/ibm-public/postfix/dist/src/postdrop/postdrop.c:1.1.1.1.2.4	Fri Jan  7 01:24:09 2011
+++ src/external/ibm-public/postfix/dist/src/postdrop/postdrop.c	Tue Aug  9 18:58:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: postdrop.c,v 1.1.1.1.2.4 2011/01/07 01:24:09 riz Exp $	*/
+/*	$NetBSD: postdrop.c,v 1.1.1.1.2.5 2011/08/09 18:58:17 riz Exp $	*/
 
 /*++
 /* NAME
@@ -237,6 +237,7 @@
     int     saved_errno;
     int     from_count = 0;
     int     rcpt_count = 0;
+    int     validate_input = 1;
 
     /*
      * Fingerprint executables and core dumps.
@@ -455,6 +456,7 @@
 		   && rec_type != REC_TYPE_EOF)
 		if (rec_type == REC_TYPE_ERROR)
 		    msg_fatal("uid=%ld: malformed input", (long) uid);
+	    validate_input = 0;
 	    errno = saved_errno;
 	    break;
 	}
@@ -480,7 +482,7 @@
      * the segment terminator records, there aren't any other mandatory
      * records in a Postfix submission queue file.
      */
-    if (from_count == 0 || rcpt_count == 0) {
+    if (validate_input && (from_count == 0 || rcpt_count == 0)) {
 	status = CLEANUP_STAT_BAD;
 	mail_stream_cleanup(dst);
     }

Index: src/external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c
diff -u src/external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c:1.1.1.1.2.3 src/external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c:1.1.1.1.2.4
--- src/external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c:1.1.1.1.2.3	Fri Jan  7 01:24:11 2011
+++ src/external/ibm-public/postfix/dist/src/qmgr/qmgr_active.c	Tue Aug  9 18:58:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: qmgr_active.c,v 1.1.1.1.2.3 2011/01/07 01:24:11 riz Exp $	*/
+/*	$NetBSD: qmgr_active.c,v 1.1.1.1.2.4 2011/08/09 18:58:18 riz Exp $	*/
 
 /*++
 /* NAME
@@ -118,6 +118,8 @@
   */
 static void qmgr_active_done_2_bounce_flush(int, char *);
 static void qmgr_active_done_2_generic(QMGR_MESSAGE *);
+static void qmgr_active_done_25_trace_flush(int, char *);
+static void qmgr_active_done_25_generic(QMGR_MESSAGE *);
 static void qmgr_active_done_3_defer_flush(int, char *);
 static void qmgr_active_done_3_defer_warn(int, char *);
 static void qmgr_active_done_3_generic(QMGR_MESSAGE *);
@@ -338,10 +340,8 @@
 
 static void qmgr_active_done_2_generic(QMGR_MESSAGE *message)
 {
-    const char *myname = "qmgr_active_done_2_generic";
     const char *path;
     struct stat st;
-    int     status;
 
     /*
      * A delivery agent marks a queue file as corrupt by changing its
@@ -374,10 +374,6 @@
     }
 
     /*
-     * As a temporary implementation, synchronously inform the sender of
-     * trace information. This will block for 10 seconds when the qmgr FIFO
-     * is full.
-     * 
      * XXX With multi-recipient mail, some recipients may have NOTIFY=SUCCESS
      * and others not. Depending on what subset of recipients are delivered,
      * a trace file may or may not be created. Even when the last partial
@@ -390,19 +386,46 @@
      */
     if ((message->tflags & (DEL_REQ_FLAG_USR_VRFY | DEL_REQ_FLAG_RECORD))
 	|| (message->rflags & QMGR_READ_FLAG_NOTIFY_SUCCESS)) {
-	status = trace_flush(message->tflags,
-			     message->queue_name,
-			     message->queue_id,
-			     message->encoding,
-			     message->sender,
-			     message->dsn_envid,
-			     message->dsn_ret);
-	if (status == 0 && message->tflags_offset)
-	    qmgr_message_kill_record(message, message->tflags_offset);
-	message->flags |= status;
+	atrace_flush(message->tflags,
+		     message->queue_name,
+		     message->queue_id,
+		     message->encoding,
+		     message->sender,
+		     message->dsn_envid,
+		     message->dsn_ret,
+		     qmgr_active_done_25_trace_flush,
+		     (char *) message);
+	return;
     }
 
     /*
+     * Asynchronous processing does not reach this point.
+     */
+    qmgr_active_done_25_generic(message);
+}
+
+/* qmgr_active_done_25_trace_flush - continue after atrace_flush() completion */
+
+static void qmgr_active_done_25_trace_flush(int status, char *context)
+{
+    QMGR_MESSAGE *message = (QMGR_MESSAGE *) context;
+
+    /*
+     * Process atrace_flush() status and continue processing.
+     */
+    if (status == 0 && message->tflags_offset)
+	qmgr_message_kill_record(message, message->tflags_offset);
+    message->flags |= status;
+    qmgr_active_done_25_generic(message);
+}
+
+/* qmgr_active_done_25_generic - continue processing */
+
+static void qmgr_active_done_25_generic(QMGR_MESSAGE *message)
+{
+    const char *myname = "qmgr_active_done_25_generic";
+
+    /*
      * If we get to this point we have tried all recipients for this message.
      * If the message is too old, try to bounce it.
      * 

Index: src/external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c
diff -u src/external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c:1.1.1.2.2.4 src/external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c:1.1.1.2.2.5
--- src/external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c:1.1.1.2.2.4	Fri Jan  7 01:24:14 2011
+++ src/external/ibm-public/postfix/dist/src/smtpd/smtpd_check.c	Tue Aug  9 18:58:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: smtpd_check.c,v 1.1.1.2.2.4 2011/01/07 01:24:14 riz Exp $	*/
+/*	$NetBSD: smtpd_check.c,v 1.1.1.2.2.5 2011/08/09 18:58:18 riz Exp $	*/
 
 /*++
 /* NAME
@@ -3226,6 +3226,7 @@
     SMTPD_RBL_STATE *rbl;
     const char *domain;
     const char *reply_addr;
+    const char *suffix;
 
     if (msg_verbose)
 	msg_info("%s: %s %s", myname, reply_class, what);
@@ -3240,7 +3241,16 @@
 	    return (SMTPD_CHECK_DUNNO);
     } else
 	domain = what;
-    if (domain[0] == 0)
+
+    /*
+     * XXX Some Spamhaus RHSBL rejects lookups with "No IP queries" even if
+     * the name has an alphanumerical prefix. We play safe, and skip RHSBL
+     * queries for names ending in a numerical suffix.
+     */
+    if (domain[0] == 0 || valid_hostname(domain, DONT_GRIPE) == 0)
+	return (SMTPD_CHECK_DUNNO);
+    suffix = strrchr(domain, '.');
+    if (alldig(suffix == 0 ? domain : suffix + 1))
 	return (SMTPD_CHECK_DUNNO);
 
     query = vstring_alloc(100);
@@ -3791,8 +3801,7 @@
 			 name);
 	    else {
 		cpp += 1;
-		if (state->helo_name
-		    && valid_hostname(state->helo_name, DONT_GRIPE))
+		if (state->helo_name)
 		    status = reject_rbl_domain(state, *cpp, state->helo_name,
 					       SMTPD_NAME_HELO);
 	    }

Index: src/external/ibm-public/postfix/dist/src/util/sys_defs.h
diff -u src/external/ibm-public/postfix/dist/src/util/sys_defs.h:1.1.1.1.2.5 src/external/ibm-public/postfix/dist/src/util/sys_defs.h:1.1.1.1.2.6
--- src/external/ibm-public/postfix/dist/src/util/sys_defs.h:1.1.1.1.2.5	Thu Mar 24 19:54:09 2011
+++ src/external/ibm-public/postfix/dist/src/util/sys_defs.h	Tue Aug  9 18:58:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_defs.h,v 1.1.1.1.2.5 2011/03/24 19:54:09 riz Exp $	*/
+/*	$NetBSD: sys_defs.h,v 1.1.1.1.2.6 2011/08/09 18:58:18 riz Exp $	*/
 
 #ifndef _SYS_DEFS_H_INCLUDED_
 #define _SYS_DEFS_H_INCLUDED_
@@ -705,7 +705,7 @@
  /*
   * LINUX.
   */
-#ifdef LINUX2
+#if defined(LINUX2) || defined(LINUX3)
 #define SUPPORTED
 #include <sys/types.h>
 #define UINT32_TYPE	unsigned int

Reply via email to