From e5dc4dffbc0d55eeea5fef856035539c3ee56a8e Mon Sep 17 00:00:00 2001 From: Wietse Venema Date: Mon, 30 Jan 2012 00:00:00 -0500 Subject: [PATCH] postfix-2.10-20120130 --- postfix/HISTORY | 18 +++++++++++ postfix/src/bounce/bounce_trace_service.c | 37 +++++++++++++++++++++-- postfix/src/global/dict_sqlite.c | 8 ++++- postfix/src/global/mail_version.h | 2 +- 4 files changed, 60 insertions(+), 5 deletions(-) diff --git a/postfix/HISTORY b/postfix/HISTORY index 8d0758c5b..fc18e1ee7 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -17589,3 +17589,21 @@ Apologies for any names omitted. This is a real stinker that causes Postfix to fail without any prior warning. File: util/warn_stat.[hc], and everything that directly calls stat(), fstat() or lstat(). + +20120127 + + Bugfix (introduced: Postfix 2.8): the Postfix client sqlite + quoting routine returned the unquoted result instead of the + quoted text. The opportunities for misuse are limited, + because Postfix sqlite files are usually owned by root, and + because Postfix daemons usually run with non-root privileges. + File: global/dict_sqlite.c. + +20120130 + + Bugfix (introduced: Postfix 2.3): the trace service did not + distinguish between notifications for a non-bounce or a + single-bounce message. This code pre-dates DSN support and + should have been updated when it was re-purposed to handle + DSN SUCCESS notifications. Problem reported by Sabahattin + Gucukoglu. File: bounce/bounce_trace_service.c. diff --git a/postfix/src/bounce/bounce_trace_service.c b/postfix/src/bounce/bounce_trace_service.c index 850515902..e00697157 100644 --- a/postfix/src/bounce/bounce_trace_service.c +++ b/postfix/src/bounce/bounce_trace_service.c @@ -83,8 +83,39 @@ int bounce_trace_service(int flags, char *service, char *queue_name, BOUNCE_INFO *bounce_info; int bounce_status = 1; VSTREAM *bounce; - VSTRING *new_id = vstring_alloc(10); + int notify_mask = name_mask(VAR_NOTIFY_CLASSES, mail_error_masks, + var_notify_classes); + VSTRING *new_id; int count; + const char *sender; + + /* + * For consistency with fail/delay notifications, send notification for a + * non-bounce message as a single-bounce message, send notification for a + * single-bounce message as a double-bounce message, and drop requests to + * send notification for a double-bounce message. + */ +#define NULL_SENDER MAIL_ADDR_EMPTY /* special address */ + + if (strcasecmp(recipient, mail_addr_double_bounce()) == 0) { + msg_info("%s: not sending notification for double-bounce message", + queue_id); + return (0); + } else if (*recipient == 0) { + if ((notify_mask & MAIL_ERROR_2BOUNCE) != 0) { + recipient = var_2bounce_rcpt; + sender = mail_addr_double_bounce(); + } else { + msg_info("%s: not sending notification for single-bounce message", + queue_id); + if (mail_queue_remove(service, queue_id) && errno != ENOENT) + msg_fatal("remove %s %s: %m", service, queue_id); + return (0); + } + } else { + /* Always send notification for non-bounce message. */ + sender = NULL_SENDER; + } /* * Initialize. Open queue file, bounce log, etc. @@ -126,7 +157,6 @@ int bounce_trace_service(int flags, char *service, char *queue_name, bounce_mail_free(bounce_info); return (0); } -#define NULL_SENDER MAIL_ADDR_EMPTY /* special address */ #define NULL_TRACE_FLAGS 0 /* @@ -139,7 +169,8 @@ int bounce_trace_service(int flags, char *service, char *queue_name, * there are fewer potential left-over files to remove up when we create * a new queue file. */ - if ((bounce = post_mail_fopen_nowait(NULL_SENDER, recipient, + new_id = vstring_alloc(10); + if ((bounce = post_mail_fopen_nowait(sender, recipient, INT_FILT_MASK_BOUNCE, NULL_TRACE_FLAGS, new_id)) != 0) { diff --git a/postfix/src/global/dict_sqlite.c b/postfix/src/global/dict_sqlite.c index 7f56cdf30..8eb0da2f7 100644 --- a/postfix/src/global/dict_sqlite.c +++ b/postfix/src/global/dict_sqlite.c @@ -57,6 +57,12 @@ /* AUTHOR(S) /* Axel Steiner /* ast@treibsand.com +/* +/* Adopted and updated by: +/* Wietse Venema +/* IBM T.J. Watson Research +/* P.O. Box 704 +/* Yorktown Heights, NY 10598, USA /*--*/ /* System library. */ @@ -109,7 +115,7 @@ static void dict_sqlite_quote(DICT *dict, const char *raw_text, VSTRING *result) /* Fix 20100616 */ if (quoted_text == 0) msg_fatal("dict_sqlite_quote: out of memory"); - vstring_strcat(result, raw_text); + vstring_strcat(result, quoted_text); sqlite3_free(quoted_text); } diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index 3aa9f4c03..b714a6c28 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20120124" +#define MAIL_RELEASE_DATE "20120130" #define MAIL_VERSION_NUMBER "2.10" #ifdef SNAPSHOT