Preparation: move src/global/dynamicmaps.[hc] to src/util
without making any other code changes. This is a baseline
for developing support to build tests with "shared=yes
- dynamicmaps=yes". Curently, tests must be built with
- "shared=yes dynamicmaps=no", which is annoying. Files:
+ dynamicmaps=yes". Currently, tests must be built with
+ "shared=yes dynamicmaps=no", which is annoying. Files:
util/dynamicmaps.[hc], util/Makefile.in, global/Makefile.in.
20260312
Deleted mail_version_parse() and mail_version_free()
infrastructure. It was used only by test code. Files:
src/global/mail_version.[hc].
+
+20260316
+
+ Cleanup: Berkeley DB plug-in support, like CDB and other
+ databases that have a third-party dependency. Files:
+ conf/dynamicmaps.cf, conf/postfix-files, makedefs, Makefile.in,
+ proto/DB_README.html, util/dict_open.c, util/Makefile.in,
+ util/sys_defs.h.
+
+ Build incompatibility: on non-Linux, non-BSD systems, if
+ CCARGS="...-DHAS_DB...", then it may be necessary to also
+ specify AUXLIBS_DB="-ldb".
+
+ Bugfix (defect introduced: 20260310) a change, to set the
+ service_name default value to "amnesiac", violated a test
+ that parameter names in postconf output must match 1:1 with
+ parameter names in the postlink script. File: global/mail_params.c,
+ postconf/postconf_builtin.c.
meta/dynamicmaps.cf: conf/dynamicmaps.cf Makefile
rm -f $@ && $(EXPAND) conf/dynamicmaps.cf | $(AWK) ' \
BEGIN { split("'"$(DEFINED_MAP_TYPES)"'", map_types); \
- for (n in map_types) has_type[map_types[n]] = n } \
+ for (n in map_types) has_type[map_types[n]] = n; \
+ if (has_type["db"]) { \
+ has_type["hash"] = has_type["btree"] = 1; \
+ delete has_type["db"] } } \
/^#/ { print } \
/^[a-z]/ { if (has_type[$$1]) print } \
' >$@
database is the name of the database file without the ".db" suffix. Berkeley DB
databases are maintained with the postmap(1) command.
-Note: Berkeley DB version 4 is not supported by Postfix versions before 2.0.
-
This document describes:
1. How to build Postfix without Berkeley DB support even if the system comes
something like:
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
- AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
+ AUXLIBS_DB="-L/usr/local/BerkeleyDB/lib -ldb"
% make
+Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier versions, use
+AUXLIBS instead.
+
If your Berkeley DB shared library is in a directory that the RUN-TIME linker
does not know about, add a "-Wl,-R,/path/to/directory" option after "-ldb".
Solaris needs this:
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
- AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
+ AUXLIBS_DB="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -
+ ldb"
% make
+Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier versions, use
+AUXLIBS instead.
+
The exact pathnames depend on the Berkeley DB version, and on how it was
installed.
To build Postfix on BSD systems with a non-default DB version, use a variant of
the following commands:
- % make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
+ % make makefiles CCARGS=-I/usr/include/db3 AUXLIBS_DB=-ldb3
% make
+Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier versions, use
+AUXLIBS instead.
+
Warning: the file format produced by Berkeley DB version 1 is not compatible
with that of versions 2 and 3 (versions 2 and 3 have the same format). If you
switch between DB versions, then you may have to rebuild all your Postfix DB
Add the "-lpthread" library to the "make makefiles" command.
- % make makefiles .... AUXLIBS="... -lpthread"
+ % make makefiles .... AUXLIBS_DB="... -lpthread"
+
+Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier versions, use
+AUXLIBS instead.
More information is available at https://www.oracle.com/database/technologies/
related/berkeleydb.html.
# dict-type so-name (pathname) dict-function mkmap-function
cdb ${LIB_PREFIX}cdb${LIB_SUFFIX} dict_cdb_open mkmap_cdb_open
+hash ${LIB_PREFIX}db${LIB_SUFFIX} dict_hash_open mkmap_hash_open
+btree ${LIB_PREFIX}db${LIB_SUFFIX} dict_btree_open mkmap_btree_open
ldap ${LIB_PREFIX}ldap${LIB_SUFFIX} dict_ldap_open
lmdb ${LIB_PREFIX}lmdb${LIB_SUFFIX} dict_lmdb_open mkmap_lmdb_open
mongodb ${LIB_PREFIX}mongodb${LIB_SUFFIX} dict_mongodb_open
$shlib_directory/lib${LIB_PREFIX}tls${LIB_SUFFIX}:f:root:-:755
$shlib_directory/lib${LIB_PREFIX}master${LIB_SUFFIX}:f:root:-:755
$shlib_directory/${LIB_PREFIX}cdb${LIB_SUFFIX}:f:root:-:755
+$shlib_directory/${LIB_PREFIX}db${LIB_SUFFIX}:f:root:-:755
$shlib_directory/${LIB_PREFIX}ldap${LIB_SUFFIX}:f:root:-:755
$shlib_directory/${LIB_PREFIX}lmdb${LIB_SUFFIX}:f:root:-:755
$shlib_directory/${LIB_PREFIX}mongodb${LIB_SUFFIX}:f:root:-:755
of the database file without the ".db" suffix. Berkeley DB databases
are maintained with the <a href="postmap.1.html">postmap(1)</a> command. </p>
-<p> Note: Berkeley DB version 4 is not supported by Postfix versions
-before 2.0. </p>
-
<p> This document describes: </p>
<ol>
<blockquote>
<pre>
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
- AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
+ <a href="DB_README.html">AUXLIBS_DB</a>="-L/usr/local/BerkeleyDB/lib -ldb"
% make
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use <a href="DB_README.html">AUXLIBS_DB</a>. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> If your Berkeley DB shared library is in a directory that the RUN-TIME
linker does not know about, add a "-Wl,-R,/path/to/directory" option after
"-ldb". </p>
<blockquote>
<pre>
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
- AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
+ <a href="DB_README.html">AUXLIBS_DB</a>="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use <a href="DB_README.html">AUXLIBS_DB</a>. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> The exact pathnames depend on the Berkeley DB version, and on
how it was installed. </p>
<blockquote>
<pre>
-% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
+% make makefiles CCARGS=-I/usr/include/db3 <a href="DB_README.html">AUXLIBS_DB</a>=-ldb3
% make
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use <a href="DB_README.html">AUXLIBS_DB</a>. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> Warning: the file format produced by Berkeley DB version 1 is
not compatible with that of versions 2 and 3 (versions 2 and 3 have
the same format). If you switch between DB versions, then you may
<blockquote>
<pre>
-% make makefiles .... AUXLIBS="... -lpthread"
+% make makefiles .... <a href="DB_README.html">AUXLIBS_DB</a>="... -lpthread"
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use <a href="DB_README.html">AUXLIBS_DB</a>. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> More information is available at
<a href="https://www.oracle.com/database/technologies/related/berkeleydb.html">https://www.oracle.com/database/technologies/related/berkeleydb.html</a>. </p>
substitutions.
In a database file, <a href="postalias.1.html"><b>postalias</b>(1)</a> stores keys in the external (quoted)
- form. Historically, Postfix versions 3.10 and earlier stored the inter-
+ form. Historically, Postfix versions 3.11 and earlier store the inter-
nal (unquoted) form. This was not consistent with <a href="postmap.1.html"><b>postmap</b>(1)</a> behavior.
For backwards compatibility, Postfix programs will search with the
legacy internal form only if the preferred external form is not found,
SYSTYPE=LINUX$RELEASE_MAJOR
case "$CCARGS" in
*-DNO_DB*) ;;
- *-DHAS_DB*) ;;
+ *-DHAS_DB*) case "$AUXLIBS_DB" in
+ "") AUXLIBS_DB=-ldb;;
+ esac;;
*) if [ -f /usr/include/db.h ]
then
: we are all set
echo "See: https://www.postfix.org/NON_BERKELEYDB_README.html#build-conf" 1>&2
exit 1
fi
- SYSLIBS="-ldb"
+ AUXLIBS_DB="-ldb"
;;
esac
for name in nsl resolv
echo "Alternatively, build with CCARGS=\"-NO_DB ...\"" 1>&2
exit 1
fi
- SYSLIBS="-ldb"
+ AUXLIBS_DB="-ldb"
;;
esac
for name in nsl resolv
CCARGS="$CCARGS -DNO_SNPRINTF"
if [ -f /usr/lib/libdb.a ]; then
CCARGS="$CCARGS -DHAS_DB"
- SYSLIBS=-ldb
+ AUXLIBS_DB=-ldb
fi
;;
HP-UX.B.11.*) SYSTYPE=HPUX11
SYSLIBS=-lnsl
if [ -f /usr/lib/libdb.a ]; then
CCARGS="$CCARGS -DHAS_DB"
- SYSLIBS="$SYSLIBS -ldb"
+ AUXLIBS_DB="-ldb"
fi
;;
ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
# and we don't try to figure out which awk versions have tolower().
# The following was validated in 2014 on FreeBSD/Linux and Solaris 9.
+# But first, find out if sys_defs.h may contain '#define HAS_DB'.
+# Historically, this was how Postfix builds "knew" BDB was supported.
+trap 'rm -f makedefs.test makedefs.test.[co]' 0 1 2 3 15
+ cat >makedefs.test.c <<'EOF'
+#include "src/util/sys_defs.h"
+#include <stdio.h>
+int main(void)
+{
+#ifdef HAS_DB
+ printf("-DHAS_DB\n");
+#endif
+ return (0);
+}
+EOF
+eval ${CC-gcc} ${CCARGS} -D$SYSTYPE -o makedefs.test makedefs.test.c || exit 1
+HAS_DB=`./makedefs.test` || exit 1
+rm -f makedefs.test makedefs.test.[co]
+
DEFINED_MAP_TYPES=`
- echo $CCARGS | sed 's/=[^ ]*//g' |
+ echo $HAS_DB $CCARGS | sed 's/=[^ ]*//g' |
tr -cd '\- _ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' |
tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | ${AWK} '
{ for (n = 1; n <= NF; n++)
# Propagate AUXLIBS_FOO or merge them into global AUXLIBS (i.e. SYSLIBS).
-PLUGGABLE_MAPS="CDB LDAP LMDB MONGODB MYSQL PCRE PGSQL SDBM SQLITE"
+PLUGGABLE_MAPS="CDB DB LDAP LMDB MONGODB MYSQL PCRE PGSQL SDBM SQLITE"
case "$dynamicmaps" in
yes) for name in $PLUGGABLE_MAPS
information with $\fInumber\fR substitutions.
In a database file, \fBpostalias\fR(1) stores keys in the external
-(quoted) form. Historically, Postfix versions 3.10 and earlier
-stored the internal (unquoted) form. This was not consistent
+(quoted) form. Historically, Postfix versions 3.11 and earlier
+store the internal (unquoted) form. This was not consistent
with \fBpostmap\fR(1) behavior. For backwards compatibility,
Postfix programs will search with the legacy internal form only
if the preferred external form is not found, and the internal
of the database file without the ".db" suffix. Berkeley DB databases
are maintained with the postmap(1) command. </p>
-<p> Note: Berkeley DB version 4 is not supported by Postfix versions
-before 2.0. </p>
-
<p> This document describes: </p>
<ol>
<blockquote>
<pre>
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
- AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
+ AUXLIBS_DB="-L/usr/local/BerkeleyDB/lib -ldb"
% make
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> If your Berkeley DB shared library is in a directory that the RUN-TIME
linker does not know about, add a "-Wl,-R,/path/to/directory" option after
"-ldb". </p>
<blockquote>
<pre>
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
- AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
+ AUXLIBS_DB="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> The exact pathnames depend on the Berkeley DB version, and on
how it was installed. </p>
<blockquote>
<pre>
-% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
+% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS_DB=-ldb3
% make
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> Warning: the file format produced by Berkeley DB version 1 is
not compatible with that of versions 2 and 3 (versions 2 and 3 have
the same format). If you switch between DB versions, then you may
<blockquote>
<pre>
-% make makefiles .... AUXLIBS="... -lpthread"
+% make makefiles .... AUXLIBS_DB="... -lpthread"
</pre>
</blockquote>
+<p> Note: Postfix version 3.12 and later use AUXLIBS_DB. With earlier
+versions, use AUXLIBS instead. </p>
+
<p> More information is available at
https://www.oracle.com/database/technologies/related/berkeleydb.html. </p>
VAR_POSTLOG_SERVICE, DEF_POSTLOG_SERVICE, &var_postlog_service, 1, 0,
VAR_DNSSEC_PROBE, DEF_DNSSEC_PROBE, &var_dnssec_probe, 0, 0,
VAR_KNOWN_TCP_PORTS, DEF_KNOWN_TCP_PORTS, &var_known_tcp_ports, 0, 0,
- VAR_SERVNAME, DEF_SERVNAME, &var_servname, 0, 0,
0,
};
static const CONFIG_BOOL_TABLE first_bool_defaults[] = {
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20260312"
+#define MAIL_RELEASE_DATE "20260316"
#define MAIL_VERSION_NUMBER "3.12"
#ifdef SNAPSHOT
/* information with $\fInumber\fR substitutions.
/*
/* In a database file, \fBpostalias\fR(1) stores keys in the external
-/* (quoted) form. Historically, Postfix versions 3.10 and earlier
-/* stored the internal (unquoted) form. This was not consistent
+/* (quoted) form. Historically, Postfix versions 3.11 and earlier
+/* store the internal (unquoted) form. This was not consistent
/* with \fBpostmap\fR(1) behavior. For backwards compatibility,
/* Postfix programs will search with the legacy internal form only
/* if the preferred external form is not found, and the internal
PCF_PARAM_TABLE_ENTER(pcf_param_table, pcf_adhoc_procname.name,
PCF_PARAM_FLAG_BUILTIN | PCF_PARAM_FLAG_READONLY,
(void *) &pcf_adhoc_procname, pcf_conv_str_parameter);
- pcf_adhoc_servname.defval = mystrdup("");
+ pcf_adhoc_servname.defval = mystrdup(DEF_SERVNAME);
PCF_PARAM_TABLE_ENTER(pcf_param_table, pcf_adhoc_servname.name,
PCF_PARAM_FLAG_BUILTIN | PCF_PARAM_FLAG_READONLY,
(void *) &pcf_adhoc_servname, pcf_conv_str_parameter);
attr_print64.o attr_print_plain.o attr_scan0.o attr_scan64.o \
attr_scan_plain.o auto_clnt.o base64_code.o basename.o binhash.o \
chroot_uid.o cidr_match.o clean_env.o close_on_exec.o concatenate.o \
- ctable.o dict.o dict_alloc.o dict_cidr.o dict_db.o \
+ ctable.o dict.o dict_alloc.o dict_cidr.o \
dict_dbm.o dict_debug.o dict_env.o dict_ht.o dict_ni.o dict_nis.o \
dict_nisplus.o dict_open.o dict_regexp.o \
dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o dummy_read.o \
split_qnameval.o argv_attr_print.o argv_attr_scan.o dict_file.o \
msg_logger.o logwriter.o unix_dgram_connect.o unix_dgram_listen.o \
byte_mask.o known_tcp_ports.o argv_split_at.o dict_stream.o \
- sane_strtol.o hash_fnv.o ldseed.o mkmap_db.o mkmap_dbm.o \
+ sane_strtol.o hash_fnv.o ldseed.o mkmap_dbm.o \
mkmap_fail.o mkmap_open.o inet_prefix_top.o inet_addr_sizes.o \
quote_for_json.o mystrerror.o sane_sockaddr_to_hostaddr.o \
normalize_ws.o valid_uri_scheme.o clean_ascii_cntrl_space.o \
# When hard-linking these, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ),
# otherwise it sets the PLUGIN_* macros.
MAP_OBJ = dict_pcre.o dict_cdb.o dict_lmdb.o dict_sdbm.o slmdb.o \
- mkmap_cdb.o mkmap_lmdb.o mkmap_sdbm.o
+ mkmap_cdb.o mkmap_lmdb.o mkmap_sdbm.o dict_db.o mkmap_db.o
HDRS = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
chroot_uid.h cidr_match.h clean_env.h connect.h ctable.h dict.h \
dict_cdb.h dict_cidr.h dict_db.h dict_dbm.h dict_debug.h dict_env.h \
normalize_v4mapped_addr_test ossl_digest_test dict_pipe_test \
dict_union_test
PLUGIN_MAP_SO = $(LIB_PREFIX)pcre$(LIB_SUFFIX) $(LIB_PREFIX)lmdb$(LIB_SUFFIX) \
- $(LIB_PREFIX)cdb$(LIB_SUFFIX) $(LIB_PREFIX)sdbm$(LIB_SUFFIX)
+ $(LIB_PREFIX)cdb$(LIB_SUFFIX) $(LIB_PREFIX)sdbm$(LIB_SUFFIX) \
+ $(LIB_PREFIX)db$(LIB_SUFFIX)
HTABLE_FIX = NORANDOMIZE=1
LIB_DIR = ../../lib
INC_DIR = ../../include
$(PLUGIN_LD) $(SHLIB_RPATH) -o $@ mkmap_sdbm.o \
dict_sdbm.o $(AUXLIBS_SDBM)
+$(LIB_PREFIX)db$(LIB_SUFFIX): mkmap_db.o dict_db.o
+ $(PLUGIN_LD) $(SHLIB_RPATH) -o $@ mkmap_db.o \
+ dict_db.o $(AUXLIBS_DB)
+
update: $(LIB_DIR)/$(LIB) $(HDRS) $(PLUGIN_MAP_SO_UPDATE) \
$(PLUGIN_MAP_OBJ_UPDATE)
-for i in $(HDRS); \
#ifdef HAS_DBM
DICT_TYPE_DBM, dict_dbm_open, mkmap_dbm_open,
#endif
-#ifdef HAS_DB
- DICT_TYPE_HASH, dict_hash_open, mkmap_hash_open,
- DICT_TYPE_BTREE, dict_btree_open, mkmap_btree_open,
-#endif
#ifdef HAS_NIS
DICT_TYPE_NIS, dict_nis_open, 0,
#endif
DICT_TYPE_UNION, dict_union_open, 0,
DICT_TYPE_INLINE, dict_inline_open, 0,
#ifndef USE_DYNAMIC_MAPS
+#ifdef HAS_DB
+ DICT_TYPE_HASH, dict_hash_open, mkmap_hash_open,
+ DICT_TYPE_BTREE, dict_btree_open, mkmap_btree_open,
+#endif
#ifdef HAS_PCRE
DICT_TYPE_PCRE, dict_pcre_open, 0,
#endif
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_SUN_LEN
#define HAS_FSYNC
-#define HAS_DB
+#define HAS_DB 1
#define HAS_SA_LEN
#define NATIVE_DB_TYPE "hash"
#if (defined(__NetBSD_Version__) && __NetBSD_Version__ >= 104250000)
#define DEF_MAILBOX_LOCK "flock, dotlock"
#define HAS_SUN_LEN
#define HAS_FSYNC
-#define HAS_DB
+#define HAS_DB 1
#define HAS_SA_LEN
#define NATIVE_DB_TYPE "hash"
#define ALIAS_DB_MAP "$default_database_type:/etc/aliases"
#define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "fcntl, dotlock" /* RedHat >= 4.x */
#define HAS_FSYNC
-#define HAS_DB
+#define HAS_DB 1
#define NATIVE_DB_TYPE "hash"
#define ALIAS_DB_MAP "$default_database_type:/etc/aliases"
#ifndef NO_NIS
#define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK
#define DEF_MAILBOX_LOCK "dotlock" /* verified RedHat 3.03 */
#define HAS_FSYNC
-#define HAS_DB
+#define HAS_DB 1
#define NATIVE_DB_TYPE "hash"
#define ALIAS_DB_MAP "$default_database_type:/etc/aliases"
#ifndef NO_NIS
#define INTERNAL_LOCK MYFLOCK_STYLE_FCNTL
#define DEF_MAILBOX_LOCK "fcntl, dotlock" /* RedHat >= 4.x */
#define HAS_FSYNC
-#define HAS_DB
+#define HAS_DB 1
#define NATIVE_DB_TYPE "hash"
#define ALIAS_DB_MAP "$default_database_type:/etc/aliases"
#ifndef NO_NIS