Prereq: "3.3.17" diff -ur --new-file /var/tmp/postfix-3.3.17/src/global/mail_version.h ./src/global/mail_version.h --- /var/tmp/postfix-3.3.17/src/global/mail_version.h 2021-04-11 10:51:11.000000000 -0400 +++ ./src/global/mail_version.h 2021-06-13 15:05:09.000000000 -0400 @@ -20,8 +20,8 @@ * Patches change both the patchlevel and the release date. Snapshots have no * patchlevel; they change the release date only. */ -#define MAIL_RELEASE_DATE "20210411" -#define MAIL_VERSION_NUMBER "3.3.17" +#define MAIL_RELEASE_DATE "20210613" +#define MAIL_VERSION_NUMBER "3.3.18" #ifdef SNAPSHOT #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE diff -ur --new-file /var/tmp/postfix-3.3.17/HISTORY ./HISTORY --- /var/tmp/postfix-3.3.17/HISTORY 2021-04-11 10:48:36.000000000 -0400 +++ ./HISTORY 2021-06-13 14:58:13.000000000 -0400 @@ -23734,3 +23734,20 @@ Missing null pointer check (introduced: Postfix alpha) after null argv[0] value. File: global/mail_task.c. + +20210601 + + Bugfix (introduced: Postfix 2.11): the command "postmap + lmdb:/file/name" handled duplicate keys ungracefully, + discarding entries stored up to and including the duplicate + key, and causing a double free() call with lmdb versions + 0.9.17 and later. Reported by Adi Prasaja; double free() + root cause analysis by Howard Chu. File: util/slmdb.c. + +20210612 + + Support for Postfix 3.6 compatibility_level syntax, to avoid + fatal runtime errors when rolling back from Postfix 3.6 to + an earlier supported version, or when sharing Postfix 3.6 + configuration files with an earlier supported Postfix + version. File: global/mail_params.c. diff -ur --new-file /var/tmp/postfix-3.3.17/src/global/mail_params.c ./src/global/mail_params.c --- /var/tmp/postfix-3.3.17/src/global/mail_params.c 2021-01-16 19:54:32.000000000 -0500 +++ ./src/global/mail_params.c 2021-06-12 11:05:25.000000000 -0400 @@ -815,6 +815,17 @@ const char *cp; /* + * Ignore the Postfix >= 3.6 compatibility_level's minor and patch + * fields, to allow rollback from Postfix >= 3.6, and to allow + * configuration sharing with Postfix >= 3.6. + */ + const char *compat_level_str; + + if ((compat_level_str = mail_conf_lookup(VAR_COMPAT_LEVEL)) != 0 + && ISDIGIT(compat_level_str[0]) && strchr(compat_level_str, '.') != 0) + set_mail_conf_int(VAR_COMPAT_LEVEL, atoi(compat_level_str)); + + /* * Extract compatibility level first, so that we can determine what * parameters of interest are left at their legacy defaults. */ diff -ur --new-file /var/tmp/postfix-3.3.17/src/util/slmdb.c ./src/util/slmdb.c --- /var/tmp/postfix-3.3.17/src/util/slmdb.c 2017-02-18 20:58:21.000000000 -0500 +++ ./src/util/slmdb.c 2021-06-01 17:02:52.000000000 -0400 @@ -386,12 +386,16 @@ * - With a bulk-mode transaction we commit when the database is closed. */ if (slmdb->open_flags & O_TRUNC) { - if ((status = mdb_drop(slmdb->txn, slmdb->dbi, 0)) != 0) + if ((status = mdb_drop(slmdb->txn, slmdb->dbi, 0)) != 0) { + mdb_txn_abort(slmdb->txn); + slmdb->txn = 0; return (status); + } if ((slmdb->slmdb_flags & SLMDB_FLAG_BULK) == 0) { - if ((status = mdb_txn_commit(slmdb->txn)) != 0) - return (status); + status = mdb_txn_commit(slmdb->txn); slmdb->txn = 0; + if (status != 0) + return (status); } } else if ((slmdb->lmdb_flags & MDB_RDONLY) != 0 || (slmdb->slmdb_flags & SLMDB_FLAG_BULK) == 0) { @@ -582,11 +586,15 @@ * Do the update. */ if ((status = mdb_put(txn, slmdb->dbi, mdb_key, mdb_value, flags)) != 0) { - mdb_txn_abort(txn); if (status != MDB_KEYEXIST) { + mdb_txn_abort(txn); if ((status = slmdb_recover(slmdb, status)) == 0) status = slmdb_put(slmdb, mdb_key, mdb_value, flags); SLMDB_API_RETURN(slmdb, status); + } else { + /* Abort non-bulk transaction only. */ + if (slmdb->txn == 0) + mdb_txn_abort(txn); } }