]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.12-20140522-nonprod
authorWietse Venema <wietse@porcupine.org>
Thu, 22 May 2014 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Fri, 23 May 2014 01:16:23 +0000 (21:16 -0400)
34 files changed:
postfix/HISTORY
postfix/INSTALL
postfix/Makefile.in
postfix/README_FILES/INSTALL
postfix/RELEASE_NOTES
postfix/WISHLIST
postfix/conf/dynamicmaps.cf
postfix/conf/post-install
postfix/conf/postfix-files
postfix/conf/postfix-script
postfix/html/INSTALL.html
postfix/html/postconf.5.html
postfix/html/postfix.1.html
postfix/makedefs
postfix/man/man1/postfix.1
postfix/man/man5/postconf.5
postfix/mantools/postlink
postfix/plugins/.keep [new file with mode: 0644]
postfix/postfix-install
postfix/proto/INSTALL.html
postfix/proto/postconf.proto
postfix/src/global/Makefile.in
postfix/src/global/dynamicmaps.c
postfix/src/global/mail_dict.c
postfix/src/global/mail_params.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/global/mkmap_open.c
postfix/src/postfix/postfix.c
postfix/src/util/Makefile.in
postfix/src/util/dict_lmdb.c
postfix/src/util/dict_lmdb.h
postfix/src/util/dict_open.c
postfix/src/util/dict_test.c

index b19965fa8a5ebd6f494da8e04db74e5307b7bca5..435a8111daf24e2be1d916d772ae52424783bb6c 100644 (file)
@@ -19801,3 +19801,14 @@ Apologies for any names omitted.
        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.
index 2489b1fed19272b9cd6012d2a0caa31ffd2ade50..706ea60a6b66d7119d8ec9bc94789552bee79a81 100644 (file)
@@ -148,37 +148,57 @@ compiler. Here are a few examples:
 
 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
@@ -248,6 +268,8 @@ postconf.5 | less").
     |_____________________|____________________|
     |newaliases_path     |/usr/bin/newaliases |
     |_____________________|____________________|
+    |plugin_directory    |/usr/libexec/postfix|
+    |_____________________|____________________|
     |queue_directory     |/var/spool/postfix  |
     |_____________________|____________________|
     |readme_directory    |no                  |
index e3e029632e384616803c01ccf459b3885bb922ca..27a9cdf739402dc3116d982adac449276d053d8f 100644 (file)
@@ -14,7 +14,11 @@ DIRS = src/util src/global src/dns src/tls src/xsasl src/milter src/master \
 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
 
@@ -33,7 +37,7 @@ update printfck tests root_tests:
         (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 $? $@
@@ -41,17 +45,15 @@ libexec/makedefs.out: conf/makedefs.out
 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
@@ -69,6 +71,9 @@ libexec/master.cf: conf/master.cf
 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; \
@@ -77,19 +82,19 @@ manpages:
 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:
@@ -108,8 +113,8 @@ tidy:       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* \
index 3760e029f4cc372e18879d9575831f3f0b12fb3a..d57ce3bbd7432b9ad2fd147894a53187953936a5 100644 (file)
@@ -148,37 +148,57 @@ compiler. Here are a few examples:
 
 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
@@ -248,6 +268,8 @@ postconf.5 | less").
     |_\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                  |
index fd9a446c201e6e94950b8c3dbe47c60e45ce3d49..93661502a44cf70e611d14a7e11a7ee781c9f269 100644 (file)
@@ -16,56 +16,47 @@ specifies the release date of a stable release or snapshot release.
 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
@@ -80,9 +71,28 @@ To override this, use, for example:
 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
 -------------------
index 8908a5e3e1c79f3cb9f2487d38d39dd1208954f2..251bf07e3e148cc96d8ccdf93de6626e356fde2d 100644 (file)
@@ -8,6 +8,8 @@ Wish list:
 
        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.
 
index 7beade0e5dcb7d0d5f7a6b4f16c7b33b6303caa7..6455b6c68b317bf840a360cd78c995d648a4f1af 100644 (file)
@@ -1 +1,9 @@
 # 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
index 942b0448537b8e7a2cfbbcc0f8a146aaa882f971..58ef79634156771776ce11e1fcae7f04ed972248 100644 (file)
 #      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
@@ -207,7 +210,7 @@ debug=:
 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
@@ -371,7 +374,7 @@ do
    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
    /*) ;;
@@ -441,6 +444,7 @@ test -n "$override" && {
        "sample_directory = $sample_directory" \
        "readme_directory = $readme_directory" \
        "shlib_directory = $shlib_directory" \
+       "plugin_directory = $plugin_directory" \
     || exit 1
 }
 
index 9562b84868ecd57f5ba0de2d9f8fe1f3bc78062a..b087146b0648f04f3313c3a94e0c4452bbb54fcc 100644 (file)
@@ -69,12 +69,21 @@ $shlib_directory/lib${LIB_PREFIX}global${LIB_SUFFIX}:f:root:-:755
 $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
index efe0ee75cc31310bf4c1f2376ccc43603a8af670..790161fecba87ed5a84f8fc819f6643dacc40b3f 100644 (file)
@@ -71,6 +71,13 @@ no) ;;
         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
@@ -249,8 +256,11 @@ check-warn)
        # 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
@@ -263,9 +273,12 @@ check-warn)
                $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: {} \;
index 3f72abb55d8a29cb551ee05fbb747d29d9cffdfe..06bb3628893159ec3214bac0fe0c3014a27b7226 100644 (file)
@@ -229,25 +229,20 @@ $ make
 
 <p> and so on. In some cases, optimization is turned off automatically. </p>
 
-<h3>4.3 - Building with Postfix shared libraries (Postfix &ge; 2.12) </h3>
+<h3>4.3 - Building with Postfix shared libraries and database plugins
+(Postfix &ge; 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>
@@ -257,8 +252,8 @@ $ make
 </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
@@ -272,6 +267,38 @@ $ make makefiles shared=yes SHLIB_VERSION=<i>version</i> ...other arguments...
 </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
@@ -365,6 +392,8 @@ listed below. See the <a href="postconf.5.html">postconf(5)</a> manpage for a de
 
 <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>
index 6944257326a378101bb79488786b333673bb47e7..61c316fed5f1d3a5b2bc2bd90d4618085df7e0ff 100644 (file)
@@ -7090,6 +7090,19 @@ is rejected by the <b><a href="postconf.5.html#reject_plaintext_session">reject_
 <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>
index cdd2ee683c0a98445f0a27fd916f27fc188bba78..87ab7ceb008b49ee17584519ba35e1a64c530490 100644 (file)
@@ -179,6 +179,11 @@ POSTFIX(1)                                                          POSTFIX(1)
 
        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.*).
 
index c1297fae3c82e4461aade376306981bbbc54fc57..b5c0cf96813af9c7b45130af8a012bd0dfa9ddc1 100644 (file)
 # .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.
@@ -679,15 +689,16 @@ daemon_directory_macro=DEF_DAEMON_DIR
 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\"
@@ -733,6 +744,12 @@ _RANLIB=$RANLIB
 
 # 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" ]
@@ -742,31 +759,56 @@ yes)
     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" && {
@@ -792,18 +834,25 @@ EOF
 
 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
 
@@ -823,12 +872,11 @@ export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS
 
 
 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
@@ -837,6 +885,9 @@ AWK = $AWK
 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
@@ -844,4 +895,13 @@ SHLIB_DIR = $shlib_directory
 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
index c3a369623b78073df93316b32d29882188e1fe42..6d7c3c0dadb803060739e6db2804618eafe5151a 100644 (file)
@@ -165,6 +165,9 @@ The directory with Postfix-writable data files (for example:
 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
index 22e3066c7ce4180c69da2c328e6e827a67771183..6a0efd347621926743545372cea71dc17412f3eb 100644 (file)
@@ -4238,6 +4238,13 @@ The numerical Postfix SMTP server response code when a request
 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
index a6072c6992ed3ce8da83881a3975ce92076adfa1..d04fb54c694e0dfa95f98552208b406c2d27c760 100755 (executable)
@@ -390,6 +390,7 @@ while (<>) {
     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;
diff --git a/postfix/plugins/.keep b/postfix/plugins/.keep
new file mode 100644 (file)
index 0000000..e69de29
index 3a2f636232c73aef9e8079640a0fd7ad6e4bc4b6..8dbffc66b576cfbb4191252d6d57643ebd456561 100644 (file)
 #      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.
@@ -370,7 +375,11 @@ README files. Specify \"no\" if you do not want to install these files."
 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.
 
@@ -435,7 +444,8 @@ grep setgid_group $CONFIG_DIRECTORY/main.cf >/dev/null 2>&1 || {
 
 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.
 
@@ -497,7 +507,7 @@ case "$manpage_directory" in
      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
    /*) ;;
@@ -525,7 +535,7 @@ do
 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
@@ -582,12 +592,15 @@ HTML_DIRECTORY=$install_root$html_directory
 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 || 
@@ -680,6 +693,9 @@ do
        '$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;;
@@ -762,6 +778,7 @@ bin/postconf -c $CONFIG_DIRECTORY -e \
     "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
index 7c89a2499276ae9a970f1f160f749ead18fc5b04..08e50c799d0b30da25154cdbba3a8dc0c9bc912d 100644 (file)
@@ -229,25 +229,20 @@ $ make
 
 <p> and so on. In some cases, optimization is turned off automatically. </p>
 
-<h3>4.3 - Building with Postfix shared libraries (Postfix &ge; 2.12) </h3>
+<h3>4.3 - Building with Postfix shared libraries and database plugins
+(Postfix &ge; 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>
@@ -257,8 +252,8 @@ $ make
 </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
@@ -272,6 +267,38 @@ $ make makefiles shared=yes SHLIB_VERSION=<i>version</i> ...other arguments...
 </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
@@ -365,6 +392,8 @@ listed below. See the postconf(5) manpage for a description
 
 <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>
index 023e281450cde5f1d6e594393bc2116892aee292..e7553f837480b72ff3e61627c5fc8f7653c2d69d 100644 (file)
@@ -15905,3 +15905,12 @@ This parameter defaults to "no" when Postfix shared libraries are
 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>
index b35f5795bbcf0265d95b41c799baf9946f0886af..6a4998658c3908955320c7e3de31c339c65bd046 100644 (file)
@@ -37,8 +37,8 @@ OBJS  = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \
        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 \
@@ -50,8 +50,8 @@ OBJS  = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.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 \
@@ -66,7 +66,14 @@ OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.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 \
@@ -112,16 +119,18 @@ TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \
 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 $? >$@
@@ -137,23 +146,44 @@ $(LIB_DIR)/$(LIB): $(LIB)
        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)
@@ -1069,11 +1099,12 @@ dsn_util.o: dsn_util.c
 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
index c2b0eb45a4d5f630c802b0f661d3b7781504e82e..3d9aaa391e6c20990001d3f7aea3f16c2fd3b822 100644 (file)
@@ -66,7 +66,7 @@
 #include <vstring.h>
 #include <vstream.h>
 #include <vstring_vstream.h>
-#include <mvect.h>
+#include <stringops.h>
 
  /*
   * Global library.
@@ -74,7 +74,7 @@
 #include <mkmap.h>
 #include <dynamicmaps.h>
 
-#ifdef USE_DYNAMIC_LIBS
+#ifdef USE_DYNAMIC_MAPS
 
  /*
   * Contents of one dynamicmaps.cf entry.
@@ -89,6 +89,7 @@ static HTABLE *dymap_info;
 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)
 
@@ -254,6 +255,8 @@ void    dymap_init(const char *path)
         */
        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++;
@@ -266,9 +269,11 @@ void    dymap_init(const char *path)
                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);
index 78507a1f8dcaddef0c98cdd2f11f824321343f4d..51259a4e9b7b6151acc2fdf496c8360a5a99c41d 100644 (file)
@@ -58,6 +58,7 @@ typedef struct {
 
 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
@@ -70,6 +71,7 @@ static const DICT_OPEN_INFO dict_open_info[] = {
 #ifdef HAS_SQLITE
     DICT_TYPE_SQLITE, dict_sqlite_open,
 #endif
+#endif                                 /* !USE_DYNAMIC_MAPS */
     DICT_TYPE_MEMCACHE, dict_memcache_open,
     0,
 };
@@ -80,10 +82,10 @@ void    mail_dict_init(void)
 {
     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
index af28425ad3363d8c8ef106d7dbbd2d786248f80e..2cad78a59112b70a5b9f230dd1c6958ff2fba2c7 100644 (file)
@@ -28,6 +28,7 @@
 /*     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;
@@ -223,6 +224,7 @@ char   *var_config_dir;
 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;
@@ -321,6 +323,8 @@ char   *var_dsn_filter;
 
 const char null_format_string[1] = "";
 
+DEFINE_DICT_LMDB_MAP_SIZE;
+
 /* check_myhostname - lookup hostname and validate */
 
 static const char *check_myhostname(void)
@@ -555,6 +559,7 @@ void    mail_params_init()
        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,
@@ -731,9 +736,7 @@ void    mail_params_init()
 #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;
 
     /*
index cd0c8484348fb065b05b2e420f38d9424900f699..c268b6ec8215ad3a2439dcb5ed0109fcb45ce304 100644 (file)
@@ -3793,6 +3793,12 @@ extern char *var_local_dsn_filter;
 #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
index d30f3e762cf42853f32f63315b6ba02e64893636..afe78aed26001d1c5b8f1aeb9022ee2f8b6f0718 100644 (file)
@@ -20,7 +20,7 @@
   * 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
index 18eedfdb153282d912209b71000b76e1b304caa6..63f525fd10b74a8a914ea2a61d683a7a1383f9b3 100644 (file)
@@ -117,21 +117,23 @@ typedef struct {
 } 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,
index e528d9a2dc268bbfeda8aab965a7a1f9977c9486..c8f08a3077592ad4a76e74f6d8f6701af195fac8 100644 (file)
 /*     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
@@ -505,6 +508,7 @@ int     main(int argc, char **argv)
     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 */
index c50a450b4228a9c62fa50647cc07f6fbc35b1796..70225d81bc06b2c50782e87aebc799219839e61a 100644 (file)
@@ -42,9 +42,9 @@ OBJS  = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
        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 \
@@ -76,7 +76,13 @@ OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.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 \
@@ -119,15 +125,17 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
        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 $? >$@
@@ -143,13 +151,31 @@ $(LIB_DIR)/$(LIB): $(LIB)
        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
index 93d4ba02fe9b4764990f9be8589ac1a5c8829372..d2b84c77e1d43b74b63c75e544da09b387b7cc08 100644 (file)
@@ -6,7 +6,9 @@
 /* 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.
@@ -115,8 +121,6 @@ typedef struct {
        ((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 */
index e44fcf6b346247ee1cf85013c8b077a26836f34e..a9cad86107bbe683f4aaf9f05dd9275e65a532ce 100644 (file)
@@ -29,6 +29,9 @@ extern DICT *dict_lmdb_open(const char *, int, int);
 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
index cb9f4b75cb1f7e2206249bc5e9f6a1f09eedc6cf..4408061ab4fab04de11ccacbb2293b284ede15bd 100644 (file)
@@ -312,16 +312,10 @@ typedef struct {
 } 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
@@ -329,9 +323,6 @@ static const DICT_OPEN_INFO dict_open_info[] = {
     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
@@ -341,9 +332,6 @@ static const DICT_OPEN_INFO dict_open_info[] = {
 #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
@@ -352,6 +340,20 @@ static const DICT_OPEN_INFO dict_open_info[] = {
     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,
 };
 
index 55910f7566bb797bf95e89334ecc3d72c79ed6a9..ab320af8b5d25e35acefe2250228153d9f1178c1 100644 (file)
@@ -22,6 +22,8 @@
 #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);