Preliminary "make plugins" support. Todo: macros to dynamically
remove pluggable maps from compile-time tables in dict_open.c
and mkmap_open.c, and from the OBJS lists in Makefile.in.
+
+20140522
+
+ Support for "make shared=yes" and "make dynamicmaps=yes".
+ New plugin_directory parameter for the location of the
+ dynamicmaps.cf file and for plugins with a relative pathname.
+ See RELEASE_NOTES and INSTALL for details. Files:
+ mail_params.[hc], dynamicmaps.c, mail_dict.c, makedefs,
+ postfix-files, dynamicmaps.cf, Makefile.in, util/Makefile.in,
+ global/Makefile.in, postlink, postconf.proto. INSTALL.html,
+ RELEASE_NOTES.
and so on. In some cases, optimization is turned off automatically.
-4.3 - Building with Postfix shared libraries (Postfix >= 2.12)
+4.3 - Building with Postfix shared libraries and database plugins (Postfix >=
+2.12)
-Postfix can be built with Postfix shared libraries (files named libpostfix-
-*.so.*). These files are needed to dynamically load Postfix database clients
-with the Debian-style dynamicmaps.cf feature. Postfix shared libraries add
-minor run-time overhead and result in smaller Postfix executable files.
-
-Although Debian-style dynamicmaps.cf support is functional, it is not yet used.
-Postfix database clients are still built into the Postfix library files.
-Postfix database clients may become plugins at some later point in time.
+Postfix can be built with Postfix shared libraries (files typically named
+libpostfix-*.so.*). Postfix shared libraries add minor run-time overhead and
+result in significantly-smaller Postfix executable files.
Postfix shared-library support is evolving. Support exists for Linux, FreeBSD
and MacOS X. Shared-library builds will become the default once the build
system stops changing.
-For now, specify "shared=yes" on the "make makefiles" command line to build
-Postfix with shared-library support.
+Specify "shared=yes" on the "make makefiles" command line to build Postfix with
+shared-library support.
$ make makefiles shared=yes ...other arguments...
$ make makefiles shared=no ...other arguments...
$ make
-Postfix shared libraries are named libpostfix-xxx.so.version where xxx is a
-source-code directory name such as "util" or "global", and the default version
-is the Postfix version: X.Y.Z for stable releases, X.Y-DATE for snapshot
-releases, or X.Y-DATE-nonprod for non-production releases.
+Postfix shared libraries are typically named libpostfix-name.so.version, where
+name is a source-code directory name such as "util" or "global", and the
+default version is the Postfix version: X.Y.Z for stable releases, X.Y-DATE for
+snapshot releases, or X.Y-DATE-nonprod for non-production releases.
To override the default shared-library version, specfy:
$ make makefiles shared=yes SHLIB_VERSION=version ...other arguments...
+The shlib_directory parameter specifies the location of Postfix shared library
+files. See section 4.5 defaults and how to override this.
+
+Additionally, Postfix can be built with support to dynamically load Postfix
+database clients with the Debian-style dynamicmaps.cf feature. This is useful
+mainly for distributors of pre-compiled Postfix packages.
+
+Specify "dynamicmaps=yes" on the "make makefiles" command line to build Postfix
+with support to dynamically load Postfix database clients with the Debian-style
+dynamicmaps.cf feature, This implicitly enables shared-library support.
+
+ $ make makefiles dynamicmaps=yes ...other arguments...
+ $ make makefiles dynamicmaps=no ...other arguments...
+ $ make
+
+Postfix database plugins libraries are typically named postfix-type.so.version
+where type is a database type such as "ldap" or "lmdb". The version is the same
+as for Postfix shared libraries. The installed dynamicmaps.cf configuration
+file is given a suffix with the same version.
+
+The plugin_directory parameter specifies the location of the dynamicmaps.cf
+file and for database plugins with relative pathnames. See section 4.5 defaults
+and how to override this.
+
4.4 - Building with optional features
By default, Postfix builds as a mail system with relatively few bells and
|_____________________|____________________|
|newaliases_path |/usr/bin/newaliases |
|_____________________|____________________|
+ |plugin_directory |/usr/libexec/postfix|
+ |_____________________|____________________|
|queue_directory |/var/spool/postfix |
|_____________________|____________________|
|readme_directory |no |
MANDIRS = proto man html
LIBEXEC = libexec/post-install libexec/postfix-files libexec/postfix-script \
libexec/postfix-wrapper libexec/main.cf libexec/master.cf \
- libexec/postmulti-script libexec/dynamicmaps.cf
+ libexec/postmulti-script
+PLUGINS = plugins/dynamicmaps.cf.$(SHLIB_VERSION)
+EXPAND = sed -e "s;\$${LIB_PREFIX};$(LIB_PREFIX);" \
+ -e "s;\$${LIB_SUFFIX};$(LIB_SUFFIX);" \
+ -e "s;\$${SHLIB_VERSION};$(SHLIB_VERSION);"
default: update
(set -e; echo "[$$i]"; cd $$i; $(MAKE) $(OPTS) $@ MAKELEVEL=) || exit 1; \
done
-update: $(LIBEXEC)
+update: $(LIBEXEC) $(PLUGINS)
libexec/makedefs.out: conf/makedefs.out
rm -f $@ && ln -f $? $@
libexec/post-install: conf/post-install
rm -f $@ && ln -f $? $@
-libexec/dynamicmaps.cf: conf/dynamicmaps.cf
- rm -f $@ && ln -f $? $@
-
libexec/postfix-files: conf/postfix-files conf/makedefs.out Makefile
rm -f $@
if [ "${SHLIB_DIR}" = "no" -o "${SHLIB_DIR}" = "" ]; then \
sed -e '/^\$$shlib_directory/d' \
- -e '/dynamicmaps.cf/d' conf/postfix-files >$@; \
+ -e '/^\$$plugin_directory/d' conf/postfix-files >$@; \
+ elif [ "${PLUGIN_DIR}" = "no" -o "${PLUGIN_DIR}" = "" ]; then \
+ sed -e '/^\$$plugin_directory/d' conf/postfix-files | $(EXPAND) >$@; \
else \
- sed -e "s;\$${LIB_PREFIX};$(LIB_PREFIX);" \
- -e "s;\$${LIB_SUFFIX};$(LIB_SUFFIX);" conf/postfix-files >$@; \
+ $(EXPAND) conf/postfix-files >$@; \
fi
libexec/postfix-script: conf/postfix-script
libexec/postmulti-script: conf/postmulti-script
rm -f $@ && ln -f $? $@
+plugins/dynamicmaps.cf.$(SHLIB_VERSION): conf/dynamicmaps.cf
+ rm -f $@ && $(EXPAND) $? >$@
+
manpages:
set -e; for i in $(MANDIRS); do \
(set -e; echo "[$$i]"; cd $$i; $(MAKE) -f Makefile.in $(OPTS) MAKELEVEL=) || exit 1; \
printfck: update
install: update
- $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} \
+ $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
$(SHELL) postfix-install
package: update
- $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} \
+ $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
$(SHELL) postfix-install -package
upgrade: update
- $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} \
+ $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
$(SHELL) postfix-install -non-interactive
non-interactive-package: update
- $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} \
+ $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
$(SHELL) postfix-install -non-interactive -package
depend clean:
cp Makefile.init Makefile
rm -f README_FILES/RELEASE_NOTES
ln -s ../RELEASE_NOTES README_FILES
- rm -f bin/[!CRS]* lib/[!CRS]* include/[!CRS]* libexec/[!CRS]* \
- src/*/libpostfix-* \
+ rm -f bin/[!CRS]* lib/[!CRS]* include/[!CRS]* libexec/[!CRS]* plugins/[!CRS]* \
+ src/*/postfix-*.so.* src/*/postfix-*.dylib.* \
junk */junk */*/junk \
*core */*core */*/*core \
.nfs* */.nfs* */*/.nfs* \
and so on. In some cases, optimization is turned off automatically.
-4\b4.\b.3\b3 -\b- B\bBu\bui\bil\bld\bdi\bin\bng\bg w\bwi\bit\bth\bh P\bPo\bos\bst\btf\bfi\bix\bx s\bsh\bha\bar\bre\bed\bd l\bli\bib\bbr\bra\bar\bri\bie\bes\bs (\b(P\bPo\bos\bst\btf\bfi\bix\bx >\b>=\b= 2\b2.\b.1\b12\b2)\b)
+4\b4.\b.3\b3 -\b- B\bBu\bui\bil\bld\bdi\bin\bng\bg w\bwi\bit\bth\bh P\bPo\bos\bst\btf\bfi\bix\bx s\bsh\bha\bar\bre\bed\bd l\bli\bib\bbr\bra\bar\bri\bie\bes\bs a\ban\bnd\bd d\bda\bat\bta\bab\bba\bas\bse\be p\bpl\blu\bug\bgi\bin\bns\bs (\b(P\bPo\bos\bst\btf\bfi\bix\bx >\b>=\b=
+2\b2.\b.1\b12\b2)\b)
-Postfix can be built with Postfix shared libraries (files named libpostfix-
-*.so.*). These files are needed to dynamically load Postfix database clients
-with the Debian-style dynamicmaps.cf feature. Postfix shared libraries add
-minor run-time overhead and result in smaller Postfix executable files.
-
-Although Debian-style dynamicmaps.cf support is functional, it is not yet used.
-Postfix database clients are still built into the Postfix library files.
-Postfix database clients may become plugins at some later point in time.
+Postfix can be built with Postfix shared libraries (files typically named
+libpostfix-*.so.*). Postfix shared libraries add minor run-time overhead and
+result in significantly-smaller Postfix executable files.
Postfix shared-library support is evolving. Support exists for Linux, FreeBSD
and MacOS X. Shared-library builds will become the default once the build
system stops changing.
-For now, specify "shared=yes" on the "make makefiles" command line to build
-Postfix with shared-library support.
+Specify "shared=yes" on the "make makefiles" command line to build Postfix with
+shared-library support.
$ make makefiles shared=yes ...other arguments...
$ make makefiles shared=no ...other arguments...
$ make
-Postfix shared libraries are named libpostfix-xxx.so.version where xxx is a
-source-code directory name such as "util" or "global", and the default version
-is the Postfix version: X.Y.Z for stable releases, X.Y-DATE for snapshot
-releases, or X.Y-DATE-nonprod for non-production releases.
+Postfix shared libraries are typically named libpostfix-name.so.version, where
+name is a source-code directory name such as "util" or "global", and the
+default version is the Postfix version: X.Y.Z for stable releases, X.Y-DATE for
+snapshot releases, or X.Y-DATE-nonprod for non-production releases.
To override the default shared-library version, specfy:
$ make makefiles shared=yes SHLIB_VERSION=version ...other arguments...
+The shlib_directory parameter specifies the location of Postfix shared library
+files. See section 4.5 defaults and how to override this.
+
+Additionally, Postfix can be built with support to dynamically load Postfix
+database clients with the Debian-style dynamicmaps.cf feature. This is useful
+mainly for distributors of pre-compiled Postfix packages.
+
+Specify "dynamicmaps=yes" on the "make makefiles" command line to build Postfix
+with support to dynamically load Postfix database clients with the Debian-style
+dynamicmaps.cf feature, This implicitly enables shared-library support.
+
+ $ make makefiles dynamicmaps=yes ...other arguments...
+ $ make makefiles dynamicmaps=no ...other arguments...
+ $ make
+
+Postfix database plugins libraries are typically named postfix-type.so.version
+where type is a database type such as "ldap" or "lmdb". The version is the same
+as for Postfix shared libraries. The installed dynamicmaps.cf configuration
+file is given a suffix with the same version.
+
+The plugin_directory parameter specifies the location of the dynamicmaps.cf
+file and for database plugins with relative pathnames. See section 4.5 defaults
+and how to override this.
+
4\b4.\b.4\b4 -\b- B\bBu\bui\bil\bld\bdi\bin\bng\bg w\bwi\bit\bth\bh o\bop\bpt\bti\bio\bon\bna\bal\bl f\bfe\bea\bat\btu\bur\bre\bes\bs
By default, Postfix builds as a mail system with relatively few bells and
|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b |
|newaliases_path |/usr/bin/newaliases |
|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b |
+ |plugin_directory |/usr/libexec/postfix|
+ |_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b |
|queue_directory |/var/spool/postfix |
|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b|_\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b |
|readme_directory |no |
If you upgrade from Postfix 2.10 or earlier, read RELEASE_NOTES-2.11
before proceeding.
-Major changes with snapshot 20140508
+Major changes with snapshot 20140522
====================================
-Preliminary support to build Postfix with Postfix shared libraries,
-based on Debian code by LaMont Jones, based on a port by Viktor
-Dukhovni. Support exists for Linux, FreeBSD and MacOS X.
+Support to build Postfix with Postfix shared libraries, and with
+support for database plugins. This is based on Debian code by LaMont
+Jones, and based on a port by Viktor Dukhovni. Support exists for
+Linux, FreeBSD and MacOS X. Postfix shared libraries introduce minor
+runtime overhead and result in smaller Postfix executable files.
-Shared-library support is introduced early in the Postfix development
-cycle so that down-stream maintainers will have time to prepare for
-the next stable Postfix release.
-
-Postfix shared libraries are required to load database plugins using
-the dynamicmaps configuration file. However, the preliminary build
-procedure still puts all supported database code inside the Postfix
-shared libraries themselves. The dynamicmaps support is operational
-but it is not yet used.
-
-Postfix shared libraries introduce minor runtime overhead and result
-in smaller Postfix executable files.
+This is introduced early in the Postfix development cycle to give
+down-stream maintainers sufficient time to prepare their build
+systems for the next stable Postfix release.
Differences with Debian
-----------------------
Besides changes to the Postfix "build" system as described below,
-the only user-visible changes with respect to Debian are:
-
-- The dynamicmaps.cf configuration file is in $daemon_directory,
- because this file is shared among all Postfix instances just like
- postfix-files and other files.
-
-- The location of the libpostfix-*.so.* files is configurable with
- the shlib_directory parameter.
-
-- You can change the location of libpostfix-*.so.* files after
- Postfix is built. However you may have to run ldconfig if you
- move the libpostfix-*.so.* files to a non-system directory.
- No ldconfig is needed if you keep the libpostfix-*.so.* files
- in the default $shlib_directory location.
+the user-visible changes with respect to Debian are:
+
+- The shlib_directory parameter specifies the location of the
+ libpostfix-*.so.* shared-library files. You can change the location
+ of these files after Postfix is built. However you may have to
+ run ldconfig if you move the libpostfix-*.so.* files to a non-system
+ directory. No ldconfig is needed if you keep the libpostfix-*.so.*
+ files in the default $shlib_directory location.
+
+- The plugin_directory parameter specifies the location of the
+ dynamicmaps.cf database plugin configuration file (and of any
+ postfix-*.so.* plugins with a relative pathname). The dynamicmaps.cf
+ location is not hard-coded to /etc, because this file is shared
+ among all Postfix instances just like postfix-files and other
+ files.
Building with Postfix shared libraries
--------------------------------------
-As noted above, the preliminary build procedure still puts all
-supported database code inside the Postfix shared libraries themselves.
-The dynamicmaps support is operational but it is not yet used.
-
To build with Postfix shared-library support:
% make makefiles shared=yes
% make
+# make install
This defaults to installing shared libraries in /usr/local/lib,
with a shared-library version that equals the Postfix version
The same syntax can be used to override other Postfix installation
parameter settings such as:
-% make makefiles config_directory=/usr/local/etc/postfix ...other arguments...
+% make makefiles config_directory=/usr/local/etc/postfix ...
+
+The earlier override method using CCARGS remains supported.
+
+Building with dynamicmaps.cf database plugins
+---------------------------------------------
+
+To build with dynamicmaps.cf database plugin support:
+
+% make makefiles dynamicmaps=yes
+% make
+# make install
+
+This implicitly enables Postfix shared-library support, and defaults
+to installing dynamicmaps.cf and postfix-*.so.* plugins in
+/usr/libexec/postfix. The dynamicmaps.cf file and database plugins
+are given a suffix that equals the shared-library version (see
+SHLIB_VERSION discussion above).
+
+To override the plugin_directory location, use, for example,
-The earlier override method that uses CCARGS remains supported.
+% make makefiles dynamicmaps=yes plugin_directory=/usr/lib/postfix ...
Further information
-------------------
Things to do after the stable release:
+ Update INSTALL.html for make "dynamicmaps=yes".
+
Discourage the use of "after 220" tests in POSTSCREEN_README
and the documentation of individual parameter settings.
# dictionary type soname (pathname) dict-function mkmap-function
+cdb ${LIB_PREFIX}cdb${LIB_SUFFIX} dict_cdb_open mkmap_cdb_open
+ldap ${LIB_PREFIX}ldap${LIB_SUFFIX} dict_ldap_open
+lmdb ${LIB_PREFIX}lmdb${LIB_SUFFIX} dict_lmdb_open mkmap_lmdb_open
+mysql ${LIB_PREFIX}mysql${LIB_SUFFIX} dict_mysql_open
+pcre ${LIB_PREFIX}pcre${LIB_SUFFIX} dict_pcre_open
+pgsql ${LIB_PREFIX}pgsql${LIB_SUFFIX} dict_pgsql_open
+sdbm ${LIB_PREFIX}sdbm${LIB_SUFFIX} dict_sdbm_open mkmap_sdbm_open
+sqlite ${LIB_PREFIX}sqlite${LIB_SUFFIX} dict-sqlite_open
# The directory for the Postfix README files.
# .IP shlib_directory
# The directory for the Postfix shared-library files.
+# .IP plugin_directory
+# The directory for the Postfix dynamicmaps.cf database plugin
+# configuration file, and files referenced by that file.
# SEE ALSO
# postfix-install(1) Postfix primary installation script.
# FILES
MOST_PARAMETERS="command_directory daemon_directory data_directory
html_directory mail_owner mailq_path manpage_directory
newaliases_path queue_directory readme_directory sample_directory
- sendmail_path setgid_group shlib_directory"
+ sendmail_path setgid_group shlib_directory plugin_directory"
NON_SHARED="config_directory queue_directory data_directory"
USAGE="Usage: $0 [name=value] command
esac
done
-for path in "$html_directory" "$readme_directory" "$shlib_directory"
+for path in "$html_directory" "$readme_directory" "$shlib_directory" "$plugin_directory"
do
case "$path" in
/*) ;;
"sample_directory = $sample_directory" \
"readme_directory = $readme_directory" \
"shlib_directory = $shlib_directory" \
+ "plugin_directory = $plugin_directory" \
|| exit 1
}
$shlib_directory/lib${LIB_PREFIX}dns${LIB_SUFFIX}:f:root:-:755
$shlib_directory/lib${LIB_PREFIX}tls${LIB_SUFFIX}:f:root:-:755
$shlib_directory/lib${LIB_PREFIX}master${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}cdb${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}ldap${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}lmdb${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}mysql${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}pcre${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}pgsql${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}sdbm${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/${LIB_PREFIX}sqlite${LIB_SUFFIX}:f:root:-:755
+$plugin_directory/dynamicmaps.cf.${SHLIB_VERSION}:f:root:-:644:
+$plugin_directory/dynamicmaps.cf:h:$plugin_directory/dynamicmaps.cf.${SHLIB_VERSION}:-:644:
$daemon_directory/anvil:f:root:-:755
$daemon_directory/bounce:f:root:-:755
$daemon_directory/cleanup:f:root:-:755
$daemon_directory/discard:f:root:-:755
$daemon_directory/dnsblog:f:root:-:755
-$daemon_directory/dynamicmaps.cf:f:root:-:755:p
$daemon_directory/error:f:root:-:755
$daemon_directory/flush:f:root:-:755
#$daemon_directory/lmtp:f:root:-:755
exit 1
}
esac
+case $plugin_directory in
+no) ;;
+ *) cd $plugin_directory || {
+ $FATAL no Postfix plugin directory $plugin_directory!
+ exit 1
+ }
+esac
cd $queue_directory || {
$FATAL no Postfix queue directory $queue_directory!
exit 1
# This command is NOT part of the public interface.
todo="$config_directory $queue_directory $queue_directory/pid"
- test -n "$check_shared_files" && todo="$daemon_directory $todo"
- test "$shlib_directory" = "no" || todo="$shlib_directory $todo"
+ test -n "$check_shared_files" && {
+ todo="$daemon_directory $todo"
+ test "$shlib_directory" = "no" || todo="$shlib_directory $todo"
+ test "$plugin_directory" = "no" || todo="$plugin_directory $todo"
+ }
for dir in $todo
do
$WARN group or other writable: $queue_directory
todo="$config_directory/*"
- test -n "$check_shared_files" && todo="$daemon_directory/* $todo"
- test "$shlib_directory" = "no" ||
- todo="$shlib_directory/libpostfix* $todo"
+ test -n "$check_shared_files" && {
+ todo="$daemon_directory/* $todo"
+ test "$shlib_directory" = "no" ||
+ todo="$shlib_directory/libpostfix* $todo"
+ # plugin_directory/* is checked by dynamicmaps routines.
+ }
find $todo ! -user root \
-exec $WARN not owned by root: {} \;
<p> and so on. In some cases, optimization is turned off automatically. </p>
-<h3>4.3 - Building with Postfix shared libraries (Postfix ≥ 2.12) </h3>
+<h3>4.3 - Building with Postfix shared libraries and database plugins
+(Postfix ≥ 2.12) </h3>
-<p> Postfix can be built with Postfix shared libraries (files named
-<tt>libpostfix-*.so.*</tt>). These files are needed to dynamically
-load Postfix database clients with the Debian-style dynamicmaps.cf
-feature. Postfix shared libraries add minor run-time overhead and
-result in smaller Postfix executable files. </p>
-
-<p> Although Debian-style dynamicmaps.cf support is functional, it
-is not yet used. Postfix database clients are still built into the
-Postfix library files. Postfix database clients may become plugins
-at some later point in time. </p>
+<p> Postfix can be built with Postfix shared libraries (files
+typically named <tt>libpostfix-*.so.*</tt>). Postfix shared libraries
+add minor run-time overhead and result in significantly-smaller
+Postfix executable files. </p>
<p> Postfix shared-library support is evolving. Support exists for
Linux, FreeBSD and MacOS X. Shared-library builds will become the
default once the build system stops changing. </p>
-<p> For now, specify "shared=yes" on the "make makefiles"
-command line to build Postfix with shared-library support. </p>
+<p> Specify "shared=yes" on the "make makefiles" command line to
+build Postfix with shared-library support. </p>
<blockquote>
<pre>
</pre>
</blockquote>
-<p> Postfix shared libraries are named
-libpostfix-<i>xxx</i>.so.<i>version</i> where <i>xxx</i> is a
+<p> Postfix shared libraries are typically named
+libpostfix-<i>name</i>.so.<i>version</i>, where <i>name</i> is a
source-code directory name such as "util" or "global", and the
default <i>version</i> is the Postfix version: X.Y.Z for stable
releases, X.Y-DATE for snapshot releases, or X.Y-DATE-nonprod for
</pre>
</blockquote>
+<p> The <a href="postconf.5.html#shlib_directory">shlib_directory</a> parameter specifies the location of Postfix
+shared library files. See section 4.5 defaults and how to override
+this. </p>
+
+<p> Additionally, Postfix can be built with support to dynamically
+load Postfix database clients with the Debian-style dynamicmaps.cf
+feature. This is useful mainly for distributors of pre-compiled
+Postfix packages. </p>
+
+<p> Specify "dynamicmaps=yes" on the "make makefiles"
+command line to build Postfix with support to dynamically
+load Postfix database clients with the Debian-style dynamicmaps.cf
+feature, This implicitly enables shared-library support. </p>
+
+<blockquote>
+<pre>
+$ make makefiles dynamicmaps=yes ...other arguments...
+$ make makefiles dynamicmaps=no ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> Postfix database plugins libraries are typically named
+postfix-<i>type</i>.so.<i>version</i> where <i>type</i> is a database
+type such as "ldap" or "lmdb". The <i>version</i> is the same as
+for Postfix shared libraries. The installed dynamicmaps.cf
+configuration file is given a suffix with the same version.
+
+<p> The <a href="postconf.5.html#plugin_directory">plugin_directory</a> parameter specifies the location of the
+dynamicmaps.cf file and for database plugins with relative pathnames.
+See section 4.5 defaults and how to override this. </p>
+
<h3>4.4 - Building with optional features</h3>
By default, Postfix builds as a mail system with relatively few
<tr> <td><a href="postconf.5.html#newaliases_path">newaliases_path</a></td> <td>/usr/bin/newaliases</td> </tr>
+<tr> <td><a href="postconf.5.html#plugin_directory">plugin_directory</a></td> <td>/usr/libexec/postfix</td> </tr>
+
<tr> <td><a href="postconf.5.html#queue_directory">queue_directory</a></td> <td>/var/spool/postfix</td> </tr>
<tr> <td><a href="postconf.5.html#readme_directory">readme_directory</a></td> <td>no</td> </tr>
<p> This feature is available in Postfix 2.3 and later. </p>
+</DD>
+
+<DT><b><a name="plugin_directory">plugin_directory</a>
+(default: see 'postconf -d' output)</b></DT><DD>
+
+<p> The location of the Postfix dynamicmaps.cf database plugin
+configuration file, and of database plugins with a relative pathname.
+This is set to "no" when Postfix database plugin support is disabled
+at compile time. </p>
+
+<p> This feature is available in Postfix 2.12 and later. </p>
+
+
</DD>
<DT><b><a name="postmulti_control_commands">postmulti_control_commands</a>
Available in Postfix version 2.12 and later:
+ <b><a href="postconf.5.html#plugin_directory">plugin_directory</a> (see 'postconf -d' output)</b>
+ The location of the Postfix dynamicmaps.cf database plugin con-
+ figuration file, and of database plugins with a relative path-
+ name.
+
<b><a href="postconf.5.html#shlib_directory">shlib_directory</a> (see 'postconf -d' output)</b>
The location of Postfix shared libraries (libpostfix-*.so.*).
# .IP \fBOPT=\fIoptimization_level\fR
# Specifies a non-default optimization level. The default is \fB-O\fR.
# Specify \fBOPT=\fR to turn off optimization.
+# .IP \fBshared=yes\fR
+# .IP \fBshared=no\fR
+# Enable (disable) Postfix builds with shared libraries
+# typically named $shlib_directory/libpostfix-*.so.*.
+# .IP \fBdynamicmaps=yes\fR
+# .IP \fBdynamicmaps=no\fR
+# Enable (disable) Postfix builds with the configuration file
+# $plugin_directory/dynamicmaps.cf for database plugins
+# typically named postfix-*.so.*. The setting "dynamicmaps=yes"
+# implicitly enables Postfix shared libraries.
# .IP \fIinstallation_parameter\fB=\fIvalue\fR...
-# Override the compiled-in default value of the specified
+# Override the compiled-in default value of the specified
# installation parameter(s). The following parameters are
# supported in this context:
#
# command_directory config_directory daemon_directory
# data_directory default_database_type html_directory
-# mailq_path manpage_directory newaliases_path queue_directory
-# readme_directory sendmail_path shlib_directory
+# mailq_path manpage_directory newaliases_path plugin_directory
+# queue_directory readme_directory sendmail_path shlib_directory
#
# See the postconf(5) manpage for a description of these
# parameters.
data_directory_macro=DEF_DATA_DIR
mailq_path_macro=DEF_MAILQ_PATH
newaliases_path_macro=DEF_NEWALIAS_PATH
+plugin_directory_macro=DEF_PLUGIN_DIR
queue_directory_macro=DEF_QUEUE_DIR
sendmail_path_macro=DEF_SENDMAIL_PATH
shlib_directory_macro=DEF_SHLIB_DIR
-# shlib_directory is checked here because "no" is not a good answer.
-# Instead, build with "shared=no".
+# shlib_directory and plugin_directory are checked here because "no"
+# is not a good answer. Instead, build with "shared=no".
for parm_name in command_directory config_directory daemon_directory \
- data_directory mailq_path newaliases_path \
+ data_directory mailq_path newaliases_path plugin_directory \
queue_directory sendmail_path shlib_directory
do
eval parm_val=\"\$$parm_name\"
# Choose between shared and non-shared library builds.
+case "$dynamicmaps" in
+ yes) shared=yes;;
+""|no) ;;
+ *) error "Specify \"dynamicmaps=yes\" or \"dynamicmaps=no\"" 1>&2;;
+esac
+
case "$shared" in
yes)
if [ -z "$SHLIB_SUFFIX" ]
AR=:
RANLIB=:
CCARGS="$CCARGS -DUSE_DYNAMIC_LIBS"
+ case "$dynamicmaps" in
+ yes) NON_PLUGIN_MAP_OBJ=
+ PLUGIN_MAP_OBJ='$(MAP_OBJ)'
+ PLUGIN_MAP_OBJ_UPDATE=plugin_map_obj_update
+ PLUGIN_MAP_SO_MAKE=plugin_map_so_make
+ PLUGIN_MAP_SO_UPDATE=plugin_map_so_update
+ CCARGS="$CCARGS -DUSE_DYNAMIC_MAPS"
+ ;;
+ *) NON_PLUGIN_MAP_OBJ='$(MAP_OBJ)'
+ PLUGIN_MAP_OBJ=
+ PLUGIN_MAP_OBJ_UPDATE=
+ PLUGIN_MAP_SO_MAKE=
+ PLUGIN_MAP_SO_UPDATE=
+ plugin_directory=no
+ CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS -UDEF_PLUGIN_DIR -DDEF_PLUGIN_DIR=\\\"no\\\""
+ ;;
+ esac
- # Determine the shared-library installation directory.
- case "$shlib_directory" in
- /*) # CCARGS was already updated above.
- ;;
- "") trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
- sed -n '/_SHLIB_DIR/,/^$/p' src/global/mail_params.h >makedefs.test.c
- cat >>makedefs.test.c <<'EOF'
+ # Determine the shared-library and plugin installation directory.
+ for parm_name in shlib_directory plugin_directory
+ do
+ eval parm_val=\"\$$parm_name\"
+ eval parm_macro=\"\$${parm_name}_macro\"
+ case "$parm_val" in
+ /*|no) # CCARGS was already updated above.
+ ;;
+ "") trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
+ sed -n '
+ /_SHLIB_DIR/,/^$/p
+ /_PLUGIN_DIR/,/^$/p
+ ' src/global/mail_params.h >makedefs.test.c
+ cat >>makedefs.test.c <<EOF
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
- printf("%s\n", DEF_SHLIB_DIR);
+ printf("%s\n", $parm_macro);
fflush(stdout);
exit(ferror(stdout) ? 1 : 0);
}
EOF
- eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
- shlib_directory=`./makedefs.test` || exit 1
- rm -f makedefs.test makedefs.test.[co]
- ;;
- *) # shlib_directory was already checked above.
- error "Can't happen in $0 - $shlib_directory is not an absolute path"
- ;;
- esac
+ eval ${CC-gcc} ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
+ eval $parm_name=`./makedefs.test` || exit 1
+ rm -f makedefs.test makedefs.test.[co]
+ ;;
+ *) # this parameter was already checked above.
+ error "Can't happen in $0 - $parm_val is not an absolute path"
+ ;;
+ esac
+ done
# Determine the shared-library version.
test -z "$SHLIB_VERSION" && {
no|"")
shlib_directory=no
+ plugin_directory=no
CCARGS="$CCARGS -UUSE_DYNAMIC_LIBS -UDEF_SHLIB_DIR -DDEF_SHLIB_DIR=\\\"no\\\""
+ CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS -UDEF_PLUGIN_DIR -DDEF_PLUGIN_DIR=\\\"no\\\""
SHLIB_CFLAGS=
SHLIB_SUFFIX=
SHLIB_LD=:
SHLIB_RPATH=
SHLIB_ENV=
+ SHLIB_VERSION=
LIB_PREFIX=
LIB_SUFFIX=.a
+ NON_PLUGIN_MAP_OBJ='$(MAP_OBJ)'
+ PLUGIN_MAP_OBJ=
+ PLUGIN_MAP_OBJ_UPDATE=
+ PLUGIN_MAP_SO_MAKE=
+ PLUGIN_MAP_SO_UPDATE=
;;
-*) echo "Specify \"shared=yes\" or \"shared=no\"" 1>&2
- exit 1
+*) error "Specify \"shared=yes\" or \"shared=no\"" 1>&2
;;
esac
sed 's/ / /g' <<EOF
+# System-dependent settings and compiler/linker overrides.
SYSTYPE = $SYSTYPE
_AR = $_AR
-AR = $AR
ARFL = $ARFL
_RANLIB = $_RANLIB
-RANLIB = $RANLIB
SYSLIBS = $AUXLIBS $SYSLIBS
CC = $CC $CCARGS
OPT = $OPT
STRCASE = $STRCASE
EXPORT = AUXLIBS='$AUXLIBS' CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
WARN = $WARN
+# Switch between Postfix static and shared libraries.
+AR = $AR
+RANLIB = $RANLIB
LIB_PREFIX = $LIB_PREFIX
LIB_SUFFIX = $LIB_SUFFIX
SHLIB_CFLAGS = $SHLIB_CFLAGS
SHLIB_ENV = $SHLIB_ENV
SHLIB_LD = $SHLIB_LD
SHLIB_RPATH = $SHLIB_RPATH
+SHLIB_VERSION = $SHLIB_VERSION
+# Switch between dynamicmaps.cf plugins and hard-linked databases.
+PLUGIN_DIR = $plugin_directory
+NON_PLUGIN_MAP_OBJ = $NON_PLUGIN_MAP_OBJ
+PLUGIN_MAP_OBJ = $PLUGIN_MAP_OBJ
+PLUGIN_MAP_OBJ_UPDATE = $PLUGIN_MAP_OBJ_UPDATE
+PLUGIN_MAP_SO_MAKE = $PLUGIN_MAP_SO_MAKE
+PLUGIN_MAP_SO_UPDATE = $PLUGIN_MAP_SO_UPDATE
+# Application-specific rules.
EOF
caches, pseudo-random numbers).
.PP
Available in Postfix version 2.12 and later:
+.IP "\fBplugin_directory (see 'postconf -d' output)\fR"
+The location of the Postfix dynamicmaps.cf database plugin
+configuration file, and of database plugins with a relative pathname.
.IP "\fBshlib_directory (see 'postconf -d' output)\fR"
The location of Postfix shared libraries (libpostfix-*.so.*).
.PP
is rejected by the \fBreject_plaintext_session\fR restriction.
.PP
This feature is available in Postfix 2.3 and later.
+.SH plugin_directory (default: see 'postconf -d' output)
+The location of the Postfix dynamicmaps.cf database plugin
+configuration file, and of database plugins with a relative pathname.
+This is set to "no" when Postfix database plugin support is disabled
+at compile time.
+.PP
+This feature is available in Postfix 2.12 and later.
.SH postmulti_control_commands (default: reload flush)
The \fBpostfix\fR(1) commands that the \fBpostmulti\fR(1) instance manager
treats as "control" commands, that operate on running instances. For
s;\bdefault_desti[-</Bb>]*\n* *[<Bb>]*na[-</Bb>]*\n* *[<Bb>]*tion_con[-</Bb>]*\n* *[<Bb>]*currency_failed_cohort_limit\b;<a href="postconf.5.html#default_destination_concurrency_failed_cohort_limit">$&</a>;g;
s;\bdestination_concurrency_feedback_debug\b;<a href="postconf.5.html#destination_concurrency_feedback_debug">$&</a>;g;
s;\bdefault_destina[-</Bb>]*\n* *[<Bb>]*tion_rate_delay\b;<a href="postconf.5.html#default_destination_rate_delay">$&</a>;g;
+ s;\bplugin_directory\b;<a href="postconf.5.html#plugin_directory">$&</a>;g;
s;\bqmqpd_client_port_logging\b;<a href="postconf.5.html#qmqpd_client_port_logging">$&</a>;g;
s;\bqmqpd_error_delay\b;<a href="postconf.5.html#qmqpd_error_delay">$&</a>;g;
# The final destination directory for the Postfix sample configuration
# files. This parameter is obsolete as of Postfix version 2.1.
# This parameter setting is recorded in the installed main.cf file.
+# .IP plugin_directory
+# The final destination directory for the Postfix dynamicmaps.cf
+# database plugin configuration file, and files referenced by
+# that file. This is "no" when dynamic linking is disabled
+# at compile time.
# .IP readme_directory
# The final destination directory for the Postfix README files.
# This parameter setting is recorded in the installed main.cf file.
html_directory_prompt="the final destination directory for the Postfix
HTML files. Specify \"no\" if you do not want to install these files."
-shlib_directory_prompt="the final destination directory for Postfix shared-library files."
+shlib_directory_prompt="the final destination directory for Postfix
+shared-library files."
+plugin_directory_prompt="the final destination directory for the
+Postfix dynamicmaps.cf configuration file and files referenced by
+that file."
# Default settings, just to get started.
CONFIG_PARAMS="command_directory daemon_directory data_directory \
html_directory mail_owner mailq_path manpage_directory newaliases_path \
-queue_directory readme_directory sendmail_path setgid_group shlib_directory"
+queue_directory readme_directory sendmail_path setgid_group shlib_directory \
+plugin_directory"
# Extract parameter settings from the installed main.cf file.
exit 1;;
esac
-for path in "$html_directory" "$readme_directory" "$shlib_directory"
+for path in "$html_directory" "$readme_directory" "$shlib_directory" "$plugin_directory"
do
case "$path" in
/*) ;;
done
for path in command_directory config_directory daemon_directory data_directory \
- manpage_directory queue_directory shlib_directory html_directory \
+ manpage_directory queue_directory shlib_directory plugin_directory html_directory \
readme_directory
do
case "$path" in
MANPAGE_DIRECTORY=$install_root$manpage_directory
README_DIRECTORY=$install_root$readme_directory
SHLIB_DIRECTORY=$install_root$shlib_directory
+PLUGIN_DIRECTORY=$install_root$plugin_directory
# Avoid repeated tests for existence of these; default permissions suffice.
test -d $DAEMON_DIRECTORY || mkdir -p $DAEMON_DIRECTORY || exit 1
test -d $COMMAND_DIRECTORY || mkdir -p $COMMAND_DIRECTORY || exit 1
test -d $QUEUE_DIRECTORY || mkdir -p $QUEUE_DIRECTORY || exit 1
+test "$plugin_directory" = "no" -o -d $PLUGIN_DIRECTORY ||
+ mkdir -p $PLUGIN_DIRECTORY || exit 1
test "$shlib_directory" = "no" -o -d $SHLIB_DIRECTORY ||
mkdir -p $SHLIB_DIRECTORY || exit 1
test "$html_directory" = "no" -o -d $HTML_DIRECTORY ||
'$shlib_directory')
compare_or_replace $mode "$owner" "$group" lib/$file \
$SHLIB_DIRECTORY/$file || exit 1;;
+ '$plugin_directory')
+ compare_or_replace $mode "$owner" "$group" plugins/$file \
+ $PLUGIN_DIRECTORY/$file || exit 1;;
'$daemon_directory')
compare_or_replace $mode "$owner" "$group" libexec/$file \
$DAEMON_DIRECTORY/$file || exit 1;;
"sample_directory = $sample_directory" \
"readme_directory = $readme_directory" \
"shlib_directory = $shlib_directory" \
+ "plugin_directory = $plugin_directory" \
|| exit 1
# If Postfix is being installed locally from source code, do the
<p> and so on. In some cases, optimization is turned off automatically. </p>
-<h3>4.3 - Building with Postfix shared libraries (Postfix ≥ 2.12) </h3>
+<h3>4.3 - Building with Postfix shared libraries and database plugins
+(Postfix ≥ 2.12) </h3>
-<p> Postfix can be built with Postfix shared libraries (files named
-<tt>libpostfix-*.so.*</tt>). These files are needed to dynamically
-load Postfix database clients with the Debian-style dynamicmaps.cf
-feature. Postfix shared libraries add minor run-time overhead and
-result in smaller Postfix executable files. </p>
-
-<p> Although Debian-style dynamicmaps.cf support is functional, it
-is not yet used. Postfix database clients are still built into the
-Postfix library files. Postfix database clients may become plugins
-at some later point in time. </p>
+<p> Postfix can be built with Postfix shared libraries (files
+typically named <tt>libpostfix-*.so.*</tt>). Postfix shared libraries
+add minor run-time overhead and result in significantly-smaller
+Postfix executable files. </p>
<p> Postfix shared-library support is evolving. Support exists for
Linux, FreeBSD and MacOS X. Shared-library builds will become the
default once the build system stops changing. </p>
-<p> For now, specify "shared=yes" on the "make makefiles"
-command line to build Postfix with shared-library support. </p>
+<p> Specify "shared=yes" on the "make makefiles" command line to
+build Postfix with shared-library support. </p>
<blockquote>
<pre>
</pre>
</blockquote>
-<p> Postfix shared libraries are named
-libpostfix-<i>xxx</i>.so.<i>version</i> where <i>xxx</i> is a
+<p> Postfix shared libraries are typically named
+libpostfix-<i>name</i>.so.<i>version</i>, where <i>name</i> is a
source-code directory name such as "util" or "global", and the
default <i>version</i> is the Postfix version: X.Y.Z for stable
releases, X.Y-DATE for snapshot releases, or X.Y-DATE-nonprod for
</pre>
</blockquote>
+<p> The shlib_directory parameter specifies the location of Postfix
+shared library files. See section 4.5 defaults and how to override
+this. </p>
+
+<p> Additionally, Postfix can be built with support to dynamically
+load Postfix database clients with the Debian-style dynamicmaps.cf
+feature. This is useful mainly for distributors of pre-compiled
+Postfix packages. </p>
+
+<p> Specify "dynamicmaps=yes" on the "make makefiles"
+command line to build Postfix with support to dynamically
+load Postfix database clients with the Debian-style dynamicmaps.cf
+feature, This implicitly enables shared-library support. </p>
+
+<blockquote>
+<pre>
+$ make makefiles dynamicmaps=yes ...other arguments...
+$ make makefiles dynamicmaps=no ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> Postfix database plugins libraries are typically named
+postfix-<i>type</i>.so.<i>version</i> where <i>type</i> is a database
+type such as "ldap" or "lmdb". The <i>version</i> is the same as
+for Postfix shared libraries. The installed dynamicmaps.cf
+configuration file is given a suffix with the same version.
+
+<p> The plugin_directory parameter specifies the location of the
+dynamicmaps.cf file and for database plugins with relative pathnames.
+See section 4.5 defaults and how to override this. </p>
+
<h3>4.4 - Building with optional features</h3>
By default, Postfix builds as a mail system with relatively few
<tr> <td>newaliases_path</td> <td>/usr/bin/newaliases</td> </tr>
+<tr> <td>plugin_directory</td> <td>/usr/libexec/postfix</td> </tr>
+
<tr> <td>queue_directory</td> <td>/var/spool/postfix</td> </tr>
<tr> <td>readme_directory</td> <td>no</td> </tr>
disabled at compile time. </p>
<p> This feature is available in Postfix 2.12 and later. </p>
+
+%PARAM plugin_directory see 'postconf -d' output
+
+<p> The location of the Postfix dynamicmaps.cf database plugin
+configuration file, and of database plugins with a relative pathname.
+This is set to "no" when Postfix database plugin support is disabled
+at compile time. </p>
+
+<p> This feature is available in Postfix 2.12 and later. </p>
canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \
defer.o deliver_completed.o deliver_flock.o deliver_pass.o \
- deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \
- dict_proxy.o dict_sqlite.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
+ deliver_request.o \
+ dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \
ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \
header_token.o input_transp.o int_filt.o is_header.o log_adhoc.o \
mail_params.o mail_pathname.o mail_queue.o mail_run.o \
mail_scan_dir.o mail_stream.o mail_task.o mail_trigger.o maps.o \
mark_corrupt.o match_parent_style.o mbox_conf.o mbox_open.o \
- mime_state.o mkmap_cdb.o mkmap_db.o mkmap_dbm.o mkmap_lmdb.o mkmap_open.o \
- mkmap_sdbm.o msg_stats_print.o msg_stats_scan.o mynetworks.o \
+ mime_state.o mkmap_db.o mkmap_dbm.o mkmap_open.o \
+ msg_stats_print.o msg_stats_scan.o mynetworks.o \
mypwd.o namadr_list.o off_cvt.o opened.o own_inet_addr.o \
pipe_command.o post_mail.o quote_821_local.o quote_822_local.o \
rcpt_buf.o rcpt_print.o rec_attr_map.o rec_streamlf.o rec_type.o \
match_service.o mail_conf_nint.o addr_match_list.o mail_conf_nbool.o \
smtp_reply_footer.o safe_ultostr.o verify_sender_addr.o \
dict_memcache.o mail_version.o memcache_proto.o server_acl.o \
- mkmap_fail.o haproxy_srvr.o dsn_filter.o dynamicmaps.o
+ mkmap_fail.o haproxy_srvr.o dsn_filter.o dynamicmaps.o \
+ $(NON_PLUGIN_MAP_OBJ)
+MAP_OBJ = dict_ldap.o dict_mysql.o dict_pgsql.o dict_sqlite.o mkmap_cdb.o \
+ mkmap_lmdb.o mkmap_sdbm.o
+# MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf.
+# When hard-linking these maps, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ),
+# otherwise it sets PLUGIN_MAP_OBJ, PLUGIN_MAP_OBJ_UPDATE,
+# PLUGIN_MAP_SO_MAKE, and PLUGIN_MAP_SO_UPDATE.
HDRS = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \
canon_addr.h cfg_parser.h cleanup_user.h clnt_stream.h config.h \
conv_time.h db_common.h debug_peer.h debug_process.h defer.h \
LIBS = ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
LIB_DIR = ../../lib
INC_DIR = ../../include
-MAPS = $(LIB_PREFIX)ldap$(LIB_SUFFIX) $(LIB_PREFIX)mysql$(LIB_SUFFIX) \
+PLG_DIR= ../../plugins
+PLUGIN_MAP_SO = $(LIB_PREFIX)ldap$(LIB_SUFFIX) $(LIB_PREFIX)mysql$(LIB_SUFFIX) \
$(LIB_PREFIX)pgsql$(LIB_SUFFIX) $(LIB_PREFIX)sqlite$(LIB_SUFFIX) \
- $(LIB_PREFIX)lmdb$(LIB_SUFFIX) $(LIB_PREFIX)cdb$(LIB_SUFFIX)
+ $(LIB_PREFIX)lmdb$(LIB_SUFFIX) $(LIB_PREFIX)cdb$(LIB_SUFFIX) \
+ $(LIB_PREFIX)sdbm$(LIB_SUFFIX)
MAKES =
.c.o:; $(CC) $(SHLIB_CFLAGS) $(CFLAGS) -c $*.c
-all: $(LIB)
+all: $(LIB) $(PLUGIN_MAP_SO) $(PLUGIN_MAP_OBJ)
-$(OBJS): ../../conf/makedefs.out
+$(OBJS) $(PLUGIN_MAP_OBJ): ../../conf/makedefs.out
Makefile: Makefile.in
cat ../../conf/makedefs.out $? >$@
cp $(LIB) $(LIB_DIR)
$(RANLIB) $(LIB_DIR)/$(LIB)
-plugins:
- $(MAKE) LIB='$(LIB_PREFIX)ldap$(LIB_SUFFIX)' OBJS=dict_ldap.o all
- $(MAKE) LIB='$(LIB_PREFIX)mysql$(LIB_SUFFIX)' OBJS=dict_mysql.o all
- $(MAKE) LIB='$(LIB_PREFIX)pgsql$(LIB_SUFFIX)' OBJS=dict_pgsql.o all
- $(MAKE) LIB='$(LIB_PREFIX)sqlite$(LIB_SUFFIX)' OBJS=dict_sqlite.o all
- $(MAKE) LIB='$(LIB_PREFIX)lmdb$(LIB_SUFFIX)' \
- OBJS='../util/dict_lmdb.o mkmap_lmdb.o' all
- $(MAKE) LIB='$(LIB_PREFIX)cdb$(LIB_SUFFIX)' \
- OBJS='../util/dict_cdb.o mkmap_cdb.o' all
-
-update: $(LIB_DIR)/$(LIB) $(HDRS)
+plugin_map_so: $(PLUGIN_MAP_SO)
+
+$(LIB_PREFIX)ldap$(LIB_SUFFIX): dict_ldap.o
+ $(SHLIB_LD) -o $@ dict_ldap.o
+
+$(LIB_PREFIX)mysql$(LIB_SUFFIX): dict_mysql.o
+ $(SHLIB_LD) -o $@ dict_mysql.o
+
+$(LIB_PREFIX)pgsql$(LIB_SUFFIX): dict_pgsql.o
+ $(SHLIB_LD) -o $@ dict_pgsql.o
+
+$(LIB_PREFIX)sqlite$(LIB_SUFFIX): dict_sqlite.o
+ $(SHLIB_LD) -o $@ dict_sqlite.o
+
+$(LIB_PREFIX)lmdb$(LIB_SUFFIX): mkmap_lmdb.o $(LIB_DIR)/dict_lmdb.o \
+ $(LIB_DIR)/slmdb.o
+ $(SHLIB_LD) -o $@ mkmap_lmdb.o $(LIB_DIR)/dict_lmdb.o \
+ $(LIB_DIR)/slmdb.o
+
+$(LIB_PREFIX)cdb$(LIB_SUFFIX): mkmap_cdb.o $(LIB_DIR)/dict_cdb.o
+ $(SHLIB_LD) -o $@ mkmap_cdb.o $(LIB_DIR)/dict_cdb.o
+
+$(LIB_PREFIX)sdbm$(LIB_SUFFIX): mkmap_sdbm.o $(LIB_DIR)/dict_sdbm.o
+ $(SHLIB_LD) -o $@ mkmap_sdbm.o $(LIB_DIR)/dict_sdbm.o
+
+update: $(LIB_DIR)/$(LIB) $(HDRS) $(PLUGIN_MAP_SO_UPDATE)
-for i in $(HDRS); \
do \
cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
done
cd $(INC_DIR); chmod 644 $(HDRS)
+plugin_map_so_update: $(PLUGIN_MAP_SO)
+ -for i in $(PLUGIN_MAP_SO); \
+ do \
+ cmp -s $$i $(PLG_DIR)/$$i 2>/dev/null || cp $$i $(PLG_DIR); \
+ done
+
dot_lockfile: $(LIB) $(LIBS)
mv $@.o junk
$(CC) -DTEST $(CFLAGS) -o $@ $@.c $(LIB) $(LIBS) $(SYSLIBS)
dsn_util.o: dsn_util.h
dynamicmaps.o: ../../include/argv.h
dynamicmaps.o: ../../include/dict.h
+dynamicmaps.o: ../../include/htable.h
dynamicmaps.o: ../../include/load_lib.h
dynamicmaps.o: ../../include/msg.h
-dynamicmaps.o: ../../include/mvect.h
dynamicmaps.o: ../../include/myflock.h
dynamicmaps.o: ../../include/mymalloc.h
+dynamicmaps.o: ../../include/stringops.h
dynamicmaps.o: ../../include/sys_defs.h
dynamicmaps.o: ../../include/vbuf.h
dynamicmaps.o: ../../include/vstream.h
#include <vstring.h>
#include <vstream.h>
#include <vstring_vstream.h>
-#include <mvect.h>
+#include <stringops.h>
/*
* Global library.
#include <mkmap.h>
#include <dynamicmaps.h>
-#ifdef USE_DYNAMIC_LIBS
+#ifdef USE_DYNAMIC_MAPS
/*
* Contents of one dynamicmaps.cf entry.
static DICT_OPEN_EXTEND_FN saved_dict_open_hook = 0;
static MKMAP_OPEN_EXTEND_FN saved_mkmap_open_hook = 0;
static DICT_MAPNAMES_EXTEND_FN saved_dict_mapnames_hook = 0;
+static char *dymap_base;
#define STREQ(x, y) (strcmp((x), (y)) == 0)
*/
else {
buf = vstring_alloc(100);
+ dymap_base = mystrdup(path);
+ (void) split_at_right(dymap_base, '/');
while (vstring_get_nonl(buf, fp) != VSTREAM_EOF) {
cp = vstring_str(buf);
linenum++;
if (!ISALNUM(argv->argv[0][0]))
msg_fatal("%s, line %d: unsupported syntax \"%s\"",
path, linenum, argv->argv[0]);
- if (argv->argv[1][0] != '/')
- msg_fatal("%s, line %d: .so-name must begin with a \"/\"",
- path, linenum);
+ if (argv->argv[1][0] != '/') {
+ cp = concatenate(dymap_base, "/", argv->argv[1], (char *) 0);
+ argv_replace_one(argv, 1, cp);
+ myfree(cp);
+ }
htable_enter(dymap_info, argv->argv[0],
(char *) dymap_entry_alloc(argv->argv + 1));
argv_free(argv);
static const DICT_OPEN_INFO dict_open_info[] = {
DICT_TYPE_PROXY, dict_proxy_open,
+#ifndef USE_DYNAMIC_MAPS
#ifdef HAS_LDAP
DICT_TYPE_LDAP, dict_ldap_open,
#endif
#ifdef HAS_SQLITE
DICT_TYPE_SQLITE, dict_sqlite_open,
#endif
+#endif /* !USE_DYNAMIC_MAPS */
DICT_TYPE_MEMCACHE, dict_memcache_open,
0,
};
{
const DICT_OPEN_INFO *dp;
-#ifdef USE_DYNAMIC_LIBS
+#ifdef USE_DYNAMIC_MAPS
char *path;
- path = concatenate(var_daemon_dir, "/", "dynamicmaps.cf", (char *) 0);
+ path = concatenate(var_plugin_dir, "/", "dynamicmaps.cf", (char *) 0);
dymap_init(path);
myfree(path);
#endif
/* char *var_daemon_dir;
/* char *var_data_dir;
/* char *var_command_dir;
+/* char *var_plugin_dir;
/* char *var_queue_dir;
/* char *var_shlib_dir;
/* int var_use_limit;
char *var_daemon_dir;
char *var_data_dir;
char *var_command_dir;
+char *var_plugin_dir;
char *var_queue_dir;
char *var_shlib_dir;
int var_use_limit;
const char null_format_string[1] = "";
+DEFINE_DICT_LMDB_MAP_SIZE;
+
/* check_myhostname - lookup hostname and validate */
static const char *check_myhostname(void)
VAR_DAEMON_DIR, DEF_DAEMON_DIR, &var_daemon_dir, 1, 0,
VAR_DATA_DIR, DEF_DATA_DIR, &var_data_dir, 1, 0,
VAR_COMMAND_DIR, DEF_COMMAND_DIR, &var_command_dir, 1, 0,
+ VAR_PLUGIN_DIR, DEF_PLUGIN_DIR, &var_plugin_dir, 1, 0,
VAR_QUEUE_DIR, DEF_QUEUE_DIR, &var_queue_dir, 1, 0,
VAR_SHLIB_DIR, DEF_SHLIB_DIR, &var_shlib_dir, 1, 0,
VAR_PID_DIR, DEF_PID_DIR, &var_pid_dir, 1, 0,
#ifdef HAS_DB
dict_db_cache_size = var_db_read_buf;
#endif
-#ifdef HAS_LMDB
dict_lmdb_map_size = var_lmdb_map_size;
-#endif
inet_windowsize = var_inet_windowsize;
/*
#endif
extern char *var_shlib_dir;
+#define VAR_PLUGIN_DIR "plugin_directory"
+#ifndef DEF_PLUGIN_DIR
+#define DEF_PLUGIN_DIR "/usr/libexec/postfix"
+#endif
+extern char *var_plugin_dir;
+
/* LICENSE
/* .ad
/* .fi
* Patches change both the patchlevel and the release date. Snapshots have no
* patchlevel; they change the release date only.
*/
-#define MAIL_RELEASE_DATE "20140518"
+#define MAIL_RELEASE_DATE "20140522"
#define MAIL_VERSION_NUMBER "2.12"
#ifdef SNAPSHOT
} MKMAP_OPEN_INFO;
static const MKMAP_OPEN_INFO mkmap_open_info[] = {
+#ifndef USE_DYNAMIC_MAPS
#ifdef HAS_CDB
DICT_TYPE_CDB, mkmap_cdb_open,
#endif
#ifdef HAS_SDBM
DICT_TYPE_SDBM, mkmap_sdbm_open,
#endif
+#ifdef HAS_LMDB
+ DICT_TYPE_LMDB, mkmap_lmdb_open,
+#endif
+#endif /* !USE_DYNAMIC_MAPS */
#ifdef HAS_DBM
DICT_TYPE_DBM, mkmap_dbm_open,
#endif
#ifdef HAS_DB
DICT_TYPE_HASH, mkmap_hash_open,
DICT_TYPE_BTREE, mkmap_btree_open,
-#endif
-#ifdef HAS_LMDB
- DICT_TYPE_LMDB, mkmap_lmdb_open,
#endif
DICT_TYPE_FAIL, mkmap_fail_open,
0,
/* caches, pseudo-random numbers).
/* .PP
/* Available in Postfix version 2.12 and later:
+/* .IP "\fBplugin_directory (see 'postconf -d' output)\fR"
+/* The location of the Postfix dynamicmaps.cf database plugin
+/* configuration file, and of database plugins with a relative pathname.
/* .IP "\fBshlib_directory (see 'postconf -d' output)\fR"
/* The location of Postfix shared libraries (libpostfix-*.so.*).
/* .PP
check_setenv(VAR_COMMAND_DIR, var_command_dir); /* main.cf */
check_setenv(VAR_DAEMON_DIR, var_daemon_dir); /* main.cf */
check_setenv(VAR_DATA_DIR, var_data_dir); /* main.cf */
+ check_setenv(VAR_PLUGIN_DIR, var_plugin_dir); /* main.cf */
check_setenv(VAR_QUEUE_DIR, var_queue_dir); /* main.cf */
check_setenv(VAR_CONFIG_DIR, var_config_dir); /* main.cf */
check_setenv(VAR_SHLIB_DIR, var_shlib_dir); /* main.cf */
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_cdb.o dict_cidr.o dict_db.o \
- dict_dbm.o dict_debug.o dict_env.o dict_ht.o dict_lmdb.o dict_ni.o dict_nis.o \
- dict_nisplus.o dict_open.o dict_pcre.o dict_regexp.o dict_sdbm.o \
+ ctable.o dict.o dict_alloc.o dict_cidr.o dict_db.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 \
dummy_write.o duplex_pipe.o environ.o events.o exec_command.o \
fifo_listen.o fifo_trigger.o file_limit.o find_inet.o fsspace.o \
ip_match.o nbbio.o base32_code.o dict_test.o \
dict_fail.o msg_rate_delay.o dict_surrogate.o warn_stat.o \
dict_sockmap.o line_number.o recv_pass_attr.o pass_accept.o \
- poll_fd.o timecmp.o slmdb.o
+ poll_fd.o timecmp.o $(NON_PLUGIN_MAP_OBJ)
+MAP_OBJ = dict_pcre.o $(MKMAP_OBJ)
+MKMAP_OBJ = dict_cdb.o dict_lmdb.o dict_sdbm.o slmdb.o
+# MAP_OBJ is for maps that may be dynamically loaded with dynamicmaps.cf.
+# When hard-linking these, makedefs sets NON_PLUGIN_MAP_OBJ=$(MAP_OBJ),
+# otherwise it sets PLUGIN_MAP_OBJ, PLUGIN_MAP_OBJ_UPDATE,
+# PLUGIN_MAP_SO_MAKE, and PLUGIN_MAP_SO_UPDATE.
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_env.h dict_ht.h \
myaddrinfo myaddrinfo4 inet_proto sane_basename format_tv \
valid_utf_8 ip_match base32_code msg_rate_delay netstring \
vstream timecmp dict_cache
+PLUGIN_MAP_SO = $(LIB_PREFIX)pcre$(LIB_SUFFIX)
LIB_DIR = ../../lib
INC_DIR = ../../include
+PLG_DIR = ../../plugins
.c.o:; $(CC) $(SHLIB_CFLAGS) $(CFLAGS) -c $*.c
-all: $(LIB)
+all: $(LIB) $(PLUGIN_MAP_SO_MAKE) $(PLUGIN_MAP_OBJ)
-$(OBJS): ../../conf/makedefs.out
+$(OBJS) $(PLUGIN_MAP_OBJ): ../../conf/makedefs.out
Makefile: Makefile.in
cat ../../conf/makedefs.out $? >$@
cp $(LIB) $(LIB_DIR)
$(RANLIB) $(LIB_DIR)/$(LIB)
-update: $(LIB_DIR)/$(LIB) $(HDRS)
+plugin_map_so_make: $(PLUGIN_MAP_SO)
+
+$(LIB_PREFIX)pcre$(LIB_SUFFIX): dict_pcre.o
+ $(SHLIB_LD) -o $@ dict_pcre.o
+
+update: $(LIB_DIR)/$(LIB) $(HDRS) $(PLUGIN_MAP_SO_UPDATE) \
+ $(PLUGIN_MAP_OBJ_UPDATE)
-for i in $(HDRS); \
do \
cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
done
cd $(INC_DIR); chmod 644 $(HDRS)
+plugin_map_so_update: $(PLUGIN_MAP_SO)
+ -for i in $(PLUGIN_MAP_SO); \
+ do \
+ cmp -s $$i $(PLG_DIR)/$$i 2>/dev/null || cp $$i $(PLG_DIR); \
+ done
+
+plugin_map_obj_update: $(MKMAP_OBJ)
+ -for i in $(MKMAP_OBJ); \
+ do \
+ cmp -s $$i $(LIB_DIR)/$$i 2>/dev/null || cp $$i $(LIB_DIR); \
+ done
+
printfck: $(OBJS) $(PROG)
rm -rf printfck
mkdir printfck
/* SYNOPSIS
/* #include <dict_lmdb.h>
/*
-/* size_t dict_lmdb_map_size;
+/* extern size_t dict_lmdb_map_size;
+/*
+/* DEFINE_DICT_LMDB_MAP_SIZE;
/*
/* DICT *dict_lmdb_open(path, open_flags, dict_flags)
/* const char *name;
/* The dict_lmdb_map_size variable specifies the initial
/* database memory map size. When a map becomes full its size
/* is doubled, and other programs pick up the size change.
+/*
+/* This variable cannot be exported via the dict(3) API and
+/* must therefore be defined in the calling program by invoking
+/* the DEFINE_DICT_LMDB_MAP_SIZE macro at the global level.
/* DIAGNOSTICS
/* Fatal errors: cannot open file, file write error, out of
/* memory.
((int) (2 * sizeof(size_t) * CHAR_BIT)) /* Retries per bulk-mode
* transaction */
-size_t dict_lmdb_map_size = 8192; /* Minimum size without SIGSEGV */
-
/* #define msg_verbose 1 */
/* dict_lmdb_lookup - find database entry */
extern size_t dict_lmdb_map_size;
extern unsigned int dict_lmdb_max_readers;
+ /* Minimum size without SIGSEGV. */
+#define DEFINE_DICT_LMDB_MAP_SIZE size_t dict_lmdb_map_size = 8192
+
/* LICENSE
/* .ad
/* .fi
} DICT_OPEN_INFO;
static const DICT_OPEN_INFO dict_open_info[] = {
-#ifdef HAS_CDB
- DICT_TYPE_CDB, dict_cdb_open,
-#endif
DICT_TYPE_ENVIRON, dict_env_open,
DICT_TYPE_HT, dict_ht_open,
DICT_TYPE_UNIX, dict_unix_open,
DICT_TYPE_TCP, dict_tcp_open,
-#ifdef HAS_SDBM
- DICT_TYPE_SDBM, dict_sdbm_open,
-#endif
#ifdef HAS_DBM
DICT_TYPE_DBM, dict_dbm_open,
#endif
DICT_TYPE_HASH, dict_hash_open,
DICT_TYPE_BTREE, dict_btree_open,
#endif
-#ifdef HAS_LMDB
- DICT_TYPE_LMDB, dict_lmdb_open,
-#endif
#ifdef HAS_NIS
DICT_TYPE_NIS, dict_nis_open,
#endif
#ifdef HAS_NETINFO
DICT_TYPE_NETINFO, dict_ni_open,
#endif
-#ifdef HAS_PCRE
- DICT_TYPE_PCRE, dict_pcre_open,
-#endif
#ifdef HAS_POSIX_REGEXP
DICT_TYPE_REGEXP, dict_regexp_open,
#endif
DICT_TYPE_THASH, dict_thash_open,
DICT_TYPE_SOCKMAP, dict_sockmap_open,
DICT_TYPE_FAIL, dict_fail_open,
+#ifndef USE_DYNAMIC_MAPS
+#ifdef HAS_PCRE
+ DICT_TYPE_PCRE, dict_pcre_open,
+#endif
+#ifdef HAS_CDB
+ DICT_TYPE_CDB, dict_cdb_open,
+#endif
+#ifdef HAS_SDBM
+ DICT_TYPE_SDBM, dict_sdbm_open,
+#endif
+#ifdef HAS_LMDB
+ DICT_TYPE_LMDB, dict_lmdb_open,
+#endif
+#endif /* !USE_DYNAMIC_MAPS */
0,
};
#include <vstring_vstream.h>
#include <dict.h>
+DEFINE_DICT_LMDB_MAP_SIZE;
+
static NORETURN usage(char *myname)
{
msg_fatal("usage: %s type:file read|write|create [flags...]", myname);