From: Wietse Venema Date: Thu, 22 May 2014 05:00:00 +0000 (-0500) Subject: postfix-2.12-20140522-nonprod X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=28e6885e324ea409cacecc9a3643cdea3c7d9f5e;p=thirdparty%2Fpostfix.git postfix-2.12-20140522-nonprod --- diff --git a/postfix/HISTORY b/postfix/HISTORY index b19965fa8..435a8111d 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -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. diff --git a/postfix/INSTALL b/postfix/INSTALL index 2489b1fed..706ea60a6 100644 --- a/postfix/INSTALL +++ b/postfix/INSTALL @@ -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 | diff --git a/postfix/Makefile.in b/postfix/Makefile.in index e3e029632..27a9cdf73 100644 --- a/postfix/Makefile.in +++ b/postfix/Makefile.in @@ -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* \ diff --git a/postfix/README_FILES/INSTALL b/postfix/README_FILES/INSTALL index 3760e029f..d57ce3bbd 100644 --- a/postfix/README_FILES/INSTALL +++ b/postfix/README_FILES/INSTALL @@ -148,37 +148,57 @@ compiler. Here are a few examples: and so on. In some cases, optimization is turned off automatically. -44..33 -- BBuuiillddiinngg wwiitthh PPoossttffiixx sshhaarreedd lliibbrraarriieess ((PPoossttffiixx >>== 22..1122)) +44..33 -- BBuuiillddiinngg wwiitthh PPoossttffiixx sshhaarreedd lliibbrraarriieess aanndd ddaattaabbaassee pplluuggiinnss ((PPoossttffiixx >>== +22..1122)) -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. + 44..44 -- BBuuiillddiinngg wwiitthh ooppttiioonnaall ffeeaattuurreess 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 | diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index fd9a446c2..93661502a 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -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 ------------------- diff --git a/postfix/WISHLIST b/postfix/WISHLIST index 8908a5e3e..251bf07e3 100644 --- a/postfix/WISHLIST +++ b/postfix/WISHLIST @@ -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. diff --git a/postfix/conf/dynamicmaps.cf b/postfix/conf/dynamicmaps.cf index 7beade0e5..6455b6c68 100644 --- a/postfix/conf/dynamicmaps.cf +++ b/postfix/conf/dynamicmaps.cf @@ -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 diff --git a/postfix/conf/post-install b/postfix/conf/post-install index 942b04485..58ef79634 100644 --- a/postfix/conf/post-install +++ b/postfix/conf/post-install @@ -177,6 +177,9 @@ # 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 } diff --git a/postfix/conf/postfix-files b/postfix/conf/postfix-files index 9562b8486..b087146b0 100644 --- a/postfix/conf/postfix-files +++ b/postfix/conf/postfix-files @@ -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 diff --git a/postfix/conf/postfix-script b/postfix/conf/postfix-script index efe0ee75c..790161fec 100644 --- a/postfix/conf/postfix-script +++ b/postfix/conf/postfix-script @@ -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: {} \; diff --git a/postfix/html/INSTALL.html b/postfix/html/INSTALL.html index 3f72abb55..06bb36288 100644 --- a/postfix/html/INSTALL.html +++ b/postfix/html/INSTALL.html @@ -229,25 +229,20 @@ $ make

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.

@@ -257,8 +252,8 @@ $ make
 
-

Postfix shared libraries are named -libpostfix-xxx.so.version where xxx is a +

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 @@ -272,6 +267,38 @@ $ 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 @@ -365,6 +392,8 @@ listed below. See the postconf(5) manpage for a de newaliases_path /usr/bin/newaliases + plugin_directory /usr/libexec/postfix + queue_directory /var/spool/postfix readme_directory no diff --git a/postfix/html/postconf.5.html b/postfix/html/postconf.5.html index 694425732..61c316fed 100644 --- a/postfix/html/postconf.5.html +++ b/postfix/html/postconf.5.html @@ -7090,6 +7090,19 @@ is rejected by the reject_

This feature is available in Postfix 2.3 and later.

+ + +
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.

+ +

This feature is available in Postfix 2.12 and later.

+ +
postmulti_control_commands diff --git a/postfix/html/postfix.1.html b/postfix/html/postfix.1.html index cdd2ee683..87ab7ceb0 100644 --- a/postfix/html/postfix.1.html +++ b/postfix/html/postfix.1.html @@ -179,6 +179,11 @@ POSTFIX(1) POSTFIX(1) Available in Postfix version 2.12 and later: + plugin_directory (see 'postconf -d' output) + The location of the Postfix dynamicmaps.cf database plugin con- + figuration file, and of database plugins with a relative path- + name. + shlib_directory (see 'postconf -d' output) The location of Postfix shared libraries (libpostfix-*.so.*). diff --git a/postfix/makedefs b/postfix/makedefs index c1297fae3..b5c0cf968 100644 --- a/postfix/makedefs +++ b/postfix/makedefs @@ -69,15 +69,25 @@ # .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 < #include 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' <) { s;\bdefault_desti[-]*\n* *[]*na[-]*\n* *[]*tion_con[-]*\n* *[]*currency_failed_cohort_limit\b;$&;g; s;\bdestination_concurrency_feedback_debug\b;$&;g; s;\bdefault_destina[-]*\n* *[]*tion_rate_delay\b;$&;g; + s;\bplugin_directory\b;$&;g; s;\bqmqpd_client_port_logging\b;$&;g; s;\bqmqpd_error_delay\b;$&;g; diff --git a/postfix/plugins/.keep b/postfix/plugins/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/postfix/postfix-install b/postfix/postfix-install index 3a2f63623..8dbffc66b 100644 --- a/postfix/postfix-install +++ b/postfix/postfix-install @@ -144,6 +144,11 @@ # 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 diff --git a/postfix/proto/INSTALL.html b/postfix/proto/INSTALL.html index 7c89a2499..08e50c799 100644 --- a/postfix/proto/INSTALL.html +++ b/postfix/proto/INSTALL.html @@ -229,25 +229,20 @@ $ make

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.

@@ -257,8 +252,8 @@ $ make
 
-

Postfix shared libraries are named -libpostfix-xxx.so.version where xxx is a +

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 @@ -272,6 +267,38 @@ $ 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 @@ -365,6 +392,8 @@ listed below. See the postconf(5) manpage for a description newaliases_path /usr/bin/newaliases + plugin_directory /usr/libexec/postfix + queue_directory /var/spool/postfix readme_directory no diff --git a/postfix/proto/postconf.proto b/postfix/proto/postconf.proto index 023e28145..e7553f837 100644 --- a/postfix/proto/postconf.proto +++ b/postfix/proto/postconf.proto @@ -15905,3 +15905,12 @@ This parameter defaults to "no" when Postfix shared libraries are disabled at compile time.

This feature is available in Postfix 2.12 and later.

+ +%PARAM plugin_directory 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.

+ +

This feature is available in Postfix 2.12 and later.

diff --git a/postfix/src/global/Makefile.in b/postfix/src/global/Makefile.in index b35f5795b..6a4998658 100644 --- a/postfix/src/global/Makefile.in +++ b/postfix/src/global/Makefile.in @@ -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 diff --git a/postfix/src/global/dynamicmaps.c b/postfix/src/global/dynamicmaps.c index c2b0eb45a..3d9aaa391 100644 --- a/postfix/src/global/dynamicmaps.c +++ b/postfix/src/global/dynamicmaps.c @@ -66,7 +66,7 @@ #include #include #include -#include +#include /* * Global library. @@ -74,7 +74,7 @@ #include #include -#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); diff --git a/postfix/src/global/mail_dict.c b/postfix/src/global/mail_dict.c index 78507a1f8..51259a4e9 100644 --- a/postfix/src/global/mail_dict.c +++ b/postfix/src/global/mail_dict.c @@ -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 diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index af28425ad..2cad78a59 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -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; /* diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index cd0c84843..c268b6ec8 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -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 diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index d30f3e762..afe78aed2 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -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 diff --git a/postfix/src/global/mkmap_open.c b/postfix/src/global/mkmap_open.c index 18eedfdb1..63f525fd1 100644 --- a/postfix/src/global/mkmap_open.c +++ b/postfix/src/global/mkmap_open.c @@ -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, diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index e528d9a2d..c8f08a307 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -155,6 +155,9 @@ /* 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 */ diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in index c50a450b4..70225d81b 100644 --- a/postfix/src/util/Makefile.in +++ b/postfix/src/util/Makefile.in @@ -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 diff --git a/postfix/src/util/dict_lmdb.c b/postfix/src/util/dict_lmdb.c index 93d4ba02f..d2b84c77e 100644 --- a/postfix/src/util/dict_lmdb.c +++ b/postfix/src/util/dict_lmdb.c @@ -6,7 +6,9 @@ /* SYNOPSIS /* #include /* -/* 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; @@ -21,6 +23,10 @@ /* 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 */ diff --git a/postfix/src/util/dict_lmdb.h b/postfix/src/util/dict_lmdb.h index e44fcf6b3..a9cad8610 100644 --- a/postfix/src/util/dict_lmdb.h +++ b/postfix/src/util/dict_lmdb.h @@ -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 diff --git a/postfix/src/util/dict_open.c b/postfix/src/util/dict_open.c index cb9f4b75c..4408061ab 100644 --- a/postfix/src/util/dict_open.c +++ b/postfix/src/util/dict_open.c @@ -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, }; diff --git a/postfix/src/util/dict_test.c b/postfix/src/util/dict_test.c index 55910f756..ab320af8b 100644 --- a/postfix/src/util/dict_test.c +++ b/postfix/src/util/dict_test.c @@ -22,6 +22,8 @@ #include #include +DEFINE_DICT_LMDB_MAP_SIZE; + static NORETURN usage(char *myname) { msg_fatal("usage: %s type:file read|write|create [flags...]", myname);