Postfix version 1.1 patch 02 fixes one portability problem and adds code that detects a Berkeley DB version conflict, which appears to be the most common cause for Postfix crashes on Linux. - Portability: some Linux systems install libnsl.so without libnsl.a file, causing an yp_match undefined reference problem. - Safety: extra code to detect and report Berkeley DB version mismatches between compile time and run time. This test is limited to mismatches in the major and minor version numbers. The patch, as well as patched Postfix source code, can be found at ftp://ftp.porcupine.org/mirrors/postfix-release/official/ 7083 Jan 25 10:54 postfix-1.1-patch02.gz 207831 Jan 25 10:32 postfix-1.1.2.HISTORY 50801 Jan 25 10:44 postfix-1.1.2.RELEASE_NOTES 1173372 Jan 25 10:44 postfix-1.1.2.tar.gz 152 Jan 25 10:44 postfix-1.1.2.tar.gz.sig You can also point your browser at: ftp://ftp.porcupine.org/mirrors/postfix-release/index.html Soon to appear on the mirror sites listed on www.postfix.org. Wietse Prereq: "1.1.1" diff -cr /tmp/postfix-1.1.1/src/global/mail_version.h ./src/global/mail_version.h *** /tmp/postfix-1.1.1/src/global/mail_version.h Tue Jan 22 09:44:07 2002 --- ./src/global/mail_version.h Fri Jan 25 10:30:37 2002 *************** *** 22,30 **** */ #define VAR_MAIL_VERSION "mail_version" #ifdef SNAPSHOT ! #define DEF_MAIL_VERSION "1.1.1-$mail_release_date" #else ! #define DEF_MAIL_VERSION "1.1.1" #endif extern char *var_mail_version; --- 22,30 ---- */ #define VAR_MAIL_VERSION "mail_version" #ifdef SNAPSHOT ! #define DEF_MAIL_VERSION "1.1.2-$mail_release_date" #else ! #define DEF_MAIL_VERSION "1.1.2" #endif extern char *var_mail_version; *************** *** 32,38 **** * Release date. */ #define VAR_MAIL_RELEASE "mail_release_date" ! #define DEF_MAIL_RELEASE "20020122" extern char *var_mail_release; /* LICENSE --- 32,38 ---- * Release date. */ #define VAR_MAIL_RELEASE "mail_release_date" ! #define DEF_MAIL_RELEASE "20020125" extern char *var_mail_release; /* LICENSE diff -cr /tmp/postfix-1.1.1/HISTORY ./HISTORY *** /tmp/postfix-1.1.1/HISTORY Tue Jan 22 11:22:35 2002 --- ./HISTORY Fri Jan 25 10:32:54 2002 *************** *** 6004,6010 **** Safety: when postmap creates a non-existent file, the new file inherits group/other read permissions from the source ! file. LaMont Jones, HP. File: postmap/postmap.c. Open problems: --- 6004,6035 ---- Safety: when postmap creates a non-existent file, the new file inherits group/other read permissions from the source ! file. Based on code by LaMont Jones, HP. File: ! postmap/postmap.c. ! ! 20020124 ! ! Portability: some Linux systems install libnsl.so without ! libnsl.a file, causing an yp_match undefined reference ! problem. File: makedefs. ! ! 20020124 ! ! Portability: post-install now requests that command_directory ! is given on the command line when the postconf command is ! in an unusual place. ! ! Safety: extra code to detect and report Berkeley DB version ! mismatches between compile time and run time. This test ! is limited to mismatches in the major version number only. ! File: util/dict_db.c. Based on code by Lawrence Greenfield, ! Carnegie-Mellon university. ! ! Safety: the postfix command and the master daemon abort if ! they are running set-uid. ! ! Documentation: the postmap manual page described an out of ! date input file format. Open problems: diff -cr /tmp/postfix-1.1.1/Makefile.in ./Makefile.in *** /tmp/postfix-1.1.1/Makefile.in Sun Jan 13 20:17:09 2002 --- ./Makefile.in Thu Jan 24 19:44:13 2002 *************** *** 47,60 **** || exit 1; \ done - cleanmakefiles: - set -e; for i in $(DIRS); do \ - (set -e; echo "[$$i]"; cd $$i; rm -f Makefile; \ - ../cleanup_makefile.pl Makefile.in >Makefile.new; \ - rm Makefile.in ; mv Makefile.new Makefile.in); \ - done; - rm -f Makefile; (set -e; sh makedefs && cat Makefile.in) >Makefile - tidy: clean rm -f Makefile */Makefile src/*/Makefile cp Makefile.init Makefile --- 47,52 ---- diff -cr /tmp/postfix-1.1.1/RELEASE_NOTES ./RELEASE_NOTES *** /tmp/postfix-1.1.1/RELEASE_NOTES Tue Jan 22 11:31:42 2002 --- ./RELEASE_NOTES Fri Jan 25 10:44:27 2002 *************** *** 7,15 **** number, b=minor release number, c=patchlevel. Snapshot releases are now called a.b.c-yyyymmdd where yyyymmdd is the release date (yyyy=year, mm=month, dd=day). The mail_release_date configuration ! parameter contains the release date. Patches change the patchlevel ! and the release date. Snapshots change only the release date, unless ! they include the same bugfix as a patch release. Incompatible changes with Postfix version 1.1.1 (released 20020122) =================================================================== --- 7,25 ---- number, b=minor release number, c=patchlevel. Snapshot releases are now called a.b.c-yyyymmdd where yyyymmdd is the release date (yyyy=year, mm=month, dd=day). The mail_release_date configuration ! parameter contains the release date (both for official release and ! snapshot release). Patches change the patchlevel and the release ! date. Snapshots change only the release date, unless they include ! the same bugfix as a patch release. ! ! Incompatible changes with Postfix version 1.1.2 (released 20020125) ! =================================================================== ! ! Postfix now detects if the run-time Berkeley DB library routines ! do not match the major version number of the compile-time include ! file that was used for compiling Postfix. The software issues a ! warning and aborts in case of a discrepancy. If it didn't, the ! software was certain to crash with a segmentation violation. Incompatible changes with Postfix version 1.1.1 (released 20020122) =================================================================== *************** *** 28,34 **** type that is used only for messages that actually use VERP (variable envelope return path) support. With this sole exception, the queue file format is entirely backwards compatible with the previous ! official Postfix release (20020228, a.k.a. Postfix 1.0.0). [snapshot-20020106] This release modifies the existing master.cf file. The local pickup service is now unprivileged, and the cleanup --- 38,44 ---- type that is used only for messages that actually use VERP (variable envelope return path) support. With this sole exception, the queue file format is entirely backwards compatible with the previous ! official Postfix release (20010228, a.k.a. Postfix 1.0.0). [snapshot-20020106] This release modifies the existing master.cf file. The local pickup service is now unprivileged, and the cleanup diff -cr /tmp/postfix-1.1.1/conf/aliases ./conf/aliases *** /tmp/postfix-1.1.1/conf/aliases Sat Jan 5 19:53:01 2002 --- ./conf/aliases Fri Jan 25 09:52:43 2002 *************** *** 1,4 **** --- 1,8 ---- # + # Sample aliases file. Install in the location as specified by the + # output from the command "postconf alias_maps". Typical path names + # are /etc/aliases or /etc/mail/aliases. + # # >>>>>>>>>> The program "newaliases" must be run after # >> NOTE >> this file is updated for any changes to # >>>>>>>>>> show through to Postfix. diff -cr /tmp/postfix-1.1.1/conf/post-install ./conf/post-install *** /tmp/postfix-1.1.1/conf/post-install Thu Jan 17 15:08:59 2002 --- ./conf/post-install Thu Jan 24 10:28:44 2002 *************** *** 234,239 **** --- 234,245 ---- POSTCONF="postconf" fi + $POSTCONF -d mail_version >/dev/null 2>/dev/null || { + echo $0: Error: no $POSTCONF command found. 1>&2 + echo Re-run this command as $0 command_directory=/some/where. 1>&2 + exit 1 + } + test -n "$config_directory" || config_directory=`$POSTCONF -d -h config_directory` || exit 1 diff -cr /tmp/postfix-1.1.1/html/postmap.1.html ./html/postmap.1.html *** /tmp/postfix-1.1.1/html/postmap.1.html Tue Jan 22 11:25:29 2002 --- ./html/postmap.1.html Fri Jan 25 08:53:04 2002 *************** *** 31,109 **** key whitespace value ! o A line that starts with whitespace (space or tab) ! is a continuation of the previous line. An empty ! line terminates the previous line, as does a line ! that starts with non-whitespace (text or comment). ! A comment line that starts with whitespace does not ! terminate multi-line text. ! ! o The # is recognized as the start of a comment, but ! only when it is the first non-whitespace character ! on a line. A comment terminates at the end of the ! line, even when the next line starts with whites- ! pace. ! ! The key and value are processed as is, except that sur- ! rounding white space is stripped off. Unlike with Postfix ! alias databases, quotes cannot be used to protect lookup ! keys that contain special characters such as `#' or whitespace. The key is mapped to lowercase to make mapping lookups case insensitive. Options: ! -N Include the terminating null character that termi- ! nates lookup keys and values. By default, Postfix does whatever is the default for the host operating system. -c config_dir ! Read the main.cf configuration file in the named directory instead of the default configuration directory. ! -d key Search the specified maps for key and remove one ! entry per map. The exit status is zero when the requested information was found. If a key value of - is specified, the program reads key values from the standard input stream. The exit ! status is zero when at least one of the requested keys was found. -f Do not fold the lookup key to lower case while cre- ating or querying a map. ! -i Incremental mode. Read entries from standard input and do not truncate an existing database. By ! default, postmap creates a new database from the entries in file_name. ! -n Don't include the terminating null character that ! terminates lookup keys and values. By default, ! Postfix does whatever is the default for the host operating system. ! -q key Search the specified maps for key and print the ! first value found on the standard output stream. The exit status is zero when the requested informa- tion was found. If a key value of - is specified, the program reads ! key values from the standard input stream and ! prints one line of key value output for each key ! that was found. The exit status is zero when at least one of the requested keys was found. ! -r When updating a table, do not warn about duplicate entries; silently replace them. -v Enable verbose logging for debugging purposes. Mul- ! tiple -v options make the software increasingly verbose. ! -w When updating a table, do not warn about duplicate entries; silently ignore them. Arguments: --- 31,104 ---- key whitespace value ! o Empty lines and whitespace-only lines are ignored, ! as are lines whose first non-whitespace character ! is a `#'. ! ! o A logical line starts with non-whitespace text. A ! line that starts with whitespace continues a logi- ! cal line. ! ! The key and value are processed as is, except that sur- ! rounding white space is stripped off. Unlike with Postfix ! alias databases, quotes cannot be used to protect lookup ! keys that contain special characters such as `#' or whitespace. The key is mapped to lowercase to make mapping lookups case insensitive. Options: ! -N Include the terminating null character that termi- ! nates lookup keys and values. By default, Postfix does whatever is the default for the host operating system. -c config_dir ! Read the main.cf configuration file in the named directory instead of the default configuration directory. ! -d key Search the specified maps for key and remove one ! entry per map. The exit status is zero when the requested information was found. If a key value of - is specified, the program reads key values from the standard input stream. The exit ! status is zero when at least one of the requested keys was found. -f Do not fold the lookup key to lower case while cre- ating or querying a map. ! -i Incremental mode. Read entries from standard input and do not truncate an existing database. By ! default, postmap creates a new database from the entries in file_name. ! -n Don't include the terminating null character that ! terminates lookup keys and values. By default, ! Postfix does whatever is the default for the host operating system. ! -q key Search the specified maps for key and print the ! first value found on the standard output stream. The exit status is zero when the requested informa- tion was found. If a key value of - is specified, the program reads ! key values from the standard input stream and ! prints one line of key value output for each key ! that was found. The exit status is zero when at least one of the requested keys was found. ! -r When updating a table, do not warn about duplicate entries; silently replace them. -v Enable verbose logging for debugging purposes. Mul- ! tiple -v options make the software increasingly verbose. ! -w When updating a table, do not warn about duplicate entries; silently ignore them. Arguments: *************** *** 111,135 **** file_type The type of database to be produced. ! btree The output file is a btree file, named ! file_name.db. This is available only on systems with support for db databases. ! dbm The output consists of two files, named ! file_name.pag and file_name.dir. This is ! available only on systems with support for dbm databases. ! hash The output file is a hashed file, named ! file_name.db. This is available only on systems with support for db databases. ! When no file_type is specified, the software uses ! the database type specified via the database_type configuration parameter. file_name ! The name of the lookup table source file when rebuilding a database. DIAGNOSTICS --- 106,130 ---- file_type The type of database to be produced. ! btree The output file is a btree file, named ! file_name.db. This is available only on systems with support for db databases. ! dbm The output consists of two files, named ! file_name.pag and file_name.dir. This is ! available only on systems with support for dbm databases. ! hash The output file is a hashed file, named ! file_name.db. This is available only on systems with support for db databases. ! When no file_type is specified, the software uses ! the database type specified via the database_type configuration parameter. file_name ! The name of the lookup table source file when rebuilding a database. DIAGNOSTICS *************** *** 137,144 **** stream. No output means no problems. Duplicate entries are skipped and are flagged with a warning. ! postmap terminates with zero exit status in case of suc- ! cess (including successful postmap -q lookup) and termi- nates with non-zero exit status in case of failure. ENVIRONMENT --- 132,139 ---- stream. No output means no problems. Duplicate entries are skipped and are flagged with a warning. ! postmap terminates with zero exit status in case of suc- ! cess (including successful postmap -q lookup) and termi- nates with non-zero exit status in case of failure. ENVIRONMENT *************** *** 150,161 **** CONFIGURATION PARAMETERS database_type ! Default output database type. On many UNIX sys- ! tems, the default database type is either hash or dbm. LICENSE ! The Secure Mailer license must be distributed with this software. AUTHOR(S) --- 145,156 ---- CONFIGURATION PARAMETERS database_type ! Default output database type. On many UNIX sys- ! tems, the default database type is either hash or dbm. LICENSE ! The Secure Mailer license must be distributed with this software. AUTHOR(S) diff -cr /tmp/postfix-1.1.1/makedefs ./makedefs *** /tmp/postfix-1.1.1/makedefs Wed Nov 21 16:40:39 2001 --- ./makedefs Fri Jan 25 09:17:18 2002 *************** *** 196,202 **** SYSLIBS="-ldb" for name in nsl resolv $GDBM_LIBS do ! test -f /usr/lib/lib$name.a && SYSLIBS="$SYSLIBS -l$name" done ;; IRIX*.5.*) SYSTYPE=IRIX5 --- 196,204 ---- SYSLIBS="-ldb" for name in nsl resolv $GDBM_LIBS do ! test -e /usr/lib/lib$name.a -o -e /usr/lib/lib$name.so \ ! -o -e /lib/lib$name.a -o -e /lib/lib$name.so \ ! && SYSLIBS="$SYSLIBS -l$name" done ;; IRIX*.5.*) SYSTYPE=IRIX5 diff -cr /tmp/postfix-1.1.1/man/man1/postmap.1 ./man/man1/postmap.1 *** /tmp/postfix-1.1.1/man/man1/postmap.1 Tue Jan 22 11:25:28 2002 --- ./man/man1/postmap.1 Fri Jan 25 08:53:04 2002 *************** *** 37,51 **** .ti +5 \fIkey\fR whitespace \fIvalue\fR .IP \(bu ! A line that starts with whitespace (space or tab) is a continuation ! of the previous line. An empty line terminates the previous line, ! as does a line that starts with non-whitespace (text or comment). A ! comment line that starts with whitespace does not terminate multi-line ! text. .IP \(bu ! The \fB#\fR is recognized as the start of a comment, but only when it is ! the first non-whitespace character on a line. A comment terminates ! at the end of the line, even when the next line starts with whitespace. .PP The \fIkey\fR and \fIvalue\fR are processed as is, except that surrounding white space is stripped off. Unlike with Postfix alias --- 37,47 ---- .ti +5 \fIkey\fR whitespace \fIvalue\fR .IP \(bu ! Empty lines and whitespace-only lines are ignored, as ! are lines whose first non-whitespace character is a `#'. .IP \(bu ! A logical line starts with non-whitespace text. A line that ! starts with whitespace continues a logical line. .PP The \fIkey\fR and \fIvalue\fR are processed as is, except that surrounding white space is stripped off. Unlike with Postfix alias diff -cr /tmp/postfix-1.1.1/proto/aliases0 ./proto/aliases0 *** /tmp/postfix-1.1.1/proto/aliases0 Thu Mar 9 20:36:49 2000 --- ./proto/aliases0 Fri Jan 25 09:39:40 2002 *************** *** 1,4 **** --- 1,8 ---- # + # Sample aliases file. Install in the location as specified by the + # output from the command "postconf alias_maps". Typical path names + # are /etc/aliases or /etc/mail/aliases. + # # >>>>>>>>>> The program "newaliases" must be run after # >> NOTE >> this file is updated for any changes to # >>>>>>>>>> show through to Postfix. diff -cr /tmp/postfix-1.1.1/src/master/Makefile.in ./src/master/Makefile.in *** /tmp/postfix-1.1.1/src/master/Makefile.in Tue Jan 15 10:25:12 2002 --- ./src/master/Makefile.in Fri Jan 25 09:10:30 2002 *************** *** 100,105 **** --- 100,106 ---- master.o: ../../include/watchdog.h master.o: ../../include/clean_env.h master.o: ../../include/argv.h + master.o: ../../include/safe.h master.o: ../../include/mail_params.h master.o: ../../include/debug_process.h master.o: ../../include/mail_task.h diff -cr /tmp/postfix-1.1.1/src/master/master.c ./src/master/master.c *** /tmp/postfix-1.1.1/src/master/master.c Thu Jul 19 13:35:36 2001 --- ./src/master/master.c Fri Jan 25 09:09:55 2002 *************** *** 154,159 **** --- 154,160 ---- #include #include #include + #include /* Global library. */ *************** *** 239,244 **** --- 240,255 ---- * Initialize logging and exit handler. */ msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY); + + /* + * The mail system must be run by the superuser so it can revoke + * privileges for selected operations. That's right - it takes privileges + * to toss privileges. + */ + if (getuid() != 0) + msg_fatal("the master command is reserved for the superuser"); + if (unsafe() != 0) + msg_fatal("the master command must not run as a set-uid process"); /* * If started from a terminal, get rid of any tty association. This also diff -cr /tmp/postfix-1.1.1/src/postfix/Makefile.in ./src/postfix/Makefile.in *** /tmp/postfix-1.1.1/src/postfix/Makefile.in Tue Jan 15 10:25:12 2002 --- ./src/postfix/Makefile.in Fri Jan 25 09:10:36 2002 *************** *** 68,72 **** --- 68,73 ---- postfix.o: ../../include/vstring.h postfix.o: ../../include/clean_env.h postfix.o: ../../include/argv.h + postfix.o: ../../include/safe.h postfix.o: ../../include/mail_conf.h postfix.o: ../../include/mail_params.h diff -cr /tmp/postfix-1.1.1/src/postfix/postfix.c ./src/postfix/postfix.c *** /tmp/postfix-1.1.1/src/postfix/postfix.c Tue Jan 15 14:01:01 2002 --- ./src/postfix/postfix.c Fri Jan 25 09:10:11 2002 *************** *** 144,149 **** --- 144,150 ---- #include #include #include + #include /* Global library. */ *************** *** 175,181 **** char *script; struct stat st; char *slash; - int uid; int fd; int ch; ARGV *import_env; --- 176,181 ---- *************** *** 220,229 **** * privileges for selected operations. That's right - it takes privileges * to toss privileges. */ ! if ((uid = getuid()) != 0) { msg_error("to submit mail, use the Postfix sendmail command"); msg_fatal("the postfix command is reserved for the superuser"); } /* * Parse switches. --- 220,231 ---- * privileges for selected operations. That's right - it takes privileges * to toss privileges. */ ! if (getuid() != 0) { msg_error("to submit mail, use the Postfix sendmail command"); msg_fatal("the postfix command is reserved for the superuser"); } + if (unsafe() != 0) + msg_fatal("the postfix command must not run as a set-uid process"); /* * Parse switches. diff -cr /tmp/postfix-1.1.1/src/postmap/postmap.c ./src/postmap/postmap.c *** /tmp/postfix-1.1.1/src/postmap/postmap.c Tue Jan 22 11:19:48 2002 --- ./src/postmap/postmap.c Fri Jan 25 08:52:52 2002 *************** *** 31,45 **** /* .ti +5 /* \fIkey\fR whitespace \fIvalue\fR /* .IP \(bu ! /* A line that starts with whitespace (space or tab) is a continuation ! /* of the previous line. An empty line terminates the previous line, ! /* as does a line that starts with non-whitespace (text or comment). A ! /* comment line that starts with whitespace does not terminate multi-line ! /* text. /* .IP \(bu ! /* The \fB#\fR is recognized as the start of a comment, but only when it is ! /* the first non-whitespace character on a line. A comment terminates ! /* at the end of the line, even when the next line starts with whitespace. /* .PP /* The \fIkey\fR and \fIvalue\fR are processed as is, except that /* surrounding white space is stripped off. Unlike with Postfix alias --- 31,41 ---- /* .ti +5 /* \fIkey\fR whitespace \fIvalue\fR /* .IP \(bu ! /* Empty lines and whitespace-only lines are ignored, as ! /* are lines whose first non-whitespace character is a `#'. /* .IP \(bu ! /* A logical line starts with non-whitespace text. A line that ! /* starts with whitespace continues a logical line. /* .PP /* The \fIkey\fR and \fIvalue\fR are processed as is, except that /* surrounding white space is stripped off. Unlike with Postfix alias diff -cr /tmp/postfix-1.1.1/src/qmqpd/qmqpd.c ./src/qmqpd/qmqpd.c *** /tmp/postfix-1.1.1/src/qmqpd/qmqpd.c Sun Dec 30 20:17:55 2001 --- ./src/qmqpd/qmqpd.c Wed Jan 23 10:22:12 2002 *************** *** 432,438 **** /* qmqpd_send_status - send mail transaction completion status */ ! static int qmqpd_send_status(QMQPD_STATE *state) { /* --- 432,438 ---- /* qmqpd_send_status - send mail transaction completion status */ ! static void qmqpd_send_status(QMQPD_STATE *state) { /* *************** *** 472,478 **** /* qmqpd_receive - receive QMQP message+sender+recipients */ ! static int qmqpd_receive(QMQPD_STATE *state) { /* --- 472,478 ---- /* qmqpd_receive - receive QMQP message+sender+recipients */ ! static void qmqpd_receive(QMQPD_STATE *state) { /* diff -cr /tmp/postfix-1.1.1/src/util/dict_db.c ./src/util/dict_db.c *** /tmp/postfix-1.1.1/src/util/dict_db.c Sat Apr 14 14:42:24 2001 --- ./src/util/dict_db.c Fri Jan 25 10:27:03 2002 *************** *** 437,442 **** --- 437,459 ---- #endif + /* + * Mismatches between #include file and library are a common cause for + * trouble. + */ + #if DB_VERSION_MAJOR > 1 + int major_version; + int minor_version; + int patch_version; + + (void) db_version(&major_version, &minor_version, &patch_version); + if (major_version != DB_VERSION_MAJOR) + msg_fatal("incorrect version of Berkeley DB: " + "compiled against %d.%d.%d, linked against %d.%d.%d", + DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH, + major_version, minor_version, patch_version); + #endif + db_path = concatenate(path, ".db", (char *) 0); /* diff -cr /tmp/postfix-1.1.1/src/util/netstring.c ./src/util/netstring.c *** /tmp/postfix-1.1.1/src/util/netstring.c Sun Jul 8 13:55:23 2001 --- ./src/util/netstring.c Wed Jan 23 10:20:37 2002 *************** *** 257,262 **** --- 257,263 ---- if (limit && len > limit) netstring_except(stream, NETSTRING_ERR_SIZE); netstring_get_data(stream, buf, len); + return (buf); } /* netstring_put - send string as netstring */