Prereq: "2.5.1" diff -cr /var/tmp/postfix-2.5.1/src/global/mail_version.h ./src/global/mail_version.h *** /var/tmp/postfix-2.5.1/src/global/mail_version.h Sat Feb 16 20:44:19 2008 --- ./src/global/mail_version.h Thu May 8 20:06:38 2008 *************** *** 20,27 **** * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ ! #define MAIL_RELEASE_DATE "20080216" ! #define MAIL_VERSION_NUMBER "2.5.1" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE --- 20,27 ---- * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ ! #define MAIL_RELEASE_DATE "20080507" ! #define MAIL_VERSION_NUMBER "2.5.2" #ifdef SNAPSHOT # define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff -cr /var/tmp/postfix-2.5.1/HISTORY ./HISTORY *** /var/tmp/postfix-2.5.1/HISTORY Sun Feb 10 19:36:18 2008 --- ./HISTORY Fri May 2 20:09:38 2008 *************** *** 14297,14306 **** main.cf when "postfix start" is invoked with an obsolete postfix command. File: conf/post-install. - Workaround (introduced 20071204): update the wrong proxywrite - process limit when upgrading an already installed default - master.cf file. File: conf/post-install. - 20080207 Cleanup: soft_bounce support for multi-line Milter replies. --- 14297,14302 ---- *************** *** 14312,14314 **** --- 14308,14379 ---- Cleanup: multi-line support in SMTP server replies. File: smtpd/smtpd_chat.c. + 20080215 + + Safety: break SASL loop in case both the SASL library and + the remote SMTP server are confused. File: smtp/smtp_sasl_glue.c. + + 20080220 + + Safety: the master daemon now sets an exclusive lock on a + file $data_directory/master.lock, so that the data directory + can't be shared between multiple Postfix instances. This + would corrupt files that rely on single-writer updates + (examples: verify(8) cache, tlsmgr(8) caches, etc.). File: + master/master.c. + + 20080228 + + Bugfix: bounce(8) segfault on one-line template text. + Problem found by Sacha Chlytor. File: bounce/bounce_template.c. + + 20080310 + + Safety: the SMTP server's Dovecot authentication client now + enforces the SASL mechanism output filter also on client + command input. File: src/xsasl/xsasl_dovecot_server.c. + + 20080311 + + Bugfix (introduced 20070811): the MAIL and RCPT Milter + application call-backs no longer received {mail_addr} or + {rcpt_addr} information. Problem reported by Anton Yuzhaninov. + File: smtpd/smtpd.c. + + 20080318 + + Human factors: the PCRE and regexp maps now give more + comprehensible error messages when people make the common + mistake of indenting if/endif blocks. Files: util/dict_pcre.c, + util/dict_regexp.c. + + 20080411 + + Bugfix (introduced Postfix 2.0): after "warn_if_reject + reject_unlisted_recipient/sender", the SMTP server mistakenly + remembered that recipient/sender validation was already + done. File: smtpd/smtpd_check.c. + + Bugfix (introduced Postfix 2.3): the queue manager would + initialize missing client logging attributes (from xforward) + with real client attributes. Fix: enable this backwards + compatibility feature only with queue files that don't + contain logging attributes. Problem reported by Liviu Daia. + Files *qmgr/qmgr_message.c. + + 20080424 + + Cleanup: some warning messages said "regexp" or "regexp + map" instead of "pcre map". File: util/dict_pcre.c. + + 20080428 + + Cleanup: the proxy_read_maps (Postfix 2.0) default setting + was not updated when adding sender/recipient_bcc_maps + (Postfix 2.1) and smtp/lmtp_generic_maps (Postfix 2.3). + File: global/mail_params.h. + + Cleanup: the SMTP server's XFORWARD and XCLIENT support was + not updated when the smtpd_client_port_logging configuration + parameter was added. Code by Victor Duchovni. Files: + smtpd/smtpd.c, smtpd/smtpd_peer.c. diff -cr /var/tmp/postfix-2.5.1/README_FILES/ADDRESS_VERIFICATION_README ./README_FILES/ADDRESS_VERIFICATION_README *** /var/tmp/postfix-2.5.1/README_FILES/ADDRESS_VERIFICATION_README Wed Feb 13 19:41:27 2008 --- ./README_FILES/ADDRESS_VERIFICATION_README Thu May 8 20:11:59 2008 *************** *** 103,111 **** response to end of DATA after a message is transferred. Postfix address verification does not work with such sites. ! * By default, Postfix probe messages have "postmaster@$myorigin" as the ! sender address. This is SAFE because the Postfix SMTP server does not ! reject mail for this address. You can change this into the null address ("address_verify_sender ="). This is UNSAFE because address probes will fail with mis-configured sites that --- 103,112 ---- response to end of DATA after a message is transferred. Postfix address verification does not work with such sites. ! * By default, Postfix probe messages have "double-bounce@$myorigin" as the ! sender address (with Postfix versions before 2.5, the default is ! "postmaster@$myorigin"). This is SAFE because the Postfix SMTP server does ! not reject mail for this address. You can change this into the null address ("address_verify_sender ="). This is UNSAFE because address probes will fail with mis-configured sites that diff -cr /var/tmp/postfix-2.5.1/html/ADDRESS_VERIFICATION_README.html ./html/ADDRESS_VERIFICATION_README.html *** /var/tmp/postfix-2.5.1/html/ADDRESS_VERIFICATION_README.html Wed Feb 13 19:41:16 2008 --- ./html/ADDRESS_VERIFICATION_README.html Thu May 8 20:11:57 2008 *************** *** 207,215 **** transferred. Postfix address verification does not work with such sites.

!
  • By default, Postfix probe messages have "postmaster@$myorigin" ! as the sender address. This is SAFE because the Postfix SMTP server ! does not reject mail for this address.

    You can change this into the null address ("address_verify_sender ="). This is UNSAFE because address probes will fail with --- 207,216 ---- transferred. Postfix address verification does not work with such sites.

    !
  • By default, Postfix probe messages have "double-bounce@$myorigin" ! as the sender address (with Postfix versions before 2.5, the default ! is "postmaster@$myorigin"). This is SAFE because the Postfix SMTP ! server does not reject mail for this address.

    You can change this into the null address ("address_verify_sender ="). This is UNSAFE because address probes will fail with diff -cr /var/tmp/postfix-2.5.1/html/master.8.html ./html/master.8.html *** /var/tmp/postfix-2.5.1/html/master.8.html Fri Jul 13 16:16:55 2007 --- ./html/master.8.html Thu May 8 20:12:00 2008 *************** *** 171,176 **** --- 171,177 ---- /etc/postfix/main.cf, global configuration file. /etc/postfix/master.cf, master server configuration file. /var/spool/postfix/pid/master.pid, master lock file. + /var/lib/postfix/master.lock, master lock file. SEE ALSO qmgr(8), queue manager diff -cr /var/tmp/postfix-2.5.1/html/postconf.5.html ./html/postconf.5.html *** /var/tmp/postfix-2.5.1/html/postconf.5.html Wed Feb 13 19:41:27 2008 --- ./html/postconf.5.html Thu May 8 20:11:59 2008 *************** *** 13211,13217 **** (default: 450)

    ! The numerical Postfix SMTP server response code when a recipient address is rejected by the reject_unverified_sender restriction.

    --- 13211,13217 ---- (default: 450)

    ! The numerical Postfix SMTP server response code when a sender address is rejected by the reject_unverified_sender restriction.

    diff -cr /var/tmp/postfix-2.5.1/html/smtpd.8.html ./html/smtpd.8.html *** /var/tmp/postfix-2.5.1/html/smtpd.8.html Sun Feb 10 19:49:26 2008 --- ./html/smtpd.8.html Thu May 8 20:12:00 2008 *************** *** 956,962 **** unverified_sender_reject_code (450) The numerical Postfix SMTP server response code ! when a recipient address is rejected by the reject_unverified_sender restriction. unverified_recipient_reject_code (450) --- 956,962 ---- unverified_sender_reject_code (450) The numerical Postfix SMTP server response code ! when a sender address is rejected by the reject_unverified_sender restriction. unverified_recipient_reject_code (450) diff -cr /var/tmp/postfix-2.5.1/man/man5/postconf.5 ./man/man5/postconf.5 *** /var/tmp/postfix-2.5.1/man/man5/postconf.5 Wed Feb 13 19:41:28 2008 --- ./man/man5/postconf.5 Thu May 8 20:11:59 2008 *************** *** 8132,8138 **** .PP This feature is available in Postfix 2.1 and later. .SH unverified_sender_reject_code (default: 450) ! The numerical Postfix SMTP server response code when a recipient address is rejected by the reject_unverified_sender restriction. .PP Unlike elsewhere in Postfix, you can specify 250 in order to --- 8132,8138 ---- .PP This feature is available in Postfix 2.1 and later. .SH unverified_sender_reject_code (default: 450) ! The numerical Postfix SMTP server response code when a sender address is rejected by the reject_unverified_sender restriction. .PP Unlike elsewhere in Postfix, you can specify 250 in order to diff -cr /var/tmp/postfix-2.5.1/man/man8/master.8 ./man/man8/master.8 *** /var/tmp/postfix-2.5.1/man/man8/master.8 Sat Mar 17 13:59:49 2007 --- ./man/man8/master.8 Thu May 8 20:11:59 2008 *************** *** 151,156 **** --- 151,157 ---- /etc/postfix/main.cf, global configuration file. /etc/postfix/master.cf, master server configuration file. /var/spool/postfix/pid/master.pid, master lock file. + /var/lib/postfix/master.lock, master lock file. .SH "SEE ALSO" .na .nf diff -cr /var/tmp/postfix-2.5.1/man/man8/smtpd.8 ./man/man8/smtpd.8 *** /var/tmp/postfix-2.5.1/man/man8/smtpd.8 Sun Feb 10 19:49:21 2008 --- ./man/man8/smtpd.8 Thu May 8 20:12:00 2008 *************** *** 769,775 **** The sender address to use in address verification probes; prior to Postfix 2.5 the default was "postmaster". .IP "\fBunverified_sender_reject_code (450)\fR" ! The numerical Postfix SMTP server response code when a recipient address is rejected by the reject_unverified_sender restriction. .IP "\fBunverified_recipient_reject_code (450)\fR" The numerical Postfix SMTP server response when a recipient address --- 769,775 ---- The sender address to use in address verification probes; prior to Postfix 2.5 the default was "postmaster". .IP "\fBunverified_sender_reject_code (450)\fR" ! The numerical Postfix SMTP server response code when a sender address is rejected by the reject_unverified_sender restriction. .IP "\fBunverified_recipient_reject_code (450)\fR" The numerical Postfix SMTP server response when a recipient address diff -cr /var/tmp/postfix-2.5.1/proto/ADDRESS_VERIFICATION_README.html ./proto/ADDRESS_VERIFICATION_README.html *** /var/tmp/postfix-2.5.1/proto/ADDRESS_VERIFICATION_README.html Tue Jan 29 17:18:00 2008 --- ./proto/ADDRESS_VERIFICATION_README.html Fri May 2 20:28:20 2008 *************** *** 207,215 **** transferred. Postfix address verification does not work with such sites.

    !
  • By default, Postfix probe messages have "postmaster@$myorigin" ! as the sender address. This is SAFE because the Postfix SMTP server ! does not reject mail for this address.

    You can change this into the null address ("address_verify_sender ="). This is UNSAFE because address probes will fail with --- 207,216 ---- transferred. Postfix address verification does not work with such sites.

    !
  • By default, Postfix probe messages have "double-bounce@$myorigin" ! as the sender address (with Postfix versions before 2.5, the default ! is "postmaster@$myorigin"). This is SAFE because the Postfix SMTP ! server does not reject mail for this address.

    You can change this into the null address ("address_verify_sender ="). This is UNSAFE because address probes will fail with diff -cr /var/tmp/postfix-2.5.1/proto/postconf.proto ./proto/postconf.proto *** /var/tmp/postfix-2.5.1/proto/postconf.proto Wed Feb 13 19:40:29 2008 --- ./proto/postconf.proto Sat Apr 26 19:21:28 2008 *************** *** 6165,6171 **** %PARAM unverified_sender_reject_code 450

    ! The numerical Postfix SMTP server response code when a recipient address is rejected by the reject_unverified_sender restriction.

    --- 6165,6171 ---- %PARAM unverified_sender_reject_code 450

    ! The numerical Postfix SMTP server response code when a sender address is rejected by the reject_unverified_sender restriction.

    diff -cr /var/tmp/postfix-2.5.1/src/bounce/bounce_template.c ./src/bounce/bounce_template.c *** /var/tmp/postfix-2.5.1/src/bounce/bounce_template.c Tue Jan 8 16:03:33 2008 --- ./src/bounce/bounce_template.c Thu Feb 28 15:52:27 2008 *************** *** 343,349 **** * Is this 7bit or 8bit text? If the character set is US-ASCII, then * don't allow 8bit text. Don't assume 8bit when charset was changed. */ ! #define NON_ASCII(p) (*(p) && !allascii((p))) if (NON_ASCII(cp) || NON_ASCII(tval)) { if (strcasecmp(tp->mime_charset, "us-ascii") == 0) { --- 343,349 ---- * Is this 7bit or 8bit text? If the character set is US-ASCII, then * don't allow 8bit text. Don't assume 8bit when charset was changed. */ ! #define NON_ASCII(p) ((p) && *(p) && !allascii((p))) if (NON_ASCII(cp) || NON_ASCII(tval)) { if (strcasecmp(tp->mime_charset, "us-ascii") == 0) { diff -cr /var/tmp/postfix-2.5.1/src/global/mail_params.h ./src/global/mail_params.h *** /var/tmp/postfix-2.5.1/src/global/mail_params.h Wed Jan 23 20:10:19 2008 --- ./src/global/mail_params.h Tue Apr 29 20:39:01 2008 *************** *** 2057,2063 **** " $" VAR_RCPT_CANON_MAPS \ " $" VAR_RELOCATED_MAPS \ " $" VAR_TRANSPORT_MAPS \ ! " $" VAR_MYNETWORKS extern char *var_proxy_read_maps; #define VAR_PROXY_WRITE_MAPS "proxy_write_maps" --- 2057,2067 ---- " $" VAR_RCPT_CANON_MAPS \ " $" VAR_RELOCATED_MAPS \ " $" VAR_TRANSPORT_MAPS \ ! " $" VAR_MYNETWORKS \ ! " $" VAR_SEND_BCC_MAPS \ ! " $" VAR_RCPT_BCC_MAPS \ ! " $" VAR_SMTP_GENERIC_MAPS \ ! " $" VAR_LMTP_GENERIC_MAPS extern char *var_proxy_read_maps; #define VAR_PROXY_WRITE_MAPS "proxy_write_maps" diff -cr /var/tmp/postfix-2.5.1/src/master/master.c ./src/master/master.c *** /var/tmp/postfix-2.5.1/src/master/master.c Sat Mar 17 13:59:38 2007 --- ./src/master/master.c Tue Apr 29 17:03:46 2008 *************** *** 133,138 **** --- 133,139 ---- /* /etc/postfix/main.cf, global configuration file. /* /etc/postfix/master.cf, master server configuration file. /* /var/spool/postfix/pid/master.pid, master lock file. + /* /var/lib/postfix/master.lock, master lock file. /* SEE ALSO /* qmgr(8), queue manager /* verify(8), address verification *************** *** 177,182 **** --- 178,185 ---- #include #include #include + #include + #include /* Global library. */ *************** *** 216,222 **** --- 219,227 ---- int main(int argc, char **argv) { static VSTREAM *lock_fp; + static VSTREAM *data_lock_fp; VSTRING *lock_path; + VSTRING *data_lock_path; off_t inherited_limit; int debug_me = 0; int ch; *************** *** 390,395 **** --- 395,401 ---- * isn't locked. */ lock_path = vstring_alloc(10); + data_lock_path = vstring_alloc(10); why = vstring_alloc(10); vstring_sprintf(lock_path, "%s/%s.pid", DEF_PID_DIR, var_procname); *************** *** 407,414 **** --- 413,441 ---- msg_fatal("cannot update lock file %s: %m", vstring_str(lock_path)); close_on_exec(vstream_fileno(lock_fp), CLOSE_ON_EXEC); + /* + * Lock down the Postfix-writable data directory. + */ + vstring_sprintf(data_lock_path, "%s/%s.lock", var_data_dir, var_procname); + set_eugid(var_owner_uid, var_owner_gid); + data_lock_fp = + open_lock(vstring_str(data_lock_path), O_RDWR | O_CREAT, 0644, why); + set_ugid(getuid(), getgid()); + if (data_lock_fp == 0) + msg_fatal("open lock file %s: %s", + vstring_str(data_lock_path), vstring_str(why)); + vstream_fprintf(data_lock_fp, "%*lu\n", (int) sizeof(unsigned long) * 4, + (unsigned long) var_pid); + if (vstream_fflush(data_lock_fp)) + msg_fatal("cannot update lock file %s: %m", vstring_str(data_lock_path)); + close_on_exec(vstream_fileno(data_lock_fp), CLOSE_ON_EXEC); + + /* + * Clean up. + */ vstring_free(why); vstring_free(lock_path); + vstring_free(data_lock_path); /* * Optionally start the debugger on ourself. *************** *** 438,443 **** --- 465,473 ---- for (;;) { #ifdef HAS_VOLATILE_LOCKS if (myflock(vstream_fileno(lock_fp), INTERNAL_LOCK, + MYFLOCK_OP_EXCLUSIVE) < 0) + msg_fatal("refresh exclusive lock: %m"); + if (myflock(vstream_fileno(data_lock_fp), INTERNAL_LOCK, MYFLOCK_OP_EXCLUSIVE) < 0) msg_fatal("refresh exclusive lock: %m"); #endif diff -cr /var/tmp/postfix-2.5.1/src/oqmgr/qmgr_message.c ./src/oqmgr/qmgr_message.c *** /var/tmp/postfix-2.5.1/src/oqmgr/qmgr_message.c Wed Dec 12 17:30:42 2007 --- ./src/oqmgr/qmgr_message.c Fri Apr 11 17:36:04 2008 *************** *** 311,316 **** --- 311,317 ---- int dsn_notify = 0; char *dsn_orcpt = 0; int n; + int have_log_client_attr = 0; /* * Initialize. No early returns or we have a memory leak. *************** *** 612,629 **** * client information. To support old queue files, we accept both * names for the purpose of logging; the new name overrides the * old one. */ else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_NAME) == 0) { ! if (message->client_name == 0) message->client_name = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_ADDR) == 0) { ! if (message->client_addr == 0) message->client_addr = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_PROTO_NAME) == 0) { ! if (message->client_proto == 0) message->client_proto = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_HELO_NAME) == 0) { ! if (message->client_helo == 0) message->client_helo = mystrdup(value); } /* Original client attributes. */ --- 613,636 ---- * client information. To support old queue files, we accept both * names for the purpose of logging; the new name overrides the * old one. + * + * XXX Do not use the "legacy" client_name etc. attribute values for + * initializing the logging attributes, when this file already + * contains the "modern" log_client_name etc. logging attributes. + * Otherwise, logging attributes that are not present in the + * queue file would be set with information from the real client. */ else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_NAME) == 0) { ! if (have_log_client_attr == 0 && message->client_name == 0) message->client_name = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_ADDR) == 0) { ! if (have_log_client_attr == 0 && message->client_addr == 0) message->client_addr = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_PROTO_NAME) == 0) { ! if (have_log_client_attr == 0 && message->client_proto == 0) message->client_proto = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_HELO_NAME) == 0) { ! if (have_log_client_attr == 0 && message->client_helo == 0) message->client_helo = mystrdup(value); } /* Original client attributes. */ *************** *** 631,652 **** --- 638,664 ---- if (message->client_name != 0) myfree(message->client_name); message->client_name = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_CLIENT_ADDR) == 0) { if (message->client_addr != 0) myfree(message->client_addr); message->client_addr = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_CLIENT_PORT) == 0) { if (message->client_port != 0) myfree(message->client_port); message->client_port = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_PROTO_NAME) == 0) { if (message->client_proto != 0) myfree(message->client_proto); message->client_proto = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_HELO_NAME) == 0) { if (message->client_helo != 0) myfree(message->client_helo); message->client_helo = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_SASL_METHOD) == 0) { if (message->sasl_method == 0) message->sasl_method = mystrdup(value); diff -cr /var/tmp/postfix-2.5.1/src/qmgr/qmgr_message.c ./src/qmgr/qmgr_message.c *** /var/tmp/postfix-2.5.1/src/qmgr/qmgr_message.c Wed Dec 12 17:29:47 2007 --- ./src/qmgr/qmgr_message.c Fri Apr 11 17:35:10 2008 *************** *** 334,339 **** --- 334,340 ---- int dsn_notify = 0; char *dsn_orcpt = 0; int n; + int have_log_client_attr = 0; /* * Initialize. No early returns or we have a memory leak. *************** *** 653,670 **** * client information. To support old queue files we accept both * names for the purpose of logging; the new name overrides the * old one. */ else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_NAME) == 0) { ! if (message->client_name == 0) message->client_name = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_ADDR) == 0) { ! if (message->client_addr == 0) message->client_addr = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_PROTO_NAME) == 0) { ! if (message->client_proto == 0) message->client_proto = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_HELO_NAME) == 0) { ! if (message->client_helo == 0) message->client_helo = mystrdup(value); } /* Original client attributes. */ --- 654,677 ---- * client information. To support old queue files we accept both * names for the purpose of logging; the new name overrides the * old one. + * + * XXX Do not use the "legacy" client_name etc. attribute values for + * initializing the logging attributes, when this file already + * contains the "modern" log_client_name etc. logging attributes. + * Otherwise, logging attributes that are not present in the + * queue file would be set with information from the real client. */ else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_NAME) == 0) { ! if (have_log_client_attr == 0 && message->client_name == 0) message->client_name = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_CLIENT_ADDR) == 0) { ! if (have_log_client_attr == 0 && message->client_addr == 0) message->client_addr = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_PROTO_NAME) == 0) { ! if (have_log_client_attr == 0 && message->client_proto == 0) message->client_proto = mystrdup(value); } else if (strcmp(name, MAIL_ATTR_ACT_HELO_NAME) == 0) { ! if (have_log_client_attr == 0 && message->client_helo == 0) message->client_helo = mystrdup(value); } /* Original client attributes. */ *************** *** 672,693 **** --- 679,705 ---- if (message->client_name != 0) myfree(message->client_name); message->client_name = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_CLIENT_ADDR) == 0) { if (message->client_addr != 0) myfree(message->client_addr); message->client_addr = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_CLIENT_PORT) == 0) { if (message->client_port != 0) myfree(message->client_port); message->client_port = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_PROTO_NAME) == 0) { if (message->client_proto != 0) myfree(message->client_proto); message->client_proto = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_LOG_HELO_NAME) == 0) { if (message->client_helo != 0) myfree(message->client_helo); message->client_helo = mystrdup(value); + have_log_client_attr = 1; } else if (strcmp(name, MAIL_ATTR_SASL_METHOD) == 0) { if (message->sasl_method == 0) message->sasl_method = mystrdup(value); diff -cr /var/tmp/postfix-2.5.1/src/smtp/smtp_sasl_glue.c ./src/smtp/smtp_sasl_glue.c *** /var/tmp/postfix-2.5.1/src/smtp/smtp_sasl_glue.c Mon Jan 14 20:09:35 2008 --- ./src/smtp/smtp_sasl_glue.c Sat Feb 16 19:12:29 2008 *************** *** 291,296 **** --- 291,297 ---- const char *mechanism; int result; char *line; + int steps = 0; /* * Sanity check. *************** *** 355,360 **** --- 356,371 ---- * that we are done. */ while ((resp = smtp_chat_resp(session))->code / 100 == 3) { + + /* + * Sanity check. + */ + if (++steps > 100) { + dsb_simple(why, "4.3.0", "SASL authentication failed; " + "authentication protocol loop with server %s", + session->namaddr); + return (-1); + } /* * Process a server challenge. diff -cr /var/tmp/postfix-2.5.1/src/smtpd/smtpd.c ./src/smtpd/smtpd.c *** /var/tmp/postfix-2.5.1/src/smtpd/smtpd.c Thu Feb 7 16:20:33 2008 --- ./src/smtpd/smtpd.c Thu May 8 20:12:00 2008 *************** *** 719,725 **** /* The sender address to use in address verification probes; prior /* to Postfix 2.5 the default was "postmaster". /* .IP "\fBunverified_sender_reject_code (450)\fR" ! /* The numerical Postfix SMTP server response code when a recipient /* address is rejected by the reject_unverified_sender restriction. /* .IP "\fBunverified_recipient_reject_code (450)\fR" /* The numerical Postfix SMTP server response when a recipient address --- 719,725 ---- /* The sender address to use in address verification probes; prior /* to Postfix 2.5 the default was "postmaster". /* .IP "\fBunverified_sender_reject_code (450)\fR" ! /* The numerical Postfix SMTP server response code when a sender /* address is rejected by the reject_unverified_sender restriction. /* .IP "\fBunverified_recipient_reject_code (450)\fR" /* The numerical Postfix SMTP server response when a recipient address *************** *** 2108,2121 **** if (smtpd_milters != 0 && SMTPD_STAND_ALONE(state) == 0 && (state->saved_flags & MILTER_SKIP_FLAGS) == 0) { err = milter_mail_event(smtpd_milters, milter_argv(state, argc - 2, argv + 2)); if (err != 0) { /* Log reject etc. with correct sender information. */ - PUSH_STRING(saved_sender, state->sender, STR(state->addr_buf)); err = check_milter_reply(state, err); - POP_STRING(saved_sender, state->sender); } if (err != 0) { /* XXX Reset access map side effects. */ mail_reset(state); --- 2108,2121 ---- if (smtpd_milters != 0 && SMTPD_STAND_ALONE(state) == 0 && (state->saved_flags & MILTER_SKIP_FLAGS) == 0) { + PUSH_STRING(saved_sender, state->sender, STR(state->addr_buf)); err = milter_mail_event(smtpd_milters, milter_argv(state, argc - 2, argv + 2)); if (err != 0) { /* Log reject etc. with correct sender information. */ err = check_milter_reply(state, err); } + POP_STRING(saved_sender, state->sender); if (err != 0) { /* XXX Reset access map side effects. */ mail_reset(state); *************** *** 2362,2375 **** } if (smtpd_milters != 0 && (state->saved_flags & MILTER_SKIP_FLAGS) == 0) { err = milter_rcpt_event(smtpd_milters, milter_argv(state, argc - 2, argv + 2)); if (err != 0) { /* Log reject etc. with correct recipient information. */ - PUSH_STRING(saved_rcpt, state->recipient, STR(state->addr_buf)); err = check_milter_reply(state, err); - POP_STRING(saved_rcpt, state->recipient); } if (err != 0) { smtpd_chat_reply(state, "%s", err); return (-1); --- 2362,2375 ---- } if (smtpd_milters != 0 && (state->saved_flags & MILTER_SKIP_FLAGS) == 0) { + PUSH_STRING(saved_rcpt, state->recipient, STR(state->addr_buf)); err = milter_rcpt_event(smtpd_milters, milter_argv(state, argc - 2, argv + 2)); if (err != 0) { /* Log reject etc. with correct recipient information. */ err = check_milter_reply(state, err); } + POP_STRING(saved_rcpt, state->recipient); if (err != 0) { smtpd_chat_reply(state, "%s", err); return (-1); *************** *** 3405,3412 **** if (state->namaddr) myfree(state->namaddr); state->namaddr = ! concatenate(state->name, "[", state->addr, "]:", ! state->port, (char *) 0); } /* --- 3405,3411 ---- if (state->namaddr) myfree(state->namaddr); state->namaddr = ! SMTPD_BUILD_NAMADDRPORT(state->name, state->addr, state->port); } /* *************** *** 3671,3680 **** myfree(state->xforward.namaddr); state->xforward.namaddr = IS_AVAIL_CLIENT_ADDR(state->xforward.addr) ? ! concatenate(state->xforward.name, "[", ! state->xforward.addr, "]:", ! state->xforward.port, ! (char *) 0) : mystrdup(state->xforward.name); } smtpd_chat_reply(state, "250 2.0.0 Ok"); return (0); --- 3670,3679 ---- myfree(state->xforward.namaddr); state->xforward.namaddr = IS_AVAIL_CLIENT_ADDR(state->xforward.addr) ? ! SMTPD_BUILD_NAMADDRPORT(state->xforward.name, ! state->xforward.addr, ! state->xforward.port) : ! mystrdup(state->xforward.name); } smtpd_chat_reply(state, "250 2.0.0 Ok"); return (0); diff -cr /var/tmp/postfix-2.5.1/src/smtpd/smtpd.h ./src/smtpd/smtpd.h *** /var/tmp/postfix-2.5.1/src/smtpd/smtpd.h Mon Jan 7 20:21:49 2008 --- ./src/smtpd/smtpd.h Tue Apr 29 20:49:01 2008 *************** *** 280,285 **** --- 280,293 ---- #define SMTPD_PEER_CODE_FORGED 6 /* + * Construct name[addr] or name[addr]:port as appropriate + */ + #define SMTPD_BUILD_NAMADDRPORT(name, addr, port) \ + concatenate((name), "[", (addr), "]", \ + var_smtpd_client_port_log ? ":" : (char *) 0, \ + (port), (char *) 0) + + /* * Choose between normal or forwarded attributes. * * Note 1: inside the SMTP server, forwarded attributes must have the exact diff -cr /var/tmp/postfix-2.5.1/src/smtpd/smtpd_check.c ./src/smtpd/smtpd_check.c *** /var/tmp/postfix-2.5.1/src/smtpd/smtpd_check.c Tue Jan 8 15:59:07 2008 --- ./src/smtpd/smtpd_check.c Fri Apr 11 15:46:54 2008 *************** *** 4295,4301 **** return (0); if (state->recipient_rcptmap_checked == 1) return (0); ! state->recipient_rcptmap_checked = 1; return (check_rcpt_maps(state, recipient, SMTPD_NAME_RECIPIENT)); } --- 4295,4303 ---- return (0); if (state->recipient_rcptmap_checked == 1) return (0); ! if (state->warn_if_reject == 0) ! /* We really validate the recipient address. */ ! state->recipient_rcptmap_checked = 1; return (check_rcpt_maps(state, recipient, SMTPD_NAME_RECIPIENT)); } *************** *** 4312,4318 **** return (0); if (state->sender_rcptmap_checked == 1) return (0); ! state->sender_rcptmap_checked = 1; return (check_rcpt_maps(state, sender, SMTPD_NAME_SENDER)); } --- 4314,4322 ---- return (0); if (state->sender_rcptmap_checked == 1) return (0); ! if (state->warn_if_reject == 0) ! /* We really validate the sender address. */ ! state->sender_rcptmap_checked = 1; return (check_rcpt_maps(state, sender, SMTPD_NAME_SENDER)); } diff -cr /var/tmp/postfix-2.5.1/src/smtpd/smtpd_peer.c ./src/smtpd/smtpd_peer.c *** /var/tmp/postfix-2.5.1/src/smtpd/smtpd_peer.c Sat Oct 6 20:07:08 2007 --- ./src/smtpd/smtpd_peer.c Mon Apr 28 20:06:08 2008 *************** *** 25,31 **** /* The verified client hostname. This name is represented by /* the string "unknown" when 1) the address->name lookup failed, /* 2) the name->address mapping fails, or 3) the name->address ! /* does not produce the client IP address. /* .IP reverse_name /* The unverified client hostname as found with address->name /* lookup; it is not verified for consistency with the client --- 25,31 ---- /* The verified client hostname. This name is represented by /* the string "unknown" when 1) the address->name lookup failed, /* 2) the name->address mapping fails, or 3) the name->address ! /* mapping does not produce the client IP address. /* .IP reverse_name /* The unverified client hostname as found with address->name /* lookup; it is not verified for consistency with the client *************** *** 373,382 **** /* * Do the name[addr]:port formatting for pretty reports. */ ! state->namaddr = ! concatenate(state->name, "[", state->addr, "]", ! var_smtpd_client_port_log ? ":" : (char *) 0, ! state->port, (char *) 0); } /* smtpd_peer_reset - destroy peer information */ --- 373,380 ---- /* * Do the name[addr]:port formatting for pretty reports. */ ! state->namaddr = SMTPD_BUILD_NAMADDRPORT(state->name, state->addr, ! state->port); } /* smtpd_peer_reset - destroy peer information */ diff -cr /var/tmp/postfix-2.5.1/src/util/dict_pcre.c ./src/util/dict_pcre.c *** /var/tmp/postfix-2.5.1/src/util/dict_pcre.c Thu Jan 4 09:35:38 2007 --- ./src/util/dict_pcre.c Thu Apr 24 15:52:18 2008 *************** *** 180,186 **** if (ret == PCRE_ERROR_NOSUBSTRING) return (MAC_PARSE_UNDEF); else ! msg_fatal("regexp %s, line %d: pcre_get_substring error: %d", dict_pcre->dict.name, match_rule->rule.lineno, ret); } if (*pp == 0) { --- 180,186 ---- if (ret == PCRE_ERROR_NOSUBSTRING) return (MAC_PARSE_UNDEF); else ! msg_fatal("pcre map %s, line %d: pcre_get_substring error: %d", dict_pcre->dict.name, match_rule->rule.lineno, ret); } if (*pp == 0) { *************** *** 671,677 **** msg_panic("pcre map %s, line %d: pcre_fullinfo failed", mapname, lineno); if (prescan_context.max_sub > actual_sub) { ! msg_warn("regexp map %s, line %d: out of range replacement index \"%d\": " "skipping this rule", mapname, lineno, (int) prescan_context.max_sub); if (engine.pattern) --- 671,677 ---- msg_panic("pcre map %s, line %d: pcre_fullinfo failed", mapname, lineno); if (prescan_context.max_sub > actual_sub) { ! msg_warn("pcre map %s, line %d: out of range replacement index \"%d\": " "skipping this rule", mapname, lineno, (int) prescan_context.max_sub); if (engine.pattern) *************** *** 722,730 **** */ while (*p && ISSPACE(*p)) ++p; ! if (*p) ! msg_warn("pcre map %s, line %d: ignoring extra text after IF", ! mapname, lineno); /* * Compile the pattern. --- 722,733 ---- */ while (*p && ISSPACE(*p)) ++p; ! if (*p) { ! msg_warn("pcre map %s, line %d: ignoring extra text after " ! "IF statement: \"%s\"", mapname, lineno, p); ! msg_warn("pcre map %s, line %d: do not prepend whitespace" ! " to statements between IF and ENDIF", mapname, lineno); ! } /* * Compile the pattern. *************** *** 782,788 **** * Unrecognized input. */ else { ! msg_warn("regexp map %s, line %d: ignoring unrecognized request", mapname, lineno); return (0); } --- 785,791 ---- * Unrecognized input. */ else { ! msg_warn("pcre map %s, line %d: ignoring unrecognized request", mapname, lineno); return (0); } diff -cr /var/tmp/postfix-2.5.1/src/util/dict_regexp.c ./src/util/dict_regexp.c *** /var/tmp/postfix-2.5.1/src/util/dict_regexp.c Thu Jan 4 09:35:52 2007 --- ./src/util/dict_regexp.c Tue Mar 18 08:17:12 2008 *************** *** 683,691 **** return (0); while (*p && ISSPACE(*p)) ++p; ! if (*p) ! msg_warn("regexp map %s, line %d: ignoring extra text after IF", ! mapname, lineno); if ((expr = dict_regexp_compile_pat(mapname, lineno, &pattern)) == 0) return (0); if_rule = (DICT_REGEXP_IF_RULE *) --- 683,694 ---- return (0); while (*p && ISSPACE(*p)) ++p; ! if (*p) { ! msg_warn("regexp map %s, line %d: ignoring extra text after" ! " IF statement: \"%s\"", mapname, lineno, p); ! msg_warn("regexp map %s, line %d: do not prepend whitespace" ! " to statements between IF and ENDIF", mapname, lineno); ! } if ((expr = dict_regexp_compile_pat(mapname, lineno, &pattern)) == 0) return (0); if_rule = (DICT_REGEXP_IF_RULE *) diff -cr /var/tmp/postfix-2.5.1/src/xsasl/xsasl_dovecot_server.c ./src/xsasl/xsasl_dovecot_server.c *** /var/tmp/postfix-2.5.1/src/xsasl/xsasl_dovecot_server.c Tue Jan 8 15:36:13 2008 --- ./src/xsasl/xsasl_dovecot_server.c Sun Mar 16 19:09:04 2008 *************** *** 50,55 **** --- 50,59 ---- #include #include + #ifdef STRCASECMP_IN_STRINGS_H + #include + #endif + /* Utility library. */ #include *************** *** 60,65 **** --- 64,70 ---- #include #include #include + #include /* Global library. */ *************** *** 156,161 **** --- 161,167 ---- VSTRING *sasl_line; unsigned int sec_props; /* Postfix mechanism filter */ char *mechanism_list; /* filtered mechanism list */ + ARGV *mechanism_argv; /* ditto */ } XSASL_DOVECOT_SERVER; /* *************** *** 208,214 **** /* xsasl_dovecot_server_mech_filter - filter server mechanism list */ ! static char *xsasl_dovecot_server_mech_filter(XSASL_DCSRV_MECH *mechanism_list, unsigned int conf_props) { const char *myname = "xsasl_dovecot_server_mech_filter"; --- 214,221 ---- /* xsasl_dovecot_server_mech_filter - filter server mechanism list */ ! static char *xsasl_dovecot_server_mech_filter(ARGV *mechanism_argv, ! XSASL_DCSRV_MECH *mechanism_list, unsigned int conf_props) { const char *myname = "xsasl_dovecot_server_mech_filter"; *************** *** 226,231 **** --- 233,239 ---- if (VSTRING_LEN(mechanisms_str) > 0) VSTRING_ADDCH(mechanisms_str, ' '); vstring_strcat(mechanisms_str, mp->mech_name); + argv_add(mechanism_argv, mp->mech_name, (char *) 0); if (msg_verbose) msg_info("%s: keep mechanism: %s", myname, mp->mech_name); } else { *************** *** 400,405 **** --- 408,414 ---- server->service = mystrdup(service); server->last_request_id = 0; server->mechanism_list = 0; + server->mechanism_argv = 0; server->sec_props = name_mask_opt(myname, xsasl_dovecot_conf_sec_props, sec_props, NAME_MASK_ANY_CASE | NAME_MASK_FATAL); *************** *** 417,426 **** if (xsasl_dovecot_server_connect(server->impl) < 0) return (0); } ! if (server->mechanism_list == 0) server->mechanism_list = ! xsasl_dovecot_server_mech_filter(server->impl->mechanism_list, server->sec_props); return (server->mechanism_list[0] ? server->mechanism_list : 0); } --- 426,438 ---- if (xsasl_dovecot_server_connect(server->impl) < 0) return (0); } ! if (server->mechanism_list == 0) { ! server->mechanism_argv = argv_alloc(2); server->mechanism_list = ! xsasl_dovecot_server_mech_filter(server->mechanism_argv, ! server->impl->mechanism_list, server->sec_props); + } return (server->mechanism_list[0] ? server->mechanism_list : 0); } *************** *** 433,440 **** vstring_free(server->sasl_line); if (server->username) myfree(server->username); ! if (server->mechanism_list) myfree(server->mechanism_list); myfree(server->service); myfree((char *) server); } --- 445,454 ---- vstring_free(server->sasl_line); if (server->username) myfree(server->username); ! if (server->mechanism_list) { myfree(server->mechanism_list); + argv_free(server->mechanism_argv); + } myfree(server->service); myfree((char *) server); } *************** *** 558,563 **** --- 572,578 ---- const char *myname = "xsasl_dovecot_server_first"; XSASL_DOVECOT_SERVER *server = (XSASL_DOVECOT_SERVER *) xp; int i; + char **cpp; #define IFELSE(e1,e2,e3) ((e1) ? (e2) : (e3)) *************** *** 566,571 **** --- 581,597 ---- IFELSE(init_response, ", init_response ", ""), IFELSE(init_response, init_response, "")); + if (server->mechanism_argv == 0) + msg_panic("%s: no mechanism list", myname); + + for (cpp = server->mechanism_argv->argv; /* see below */ ; cpp++) { + if (*cpp == 0) { + vstring_strcpy(reply, "Invalid authentication mechanism"); + return XSASL_AUTH_FAIL; + } + if (strcasecmp(sasl_method, *cpp) == 0) + break; + } if (init_response) if (!is_valid_base64(init_response)) { vstring_strcpy(reply, "Invalid base64 data in initial response");