From: Wietse Venema Date: Thu, 28 Apr 2005 05:00:00 +0000 (-0500) Subject: postfix-2.2.3 X-Git-Tag: v2.2.3^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cd0939606222cc9f2d2eab77c87371c327de8c2a;p=thirdparty%2Fpostfix.git postfix-2.2.3 --- diff --git a/postfix/HISTORY b/postfix/HISTORY index 8af435734..8d7cd173d 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -10512,3 +10512,62 @@ Apologies for any names omitted. PREPEND+IGNORE. The result remains in the input stream, and is subject to address rewriting and other processing where applicable. File: cleanup/cleanup_message.c. + +20050407 + + @%^!#& Thanks to inadequate SASL documentation the client + could negotiate a security layer where none was desired. + Better documentation has become available since Postfix + SASL support was implemented, and now Postfix needs to be + fixed. Files: */*_sasl_glue.c. + +20050402 + + Cleanup: updated error messages about MIME processing errors + in the SMTP client. These errors are no longer specific to + 8bit->7bit conversion; they can also happen with generic + address mapping. File: smtp/smtp_proto.c. + +20050409 + + Safety: the CDB map now logs a warning when the source file + is newer than the indexed file, just like the Berkeley DB + and DBM maps. Michael Tokarev. File: util/dict_cdb.c. + +20050412 + + Bugfix: while updating the cleanup_flush() infrastructure + in the 2.3 development release, eliminated a portability + problem that was introduced when "REJECT text" support was + added. File: cleanup/cleanup.c. + +20050413 + + Portability: don't mix socket message send/receive calls + with socket stream read/write calls. The fact that you can + get away with it only on some stacks implies that there is + no long-term guarantee. Specify -DCAN_WRITE_BEFORE_SENDING_FD + if you feel brave. File: util/sys_defs.h. + + Robustness: re-compile all object files after the "make + makefiles" options have changed. Files: src/*/Makefile.in. + +20050417 + + Safety: don't call syslog from a user-triggered signal + handler, and other minor fixes back-ported from the 2.3 + development release. File: postdrop/postdrop.c. + +20050422 + + Bugfix: postsuper could lose an error message after reporting + a fatal error. Fix back-ported from the 2.3 development + release. File: postsuper/postsuper.c. + +20050427 + + Bugfix: don't panic when the fall-back relay can't be used + because the local MTA is MX for the destination, or when + the fall-back relay can't be used because it was already + tried via a cached session. Files: util/argv.c, + smtp/smtp_connect.c. diff --git a/postfix/conf/post-install b/postfix/conf/post-install index 1119bcec6..ee6efa894 100644 --- a/postfix/conf/post-install +++ b/postfix/conf/post-install @@ -638,7 +638,7 @@ EOF grep "^tlsmgr[ ]*fifo[ ]" \ $config_directory/master.cf >/dev/null && { - echo Editing $config_directory/master.cf, updating the tlsmgr fifo->unix service + echo Editing $config_directory/master.cf, updating the tlsmgr from fifo to unix service ed $config_directory/master.cf <$@ diff --git a/postfix/src/bounce/Makefile.in b/postfix/src/bounce/Makefile.in index 7c802a6da..a12e58ffd 100644 --- a/postfix/src/bounce/Makefile.in +++ b/postfix/src/bounce/Makefile.in @@ -19,6 +19,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/cleanup/Makefile.in b/postfix/src/cleanup/Makefile.in index 233baab16..cb3df0048 100644 --- a/postfix/src/cleanup/Makefile.in +++ b/postfix/src/cleanup/Makefile.in @@ -23,6 +23,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/cleanup/cleanup.c b/postfix/src/cleanup/cleanup.c index 720e4fe97..b0e9aed6f 100644 --- a/postfix/src/cleanup/cleanup.c +++ b/postfix/src/cleanup/cleanup.c @@ -338,6 +338,7 @@ static void cleanup_service(VSTREAM *src, char *unused_service, char **argv) CLEANUP_STATE *state; int flags; int type = 0; + int status; /* * Sanity check. This service takes no command-line arguments. @@ -403,8 +404,9 @@ static void cleanup_service(VSTREAM *src, char *unused_service, char **argv) /* * Finish this message, and report the result status to the client. */ + status = cleanup_flush(state); /* in case state is modified */ attr_print(src, ATTR_FLAG_NONE, - ATTR_TYPE_NUM, MAIL_ATTR_STATUS, cleanup_flush(state), + ATTR_TYPE_NUM, MAIL_ATTR_STATUS, status, ATTR_TYPE_STR, MAIL_ATTR_WHY, state->reason ? state->reason : "", ATTR_TYPE_END); diff --git a/postfix/src/discard/Makefile.in b/postfix/src/discard/Makefile.in index 9f87480a1..10152ffdf 100644 --- a/postfix/src/discard/Makefile.in +++ b/postfix/src/discard/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/dns/Makefile.in b/postfix/src/dns/Makefile.in index d18adf450..615c2356d 100644 --- a/postfix/src/dns/Makefile.in +++ b/postfix/src/dns/Makefile.in @@ -18,6 +18,8 @@ INC_DIR = ../../include all: $(LIB) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/error/Makefile.in b/postfix/src/error/Makefile.in index 8bacb92b9..77a4da26b 100644 --- a/postfix/src/error/Makefile.in +++ b/postfix/src/error/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/flush/Makefile.in b/postfix/src/flush/Makefile.in index 21603b9e8..70c76ff9f 100644 --- a/postfix/src/flush/Makefile.in +++ b/postfix/src/flush/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/fsstone/Makefile.in b/postfix/src/fsstone/Makefile.in index a04617a03..cc29f5ee9 100644 --- a/postfix/src/fsstone/Makefile.in +++ b/postfix/src/fsstone/Makefile.in @@ -14,6 +14,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a all: $(PROG) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index e15cbca8b..092d7b7c4 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -97,6 +97,8 @@ MAKES = all: $(LIB) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index d35191193..8a6688dfd 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,8 +20,8 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only. */ -#define MAIL_RELEASE_DATE "20050401" -#define MAIL_VERSION_NUMBER "2.2.2" +#define MAIL_RELEASE_DATE "20050428" +#define MAIL_VERSION_NUMBER "2.2.3" #define VAR_MAIL_VERSION "mail_version" #ifdef SNAPSHOT diff --git a/postfix/src/lmtp/Makefile.in b/postfix/src/lmtp/Makefile.in index 24aad7250..b5c911548 100644 --- a/postfix/src/lmtp/Makefile.in +++ b/postfix/src/lmtp/Makefile.in @@ -19,6 +19,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libdns.a ../../lib/ $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/lmtp/lmtp_sasl_glue.c b/postfix/src/lmtp/lmtp_sasl_glue.c index 05bcc7d92..db11b12ad 100644 --- a/postfix/src/lmtp/lmtp_sasl_glue.c +++ b/postfix/src/lmtp/lmtp_sasl_glue.c @@ -377,7 +377,7 @@ void lmtp_sasl_start(LMTP_STATE *state, const char *sasl_opts_name, */ memset(&sec_props, 0L, sizeof(sec_props)); sec_props.min_ssf = 0; - sec_props.max_ssf = 1; /* don't allow real SASL + sec_props.max_ssf = 0; /* don't allow real SASL * security layer */ sec_props.security_flags = name_mask(sasl_opts_name, lmtp_sasl_sec_mask, sasl_opts_val); diff --git a/postfix/src/local/Makefile.in b/postfix/src/local/Makefile.in index fb439cde6..a804f1582 100644 --- a/postfix/src/local/Makefile.in +++ b/postfix/src/local/Makefile.in @@ -21,6 +21,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/master/Makefile.in b/postfix/src/master/Makefile.in index d21f674c8..8c7bd19fe 100644 --- a/postfix/src/master/Makefile.in +++ b/postfix/src/master/Makefile.in @@ -24,6 +24,8 @@ BIN_DIR = ../../libexec all: $(PROG) $(LIB) +$(OBJS) $(LIB_OBJ): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/oqmgr/Makefile.in b/postfix/src/oqmgr/Makefile.in index 509875b75..7f16e4b32 100644 --- a/postfix/src/oqmgr/Makefile.in +++ b/postfix/src/oqmgr/Makefile.in @@ -19,6 +19,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/pickup/Makefile.in b/postfix/src/pickup/Makefile.in index 5e7436029..e30b42432 100644 --- a/postfix/src/pickup/Makefile.in +++ b/postfix/src/pickup/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/pipe/Makefile.in b/postfix/src/pipe/Makefile.in index 6a676ed8f..5ed3a20dd 100644 --- a/postfix/src/pipe/Makefile.in +++ b/postfix/src/pipe/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postalias/Makefile.in b/postfix/src/postalias/Makefile.in index 2e414ad78..6e5112289 100644 --- a/postfix/src/postalias/Makefile.in +++ b/postfix/src/postalias/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postcat/Makefile.in b/postfix/src/postcat/Makefile.in index 4cce48332..0982b6790 100644 --- a/postfix/src/postcat/Makefile.in +++ b/postfix/src/postcat/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postconf/Makefile.in b/postfix/src/postconf/Makefile.in index 069f951b0..54a12e3ec 100644 --- a/postfix/src/postconf/Makefile.in +++ b/postfix/src/postconf/Makefile.in @@ -25,6 +25,8 @@ $(PROG): $(OBJS) $(LIBS) echo "#"; \ ./$(PROG) -d) |egrep -v '^(myhostname|mydomain|mynetworks) ' >$@ +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postdrop/Makefile.in b/postfix/src/postdrop/Makefile.in index 6ddcf835e..c9fa3fe9f 100644 --- a/postfix/src/postdrop/Makefile.in +++ b/postfix/src/postdrop/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postdrop/postdrop.c b/postfix/src/postdrop/postdrop.c index d5cf5fa0a..7d22955d8 100644 --- a/postfix/src/postdrop/postdrop.c +++ b/postfix/src/postdrop/postdrop.c @@ -165,48 +165,45 @@ static CONFIG_STR_TABLE str_table[] = { */ static char *postdrop_path; -/* postdrop_cleanup - callback for the runtime error handler */ - -static void postdrop_cleanup(void) -{ - - /* - * This is the fatal error handler. Don't try to do anything fancy. - * - * msg_xxx() does not allocate memory, so it is safe as long as the signal - * handler can't be invoked recursively. - */ - if (postdrop_path) { - if (remove(postdrop_path)) - msg_warn("uid=%ld: remove %s: %m", (long) getuid(), postdrop_path); - else if (msg_verbose) - msg_info("remove %s", postdrop_path); - postdrop_path = 0; - } -} - /* postdrop_sig - catch signal and clean up */ static void postdrop_sig(int sig) { /* - * Assume atomic signal() updates, even when emulated with sigaction(). - * We use the in-kernel SIGINT handler address as an atomic variable to + * This is the fatal error handler. Don't try to do anything fancy. + * + * msg_vstream does not allocate memory, but msg_syslog may indirectly in + * syslog(), so it should not be called from a user-triggered signal + * handler. + * + * Assume atomic signal() updates, even when emulated with sigaction(). We + * use the in-kernel SIGINT handler address as an atomic variable to * prevent nested postdrop_sig() calls. For this reason, main() must * configure postdrop_sig() as SIGINT handler before other signal * handlers are allowed to invoke postdrop_sig(). */ if (signal(SIGINT, SIG_IGN) != SIG_IGN) { - (void)signal(SIGQUIT, SIG_IGN); - (void)signal(SIGTERM, SIG_IGN); - (void)signal(SIGHUP, SIG_IGN); - postdrop_cleanup(); + (void) signal(SIGQUIT, SIG_IGN); + (void) signal(SIGTERM, SIG_IGN); + (void) signal(SIGHUP, SIG_IGN); + if (postdrop_path) { + (void) remove(postdrop_path); + postdrop_path = 0; + } /* Future proofing. If you need exit() here then you broke Postfix. */ - _exit(sig); + if (sig) + _exit(sig); } } +/* postdrop_cleanup - callback for the runtime error handler */ + +static void postdrop_cleanup(void) +{ + postdrop_sig(0); +} + /* main - the main program */ int main(int argc, char **argv) @@ -228,6 +225,7 @@ int main(int argc, char **argv) char *attr_name; char *attr_value; const char *errstr; + char *junk; /* * Be consistent with file permissions. @@ -428,8 +426,9 @@ int main(int argc, char **argv) * will not be deleted after we have taken responsibility for delivery. */ if (postdrop_path) { - myfree(postdrop_path); + junk = postdrop_path; postdrop_path = 0; + myfree(junk); } /* diff --git a/postfix/src/postfix/Makefile.in b/postfix/src/postfix/Makefile.in index dad1be2c3..52942c846 100644 --- a/postfix/src/postfix/Makefile.in +++ b/postfix/src/postfix/Makefile.in @@ -16,6 +16,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postkick/Makefile.in b/postfix/src/postkick/Makefile.in index 568edf654..77ffc568f 100644 --- a/postfix/src/postkick/Makefile.in +++ b/postfix/src/postkick/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postlock/Makefile.in b/postfix/src/postlock/Makefile.in index 48853df79..8a3588bde 100644 --- a/postfix/src/postlock/Makefile.in +++ b/postfix/src/postlock/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postlog/Makefile.in b/postfix/src/postlog/Makefile.in index 64f32b5d4..421649f6f 100644 --- a/postfix/src/postlog/Makefile.in +++ b/postfix/src/postlog/Makefile.in @@ -16,6 +16,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postmap/Makefile.in b/postfix/src/postmap/Makefile.in index 7761292e4..739162ff0 100644 --- a/postfix/src/postmap/Makefile.in +++ b/postfix/src/postmap/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postqueue/Makefile.in b/postfix/src/postqueue/Makefile.in index f3a523b5e..31bb675f6 100644 --- a/postfix/src/postqueue/Makefile.in +++ b/postfix/src/postqueue/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postsuper/Makefile.in b/postfix/src/postsuper/Makefile.in index df0dfa08a..ba6b844a2 100644 --- a/postfix/src/postsuper/Makefile.in +++ b/postfix/src/postsuper/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/postsuper/postsuper.c b/postfix/src/postsuper/postsuper.c index 633e0a42a..32b818d3b 100644 --- a/postfix/src/postsuper/postsuper.c +++ b/postfix/src/postsuper/postsuper.c @@ -943,19 +943,31 @@ static void super(const char **queues, int action) argv_free(hash_queue_names); } -/* fatal_exit - print warning if queue fix is incomplete */ +/* interrupted - signal handler */ -static void fatal_exit(void) +static void interrupted(int sig) { - if (inode_mismatch > 0 || inode_fixed > 0 || position_mismatch > 0) - msg_fatal("OPERATION INCOMPLETE -- RERUN COMMAND TO FIX THE QUEUE FIRST"); + + /* + * This commands requires root privileges. We therefore do not worry + * about hostile signals, and report problems via msg_warn(). + */ + if (signal(SIGHUP, SIG_IGN) != SIG_IGN) { + (void) signal(SIGINT, SIG_IGN); + (void) signal(SIGQUIT, SIG_IGN); + (void) signal(SIGTERM, SIG_IGN); + if (inode_mismatch > 0 || inode_fixed > 0 || position_mismatch > 0) + msg_warn("OPERATION INCOMPLETE -- RERUN COMMAND TO FIX THE QUEUE FIRST"); + if (sig) + _exit(sig); + } } -/* interrupted - signal handler */ +/* fatal_warning - print warning if queue fix is incomplete */ -static void interrupted(int unused_sig) +static void fatal_warning(void) { - fatal_exit(); + interrupted(0); } int main(int argc, char **argv) @@ -1136,7 +1148,7 @@ int main(int argc, char **argv) signal(SIGINT, interrupted); signal(SIGQUIT, interrupted); signal(SIGTERM, interrupted); - msg_cleanup(fatal_exit); + msg_cleanup(fatal_warning); /* * Sanity checks. diff --git a/postfix/src/proxymap/Makefile.in b/postfix/src/proxymap/Makefile.in index deb28075c..02c9d8c87 100644 --- a/postfix/src/proxymap/Makefile.in +++ b/postfix/src/proxymap/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/qmgr/Makefile.in b/postfix/src/qmgr/Makefile.in index 91f19f176..18e77af59 100644 --- a/postfix/src/qmgr/Makefile.in +++ b/postfix/src/qmgr/Makefile.in @@ -21,6 +21,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/qmqpd/Makefile.in b/postfix/src/qmqpd/Makefile.in index b61043840..e5db831dd 100644 --- a/postfix/src/qmqpd/Makefile.in +++ b/postfix/src/qmqpd/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libdns.a ../../lib/ $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/scache/Makefile.in b/postfix/src/scache/Makefile.in index 9ce850494..b4cc80885 100644 --- a/postfix/src/scache/Makefile.in +++ b/postfix/src/scache/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/sendmail/Makefile.in b/postfix/src/sendmail/Makefile.in index 364e6a15a..4df66f03d 100644 --- a/postfix/src/sendmail/Makefile.in +++ b/postfix/src/sendmail/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/showq/Makefile.in b/postfix/src/showq/Makefile.in index 285d77adc..81e0423ed 100644 --- a/postfix/src/showq/Makefile.in +++ b/postfix/src/showq/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/smtp/Makefile.in b/postfix/src/smtp/Makefile.in index 16cae7bd2..4f6c6253d 100644 --- a/postfix/src/smtp/Makefile.in +++ b/postfix/src/smtp/Makefile.in @@ -20,6 +20,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a \ $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/smtp/smtp_connect.c b/postfix/src/smtp/smtp_connect.c index ecaa2ebfa..3b69841d3 100644 --- a/postfix/src/smtp/smtp_connect.c +++ b/postfix/src/smtp/smtp_connect.c @@ -561,9 +561,6 @@ int smtp_connect(SMTP_STATE *state) (*(cpp) && (cpp) >= (sites)->argv + (non_fallback_sites)) for (cpp = sites->argv; SMTP_RCPT_LEFT(state) > 0 && (dest = *cpp) != 0; cpp++) { - if (i_am_mx && IS_FALLBACK_RELAY(cpp, sites, non_fallback_sites)) - break; - state->final_server = (cpp[1] == 0); /* * Parse the destination. Default is to use the SMTP port. Look up @@ -588,7 +585,11 @@ int smtp_connect(SMTP_STATE *state) /* XXX We could be an MX host for this destination... */ } else { addr_list = smtp_domain_addr(domain, misc_flags, why, &i_am_mx); + /* If we're MX host, don't connect to non-MX backups. */ + if (i_am_mx) + argv_truncate(sites, cpp - sites->argv + 1); } + state->final_server = (cpp[1] == 0); /* * When session caching is enabled, store the first good session for @@ -699,8 +700,16 @@ int smtp_connect(SMTP_STATE *state) * * Pay attention to what could be configuration problems, and pretend that * these are recoverable rather than bouncing the mail. + * + * In case of a "no error" indication we make up an excuse; this can happen + * when the fall-back relay was already tried via a cached connection, so + * that the address list scrubber left behind an empty list. */ if (SMTP_RCPT_LEFT(state) > 0) { + if (smtp_errno == SMTP_ERR_NONE) { + vstring_sprintf(why, "server unavailable or unable to receive mail"); + smtp_errno = SMTP_ERR_RETRY; + } switch (smtp_errno) { default: diff --git a/postfix/src/smtp/smtp_proto.c b/postfix/src/smtp/smtp_proto.c index 398a951c7..f197ea5e1 100644 --- a/postfix/src/smtp/smtp_proto.c +++ b/postfix/src/smtp/smtp_proto.c @@ -1411,8 +1411,7 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state, vstring_str(session->scratch), VSTRING_LEN(session->scratch)); if (mime_errs) { - smtp_mesg_fail(state, 554, - "MIME 7-bit conversion failed: %s", + smtp_mesg_fail(state, 554, "%s", mime_state_error(mime_errs)); RETURN(0); } @@ -1429,12 +1428,13 @@ static int smtp_loop(SMTP_STATE *state, NOCLOBBER int send_state, * ending in newline via /usr/sbin/sendmail while MIME input * processing is turned off, and MIME 8bit->7bit conversion * is requested upon delivery. + * + * Or some error while doing generic address mapping. */ mime_errs = mime_state_update(session->mime_state, rec_type, "", 0); if (mime_errs) { - smtp_mesg_fail(state, 554, - "MIME 7-bit conversion failed: %s", + smtp_mesg_fail(state, 554, "%s", mime_state_error(mime_errs)); RETURN(0); } diff --git a/postfix/src/smtp/smtp_sasl_glue.c b/postfix/src/smtp/smtp_sasl_glue.c index 735c2a456..b6e93ee8c 100644 --- a/postfix/src/smtp/smtp_sasl_glue.c +++ b/postfix/src/smtp/smtp_sasl_glue.c @@ -412,7 +412,7 @@ void smtp_sasl_start(SMTP_SESSION *session, const char *sasl_opts_name, */ memset(&sec_props, 0L, sizeof(sec_props)); sec_props.min_ssf = 0; - sec_props.max_ssf = 1; /* don't allow real SASL + sec_props.max_ssf = 0; /* don't allow real SASL * security layer */ sec_props.security_flags = name_mask(sasl_opts_name, smtp_sasl_sec_mask, sasl_opts_val); diff --git a/postfix/src/smtpd/Makefile.in b/postfix/src/smtpd/Makefile.in index 88a8dbe9b..4c0c64218 100644 --- a/postfix/src/smtpd/Makefile.in +++ b/postfix/src/smtpd/Makefile.in @@ -21,6 +21,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a \ $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/smtpd/smtpd_sasl_glue.c b/postfix/src/smtpd/smtpd_sasl_glue.c index 63f3d8183..bc2f0e22f 100644 --- a/postfix/src/smtpd/smtpd_sasl_glue.c +++ b/postfix/src/smtpd/smtpd_sasl_glue.c @@ -289,7 +289,7 @@ void smtpd_sasl_connect(SMTPD_STATE *state, const char *sasl_opts_name, */ memset(&sec_props, 0, sizeof(sec_props)); sec_props.min_ssf = 0; - sec_props.max_ssf = 1; /* don't allow real SASL + sec_props.max_ssf = 0; /* don't allow real SASL * security layer */ sec_props.security_flags = name_mask(sasl_opts_name, smtpd_sasl_mask, sasl_opts_val); diff --git a/postfix/src/smtpstone/Makefile.in b/postfix/src/smtpstone/Makefile.in index e05b1bc02..5823191d7 100644 --- a/postfix/src/smtpstone/Makefile.in +++ b/postfix/src/smtpstone/Makefile.in @@ -14,6 +14,8 @@ LIBS = ../../lib/libglobal.a ../../lib/libutil.a all: $(PROG) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/spawn/Makefile.in b/postfix/src/spawn/Makefile.in index a755e3610..93dacccd5 100644 --- a/postfix/src/spawn/Makefile.in +++ b/postfix/src/spawn/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/tls/Makefile.in b/postfix/src/tls/Makefile.in index d524015fa..c6ed48a80 100644 --- a/postfix/src/tls/Makefile.in +++ b/postfix/src/tls/Makefile.in @@ -24,6 +24,8 @@ MAKES = all: $(LIB) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/tlsmgr/Makefile.in b/postfix/src/tlsmgr/Makefile.in index ddfd530a6..ef0d2e13c 100644 --- a/postfix/src/tlsmgr/Makefile.in +++ b/postfix/src/tlsmgr/Makefile.in @@ -16,6 +16,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libglobal.a \ $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (set -e; echo "# DO NOT EDIT"; $(OPTS) $(SHELL) ../../makedefs && cat $?) >$@ diff --git a/postfix/src/trivial-rewrite/Makefile.in b/postfix/src/trivial-rewrite/Makefile.in index dfe21f6e2..7c134d057 100644 --- a/postfix/src/trivial-rewrite/Makefile.in +++ b/postfix/src/trivial-rewrite/Makefile.in @@ -20,6 +20,8 @@ all: $(PROG) $(LIB) $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in index ea4c68980..70190d573 100644 --- a/postfix/src/util/Makefile.in +++ b/postfix/src/util/Makefile.in @@ -109,6 +109,8 @@ INC_DIR = ../../include all: $(LIB) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/util/argv.c b/postfix/src/util/argv.c index bf3fb84ce..33f1843d1 100644 --- a/postfix/src/util/argv.c +++ b/postfix/src/util/argv.c @@ -23,6 +23,10 @@ /* /* void argv_terminate(argvp); /* ARGV *argvp; +/* +/* void argv_truncate(argvp, len); +/* ARGV *argvp; +/* int len; /* DESCRIPTION /* The functions in this module manipulate arrays of string /* pointers. An ARGV structure contains the following members: @@ -49,6 +53,10 @@ /* returns a null pointer. /* /* argv_terminate() null-terminates its string array argument. +/* +/* argv_truncate() trucates its argument to the specified +/* number of entries, but does not reallocate memory. The +/* result is null-terminated. /* SEE ALSO /* msg(3) diagnostics interface /* DIAGNOSTICS @@ -177,3 +185,23 @@ void argv_terminate(ARGV *argvp) */ argvp->argv[argvp->argc] = 0; } + +/* argv_truncate - truncate string array */ + +void argv_truncate(ARGV *argvp, int len) +{ + char **cpp; + + /* + * Sanity check. + */ + if (len < 0) + msg_panic("argv_truncate: bad length %d", len); + + if (len < argvp->argc) { + for (cpp = argvp->argv + len; cpp < argvp->argv + argvp->argc; cpp++) + myfree(*cpp); + argvp->argc = len; + argvp->argv[argvp->argc] = 0; + } +} diff --git a/postfix/src/util/argv.h b/postfix/src/util/argv.h index f490c7034..9c0e75851 100644 --- a/postfix/src/util/argv.h +++ b/postfix/src/util/argv.h @@ -24,6 +24,7 @@ extern ARGV *argv_alloc(int); extern void argv_add(ARGV *,...); extern void argv_addn(ARGV *,...); extern void argv_terminate(ARGV *); +extern void argv_truncate(ARGV *, int); extern ARGV *argv_free(ARGV *); extern ARGV *argv_split(const char *, const char *); diff --git a/postfix/src/util/dict_cdb.c b/postfix/src/util/dict_cdb.c index a66004d44..1c596ffea 100644 --- a/postfix/src/util/dict_cdb.c +++ b/postfix/src/util/dict_cdb.c @@ -189,6 +189,15 @@ static DICT *dict_cdbq_open(const char *path, int dict_flags) dict_cdbq->dict.mtime = st.st_mtime; close_on_exec(fd, CLOSE_ON_EXEC); + /* + * Warn if the source file is newer than the indexed file, except when + * the source file changed only seconds ago. + */ + if (stat(path, &st) == 0 + && st.st_mtime > dict_cdbq->dict.mtime + && st.st_mtime < time((time_t *)0) - 100) + msg_warn("database %s is older than source file %s", cdb_path, path); + /* * If undecided about appending a null byte to key and value, choose to * try both in query mode. diff --git a/postfix/src/util/sys_defs.h b/postfix/src/util/sys_defs.h index 42a365896..11e847e41 100644 --- a/postfix/src/util/sys_defs.h +++ b/postfix/src/util/sys_defs.h @@ -1287,6 +1287,15 @@ typedef int pid_t; */ #ifndef SET_H_ERRNO #define SET_H_ERRNO(err) (h_errno = (err)) +#endif + + /* + * Don't mix socket message calls with socket read/write calls. The fact + * that you can get away with it only on some stacks implies that there is + * no long-term guarantee. + */ +#ifndef CAN_WRITE_BEFORE_SENDING_FD +#define CANT_WRITE_BEFORE_SENDING_FD #endif /* diff --git a/postfix/src/verify/Makefile.in b/postfix/src/verify/Makefile.in index 39215f543..56dd0544b 100644 --- a/postfix/src/verify/Makefile.in +++ b/postfix/src/verify/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@ diff --git a/postfix/src/virtual/Makefile.in b/postfix/src/virtual/Makefile.in index d0e7bca7d..d9b8d1213 100644 --- a/postfix/src/virtual/Makefile.in +++ b/postfix/src/virtual/Makefile.in @@ -15,6 +15,8 @@ LIBS = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a $(PROG): $(OBJS) $(LIBS) $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS) +$(OBJS): ../../conf/makedefs.out + Makefile: Makefile.in (cat ../../conf/makedefs.out $?) >$@