]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-2.12-20140530
authorWietse Venema <wietse@porcupine.org>
Fri, 30 May 2014 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Fri, 30 May 2014 14:38:41 +0000 (10:38 -0400)
117 files changed:
postfix/.indent.pro
postfix/HISTORY
postfix/INSTALL [changed from symlink to file mode: 0644]
postfix/Makefile.in
postfix/README_FILES/CDB_README
postfix/README_FILES/INSTALL
postfix/README_FILES/LDAP_README
postfix/README_FILES/LMDB_README
postfix/README_FILES/MYSQL_README
postfix/README_FILES/PCRE_README
postfix/README_FILES/PGSQL_README
postfix/README_FILES/SQLITE_README
postfix/RELEASE_NOTES
postfix/conf/dynamicmaps.cf [new file with mode: 0644]
postfix/conf/post-install
postfix/conf/postfix-files
postfix/conf/postfix-script
postfix/html/CDB_README.html
postfix/html/INSTALL.html
postfix/html/LDAP_README.html
postfix/html/LMDB_README.html
postfix/html/MYSQL_README.html
postfix/html/PCRE_README.html
postfix/html/PGSQL_README.html
postfix/html/SQLITE_README.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/CDB_README.html
postfix/proto/INSTALL.html
postfix/proto/LDAP_README.html
postfix/proto/LMDB_README.html
postfix/proto/MYSQL_README.html
postfix/proto/Makefile.in
postfix/proto/PCRE_README.html
postfix/proto/PGSQL_README.html
postfix/proto/SQLITE_README.html
postfix/proto/postconf.proto
postfix/proto/stop
postfix/src/anvil/Makefile.in
postfix/src/bounce/Makefile.in
postfix/src/cleanup/Makefile.in
postfix/src/cleanup/cleanup_masquerade.c
postfix/src/discard/Makefile.in
postfix/src/dns/Makefile.in
postfix/src/dnsblog/Makefile.in
postfix/src/error/Makefile.in
postfix/src/flush/Makefile.in
postfix/src/fsstone/Makefile.in
postfix/src/global/Makefile.in
postfix/src/global/dynamicmaps.c [new file with mode: 0644]
postfix/src/global/dynamicmaps.h [new file with mode: 0644]
postfix/src/global/mail_conf.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.h
postfix/src/global/mkmap_open.c
postfix/src/local/Makefile.in
postfix/src/master/Makefile.in
postfix/src/master/event_server.c
postfix/src/master/multi_server.c
postfix/src/master/single_server.c
postfix/src/master/trigger_server.c
postfix/src/milter/Makefile.in
postfix/src/oqmgr/Makefile.in
postfix/src/pickup/Makefile.in
postfix/src/pipe/Makefile.in
postfix/src/postalias/Makefile.in
postfix/src/postcat/Makefile.in
postfix/src/postconf/Makefile.in
postfix/src/postconf/postconf.c
postfix/src/postdrop/Makefile.in
postfix/src/postdrop/postdrop.c
postfix/src/postfix/Makefile.in
postfix/src/postfix/postfix.c
postfix/src/postkick/Makefile.in
postfix/src/postlock/Makefile.in
postfix/src/postlog/Makefile.in
postfix/src/postmap/Makefile.in
postfix/src/postmulti/Makefile.in
postfix/src/postqueue/Makefile.in
postfix/src/postscreen/Makefile.in
postfix/src/postsuper/Makefile.in
postfix/src/posttls-finger/Makefile.in
postfix/src/proxymap/Makefile.in
postfix/src/qmgr/Makefile.in
postfix/src/qmqpd/Makefile.in
postfix/src/scache/Makefile.in
postfix/src/sendmail/Makefile.in
postfix/src/showq/Makefile.in
postfix/src/smtp/Makefile.in
postfix/src/smtpd/Makefile.in
postfix/src/smtpstone/Makefile.in
postfix/src/spawn/Makefile.in
postfix/src/tls/Makefile.in
postfix/src/tlsmgr/Makefile.in
postfix/src/tlsproxy/Makefile.in
postfix/src/trivial-rewrite/Makefile.in
postfix/src/util/Makefile.in
postfix/src/util/dict.h
postfix/src/util/dict_lmdb.c
postfix/src/util/dict_lmdb.h
postfix/src/util/dict_open.c
postfix/src/util/dict_test.c
postfix/src/util/load_lib.c [new file with mode: 0644]
postfix/src/util/load_lib.h [new file with mode: 0644]
postfix/src/util/sys_defs.h
postfix/src/verify/Makefile.in
postfix/src/virtual/Makefile.in
postfix/src/xsasl/Makefile.in

index 6c5e7904b00da0bb97a0008e58c2e9f851a04f4a..901ccc0fd9b39f647d03b1514b857f8f98635456 100644 (file)
@@ -85,6 +85,8 @@
 -TDICT_NIS
 -TDICT_NISPLUS
 -TDICT_NODE
+-TDICT_OPEN_EXTEND_FN
+-TDICT_OPEN_FN
 -TDICT_OPEN_INFO
 -TDICT_OWNER
 -TDICT_PCRE
 -TDSN_FILTER
 -TDSN_SPLIT
 -TDSN_STAT
+-TDYMAP_INFO
 -TEC_GROUP
 -TEC_KEY
 -TEDIT_FILE
 -TLDAP
 -TLDAPMessage
 -TLDAP_CONN
+-TLIB_DP
+-TLIB_FN
 -TLMTP_ATTR
 -TLMTP_RESP
 -TLMTP_SESSION
 -TMKMAP
 -TMKMAP_DB
 -TMKMAP_DBM
+-TMKMAP_OPEN_EXTEND_FN
+-TMKMAP_OPEN_FN
 -TMKMAP_OPEN_INFO
 -TMKMAP_SDBM
 -TMSG_STATS
index fd79660d9f054254966517aaee23b24ec3814c1f..b06b38a50bd6c5148bb7b95a21fe8286f2969196 100644 (file)
@@ -19659,6 +19659,11 @@ Apologies for any names omitted.
        smtp/lmtp_params.c, smtp/smtp_params.c, virtual/virtual.c,
        global/bounce.c.
 
+20140323
+
+       Feature: initial merge of Debian-style dynamic linking.
+       Viktor Dukhovni. 
+
 20140406
 
        Bugfix: when testing session caching, stop reconnecting
@@ -19720,22 +19725,137 @@ Apologies for any names omitted.
        smtp_proto.c, smtp_trouble.c.
 
        Cleanup: enable SMTP connection cache lookup by destination
-       while a surge of mail is drying up. File: smtp_connect.c.
+       name while a surge of mail dries up. File: smtp_connect.c.
+
+20140505
+
+       Bugfix: the postdrop authorized_submit_users feature requires
+       that lookup table support is initialized so that it can use
+       libglobal or dynamicmaps maps.  File: postdrop/postdrop.c.
+
+       Cleanup: moved dynamicmaps initialization from parameter
+       inititialization (mail_conf_suck()) to dictionary initialization
+       (mail_dict_init()).  A benefit of this is that dynamicmaps.cf
+       is no longer read by programs that don't use Postfix lookup
+       tables.  Files: global/mail_conf.[hc], global/mail_dict.c.
+
+       Cleanup: move the mail_dict_init() call after the
+       mail_conf_read() or mail_params_init() call, to prepare for
+       a configurable dynamicmaps.cf directory.   Files:
+       master/event_server.c, master/multi_server.c,
+       master/single_server.c, master/trigger_server.c.
+
+20140506
+
+       Cleanup: you can now specify "make makefiles parameter=value"
+       for selected compile-time parameter default overrides.  The
+       old "make makefiles 'CCARGS=-DDEF_MUMBLE=\"mumble\"'"
+       approach remains supported.  File: makedefs.
+
+20140508
+
+       Cleanup: dynamicmaps.cf is now installed into $daemon_directory
+       because the file is shared among Postfix instances just like
+       postfix-files and other files.  Files: conf/dynamicmaps.cf,
+       Makefile.in, conf/postfix-files.
+
+       Cleanup: INSTALL is now plain ASCII instead of README format,
+       to avoid a chicken-and-egg problem (the instructions to
+       print/view README-format files are in the INSTALL file).
+
+       Documentation: updated INSTALL instructions and RELEASE_NOTES.
 
 20140512
 
        Portability: Berkeley DB6 support. File: util/dict_db.c.
 
+20140514
+
+       Cleanup: replace #ifdef/endif containing hard-coded calls
+       of dynamicmaps functions with an extension mechanism that
+       dynamicmaps functions invoke instead. Files: util/dict.h,
+       util/dict_open.c, global/dynamicmaps.[hc], global/mkmap.h,
+       global/mkmap_open.c.
+
 20140515
 
        Bugfix (introduced: 20140320): missing initialization.
        Viktor Dukhovni. File pipe/pipe.c.
 
-20140516
+       Cleanup: mkmap_open() now caches a dynamically-loaded
+       function. This is useful because postmap/postalias may open
+       the same database type multiple times. Files: global/mkmap.h,
+       global/mkmap_open.c.
+
+       Security: the dynamicmaps.cf file and its and shared-object
+       files must not be writable by non-root users. File:
+       global/dynamicmaps.c.
+
+20140517
+
+       Cleanup: dynamic linking and hooking. Files: util/dict.h,
+       util/load_lib.[hc], global/dynamicmaps.c.
+
+20140518
+
+       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:
+       postfix.c, 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.
+
+20140523
+
+       Cleanup: don't install plugins for unsupported databases,
+       and don't make dynamicmaps.cf entries for them. Files:
+       makedefs, Makefile.in, util/Makefile.in, global/Makefile.in.
+
+       Cleanup: added support for symlinks where the "source" is
+       specified as a relative pathname. File: postfix-install.
+
+       Cleanup: moved instructions from RELEASE_NOTES to INSTALL
+       to avoid duplication. Files: RELEASE_NOTES, proto/INSTALL.html.
+
+       Cleanup: include <dict_lmdb.h> unconditionally so that
+       dict_lmdb_map_size is always defined. Files: mail_params.c,
+       dict_test.c.
 
-       Cleanup: Berkeley DB6 support. File: util/dict_db.c.
+       Cleanup: port for ancient Solaris9 revealed some non-portability.
+       Files: master/Makefile.in, makedefs, sys_defs.h.
 
 20140524
 
-       Cleanup: symlink handling in post-install, back-ported
-       from the non-production release. File: post-install.
+       Cleanup: specify database library dependencies with variables
+       named AUXLIBS_CDB, AUXLIBS_LDAP, etc. The global AUXLIBS
+       variable is still supported, but the new variables are
+       required when building dynamically-loadable building database
+       plugins.  Files: RELEASE_NOTES, INSTALL.html, CDB_README.html,
+       LDAP_README.html, LMDB_README.html, MYSQL_README.html,
+       PCRE_README.html, PGSQL_README.html, SQLITE_README.html,
+       makedefs, util/Makefile.in, global/Makefile.in.
+
+       Workaround: reportedly, MacOS can fail to move a symlink
+       with a relative target across file system boundaries, because
+       it examines the symlink with stat() instead of lstat().
+       Files: makedefs, Makefile.in.
+
+       Cleanup: use readlink to verify symlink target. File:
+       postfix-install.
+
+20140528
+
+       Cleanup: the configuration file dynamicmaps.cf will now
+       automatically include files under the directory dynamicmaps.cf.d,
+       just like the configuration file postfix-files will
+       automatically include files under the directory postfix-files.d.
+       See INSTALL section "Building with Postfix shared libraries
+       and database plugins".  File: dynamicmaps.c.
deleted file mode 120000 (symlink)
index 362cf2a5777692af72b58af52de5600787f6e918..0000000000000000000000000000000000000000
+++ /dev/null
@@ -1 +0,0 @@
-README_FILES/INSTALL
\ No newline at end of file
new file mode 100644 (file)
index 0000000000000000000000000000000000000000..951721231ee5f0d52c73e97ca3cc9dfb784ec062
--- /dev/null
+Postfix Installation From Source Code
+
+-------------------------------------------------------------------------------
+
+1 - Purpose of this document
+
+If you are using a pre-compiled version of Postfix, you should start with
+BASIC_CONFIGURATION_README and the general documentation referenced by it.
+INSTALL is only a bootstrap document to get Postfix up and running from scratch
+with the minimal number of steps; it should not be considered part of the
+general documentation.
+
+This document describes how to build, install and configure a Postfix system so
+that it can do one of the following:
+
+  * Send mail only, without changing an existing Sendmail installation.
+  * Send and receive mail via a virtual host interface, still without any
+    change to an existing Sendmail installation.
+  * Run Postfix instead of Sendmail.
+
+Topics covered in this document:
+
+ 1. Purpose of this document
+ 2. Typographical conventions
+ 3. Documentation
+ 4. Building on a supported system
+ 5. Porting Postfix to an unsupported system
+ 6. Installing the software after successful compilation
+ 7. Configuring Postfix to send mail only
+ 8. Configuring Postfix to send and receive mail via virtual interface
+ 9. Running Postfix instead of Sendmail
+10. Mandatory configuration file edits
+11. To chroot or not to chroot
+12. Care and feeding of the Postfix system
+
+2 - Typographical conventions
+
+In the instructions below, a command written as
+
+    # command
+
+should be executed as the superuser.
+
+A command written as
+
+    $ command
+
+should be executed as an unprivileged user.
+
+3 - Documentation
+
+Documentation is available as README files (start with the file README_FILES/
+AAAREADME), as HTML web pages (point your browser to "html/index.html") and as
+UNIX-style manual pages.
+
+You should view the README files with a pager such as more(1) or less(1),
+because the files use backspace characters in order to produce bold font. To
+print a README file without backspace characters, use the col(1) command. For
+example:
+
+    $ col -bx <file | lpr
+
+In order to view the manual pages before installing Postfix, point your MANPATH
+environment variable to the "man" subdirectory; be sure to use an absolute
+path.
+
+    $ export MANPATH; MANPATH="`pwd`/man:$MANPATH"
+    $ setenv MANPATH "`pwd`/man:$MANPATH"
+
+Of particular interest is the postconf(5) manual page that lists all the 500+
+configuration parameters. The HTML version of this text makes it easy to
+navigate around.
+
+All Postfix source files have their own built-in manual page. Tools to extract
+those embedded manual pages are available in the mantools directory.
+
+4 - Building on a supported system
+
+At some point in time, a version of Postfix was supported on:
+
+    AIX 3.2.5, 4.1.x, 4.2.0, 4.3.x, 5.2
+    BSD/OS 2.x, 3.x, 4.x
+    FreeBSD 2.x .. 9.x
+    HP-UX 9.x, 10.x, 11.x
+    IRIX 5.x, 6.x
+    Linux Debian 1.3.1 and later
+    Linux RedHat 3.x (January 2004) and later
+    Linux Slackware 3.x and later
+    Linux SuSE 5.x and later
+    Linux Ubuntu 4.10 and later
+    Mac OS X
+    NEXTSTEP 3.x
+    NetBSD 1.x and later
+    OPENSTEP 4.x
+    OSF1.V3 - OSF1.V5 (Digital UNIX)
+    Reliant UNIX 5.x
+    SunOS 4.1.4 (March 2007)
+    SunOS 5.4 - 5.10 (Solaris 2.4..10)
+    Ultrix 4.x (well, that was long ago)
+
+or something closely resemblant.
+
+4.1 - Getting started
+
+On Solaris, the "make" command and other utilities for software development are
+in /usr/ccs/bin, so you MUST have /usr/ccs/bin in your command search path. If
+these files do not exist, install the development packages first. See the
+Solaris FAQ item "Which packages do I need to install to support a C
+compiler?".
+
+If you need to build Postfix for multiple architectures, use the "lndir"
+command to build a shadow tree with symbolic links to the source files. "lndir"
+is part of X11R6.
+
+If at any time in the build process you get messages like: "make: don't know
+how to ..." you should be able to recover by running the following command from
+the Postfix top-level directory:
+
+    $ make -f Makefile.init makefiles
+
+If you copied the Postfix source code after building it on another machine, it
+is a good idea to cd into the top-level directory and first do this:
+
+    $ make tidy
+
+This will get rid of any system dependencies left over from compiling the
+software elsewhere.
+
+4.2 - What compiler to use
+
+To build with GCC, or with the native compiler if people told me that is better
+for your system, just cd into the top-level Postfix directory of the source
+tree and type:
+
+    $ make
+
+To build with a non-default compiler, you need to specify the name of the
+compiler. Here are a few examples:
+
+    $ make makefiles CC=/opt/SUNWspro/bin/cc       (Solaris)
+    $ make
+
+    $ make makefiles CC="/opt/ansic/bin/cc -Ae"     (HP-UX)
+    $ make
+
+    $ make makefiles CC="purify cc"
+    $ make
+
+and so on. In some cases, optimization is turned off automatically.
+
+4.3 - Building with Postfix shared libraries and database plugins (Postfix >=
+2.12)
+
+Postfix shared-library and database plugin support exists for recent versions
+of Linux, FreeBSD and MacOS X. Shared-library builds may become the default at
+some point in the future.
+
+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.
+
+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
+
+This defaults to installing shared libraries in /usr/local/lib, typically with
+names like libpostfix-name.so.version, where the name is a source-code
+directory name such as "util" or "global", and the version is the Postfix
+version: x.y.z for stable releases, x.y-date for snapshot (development)
+releases, or x.y-date-nonprod for non-production releases.
+
+To override the default location or shared-library version, specify, for
+example:
+
+    $ make makefiles shared=yes shlib_directory=/usr/lib \
+       SHLIB_VERSION=1 ...other arguments...
+
+You can change the shlib_directory setting after Postfix is built, with "make
+install" or "make upgrade". However, you may have to run ldconfig if you change
+shlib_directory after Postfix is built and install the libpostfix-*.so.* files
+in a non-system directory. No ldconfig is needed if you keep the libpostfix-
+*.so.* files in the compiled-in default $shlib_directory location.
+
+Additionally, Postfix can be built to support dynamic loading of Postfix
+database clients with the Debian-style dynamicmaps feature. Postfix 2.12
+supports dynamic loading of cdb:, ldap:, lmdb:, mysql:, pcre:, pgsql:, sdbm:,
+and sqlite: database clients. Dynamic loading is useful when you distribute or
+install pre-compiled Postfix packages.
+
+Specify "dynamicmaps=yes" on the "make makefiles" command line to build Postfix
+with support to dynamically load Postfix database clients (database plugins)
+with the Debian-style dynamicmaps feature.
+
+    $ make makefiles dynamicmaps=yes ...other arguments...
+    $ make makefiles dynamicmaps=no ...other arguments...
+    $ make
+
+This implicitly enables shared-library support, and defaults to installing
+dynamicmaps.cf and database plugins in /usr/libexec/postfix. Database plugins
+are typically named postfix-type.so.version where the type is a database type
+such as "cdb" or "ldap", and where the version is the same as for Postfix
+shared libraries. The installed dynamicmaps.cf configuration file is given a
+suffix with the same version.
+
+    NOTE: The Postfix 2.12 build procedure expects that you specify database
+    library dependencies with variables named AUXLIBS_CDB, AUXLIBS_LDAP, etc.
+    With Postfix 2.12 and later, the old AUXLIBS variable still supports
+    building a statically-loaded database client, but only the new AUXLIBS_CDB
+    etc. variables support building a dynamically-loaded or statically-loaded
+    CDB etc. database client. See CDB_README, LDAP_README, etc. for details.
+
+    Failure to follow this advice will defeat the purpose of dynamic database
+    client loading. Every Postfix executable file will have database library
+    dependencies. And that was exactly what dynamic database client loading was
+    meant to avoid.
+
+To override the default location or shared-library version, specify, for
+example:
+
+    % make makefiles dynamicmaps=yes plugin_directory=/usr/lib/postfix \
+       SHLIB_VERSION=1  ...
+
+You can also override the plugin_directory setting after Postfix is built, with
+"make install" or "make upgrade". In this case, there is no need to run the
+ldconfig command.
+
+Tips for distribution maintainers:
+
+  * The postfix-install procedure creates a compatibility symlink
+    dynamicmaps.cf -> dynamicmaps.cf.version (as well as a symlink
+    dynamicmaps.cf.d -> dynamicmaps.cf.version.d; more on that below). It is
+    therefore safe to use "unversioned" configuration file names when
+    installing or deinstalling a database plugin. However, Postfix itself will
+    use the "versioned" names, to allow minor upgrades to happen without having
+    to stop Postfix.
+
+  * The configuration file dynamicmaps.cf.version will automatically include
+    files under the directory dynamicmaps.cf.d.version, just like the
+    configuration file postfix-files will automatically include files under the
+    directory postfix-files.d. Thanks to this, you don't have to edit postfix-
+    files or dynamicmaps.cf, when installing or deinstalling a database plugin
+    package. Instead, each plugin can have its own configuration file.
+
+  * The plugin_directory setting provides the default directory for shared-
+    library objects with a relative pathname in the file
+    dynamicmaps.cf.version.
+
+  * Each configuration file under the directory dynamicmaps.cf.d.version must
+    have a name that ends in ".cf" and must have the same format as the file
+    dynamicmaps.cf.version.
+
+  * The directory dynamicmaps.cf.d.version is the default directory for shared-
+    library objects with a relative pathname in the files
+    dynamicmaps.cf.d.version/*.cf. Thus, the directory dynamicmaps.cf.d.version
+    may contain both configuration files and shared-library object files.
+    Hence, the requirement that configuration file names must end in ".cf".
+
+  * Each configuration file under the directory postfix-files.d must have the
+    same format as the configuration file postfix-files. There is no
+    requirement that these configuration file names have a specific format.
+
+4.4 - Building with optional features
+
+By default, Postfix builds as a mail system with relatively few bells and
+whistles. Support for third-party databases etc. must be configured when
+Postfix is compiled. The following documents describe how to build Postfix with
+support for optional features:
+
+     _____________________________________________________________
+    |Optional feature                 |Document     |Availability|
+    |__________________________________|_____________|____________|
+    |Berkeley DB database             |DB_README    |Postfix 1.0 |
+    |__________________________________|_____________|____________|
+    |LMDB database                    |LMDB_README  |Postfix 2.11|
+    |__________________________________|_____________|____________|
+    |LDAP database                    |LDAP_README  |Postfix 1.0 |
+    |__________________________________|_____________|____________|
+    |MySQL database                   |MYSQL_README |Postfix 1.0 |
+    |__________________________________|_____________|____________|
+    |Perl compatible regular expression|PCRE_README  |Postfix 1.0 |
+    |__________________________________|_____________|____________|
+    |PostgreSQL database              |PGSQL_README |Postfix 2.0 |
+    |__________________________________|_____________|____________|
+    |SASL authentication              |SASL_README  |Postfix 1.0 |
+    |__________________________________|_____________|____________|
+    |SQLite database                  |SQLITE_README|Postfix 2.8 |
+    |__________________________________|_____________|____________|
+    |STARTTLS session encryption       |TLS_README   |Postfix 2.2 |
+    |__________________________________|_____________|____________|
+
+Note: IP version 6 support is compiled into Postfix on operating systems that
+have IPv6 support. See the IPV6_README file for details.
+
+4.5 - Overriding built-in parameter default settings
+
+4.5.1 - Postfix 2.12 and later
+
+All Postfix configuration parameters can be changed by editing a Postfix
+configuration file, except for one: the parameter that specifies the location
+of Postfix configuration files. In order to build Postfix with a configuration
+directory other than /etc/postfix, use:
+
+    $ make makefiles config_directory=/some/where ...other arguments...
+    $ make
+
+Parameters whose defaults can be specified in this way are listed below. See
+the postconf(5) manpage for a description (command: "nroff -man man/man5/
+postconf.5 | less").
+
+     __________________________________________
+    |parameter name      |typical default     |
+    |_____________________|____________________|
+    |command_directory   |/usr/sbin           |
+    |_____________________|____________________|
+    |config_directory    |/etc/postfix        |
+    |_____________________|____________________|
+    |default_database_type|hash               |
+    |_____________________|____________________|
+    |daemon_directory    |/usr/libexec/postfix|
+    |_____________________|____________________|
+    |data_directory      |/var/lib/postfix    |
+    |_____________________|____________________|
+    |html_directory      |no                  |
+    |_____________________|____________________|
+    |mailq_path          |/usr/bin/mailq      |
+    |_____________________|____________________|
+    |manpage_directory   |/usr/local/man      |
+    |_____________________|____________________|
+    |newaliases_path     |/usr/bin/newaliases |
+    |_____________________|____________________|
+    |plugin_directory    |/usr/libexec/postfix|
+    |_____________________|____________________|
+    |queue_directory     |/var/spool/postfix  |
+    |_____________________|____________________|
+    |readme_directory    |no                  |
+    |_____________________|____________________|
+    |sendmail_path       |/usr/sbin/sendmail  |
+    |_____________________|____________________|
+    |shlib_directory     |/usr/local/lib      |
+    |_____________________|____________________|
+
+4.5.2 - All Postfix versions
+
+All Postfix configuration parameters can be changed by editing a Postfix
+configuration file, except for one: the parameter that specifies the location
+of Postfix configuration files. In order to build Postfix with a configuration
+directory other than /etc/postfix, use:
+
+    $ make makefiles CCARGS='-DDEF_CONFIG_DIR=\"/some/where\"'
+    $ make
+
+IMPORTANT: Be sure to get the quotes right. These details matter a lot.
+
+Parameters whose defaults can be specified in this way are listed below. See
+the postconf(5) manpage for a description (command: "nroff -man man/man5/
+postconf.5 | less").
+
+     ____________________________________________________________
+    |Macro name       |default value for    |typical default    |
+    |_________________|_____________________|____________________|
+    |DEF_COMMAND_DIR  |command_directory    |/usr/sbin          |
+    |_________________|_____________________|____________________|
+    |DEF_CONFIG_DIR   |config_directory     |/etc/postfix       |
+    |_________________|_____________________|____________________|
+    |DEF_DB_TYPE      |default_database_type|hash               |
+    |_________________|_____________________|____________________|
+    |DEF_DAEMON_DIR   |daemon_directory     |/usr/libexec/postfix|
+    |_________________|_____________________|____________________|
+    |DEF_DATA_DIR     |data_directory      |/var/lib/postfix    |
+    |_________________|_____________________|____________________|
+    |DEF_MAILQ_PATH   |mailq_path          |/usr/bin/mailq      |
+    |_________________|_____________________|____________________|
+    |DEF_HTML_DIR     |html_directory      |no                  |
+    |_________________|_____________________|____________________|
+    |DEF_MANPAGE_DIR  |manpage_directory    |/usr/local/man     |
+    |_________________|_____________________|____________________|
+    |DEF_NEWALIAS_PATH|newaliases_path     |/usr/bin/newaliases |
+    |_________________|_____________________|____________________|
+    |DEF_QUEUE_DIR    |queue_directory     |/var/spool/postfix  |
+    |_________________|_____________________|____________________|
+    |DEF_README_DIR   |readme_directory     |no                 |
+    |_________________|_____________________|____________________|
+    |DEF_SENDMAIL_PATH|sendmail_path       |/usr/sbin/sendmail  |
+    |_________________|_____________________|____________________|
+
+Note: the data_directory parameter (for caches and pseudo-random numbers) was
+introduced with Postfix version 2.5.
+
+4.6 - Overriding other compile-time features
+
+The general method to override Postfix compile-time features is as follows:
+
+    $ make makefiles name=value name=value...
+    $ make
+
+The following is an extensive list of names and values.
+
+ _____________________________________________________________________________
+|Name/Value                   |Description                                   |
+|______________________________|______________________________________________|
+|                             |Specifies one or more non-default object      |
+|                             |libraries. Postfix 2,12 and later specify some|
+|                             |of their database library dependencies with   |
+|AUXLIBS="object_library..."   |AUXLIBS_CDB, AUXLIBS_LDAP, AUXLIBS_LMDB,      |
+|                             |AUXLIBS_MYSQL, AUXLIBS_PCRE, AUXLIBS_PGSQL,   |
+|                             |AUXLIBS_SDBM, and AUXLIBS_SQLITE,             |
+|                             |respectively.                                 |
+|______________________________|______________________________________________|
+|CC=compiler_command          |Specifies a non-default compiler. On many     |
+|                             |systems, the default is gcc.                  |
+|______________________________|______________________________________________|
+|                             |Specifies non-default compiler arguments, for |
+|CCARGS="compiler_arguments..."|example, a non-default include directory. The |
+|                             |following directives turn off Postfix features|
+|                             |at compile time:                              |
+|______________________________|______________________________________________|
+||                            |Do not build with Berkeley DB support. By     |
+||                            |default, Berkeley DB support is compiled in on|
+||-DNO_DB                     |platforms that are known to support this      |
+||                            |feature. If you override this, then you       |
+||                            |probably should also override DEF_DB_TYPE as  |
+||                            |described in section 4.5.                     |
+||_____________________________|______________________________________________|
+||                            |Do not build with Solaris /dev/poll support.  |
+||-DNO_DEVPOLL                |By default, /dev/poll support is compiled in  |
+||                            |on Solaris versions that are known to support |
+||                            |this feature.                                 |
+||_____________________________|______________________________________________|
+||                            |Do not build with Linux EPOLL support. By     |
+||-DNO_EPOLL                  |default, EPOLL support is compiled in on      |
+||                            |platforms that are known to support this      |
+||                            |feature.                                      |
+||_____________________________|______________________________________________|
+||                            |Do not build with IPv6 support. By default,   |
+||                            |IPv6 support is compiled in on platforms that |
+||-DNO_IPV6                   |are known to have IPv6 support. Note: this    |
+||                            |directive is for debugging and testing only.  |
+||                            |It is not guaranteed to work on all platforms.|
+||_____________________________|______________________________________________|
+||                            |Do not build with FreeBSD / NetBSD / OpenBSD /|
+||-DNO_KQUEUE                 |MacOSX KQUEUE support. By default, KQUEUE     |
+||                            |support is compiled in on platforms that are  |
+||                            |known to support it.                          |
+||_____________________________|______________________________________________|
+||                            |Do not build with NIS or NISPLUS support. NIS |
+||-DNO_NIS                    |is not available on some recent Linux         |
+||                            |distributions.                                |
+||_____________________________|______________________________________________|
+||                            |Do not build with NISPLUS support. NISPLUS is |
+||-DNO_NISPLUS                |not available on some recent Solaris          |
+||                            |distributions.                                |
+||_____________________________|______________________________________________|
+||                            |Do not build with PCRE support. By default,   |
+||-DNO_PCRE                   |PCRE support is compiled in when the pcre-    |
+||                            |config utility is installed.                  |
+||_____________________________|______________________________________________|
+||                            |Disable support for POSIX getpwnam_r/         |
+||-DNO_POSIX_GETPW_R          |getpwuid_r. By default Postfix uses these     |
+||                            |where they are known to be available.         |
+||_____________________________|______________________________________________|
+||                            |Use setjmp()/longjmp() instead of sigsetjmp()/|
+||-DNO_SIGSETJMP              |siglongjmp(). By default, Postfix uses        |
+||                            |sigsetjmp()/siglongjmp() when they are known  |
+||                            |to be available.                              |
+||_____________________________|______________________________________________|
+|                             |Specifies a non-default compiler debugging    |
+|DEBUG=debug_level            |level. The default is -g. Specify DEBUG= to   |
+|                             |turn off debugging.                           |
+|______________________________|______________________________________________|
+|                             |Specifies a non-default optimization level.   |
+|OPT=optimization_level        |The default is -O. Specify OPT= to turn off   |
+|                             |optimization.                                 |
+|______________________________|______________________________________________|
+|                             |Specifies a non-default Postfix shared-library|
+|                             |version number. The default is to use the     |
+|SHLIB_VERSION=version        |Postfix version: X.Y.Z for stable releases,   |
+|                             |X.Y-DATE for snapshot releases, X.Y-DATE-     |
+|                             |nonprod for non-production releases.          |
+|______________________________|______________________________________________|
+|                             |Specifies non-default gcc compiler warning    |
+|WARN="warning_flags..."       |options for use when "make" is invoked in a   |
+|                             |source subdirectory only.                     |
+|______________________________|______________________________________________|
+
+4.7 - Support for thousands of processes
+
+The number of connections that Postfix can manage simultaneously is limited by
+the number of processes that it can run. This number in turn is limited by the
+number of files and sockets that a single process can open. For example, the
+Postfix queue manager has a separate connection to each delivery process, and
+the anvil(8) server has one connection per smtpd(8) process.
+
+Postfix version 2.4 and later have no built-in limits on the number of open
+files or sockets, when compiled on systems that support one of the following:
+
+  * BSD kqueue(2) (FreeBSD 4.1, NetBSD 2.0, OpenBSD 2.9),
+  * Solaris 8 /dev/poll,
+  * Linux 2.6 epoll(4).
+
+With other Postfix versions or operating systems, the number of file
+descriptors per process is limited by the value of the FD_SETSIZE macro. If you
+expect to run more than 1000 mail delivery processes, you may need to override
+the definition of the FD_SETSIZE macro to make select() work correctly:
+
+    $ make makefiles CCARGS=-DFD_SETSIZE=2048
+
+Warning: the above has no effect on some Linux versions. Apparently, on these
+systems the FD_SETSIZE value can be changed only by using undocumented
+interfaces. Currently, that means including <bits/types.h> directly (which is
+not allowed) and overriding the __FD_SETSIZE macro. Beware, undocumented
+interfaces can change at any time and without warning.
+
+But wait, there is more: none of this will work unless the operating system is
+configured to handle thousands of connections. See the TUNING_README guide for
+examples of how to increase the number of open sockets or files.
+
+4.8 - Compiling Postfix, at last
+
+If the command
+
+    $ make
+
+is successful, then you can proceed to install Postfix (section 6).
+
+If the command produces compiler error messages, it may be time to search the
+web or to ask the postfix-users@postfix.org mailing list, but be sure to search
+the mailing list archives first. Some mailing list archives are linked from
+http://www.postfix.org/.
+
+5 - Porting Postfix to an unsupported system
+
+Each system type that Postfix knows is identified by a unique name. Examples:
+SUNOS5, FREEBSD4, and so on. When porting Postfix to a new system, the first
+step is to choose a SYSTEMTYPE name for the new system. You must use a name
+that includes at least the major version of the operating system (such as
+SUNOS4 or LINUX2), so that different releases of the same system can be
+supported without confusion.
+
+Add a case statement to the "makedefs" shell script in the source code top-
+level directory that recognizes the new system reliably, and that emits the
+right system-specific information. Be sure to make the code robust against user
+PATH settings; if the system offers multiple UNIX flavors (e.g. BSD and SYSV)
+be sure to build for the native flavor, instead of the emulated one.
+
+Add an "#ifdef SYSTEMTYPE" section to the central util/sys_defs.h include file.
+You may have to invent new feature macro names. Please choose sensible feature
+macro names such as HAS_DBM or FIONREAD_IN_SYS_FILIO_H.
+
+I strongly recommend against using "#ifdef SYSTEMTYPE" in individual source
+files. While this may look like the quickest solution, it will create a mess
+when newer versions of the same SYSTEMTYPE need to be supported. You're likely
+to end up placing "#ifdef" sections all over the source code again.
+
+6 - Installing the software after successful compilation
+
+This text describes how to install Postfix from source code. See the
+PACKAGE_README file if you are building a package for distribution to other
+systems.
+
+6.1 - Save existing Sendmail binaries
+
+IMPORTANT: if you are REPLACING an existing Sendmail installation with Postfix,
+you may need to keep the old sendmail program running for some time in order to
+flush the mail queue.
+
+  * Some systems implement a mail switch mechanism where different MTAs
+    (Postfix, Sendmail, etc.) can be installed at the same time, while only one
+    of them is actually being used. Examples of such switching mechanisms are
+    the FreeBSD mailwrapper(8) or the Linux mail switch. In this case you
+    should try to "flip" the switch to "Postfix" before installing Postfix.
+
+  * If your system has no mail switch mechanism, execute the following commands
+    (your sendmail, newaliases and mailq programs may be in a different place):
+
+    # mv /usr/sbin/sendmail /usr/sbin/sendmail.OFF
+    # mv /usr/bin/newaliases /usr/bin/newaliases.OFF
+    # mv /usr/bin/mailq /usr/bin/mailq.OFF
+    # chmod 755 /usr/sbin/sendmail.OFF /usr/bin/newaliases.OFF \
+       /usr/bin/mailq.OFF
+
+6.2 - Create account and groups
+
+Before you install Postfix for the first time you need to create an account and
+a group:
+
+  * Create a user account "postfix" with a user id and group id that are not
+    used by any other user account. Preferably, this is an account that no-one
+    can log into. The account does not need an executable login shell, and
+    needs no existing home directory. My password and group file entries look
+    like this:
+
+       /etc/passwd:
+           postfix:*:12345:12345:postfix:/no/where:/no/shell
+
+       /etc/group:
+           postfix:*:12345:
+
+    Note: there should be no whitespace before "postfix:".
+
+  * Create a group "postdrop" with a group id that is not used by any other
+    user account. Not even by the postfix user account. My group file entry
+    looks like:
+
+       /etc/group:
+           postdrop:*:54321:
+
+    Note: there should be no whitespace before "postdrop:".
+
+6.3 - Install Postfix
+
+To install or upgrade Postfix from compiled source code, run one of the
+following commands as the super-user:
+
+    # make install      (interactive version, first time install)
+
+    # make upgrade      (non-interactive version, for upgrades)
+
+  * The interactive version ("make install") asks for pathnames for Postfix
+    data and program files, and stores your preferences in the main.cf file. If
+    you don't want Postfix to overwrite non-Postfix "sendmail", "mailq" and
+    "newaliases" files, specify pathnames that end in ".postfix".
+
+  * The non-interactive version ("make upgrade") needs the /etc/postfix/main.cf
+    file from a previous installation. If the file does not exist, use
+    interactive installation ("make install") instead.
+
+6.4 - Configure Postfix
+
+Proceed to the section on how you wish to run Postfix on your particular
+machine:
+
+  * Send mail only, without changing an existing Sendmail installation (section
+    7).
+
+  * Send and receive mail via a virtual host interface, still without any
+    change to an existing Sendmail installation (section 8).
+
+  * Run Postfix instead of Sendmail (section 9).
+
+7 - Configuring Postfix to send mail only
+
+If you are going to use Postfix to send mail only, there is no need to change
+your existing sendmail setup. Instead, set up your mail user agent so that it
+calls the Postfix sendmail program directly.
+
+Follow the instructions in the "Mandatory configuration file edits" in section
+10, and review the "To chroot or not to chroot" text in section 11.
+
+You MUST comment out the "smtp inet" entry in /etc/postfix/master.cf, in order
+to avoid conflicts with the real sendmail. Put a "#" character in front of the
+line that defines the smtpd service:
+
+    /etc/postfix/master.cf:
+       #smtp      inet  n       -       n       -       -       smtpd
+
+Start the Postfix system:
+
+    # postfix start
+
+or, if you feel nostalgic, use the Postfix sendmail command:
+
+    # sendmail -bd -qwhatever
+
+and watch your maillog file for any error messages. The pathname is /var/log/
+maillog, /var/log/mail, /var/log/syslog, or something else. Typically, the
+pathname is defined in the /etc/syslog.conf file.
+
+    $ egrep '(reject|warning|error|fatal|panic):' /some/log/file
+
+Note: the most important error message is logged first. Later messages are not
+as useful.
+
+In order to inspect the mail queue, use one of the following commands:
+
+    $ mailq
+
+    $ sendmail -bp
+
+    $ postqueue -p
+
+See also the "Care and feeding" section 12 below.
+
+8 - Configuring Postfix to send and receive mail via virtual interface
+
+Alternatively, you can use the Postfix system to send AND receive mail while
+leaving your Sendmail setup intact, by running Postfix on a virtual interface
+address. Simply configure your mail user agent to directly invoke the Postfix
+sendmail program.
+
+To create a virtual network interface address, study your system ifconfig
+manual page. The command syntax could be any of:
+
+    # ifconfig le0:1 <address> netmask <mask> up
+    # ifconfig en0 alias <address> netmask 255.255.255.255
+
+In the /etc/postfix/main.cf file, I would specify
+
+    /etc/postfix/main.cf:
+       myhostname = virtual.host.tld
+       inet_interfaces = $myhostname
+       mydestination = $myhostname
+
+Follow the instructions in the "Mandatory configuration file edits" in section
+10, and review the "To chroot or not to chroot" text in section 11.
+
+Start the Postfix system:
+
+    # postfix start
+
+or, if you feel nostalgic, use the Postfix sendmail command:
+
+    # sendmail -bd -qwhatever
+
+and watch your maillog file for any error messages. The pathname is /var/log/
+maillog, /var/log/mail, /var/log/syslog, or something else. Typically, the
+pathname is defined in the /etc/syslog.conf file.
+
+    $ egrep '(reject|warning|error|fatal|panic):' /some/log/file
+
+Note: the most important error message is logged first. Later messages are not
+as useful.
+
+In order to inspect the mail queue, use one of the following commands:
+
+    $ mailq
+
+    $ sendmail -bp
+
+    $ postqueue -p
+
+See also the "Care and feeding" section 12 below.
+
+9 - Running Postfix instead of Sendmail
+
+Prior to installing Postfix you should save any existing sendmail program files
+as described in section 6. Be sure to keep the old sendmail running for at
+least a couple days to flush any unsent mail. To do so, stop the sendmail
+daemon and restart it as:
+
+    # /usr/sbin/sendmail.OFF -q
+
+Note: this is old sendmail syntax. Newer versions use separate processes for
+mail submission and for running the queue.
+
+After you have visited the "Mandatory configuration file edits" section below,
+you can start the Postfix system with:
+
+    # postfix start
+
+or, if you feel nostalgic, use the Postfix sendmail command:
+
+    # sendmail -bd -qwhatever
+
+and watch your maillog file for any error messages. The pathname is /var/log/
+maillog, /var/log/mail, /var/log/syslog, or something else. Typically, the
+pathname is defined in the /etc/syslog.conf file.
+
+    $ egrep '(reject|warning|error|fatal|panic):' /some/log/file
+
+Note: the most important error message is logged first. Later messages are not
+as useful.
+
+In order to inspect the mail queue, use one of the following commands:
+
+    $ mailq
+
+    $ sendmail -bp
+
+    $ postqueue -p
+
+See also the "Care and feeding" section 12 below.
+
+10 - Mandatory configuration file edits
+
+Note: the material covered in this section is covered in more detail in the
+BASIC_CONFIGURATION_README document. The information presented below is
+targeted at experienced system administrators.
+
+10.1 - Postfix configuration files
+
+By default, Postfix configuration files are in /etc/postfix. The two most
+important files are main.cf and master.cf; these files must be owned by root.
+Giving someone else write permission to main.cf or master.cf (or to their
+parent directories) means giving root privileges to that person.
+
+In /etc/postfix/main.cf, you will have to set up a minimal number of
+configuration parameters. Postfix configuration parameters resemble shell
+variables, with two important differences: the first one is that Postfix does
+not know about quotes like the UNIX shell does.
+
+You specify a configuration parameter as:
+
+    /etc/postfix/main.cf:
+       parameter = value
+
+and you use it by putting a "$" character in front of its name:
+
+    /etc/postfix/main.cf:
+       other_parameter = $parameter
+
+You can use $parameter before it is given a value (that is the second main
+difference with UNIX shell variables). The Postfix configuration language uses
+lazy evaluation, and does not look at a parameter value until it is needed at
+runtime.
+
+Whenever you make a change to the main.cf or master.cf file, execute the
+following command in order to refresh a running mail system:
+
+    # postfix reload
+
+10.2 - Default domain for unqualified addresses
+
+First of all, you must specify what domain will be appended to an unqualified
+address (i.e. an address without @domain.tld). The "myorigin" parameter
+defaults to the local hostname, but that is probably OK only for very small
+sites.
+
+Some examples (use only one):
+
+    /etc/postfix/main.cf:
+       myorigin = $myhostname    (send mail as "user@$myhostname")
+       myorigin = $mydomain      (send mail as "user@$mydomain")
+
+10.3 - What domains to receive locally
+
+Next you need to specify what mail addresses Postfix should deliver locally.
+
+Some examples (use only one):
+
+    /etc/postfix/main.cf:
+       mydestination = $myhostname, localhost.$mydomain, localhost
+       mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
+       mydestination = $myhostname
+
+The first example is appropriate for a workstation, the second is appropriate
+for the mailserver for an entire domain. The third example should be used when
+running on a virtual host interface.
+
+10.4 - Proxy/NAT interface addresses
+
+The proxy_interfaces parameter specifies all network addresses that Postfix
+receives mail on by way of a proxy or network address translation unit. You may
+specify symbolic hostnames instead of network addresses.
+
+IMPORTANT: You must specify your proxy/NAT external addresses when your system
+is a backup MX host for other domains, otherwise mail delivery loops will
+happen when the primary MX host is down.
+
+Example: host behind NAT box running a backup MX host.
+
+    /etc/postfix/main.cf:
+       proxy_interfaces = 1.2.3.4 (the proxy/NAT external network address)
+
+10.5 - What local clients to relay mail from
+
+If your machine is on an open network then you must specify what client IP
+addresses are authorized to relay their mail through your machine into the
+Internet. The default setting includes all subnetworks that the machine is
+attached to. This may give relay permission to too many clients. My own
+settings are:
+
+    /etc/postfix/main.cf:
+       mynetworks = 168.100.189.0/28, 127.0.0.0/8
+
+10.6 - What relay destinations to accept from strangers
+
+If your machine is on an open network then you must also specify whether
+Postfix will forward mail from strangers. The default setting will forward mail
+to all domains (and subdomains of) what is listed in $mydestination. This may
+give relay permission for too many destinations. Recommended settings (use only
+one):
+
+    /etc/postfix/main.cf:
+       relay_domains =            (do not forward mail from strangers)
+       relay_domains = $mydomain  (my domain and subdomains)
+       relay_domains = $mydomain, other.domain.tld, ...
+
+10.7 - Optional: configure a smart host for remote delivery
+
+If you're behind a firewall, you should set up a relayhost. If you can, specify
+the organizational domain name so that Postfix can use DNS lookups, and so that
+it can fall back to a secondary MX host when the primary MX host is down.
+Otherwise just specify a hard-coded hostname.
+
+Some examples (use only one):
+
+    /etc/postfix/main.cf:
+       relayhost = $mydomain
+       relayhost = [mail.$mydomain]
+
+The form enclosed with [] eliminates DNS MX lookups.
+
+By default, the SMTP client will do DNS lookups even when you specify a relay
+host. If your machine has no access to a DNS server, turn off SMTP client DNS
+lookups like this:
+
+    /etc/postfix/main.cf:
+       disable_dns_lookups = yes
+
+The STANDARD_CONFIGURATION_README file has more hints and tips for firewalled
+and/or dial-up networks.
+
+10.8 - Create the aliases database
+
+Postfix uses a Sendmail-compatible aliases(5) table to redirect mail for local
+(8) recipients. Typically, this information is kept in two files: in a text
+file /etc/aliases and in an indexed file /etc/aliases.db. The command "postconf
+alias_maps" will tell you the exact location of the text file.
+
+First, be sure to update the text file with aliases for root, postmaster and
+"postfix" that forward mail to a real person. Postfix has a sample aliases file
+/etc/postfix/aliases that you can adapt to local conditions.
+
+    /etc/aliases:
+       root: you
+       postmaster: root
+       postfix: root
+       bin: root
+       etcetera...
+
+Note: there should be no whitespace before the ":".
+
+Finally, build the indexed aliases file with one of the following commands:
+
+    # newaliases
+    # sendmail -bi
+
+11 - To chroot or not to chroot
+
+Postfix daemon processes can be configured (via master.cf) to run in a chroot
+jail. The processes run at a fixed low privilege and with access only to the
+Postfix queue directories (/var/spool/postfix). This provides a significant
+barrier against intrusion. The barrier is not impenetrable, but every little
+bit helps.
+
+With the exception of Postfix daemons that deliver mail locally and/or that
+execute non-Postfix commands, every Postfix daemon can run chrooted.
+
+Sites with high security requirements should consider to chroot all daemons
+that talk to the network: the smtp(8) and smtpd(8) processes, and perhaps also
+the lmtp(8) client. The author's own porcupine.org mail server runs all daemons
+chrooted that can be chrooted.
+
+The default /etc/postfix/master.cf file specifies that no Postfix daemon runs
+chrooted. In order to enable chroot operation, edit the file /etc/postfix/
+master.cf. Instructions are in the file.
+
+Note that a chrooted daemon resolves all filenames relative to the Postfix
+queue directory (/var/spool/postfix). For successful use of a chroot jail, most
+UNIX systems require you to bring in some files or device nodes. The examples/
+chroot-setup directory in the source code distribution has a collection of
+scripts that help you set up Postfix chroot environments on different operating
+systems.
+
+Additionally, you almost certainly need to configure syslogd so that it listens
+on a socket inside the Postfix queue directory. Examples for specific systems:
+
+FreeBSD:
+
+    # mkdir -p /var/spool/postfix/var/run
+    # syslogd -l /var/spool/postfix/var/run/log
+
+Linux, OpenBSD:
+
+    # mkdir -p /var/spool/postfix/dev
+    # syslogd -a /var/spool/postfix/dev/log
+
+12 - Care and feeding of the Postfix system
+
+Postfix daemon processes run in the background, and log problems and normal
+activity to the syslog daemon. The names of logfiles are specified in /etc/
+syslog.conf. At the very least you need something like:
+
+    /etc/syslog.conf:
+       mail.err                                    /dev/console
+       mail.debug                                  /var/log/maillog
+
+IMPORTANT: the syslogd will not create files. You must create them before
+(re)starting syslogd.
+
+IMPORTANT: on Linux you need to put a "-" character before the pathname, e.g.,
+-/var/log/maillog, otherwise the syslogd will use more system resources than
+Postfix does.
+
+Hopefully, the number of problems will be small, but it is a good idea to run
+every night before the syslog files are rotated:
+
+    # postfix check
+    # egrep '(reject|warning|error|fatal|panic):' /some/log/file
+
+  * The first line (postfix check) causes Postfix to report file permission/
+    ownership discrepancies.
+
+  * The second line looks for problem reports from the mail software, and
+    reports how effective the relay and junk mail access blocks are. This may
+    produce a lot of output. You will want to apply some postprocessing to
+    eliminate uninteresting information.
+
+The DEBUG_README document describes the meaning of the "warning" etc. labels in
+Postfix logging.
+
index 9fb328a3a08363758c50ae82dec2f87253856349..0e84d856875bf723d0646090fa9c12946a3388a5 100644 (file)
@@ -15,9 +15,16 @@ 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
+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
 
+# While generating the top-level Makefile, we must get the PLUGIN_DIR
+# setting directly from the latest makedefs.out result.
+
 makefiles Makefiles:
        (echo "# Do not edit -- this file documents how Postfix was built for your machine."; $(SHELL) makedefs) >makedefs.tmp
        set +e; if cmp makedefs.tmp conf/makedefs.out; then rm makedefs.tmp; \
@@ -25,22 +32,42 @@ makefiles Makefiles:
        set -e; for i in $(DIRS); do \
         (set -e; echo "[$$i]"; cd $$i; rm -f Makefile; \
         $(MAKE) -f Makefile.in Makefile MAKELEVEL=) || exit 1; \
-       done;
-       rm -f Makefile; (cat conf/makedefs.out Makefile.in) >Makefile
+       done
+       set -- `grep '^PLUGIN_DIR' conf/makedefs.out`; \
+       rm -f Makefile; (cat conf/makedefs.out; \
+       case  "$$3" in \
+       /*) cat Makefile.in;; \
+        *) grep -v '^PLUGINS' Makefile.in;; \
+       esac) >Makefile
 
 update printfck tests root_tests:
        set -e; for i in $(DIRS); do \
         (set -e; echo "[$$i]"; cd $$i; $(MAKE) $(OPTS) $@ MAKELEVEL=) || exit 1; \
        done
 
-update: $(LIBEXEC)
+update: $(LIBEXEC) $(PLUGINS)
 
-libexec/post-install: conf/post-install
+libexec/makedefs.out: conf/makedefs.out
        rm -f $@ && ln -f $? $@
 
-libexec/postfix-files: conf/postfix-files
+libexec/post-install: conf/post-install
        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 '/^\$$plugin_directory/d' conf/postfix-files; \
+       elif [ "${PLUGIN_DIR}" = "no" -o "${PLUGIN_DIR}" = "" ]; then \
+           sed -e '/^\$$plugin_directory/d' conf/postfix-files | $(EXPAND); \
+       else \
+           $(EXPAND) conf/postfix-files; \
+       fi) | case "$(MAKE_FIX)" in \
+       *cant-move-relative-symlink*) \
+           sed 's;:l:dynamic;:h:$plugin_directory/dynamic;';; \
+        *) cat;; \
+       esac > $@
+
 libexec/postfix-script: conf/postfix-script
        rm -f $@ && ln -f $? $@
 
@@ -56,6 +83,14 @@ libexec/master.cf: conf/master.cf
 libexec/postmulti-script: conf/postmulti-script
        rm -f $@ && ln -f $? $@
 
+plugins/dynamicmaps.cf.$(SHLIB_VERSION): conf/dynamicmaps.cf Makefile
+       rm -f $@ && $(EXPAND) conf/dynamicmaps.cf | $(AWK) ' \
+               BEGIN { split("'"$(DEFINED_MAP_TYPES)"'", map_types); \
+                       for (n in map_types) has_type[map_types[n]] = n } \
+               /^#/ { print } \
+               /^[a-z]/ { if (has_type[$$1]) print } \
+       ' >$@
+
 manpages:
        set -e; for i in $(MANDIRS); do \
         (set -e; echo "[$$i]"; cd $$i; $(MAKE) -f Makefile.in $(OPTS) MAKELEVEL=) || exit 1; \
@@ -63,17 +98,26 @@ manpages:
 
 printfck: update
 
+# The build-time shlib_directory/plugin_directory settings must take
+# precedence over the installed main.cf settings, otherwise we can't
+# update an installed system from dynamicmaps=yes<->dynamicmaps=no
+# or from shared=yes<->shared=no.
+
 install: update
-       $(SHELL) postfix-install
+       $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
+               $(SHELL) postfix-install
 
 package: update
-       $(SHELL) postfix-install -package
+       $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
+               $(SHELL) postfix-install -package
 
 upgrade: update
-       $(SHELL) postfix-install -non-interactive
+       $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
+               $(SHELL) postfix-install -non-interactive
 
 non-interactive-package: update
-       $(SHELL) postfix-install -non-interactive -package
+       $(SHLIB_ENV) shlib_directory=${SHLIB_DIR} plugin_directory=$(PLUGIN_DIR) \
+               $(SHELL) postfix-install -non-interactive -package
 
 depend clean:
        set -e; for i in $(DIRS); do \
@@ -91,7 +135,9 @@ 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]* \
+       rm -f bin/[!CRS]* lib/[!CRS]* include/[!CRS]* libexec/[!CRS]* plugins/[!CRS]* \
+           src/*/libpostfix-*.so.* src/*/libpostfix-*.dylib.* \
+           src/*/postfix-*.so.* src/*/postfix-*.dylib.* \
            junk */junk */*/junk \
            *core */*core */*/*core \
            .nfs* */.nfs* */*/.nfs* \
index 502b7c4911cca2692232445f90b983b394cec01b..0dbb675ec07072bc7091c31f5888355f128a9bb4 100644 (file)
@@ -42,7 +42,7 @@ To build Postfix after you have installed tinycdb, use something like:
     % make tidy
     % CDB=../../../tinycdb-0.5
     % make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
-        "AUXLIBS=$CDB/libcdb.a"
+        "AUXLIBS_CDB=$CDB/libcdb.a"
     % make
 
 Alternatively, for the D.J.B. version of CDB:
@@ -50,9 +50,20 @@ Alternatively, for the D.J.B. version of CDB:
     % make tidy
     % CDB=../../../cdb-0.75
     % make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
-        "AUXLIBS=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
+        "AUXLIBS_CDB=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/
+    byte.a"
     % make
 
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_CDB. With Postfix
+2.12 and later, the old AUXLIBS variable still supports building a statically-
+loaded CDB database client, but only the new AUXLIBS_CDB variable supports
+building a dynamically-loaded or statically-loaded CDB database client.
+
+    Failure to use the AUXLIBS_CDB variable will defeat the purpose of dynamic
+    database client loading. Every Postfix executable file will have CDB
+    database library dependencies. And that was exactly what dynamic database
+    client loading was meant to avoid.
+
 After Postfix has been built with cdb support, you can use "cdb" tables
 wherever you can use read-only "hash", "btree" or "dbm" tables. However, the
 "p\bpo\bos\bst\btm\bma\bap\bp -\b-i\bi" (incremental record insertion) and "p\bpo\bos\bst\btm\bma\bap\bp -\b-d\bd" (incremental
index 3a473abb1fef53831fdcf6957b358a61c7f474f4..18d60aa6fd4f86620e82861c55f8931464298ca1 100644 (file)
@@ -148,7 +148,121 @@ 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 o\bop\bpt\bti\bio\bon\bna\bal\bl f\bfe\bea\bat\btu\bur\bre\bes\bs
+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 shared-library and database plugin support exists for recent versions
+of Linux, FreeBSD and MacOS X. Shared-library builds may become the default at
+some point in the future.
+
+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.
+
+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
+
+This defaults to installing shared libraries in /usr/local/lib, typically with
+names like libpostfix-name.so.version, where the name is a source-code
+directory name such as "util" or "global", and the version is the Postfix
+version: x.y.z for stable releases, x.y-date for snapshot (development)
+releases, or x.y-date-nonprod for non-production releases.
+
+To override the default location or shared-library version, specify, for
+example:
+
+    $ make makefiles shared=yes shlib_directory=/usr/lib \
+        SHLIB_VERSION=1 ...other arguments...
+
+You can change the shlib_directory setting after Postfix is built, with "make
+install" or "make upgrade". However, you may have to run ldconfig if you change
+shlib_directory after Postfix is built and install the libpostfix-*.so.* files
+in a non-system directory. No ldconfig is needed if you keep the libpostfix-
+*.so.* files in the compiled-in default $shlib_directory location.
+
+Additionally, Postfix can be built to support dynamic loading of Postfix
+database clients with the Debian-style dynamicmaps feature. Postfix 2.12
+supports dynamic loading of cdb:, ldap:, lmdb:, mysql:, pcre:, pgsql:, sdbm:,
+and sqlite: database clients. Dynamic loading is useful when you distribute or
+install pre-compiled Postfix packages.
+
+Specify "dynamicmaps=yes" on the "make makefiles" command line to build Postfix
+with support to dynamically load Postfix database clients (database plugins)
+with the Debian-style dynamicmaps feature.
+
+    $ make makefiles dynamicmaps=yes ...other arguments...
+    $ make makefiles dynamicmaps=no ...other arguments...
+    $ make
+
+This implicitly enables shared-library support, and defaults to installing
+dynamicmaps.cf and database plugins in /usr/libexec/postfix. Database plugins
+are typically named postfix-type.so.version where the type is a database type
+such as "cdb" or "ldap", and where the version is the same as for Postfix
+shared libraries. The installed dynamicmaps.cf configuration file is given a
+suffix with the same version.
+
+    NOTE: The Postfix 2.12 build procedure expects that you specify database
+    library dependencies with variables named AUXLIBS_CDB, AUXLIBS_LDAP, etc.
+    With Postfix 2.12 and later, the old AUXLIBS variable still supports
+    building a statically-loaded database client, but only the new AUXLIBS_CDB
+    etc. variables support building a dynamically-loaded or statically-loaded
+    CDB etc. database client. See CDB_README, LDAP_README, etc. for details.
+
+    Failure to follow this advice will defeat the purpose of dynamic database
+    client loading. Every Postfix executable file will have database library
+    dependencies. And that was exactly what dynamic database client loading was
+    meant to avoid.
+
+To override the default location or shared-library version, specify, for
+example:
+
+    % make makefiles dynamicmaps=yes plugin_directory=/usr/lib/postfix \
+        SHLIB_VERSION=1  ...
+
+You can also override the plugin_directory setting after Postfix is built, with
+"make install" or "make upgrade". In this case, there is no need to run the
+ldconfig command.
+
+Tips for distribution maintainers:
+
+  * The postfix-install procedure creates a compatibility symlink
+    dynamicmaps.cf -> dynamicmaps.cf.version (as well as a symlink
+    dynamicmaps.cf.d -> dynamicmaps.cf.version.d; more on that below). It is
+    therefore safe to use "unversioned" configuration file names when
+    installing or deinstalling a database plugin. However, Postfix itself will
+    use the "versioned" names, to allow minor upgrades to happen without having
+    to stop Postfix.
+
+  * The configuration file dynamicmaps.cf.version will automatically include
+    files under the directory dynamicmaps.cf.d.version, just like the
+    configuration file postfix-files will automatically include files under the
+    directory postfix-files.d. Thanks to this, you don't have to edit postfix-
+    files or dynamicmaps.cf, when installing or deinstalling a database plugin
+    package. Instead, each plugin can have its own configuration file.
+
+  * The plugin_directory setting provides the default directory for shared-
+    library objects with a relative pathname in the file
+    dynamicmaps.cf.version.
+
+  * Each configuration file under the directory dynamicmaps.cf.d.version must
+    have a name that ends in ".cf" and must have the same format as the file
+    dynamicmaps.cf.version.
+
+  * The directory dynamicmaps.cf.d.version is the default directory for shared-
+    library objects with a relative pathname in the files
+    dynamicmaps.cf.d.version/*.cf. Thus, the directory dynamicmaps.cf.d.version
+    may contain both configuration files and shared-library object files.
+    Hence, the requirement that configuration file names must end in ".cf".
+
+  * Each configuration file under the directory postfix-files.d must have the
+    same format as the configuration file postfix-files. There is no
+    requirement that these configuration file names have a specific format.
+
+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
 whistles. Support for third-party databases etc. must be configured when
@@ -180,7 +294,55 @@ support for optional features:
 Note: IP version 6 support is compiled into Postfix on operating systems that
 have IPv6 support. See the IPV6_README file for details.
 
-4\b4.\b.4\b4 -\b- O\bOv\bve\ber\brr\bri\bid\bdi\bin\bng\bg b\bbu\bui\bil\blt\bt-\b-i\bin\bn p\bpa\bar\bra\bam\bme\bet\bte\ber\br d\bde\bef\bfa\bau\bul\blt\bt s\bse\bet\btt\bti\bin\bng\bgs\bs
+4\b4.\b.5\b5 -\b- O\bOv\bve\ber\brr\bri\bid\bdi\bin\bng\bg b\bbu\bui\bil\blt\bt-\b-i\bin\bn p\bpa\bar\bra\bam\bme\bet\bte\ber\br d\bde\bef\bfa\bau\bul\blt\bt s\bse\bet\btt\bti\bin\bng\bgs\bs
+
+4\b4.\b.5\b5.\b.1\b1 -\b- P\bPo\bos\bst\btf\bfi\bix\bx 2\b2.\b.1\b12\b2 a\ban\bnd\bd l\bla\bat\bte\ber\br
+
+All Postfix configuration parameters can be changed by editing a Postfix
+configuration file, except for one: the parameter that specifies the location
+of Postfix configuration files. In order to build Postfix with a configuration
+directory other than /etc/postfix, use:
+
+    $ make makefiles config_directory=/some/where ...other arguments...
+    $ make
+
+Parameters whose defaults can be specified in this way are listed below. See
+the postconf(5) manpage for a description (command: "nroff -man man/man5/
+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 
+    |p\bpa\bar\bra\bam\bme\bet\bte\ber\br n\bna\bam\bme\be       |t\bty\byp\bpi\bic\bca\bal\bl d\bde\bef\bfa\bau\bul\blt\bt     |
+    |_\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 |
+    |command_directory    |/usr/sbin           |
+    |_\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 |
+    |config_directory     |/etc/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 |
+    |default_database_type|hash                |
+    |_\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 |
+    |daemon_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 |
+    |data_directory       |/var/lib/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 |
+    |html_directory       |no                  |
+    |_\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 |
+    |mailq_path           |/usr/bin/mailq      |
+    |_\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 |
+    |manpage_directory    |/usr/local/man      |
+    |_\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                  |
+    |_\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 |
+    |sendmail_path        |/usr/sbin/sendmail  |
+    |_\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 |
+    |shlib_directory      |/usr/local/lib      |
+    |_\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 |
+
+4\b4.\b.5\b5.\b.2\b2 -\b- A\bAl\bll\bl P\bPo\bos\bst\btf\bfi\bix\bx v\bve\ber\brs\bsi\bio\bon\bns\bs
 
 All Postfix configuration parameters can be changed by editing a Postfix
 configuration file, except for one: the parameter that specifies the location
@@ -192,7 +354,9 @@ directory other than /etc/postfix, use:
 
 IMPORTANT: Be sure to get the quotes right. These details matter a lot.
 
-Parameters whose defaults can be specified in this way are:
+Parameters whose defaults can be specified in this way are listed below. See
+the postconf(5) manpage for a description (command: "nroff -man man/man5/
+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 _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b _\b 
     |M\bMa\bac\bcr\bro\bo n\bna\bam\bme\be       |d\bde\bef\bfa\bau\bul\blt\bt v\bva\bal\blu\bue\be f\bfo\bor\br    |t\bty\byp\bpi\bic\bca\bal\bl d\bde\bef\bfa\bau\bul\blt\bt     |
@@ -225,7 +389,7 @@ Parameters whose defaults can be specified in this way are:
 Note: the data_directory parameter (for caches and pseudo-random numbers) was
 introduced with Postfix version 2.5.
 
-4\b4.\b.5\b5 -\b- O\bOv\bve\ber\brr\bri\bid\bdi\bin\bng\bg o\bot\bth\bhe\ber\br c\bco\bom\bmp\bpi\bil\ble\be-\b-t\bti\bim\bme\be f\bfe\bea\bat\btu\bur\bre\bes\bs
+4\b4.\b.6\b6 -\b- O\bOv\bve\ber\brr\bri\bid\bdi\bin\bng\bg o\bot\bth\bhe\ber\br c\bco\bom\bmp\bpi\bil\ble\be-\b-t\bti\bim\bme\be f\bfe\bea\bat\btu\bur\bre\bes\bs
 
 The general method to override Postfix compile-time features is as follows:
 
@@ -237,8 +401,13 @@ The following is an extensive list of names and values.
  _\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 _\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 
 |N\bNa\bam\bme\be/\b/V\bVa\bal\blu\bue\be                    |D\bDe\bes\bsc\bcr\bri\bip\bpt\bti\bio\bon\bn                                   |
 |_\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 _\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 |
-|AUXLIBS="object_library..."   |Specifies one or more non-default object      |
-|                              |libraries.                                    |
+|                              |Specifies one or more non-default object      |
+|                              |libraries. Postfix 2,12 and later specify some|
+|                              |of their database library dependencies with   |
+|AUXLIBS="object_library..."   |AUXLIBS_CDB, AUXLIBS_LDAP, AUXLIBS_LMDB,      |
+|                              |AUXLIBS_MYSQL, AUXLIBS_PCRE, AUXLIBS_PGSQL,   |
+|                              |AUXLIBS_SDBM, and AUXLIBS_SQLITE,             |
+|                              |respectively.                                 |
 |_\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 _\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 |
 |CC=compiler_command           |Specifies a non-default compiler. On many     |
 |                              |systems, the default is gcc.                  |
@@ -253,7 +422,7 @@ The following is an extensive list of names and values.
 ||-DNO_DB                      |platforms that are known to support this      |
 ||                             |feature. If you override this, then you       |
 ||                             |probably should also override DEF_DB_TYPE as  |
-||                             |described in section 4.4.                     |
+||                             |described in section 4.5.                     |
 |_\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 _\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 |
 ||                             |Do not build with Solaris /dev/poll support.  |
 ||-DNO_DEVPOLL                 |By default, /dev/poll support is compiled in  |
@@ -305,12 +474,18 @@ The following is an extensive list of names and values.
 |OPT=optimization_level        |The default is -O. Specify OPT= to turn off   |
 |                              |optimization.                                 |
 |_\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 _\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 |
+|                              |Specifies a non-default Postfix shared-library|
+|                              |version number. The default is to use the     |
+|SHLIB_VERSION=version         |Postfix version: X.Y.Z for stable releases,   |
+|                              |X.Y-DATE for snapshot releases, X.Y-DATE-     |
+|                              |nonprod for non-production releases.          |
+|_\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 _\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 |
 |                              |Specifies non-default gcc compiler warning    |
 |WARN="warning_flags..."       |options for use when "make" is invoked in a   |
 |                              |source subdirectory only.                     |
 |_\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 _\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 |
 
-4\b4.\b.6\b6 -\b- S\bSu\bup\bpp\bpo\bor\brt\bt f\bfo\bor\br t\bth\bho\bou\bus\bsa\ban\bnd\bds\bs o\bof\bf p\bpr\bro\boc\bce\bes\bss\bse\bes\bs
+4\b4.\b.7\b7 -\b- S\bSu\bup\bpp\bpo\bor\brt\bt f\bfo\bor\br t\bth\bho\bou\bus\bsa\ban\bnd\bds\bs o\bof\bf p\bpr\bro\boc\bce\bes\bss\bse\bes\bs
 
 The number of connections that Postfix can manage simultaneously is limited by
 the number of processes that it can run. This number in turn is limited by the
@@ -342,7 +517,7 @@ But wait, there is more: none of this will work unless the operating system is
 configured to handle thousands of connections. See the TUNING_README guide for
 examples of how to increase the number of open sockets or files.
 
-4\b4.\b.7\b7 -\b- C\bCo\bom\bmp\bpi\bil\bli\bin\bng\bg P\bPo\bos\bst\btf\bfi\bix\bx,\b, a\bat\bt l\bla\bas\bst\bt
+4\b4.\b.8\b8 -\b- C\bCo\bom\bmp\bpi\bil\bli\bin\bng\bg P\bPo\bos\bst\btf\bfi\bix\bx,\b, a\bat\bt l\bla\bas\bst\bt
 
 If the command
 
index bfcb7963a725de9a2ceeef02ae98b8a636ae2518..c70acd4f06f9a52cdbb5e8db66671580963246ab 100644 (file)
@@ -52,14 +52,24 @@ this in the top level of your Postfix source tree should work:
 
     % make tidy
     % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
-        AUXLIBS="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
+        AUXLIBS_LDAP="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
+
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_LDAP. With Postfix
+2.12 and later, the old AUXLIBS variable still supports building a statically-
+loaded LDAP database client, but only the new AUXLIBS_LDAP variable supports
+building a dynamically-loaded or statically-loaded LDAP database client.
+
+    Failure to use the AUXLIBS_LDAP variable will defeat the purpose of dynamic
+    database client loading. Every Postfix executable file will have LDAP
+    database library dependencies. And that was exactly what dynamic database
+    client loading was meant to avoid.
 
 On Solaris 2.x you may have to specify run-time link information, otherwise
 ld.so will not find some of the shared libraries:
 
     % make tidy
     % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
-        AUXLIBS="-L/usr/local/lib -R/usr/local/lib -lldap \
+        AUXLIBS_LDAP="-L/usr/local/lib -R/usr/local/lib -lldap \
                 -L/usr/local/lib -R/usr/local/lib -llber"
 
 The 'make tidy' command is needed only if you have previously built Postfix
index 12c3767f90110df230b20ad47403b4f26f2e446c..d891da9a03894e43ae75755c2d9edd8984773f87 100644 (file)
@@ -28,13 +28,23 @@ Postfix normally does not enable LMDB support. To build Postfix with LMDB
 support, use something like:
 
     % make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
-        AUXLIBS="-L/usr/local/lib -llmdb"
+        AUXLIBS_LMDB="-L/usr/local/lib -llmdb"
     % make
 
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_LMDB. With Postfix
+2.12 and later, the old AUXLIBS variable still supports building a statically-
+loaded LMDB database client, but only the new AUXLIBS_LMDB variable supports
+building a dynamically-loaded or statically-loaded LMDB database client.
+
+    Failure to use the AUXLIBS_LMDB variable will defeat the purpose of dynamic
+    database client loading. Every Postfix executable file will have LMDB
+    database library dependencies. And that was exactly what dynamic database
+    client loading was meant to avoid.
+
 Solaris may need this:
 
     % make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
-        AUXLIBS="-R/usr/local/lib -L/usr/local/lib -llmdb"
+        AUXLIBS_LMDB="-R/usr/local/lib -L/usr/local/lib -llmdb"
     % make
 
 The exact pathnames depend on how LMDB was installed.
@@ -47,7 +57,7 @@ When building Postfix fails with:
 
 Add the "-lpthread" library to the "make makefiles" command.
 
-    % make makefiles .... AUXLIBS="... -lpthread"
+    % make makefiles .... AUXLIBS_LMDB="... -lpthread"
 
 C\bCo\bon\bnf\bfi\big\bgu\bur\bri\bin\bng\bg L\bLM\bMD\bDB\bB s\bse\bet\btt\bti\bin\bng\bgs\bs
 
index 7639bf36eb3bac45eb5bd2d207fa83372546a065..32e77dcf9763f16968f7d256eb6fcc06110db115 100644 (file)
@@ -33,17 +33,27 @@ obtained from:
 
 In order to build Postfix with mysql map support, you will need to add -
 DHAS_MYSQL and -I for the directory containing the mysql headers, and the
-mysqlclient library (and libm) to AUXLIBS, for example:
+mysqlclient library (and libm) to AUXLIBS_MYSQL, for example:
 
     make -f Makefile.init makefiles \
         'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
-        'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
+        'AUXLIBS_MYSQL=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
+
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_MYSQL. With Postfix
+2.12 and later, the old AUXLIBS variable still supports building a statically-
+loaded MySQL database client, but only the new AUXLIBS_MYSQL variable supports
+building a dynamically-loaded or statically-loaded MySQL database client.
+
+    Failure to use the AUXLIBS_MYSQL variable will defeat the purpose of
+    dynamic database client loading. Every Postfix executable file will have
+    MYSQL database library dependencies. And that was exactly what dynamic
+    database client loading was meant to avoid.
 
 On Solaris, use this instead:
 
     make -f Makefile.init makefiles \
         'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
-        'AUXLIBS=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
+        'AUXLIBS_MYSQL=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
             -lmysqlclient -lz -lm'
 
 Then, just run 'make'. This requires libz, the compression library. Older mysql
index f8d40d3d378c3439e2ff3b2b05ea86717727ff22..806a4e09d36b7297019e5f59f3241ddc562f3d0b 100644 (file)
@@ -35,18 +35,22 @@ which can be obtained from:
 NOTE: pcre versions prior to 2.06 cannot be used.
 
 In order to build Postfix with PCRE support you need to add -DHAS_PCRE and a -
-I for the PCRE include file to CCARGS, and add the path to the PCRE library to
-AUXLIBS, for example:
+I option for the PCRE include file to CCARGS, and add the path to the PCRE
+library to AUXLIBS_PCRE, for example:
 
     make -f Makefile.init makefiles \
-        "CCARGS=-DHAS_PCRE -I/usr/local/include" \
-        "AUXLIBS=-L/usr/local/lib -lpcre"
-
-Solaris needs run-time path information too:
-
-    make -f Makefile.init makefiles \
-        "CCARGS=-DHAS_PCRE -I/usr/local/include" \
-        "AUXLIBS=-L/usr/local/lib -R/usr/local/lib -lpcre"
+        "CCARGS=-DHAS_PCRE `pcre-config --cflags`" \
+        "AUXLIBS_PCRE=`pcre-config --libs`"
+
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_PCRE. With Postfix
+2.12 and later, the old AUXLIBS variable still supports building a statically-
+loaded PCRE database client, but only the new AUXLIBS_PCRE variable supports
+building a dynamically-loaded or statically-loaded PCRE database client.
+
+    Failure to use the AUXLIBS_PCRE variable will defeat the purpose of dynamic
+    database client loading. Every Postfix executable file will have PCRE
+    library dependencies. And that was exactly what dynamic database client
+    loading was meant to avoid.
 
 T\bTh\bhi\bin\bng\bgs\bs t\bto\bo k\bkn\bno\bow\bw
 
index 502b5e6835595c60033aae16623696029d9c0031..0f3b84e022e92284ced0fa5e9d330c467e985ef2 100644 (file)
@@ -34,7 +34,18 @@ For example:
     % make tidy
     % make -f Makefile.init makefiles \
             'CCARGS=-DHAS_PGSQL -I/usr/local/include/pgsql' \
-            'AUXLIBS=-L/usr/local/lib -lpq'
+            'AUXLIBS_PGSQL=-L/usr/local/lib -lpq'
+
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_PGSQL. With Postfix
+2.12 and later, the old AUXLIBS variable still supports building a statically-
+loaded PostgreSQL database client, but only the new AUXLIBS_PGSQL variable
+supports building a dynamically-loaded or statically-loaded PostgreSQL database
+client.
+
+    Failure to use the AUXLIBS_PGSQL variable will defeat the purpose of
+    dynamic database client loading. Every Postfix executable file will have
+    PGSQL database library dependencies. And that was exactly what dynamic
+    database client loading was meant to avoid.
 
 Then just run 'make'.
 
index cdd035cbea5c82173dff64b79d2e51a5c4654c58..fdb92f9ef085eb2329da8ed79dd6710e266331a7 100644 (file)
@@ -24,7 +24,18 @@ For example:
 
     make -f Makefile.init makefiles \
          'CCARGS=-DHAS_SQLITE -I/usr/local/include' \
-         'AUXLIBS=-L/usr/local/lib -lsqlite3 -lpthread'
+         'AUXLIBS_SQLITE=-L/usr/local/lib -lsqlite3 -lpthread'
+
+Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_SQLITE. With
+Postfix 2.12 and later, the old AUXLIBS variable still supports building a
+statically-loaded SQLite database client, but only the new AUXLIBS_SQLITE
+variable supports building a dynamically-loaded or statically-loaded SQLite
+database client.
+
+    Failure to use the AUXLIBS_SQLITE variable will defeat the purpose of
+    dynamic database client loading. Every Postfix executable file will have
+    SQLITE database library dependencies. And that was exactly what dynamic
+    database client loading was meant to avoid.
 
 Then, just run 'make'.
 
index 76addc374a4db2b6e6be5fefebf6c91b60890289..005ecab3b86d03b30a94f8c2d73475be2e15b89e 100644 (file)
@@ -16,6 +16,118 @@ 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.
 
+Notes for distribution maintainers (20140530)
+---------------------------------------------
+
+The Postfix build/install procedure has changed.
+
+To avoid massive frustration due to broken patches, PLEASE BUILD
+POSTFIX FIRST WITHOUT APPLYING ANY PATCHES.  Follow the INSTALL
+instructions (see "Building with Postfix shared libraries and
+database plugins" below), and see how things work and what the
+shared libraries, database plugin, and configuration files look
+like.  Only then, go ahead and perform your platform-specific
+customizations.
+
+Maintainers may also benefit from the makedefs documentation
+(mantools/srctoman - makedefs | nroff -man | less) with information
+about build options that are not described in the INSTALL instructions.
+
+Incompatible changes with snapshot 20140530
+===========================================
+
+The Postfix 2.12 build procedure expects that you specify database
+library dependencies with variables named AUXLIBS_CDB, AUXLIBS_LDAP,
+etc.  With Postfix 2.12 and later, the old AUXLIBS variable still
+supports building a statically-loaded CDB etc. database client, but
+only the new AUXLIBS_CDB etc. variables support building a
+dynamically-loaded or statically-loaded CDB etc. database client.
+See CDB_README, LDAP_README, etc. for details.
+
+Failure to follow this advice will defeat the purpose of dynamic
+database client loading. Every Postfix executable file will have
+database library dependencies. And that was exactly what dynamic
+database client loading was meant to avoid.
+
+Major changes with snapshot 20140530
+====================================
+
+Support to build Postfix with Postfix shared libraries, and with
+dynamically-loadable database clients. Postfix shared libraries
+introduce minor runtime overhead and result in smaller Postfix
+executable files. Dynamically-loadable database clients are useful
+when you distribute or install pre-compiled packages.  Postfix 2.12
+supports dynamic loading for CDB, LDAP, LMDB, MYSQL, PCRE, PGSQL,
+SDBM, and SQLITE database clients.
+
+This is based on Debian code by LaMont Jones, and based on a port
+by Viktor Dukhovni. Currently, support exists for recent versions
+of Linux, FreeBSD, MacOS X, and for the ancient Solaris 9.
+
+To support Postfix shared libraries and dynamically-loadable database
+clients, the Postfix build procedure had to be changed (specifically,
+the makedefs and Makefile.in files, and the scripts that install
+or update Postfix).  These changes are introduced early in the
+annual Postfix development cycle to give down-stream maintainers
+sufficient time to prepare their build systems for the next stable
+Postfix release.
+
+Building with Postfix shared libraries and database plugins
+-----------------------------------------------------------
+
+Please see the INSTALL section "Building with Postfix shared libraries
+and database plugins" for fine-tuning details. 
+
+To build with Postfix shared libraries (libpostfix-*.so.*), use:
+
+% make makefiles shared=yes ...other arguments...
+
+To build with dynamicmaps.cf support and dynamically-loadable
+database clients (postfix-*.so.*), use:
+
+% make makefiles dynamicmaps=yes ...other arguments...
+
+This implicitly enables support for libpostfix-*.so.* shared
+libraries. Postfix 2.12 supports dynamic loading for CDB, LDAP,
+LMDB, MYSQL, PCRE, PGSQL, SDBM, and SQLITE database clients.
+
+NOTE: The Postfix 2.12 build procedure expects that you specify
+database library dependencies with variables named AUXLIBS_CDB,
+AUXLIBS_LDAP, etc.  With Postfix 2.12 and later, the old AUXLIBS
+variable still supports building a statically-loaded database client,
+but only the new AUXLIBS_CDB etc. variables support building a
+dynamically-loaded or statically-loaded CDB etc. database client.
+See CDB_README, LDAP_README, etc. for details.
+
+Failure to follow this advice will defeat the purpose of dynamic
+database client loading. Every Postfix executable file will have
+database library dependencies. And that was exactly what dynamic
+database client loading was meant to avoid.
+
+Differences with Debian
+-----------------------
+
+Besides changes to the Postfix "build" system as described above,
+the user-visible changes with respect to Debian are:
+
+- The new 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 compiled-in default $shlib_directory location.
+
+- The new 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 the file is shared
+  among all Postfix instances just like postfix-files and other
+  files. Files in /etc are meant to be instance-specific.
+
+- Postfix supports the directory dynamicmaps.cf.d. in addition to
+  the file dynamicmaps.cf. Maintainers can one configuration file
+  per database plugin, which simplifies installation and removal.
+
 Major changes with snapshot 20140321
 ====================================
 
diff --git a/postfix/conf/dynamicmaps.cf b/postfix/conf/dynamicmaps.cf
new file mode 100644 (file)
index 0000000..5179f66
--- /dev/null
@@ -0,0 +1,9 @@
+# dict-type    so-name (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 7e79c92cd14b1cb3507934f087d77d98d6204a7d..58ef79634156771776ce11e1fcae7f04ed972248 100644 (file)
 #      This feature is obsolete as of Postfix 2.1.
 # .IP readme_directory
 #      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
@@ -205,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"
+    sendmail_path setgid_group shlib_directory plugin_directory"
 NON_SHARED="config_directory queue_directory data_directory"
 
 USAGE="Usage: $0 [name=value] command
@@ -369,7 +374,7 @@ do
    esac
 done
 
-for path in "$html_directory" "$readme_directory"
+for path in "$html_directory" "$readme_directory" "$shlib_directory" "$plugin_directory"
 do
    case "$path" in
    /*) ;;
@@ -438,6 +443,8 @@ test -n "$override" && {
        "manpage_directory = $manpage_directory" \
        "sample_directory = $sample_directory" \
        "readme_directory = $readme_directory" \
+       "shlib_directory = $shlib_directory" \
+       "plugin_directory = $plugin_directory" \
     || exit 1
 }
 
index 9e1804a6d00c2539a9f63b90c5410b1703157d88..2b333e0063fc8cb82c2fe4a8fa4f2e5dc43395ee 100644 (file)
@@ -7,9 +7,10 @@
 # Postfix configuration files. See the respective manual pages within
 # the script files.
 #
-# Do not list $command_directory in this file, or it will be blown
-# away by a future Postfix uninstallation procedure. You would not
-# want to lose all files in /usr/sbin.
+# Do not list $command_directory or $shlib_directory in this file,
+# or it will be blown away by a future Postfix uninstallation
+# procedure. You would not want to lose all files in /usr/sbin or
+# /usr/local/lib.
 #
 # Each record in this file describes one file or directory.
 # Fields are separated by ":". Specify a null field as "-".
@@ -42,6 +43,8 @@
 # it is a good idea to "u" all the files that have special ownership or
 # permissions, so that running "make install" fixes any glitches.
 #
+# Note: order matters. Update shared libraries and database plugins
+# before daemon/command-line programs.
 $config_directory:d:root:-:755:u
 $data_directory:d:$mail_owner:-:700:uc
 $daemon_directory:d:root:-:755:u
@@ -63,6 +66,25 @@ $queue_directory/public:d:$mail_owner:$setgid_group:710:uc
 $queue_directory/pid:d:root:-:755:uc
 $queue_directory/saved:d:$mail_owner:-:700:ucr
 $queue_directory/trace:d:$mail_owner:-:700:ucr
+# Update shared libraries before daemon or command-line programs.
+$shlib_directory/lib${LIB_PREFIX}util${LIB_SUFFIX}:f:root:-:755
+$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
+# Update database plugins before daemon or command-line programs.
+$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.${SHLIB_VERSION}.d:d:root:-:755:
+$plugin_directory/dynamicmaps.cf:l:dynamicmaps.cf.${SHLIB_VERSION}:-::
+$plugin_directory/dynamicmaps.cf.d:l:dynamicmaps.cf.${SHLIB_VERSION}.d:-::
 $daemon_directory/anvil:f:root:-:755
 $daemon_directory/bounce:f:root:-:755
 $daemon_directory/cleanup:f:root:-:755
@@ -80,6 +102,7 @@ $daemon_directory/pickup:f:root:-:755
 $daemon_directory/pipe:f:root:-:755
 $daemon_directory/post-install:f:root:-:755
 $daemon_directory/postfix-files:f:root:-:644
+$daemon_directory/postfix-files.d:d:root:-:755
 $daemon_directory/postfix-script:f:root:-:755
 $daemon_directory/postfix-wrapper:f:root:-:755
 $daemon_directory/postmulti-script:f:root:-:755
index 68c663fd1fcba7da394bcd4f26a63e338740a0c1..790161fecba87ed5a84f8fc819f6643dacc40b3f 100644 (file)
@@ -64,6 +64,20 @@ cd $config_directory || {
        $FATAL no Postfix configuration directory $config_directory!
        exit 1
 }
+case $shlib_directory in
+no) ;;
+ *) cd $shlib_directory || {
+       $FATAL no Postfix shared-library directory $shlib_directory!
+        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
@@ -242,7 +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 -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
@@ -255,13 +273,21 @@ check-warn)
                $WARN group or other writable: $queue_directory
 
        todo="$config_directory/*"
-       test -n "$check_shared_files" && todo="$daemon_directory/* $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: {} \;
 
        todo="$config_directory/."
        test -n "$check_shared_files" && todo="$daemon_directory/. $todo"
+       # FIXME don't scan non-Postfix files under /usr/local/lib.
+       test "$shlib_directory" = "no" || 
+           todo="$shlib_directory/libpostfix* $todo"
 
        find $todo \
                \( -perm -020 -o -perm -002 \) -type f \
index b0a56242a4f05aeb3dc2baf379f51137c48bdf2c..8919c34ca82bb51e42dd9b0cccb590fbcc13889f 100644 (file)
@@ -67,7 +67,7 @@ like: </p>
 % make tidy
 % CDB=../../../tinycdb-0.5
 % make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
-    "AUXLIBS=$CDB/libcdb.a"
+    "<a href="CDB_README.html">AUXLIBS_CDB</a>=$CDB/libcdb.a"
 % make
 </pre>
 </blockquote>
@@ -79,11 +79,26 @@ like: </p>
 % make tidy
 % CDB=../../../cdb-0.75
 % make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
-    "AUXLIBS=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
+    "<a href="CDB_README.html">AUXLIBS_CDB</a>=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
 % make
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="CDB_README.html">AUXLIBS_CDB</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded CDB database client, but only the new
+<a href="CDB_README.html">AUXLIBS_CDB</a> variable supports building a dynamically-loaded or
+statically-loaded CDB database client.  </p>
+
+<blockquote>
+
+<p> Failure to use the <a href="CDB_README.html">AUXLIBS_CDB</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have CDB database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+
+</blockquote>
+
 <p> After Postfix has been built with cdb support, you can use
 "cdb" tables wherever you can use read-only "hash", "btree" or
 "dbm" tables. However, the "<b>postmap -i</b>" (incremental record
index 7eb29a05d32dc33c3178c2a8242acecbe9279a56..2072a22f1573f5ae55a7c2b9d7acd3f430e0d662 100644 (file)
@@ -229,7 +229,158 @@ $ make
 
 <p> and so on. In some cases, optimization is turned off automatically. </p>
 
-<h3>4.3 - Building with optional features</h3>
+<h3>4.3 - Building with Postfix shared libraries and database plugins
+(Postfix &ge; 2.12) </h3>
+
+<p> Postfix shared-library and database plugin support exists for
+recent versions of Linux, FreeBSD and MacOS X. Shared-library builds
+may become the default at some point in the future. </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> Specify "shared=yes" on the "make makefiles" command line to
+build Postfix with shared-library support. </p>
+
+<blockquote>
+<pre>
+$ make makefiles shared=yes ...other arguments...
+$ make makefiles shared=no ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> This defaults to installing shared libraries in /usr/local/lib,
+typically with names like libpostfix-<i>name</i>.so.<i>version</i>,
+where the <i>name</i> is a source-code directory name such as "util"
+or "global", and the <i>version</i> is the Postfix version:
+<i>x.y.z</i> for stable releases, <i>x.y</i>-<i>date</i> for snapshot
+(development) releases, or <i>x.y</i>-<i>date</i>-nonprod for
+non-production releases.  </p>
+
+<p> To override the default location or shared-library version,
+specify, for example: </p>
+
+<blockquote>
+<pre>
+$ make makefiles shared=yes <a href="postconf.5.html#shlib_directory">shlib_directory</a>=/usr/lib \
+    SHLIB_VERSION=1 ...other arguments...
+</pre>
+</blockquote>
+
+<p> You can change the <a href="postconf.5.html#shlib_directory">shlib_directory</a> setting after Postfix is
+built, with "make install" or "make upgrade". However, you may have
+to run ldconfig if you change <a href="postconf.5.html#shlib_directory">shlib_directory</a> after Postfix is built
+and install the libpostfix-*.so.* files in a non-system directory.
+No ldconfig is needed if you keep the libpostfix-*.so.* files in
+the compiled-in default $<a href="postconf.5.html#shlib_directory">shlib_directory</a> location. </p>
+
+<p> Additionally, Postfix can be built to support dynamic loading
+of Postfix database clients with the Debian-style dynamicmaps
+feature. Postfix 2.12 supports dynamic loading of <a href="CDB_README.html">cdb</a>:, <a href="ldap_table.5.html">ldap</a>:,
+<a href="lmdb_table.5.html">lmdb</a>:, <a href="mysql_table.5.html">mysql</a>:, <a href="pcre_table.5.html">pcre</a>:, <a href="pgsql_table.5.html">pgsql</a>:, <a href="DATABASE_README.html#types">sdbm</a>:, and <a href="sqlite_table.5.html">sqlite</a>: database clients.
+Dynamic loading is useful when you distribute or install 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 (database plugins) with the Debian-style dynamicmaps feature.
+</p>
+
+<blockquote>
+<pre>
+$ make makefiles dynamicmaps=yes ...other arguments...
+$ make makefiles dynamicmaps=no ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> This implicitly enables shared-library support, and defaults
+to installing dynamicmaps.cf and database plugins in /usr/libexec/postfix.
+Database plugins are typically named postfix-<i>type</i>.so.<i>version</i>
+where the <i>type</i> is a database type such as "cdb" or "ldap",
+and where 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>
+
+<blockquote>
+
+<p> NOTE: The Postfix 2.12 build procedure expects that you specify
+database library dependencies with variables named <a href="CDB_README.html">AUXLIBS_CDB</a>,
+<a href="LDAP_README.html">AUXLIBS_LDAP</a>, etc.  With Postfix 2.12 and later, the old AUXLIBS
+variable still supports building a statically-loaded database client,
+but only the new <a href="CDB_README.html">AUXLIBS_CDB</a> etc. variables support building a
+dynamically-loaded or statically-loaded CDB etc. database client.
+See <a href="CDB_README.html">CDB_README</a>, <a href="LDAP_README.html">LDAP_README</a>, etc. for details.  </p>
+
+<p> Failure to follow this advice will defeat the purpose of dynamic
+database client loading. Every Postfix executable file will have
+database library dependencies. And that was exactly what dynamic
+database client loading was meant to avoid. </p>
+
+</blockquote>
+
+<p> To override the default location or shared-library version,
+specify, for example: </p>
+
+<blockquote>
+<pre>
+% make makefiles dynamicmaps=yes <a href="postconf.5.html#plugin_directory">plugin_directory</a>=/usr/lib/postfix \
+    SHLIB_VERSION=1  ...
+</pre>
+</blockquote>
+
+<p> You can also override the <a href="postconf.5.html#plugin_directory">plugin_directory</a> setting after Postfix
+is built, with "make install" or "make upgrade". In this case, there
+is no need to run the ldconfig command. </p>
+
+<p> Tips for distribution maintainers: 
+
+<ul>
+
+<li> <p> The postfix-install procedure creates a compatibility
+symlink dynamicmaps.cf -> dynamicmaps.cf.<i>version</i> (as well
+as a symlink dynamicmaps.cf.d -> dynamicmaps.cf.<i>version</i>.d;
+more on that below).  It is therefore safe to use "unversioned"
+configuration file names when installing or deinstalling a database
+plugin. However, Postfix itself will use the "versioned" names, to
+allow minor upgrades to happen without having to stop Postfix. </p>
+
+<li> <p> The configuration file dynamicmaps.cf.<i>version</i> will
+automatically include files under the directory
+dynamicmaps.cf.d.<i>version</i>, just like the configuration file
+postfix-files will automatically include files under the directory
+postfix-files.d.  Thanks to this, you don't have to edit postfix-files
+or dynamicmaps.cf, when installing or deinstalling a database plugin
+package. Instead, each plugin can have its own configuration file.
+</p>
+
+<li> <p> The <a href="postconf.5.html#plugin_directory">plugin_directory</a> setting provides the default directory
+for shared-library objects with a relative pathname in the file
+dynamicmaps.cf.<i>version</i>.
+
+<li> <p> Each configuration file under the directory
+dynamicmaps.cf.d.<i>version</i> must have a name that ends in ".cf"
+and must have the same format as the file dynamicmaps.cf.<i>version</i>.
+</p>
+
+<li> <p> The directory dynamicmaps.cf.d.<i>version</i> is the default
+directory for shared-library objects with a relative pathname in
+the files dynamicmaps.cf.d.<i>version</i>/*.cf.  Thus, the directory
+dynamicmaps.cf.d.<i>version</i> may contain both configuration files
+and shared-library object files.  Hence, the requirement that
+configuration file names must end in ".cf".  </p>
+
+<li> <p> Each configuration file under the directory postfix-files.d
+must have the same format as the configuration file postfix-files.
+There is no requirement that these configuration file names have a
+specific format.  </p>
+
+</ul>
+
+<h3>4.4 - Building with optional features</h3>
 
 By default, Postfix builds as a mail system with relatively few
 bells and whistles. Support for third-party databases etc.
@@ -277,7 +428,66 @@ Postfix 2.2 </td> </tr>
 systems that have IPv6 support. See the <a href="IPV6_README.html">IPV6_README</a> file for details.
 </p>
 
-<h3>4.4 - Overriding built-in parameter default settings</h3>
+<h3>4.5 - Overriding built-in parameter default settings</h3>
+
+<h4>4.5.1 - Postfix 2.12 and later </h4>
+
+<p> All Postfix configuration parameters can be changed by editing
+a Postfix configuration file, except for one: the parameter that
+specifies the location of Postfix configuration files. In order to
+build Postfix with a configuration directory other than /etc/postfix,
+use: </p>
+
+<blockquote>
+<pre>
+$ make makefiles <a href="postconf.5.html#config_directory">config_directory</a>=/some/where ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> Parameters whose defaults can be specified in this way are
+listed below. See the <a href="postconf.5.html">postconf(5)</a> manpage for a description
+(command: "<tt>nroff -man man/man5/postconf.5 | less</tt>").  </p>
+
+<blockquote>
+
+<table border="1">
+
+<tr> <th>parameter name</th>  <th>typical default</th> </tr>
+
+<tr> <td><a href="postconf.5.html#command_directory">command_directory</a></td> <td>/usr/sbin</td> </tr>
+
+<tr> <td><a href="postconf.5.html#config_directory">config_directory</a></td> <td>/etc/postfix</td> </tr>
+
+<tr> <td><a href="postconf.5.html#default_database_type">default_database_type</a></td> <td>hash</td> </tr>
+
+<tr> <td><a href="postconf.5.html#daemon_directory">daemon_directory</a></td> <td>/usr/libexec/postfix</td> </tr>
+
+<tr> <td><a href="postconf.5.html#data_directory">data_directory</a></td> <td>/var/lib/postfix</td> </tr>
+
+<tr> <td><a href="postconf.5.html#html_directory">html_directory</a></td> <td>no</td> </tr>
+
+<tr> <td><a href="postconf.5.html#mailq_path">mailq_path</a></td> <td>/usr/bin/mailq</td> </tr>
+
+<tr> <td><a href="postconf.5.html#manpage_directory">manpage_directory</a></td> <td>/usr/local/man</td> </tr>
+
+<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>
+
+<tr> <td><a href="postconf.5.html#sendmail_path">sendmail_path</a></td> <td>/usr/sbin/sendmail</td> </tr>
+
+<tr> <td><a href="postconf.5.html#shlib_directory">shlib_directory</a></td> <td>/usr/local/lib</td> </tr>
+
+</table>
+
+</blockquote>
+
+<h4>4.5.2 - All Postfix versions </h4>
 
 <p> All Postfix configuration parameters can be changed by editing
 a Postfix configuration file, except for one: the parameter that
@@ -295,7 +505,9 @@ $ make
 <p> IMPORTANT: Be sure to get the quotes right. These details matter
 a lot. </p>
 
-<p> Parameters whose defaults can be specified in this way are: </p>
+<p> Parameters whose defaults can be specified in this way are
+listed below. See the <a href="postconf.5.html">postconf(5)</a> manpage for a description
+(command: "<tt>nroff -man man/man5/postconf.5 | less</tt>").  </p>
 
 <blockquote>
 
@@ -347,7 +559,7 @@ default</th> </tr>
 <p> Note: the <a href="postconf.5.html#data_directory">data_directory</a> parameter (for caches and pseudo-random
 numbers) was introduced with Postfix version 2.5. </p>
 
-<h3>4.5 - Overriding other compile-time features</h3>
+<h3>4.6 - Overriding other compile-time features</h3>
 
 <p> The general method to override Postfix compile-time features
 is as follows: </p>
@@ -366,7 +578,10 @@ $ make
 <tr> <th colspan="2"> Name/Value </th> <th> Description </th> </tr>
 
 <tr> <td colspan="2"> AUXLIBS="object_library..."</td> <td> Specifies
-one or more non-default object libraries. </td> </tr>
+one or more non-default object libraries. Postfix 2,12 and later
+specify some of their database library dependencies with <a href="CDB_README.html">AUXLIBS_CDB</a>,
+<a href="LDAP_README.html">AUXLIBS_LDAP</a>, <a href="LMDB_README.html">AUXLIBS_LMDB</a>, <a href="MYSQL_README.html">AUXLIBS_MYSQL</a>, <a href="PCRE_README.html">AUXLIBS_PCRE</a>, <a href="PGSQL_README.html">AUXLIBS_PGSQL</a>,
+<a href="SDBM_README.html">AUXLIBS_SDBM</a>, and <a href="SQLITE_README.html">AUXLIBS_SQLITE</a>, respectively. </td> </tr>
 
 <tr> <td colspan="2"> CC=compiler_command</td> <td> Specifies a
 non-default compiler. On many systems, the default is <tt>gcc</tt>.
@@ -381,7 +596,7 @@ off Postfix features at compile time:</td> </tr>
 DB support. By default, Berkeley DB support is compiled in on
 platforms that are known to support this feature. If you override
 this, then you probably should also override DEF_DB_TYPE as described
-in section 4.4.  </td> </tr>
+in section 4.5.  </td> </tr>
 
 <tr> <td> </td> <td> -DNO_DEVPOLL </td> <td> Do not build with
 Solaris <tt>/dev/poll</tt> support. By default, <tt>/dev/poll</tt>
@@ -432,6 +647,12 @@ Specify DEBUG= to turn off debugging. </td> </tr>
 a non-default optimization level. The default is -O.  Specify OPT=
 to turn off optimization. </td> </tr>
 
+<tr> <td colspan="2"> SHLIB_VERSION=version </td> <td> Specifies a
+non-default Postfix shared-library version number. The default is
+to use the Postfix version: X.Y.Z for stable releases, X.Y-DATE for
+snapshot releases, X.Y-DATE-nonprod for non-production releases.
+</td> </tr>
+
 <tr> <td colspan="2"> WARN="warning_flags..." </td> <td> Specifies
 non-default <tt>gcc</tt> compiler warning options for use when
 "<tt>make</tt>" is invoked in a source subdirectory only. </td>
@@ -439,7 +660,7 @@ non-default <tt>gcc</tt> compiler warning options for use when
 
 </table>
 
-<h3>4.6 - Support for thousands of processes</h3>
+<h3>4.7 - Support for thousands of processes</h3>
 
 <p> The number of connections that Postfix can manage simultaneously
 is limited by the number of processes that it can run.  This number
@@ -487,7 +708,7 @@ operating system is configured to handle thousands of connections.
 See the <a href="TUNING_README.html">TUNING_README</a> guide for examples of how to increase the
 number of open sockets or files. </p>
 
-<h3>4.7 - Compiling Postfix, at last</h3>
+<h3>4.8 - Compiling Postfix, at last</h3>
 
 <p> If the command </p>
 
index 10b3f937e401f47ca3d01477f84f6016ad2922f8..3d3d61cb5233b331e789074896f57154e777d144 100644 (file)
@@ -92,10 +92,25 @@ your Postfix source tree should work: </p>
 <pre>
 % make tidy
 % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
-    AUXLIBS="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
+    <a href="LDAP_README.html">AUXLIBS_LDAP</a>="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="LDAP_README.html">AUXLIBS_LDAP</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded LDAP database client, but only the new
+<a href="LDAP_README.html">AUXLIBS_LDAP</a> variable supports building a dynamically-loaded or
+statically-loaded LDAP database client.  </p>
+
+<blockquote>
+<p> Failure to use the <a href="LDAP_README.html">AUXLIBS_LDAP</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have LDAP database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> On Solaris 2.x you may have to specify run-time link information,
 otherwise ld.so will not find some of the shared libraries: </p>
 
@@ -103,7 +118,7 @@ otherwise ld.so will not find some of the shared libraries: </p>
 <pre>
 % make tidy
 % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
-    AUXLIBS="-L/usr/local/lib -R/usr/local/lib -lldap \
+    <a href="LDAP_README.html">AUXLIBS_LDAP</a>="-L/usr/local/lib -R/usr/local/lib -lldap \
             -L/usr/local/lib -R/usr/local/lib -llber"
 </pre>
 </blockquote>
index 35e486f5429cf4e1ebe2bf560eda5e090d7a501e..d15eb4a826e0d1e37ef8d80cf8fa56f86d074c6d 100644 (file)
@@ -50,17 +50,33 @@ build Postfix with LMDB support, use something like: </p>
 <blockquote>
 <pre>
 % make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
-    AUXLIBS="-L/usr/local/lib -llmdb"
+    <a href="LMDB_README.html">AUXLIBS_LMDB</a>="-L/usr/local/lib -llmdb"
 % make
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="LMDB_README.html">AUXLIBS_LMDB</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded LMDB database client, but only the new
+<a href="LMDB_README.html">AUXLIBS_LMDB</a> variable supports building a dynamically-loaded or 
+statically-loaded LMDB database client.  </p>
+
+<blockquote>
+<p> Failure to use the <a href="LMDB_README.html">AUXLIBS_LMDB</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have LMDB database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
+
 <p> Solaris may need this: </p>
 
 <blockquote>
 <pre>
 % make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
-    AUXLIBS="-R/usr/local/lib -L/usr/local/lib -llmdb"
+    <a href="LMDB_README.html">AUXLIBS_LMDB</a>="-R/usr/local/lib -L/usr/local/lib -llmdb"
 % make
 </pre>
 </blockquote>
@@ -81,7 +97,7 @@ undefined reference to `pthread_mutex_lock'
 
 <blockquote>
 <pre>
-% make makefiles .... AUXLIBS="... -lpthread"
+% make makefiles .... <a href="LMDB_README.html">AUXLIBS_LMDB</a>="... -lpthread"
 </pre>
 </blockquote>
 
index 1b50298ec318dc9deef9d90ed060ac83f6cbe0c0..9cfa3b1c4a0c08514424a20a3f5246eb88e4cd0e 100644 (file)
@@ -52,23 +52,38 @@ which can be obtained from: </p>
 
 <p> In order to build Postfix with mysql map support, you will need to add
 -DHAS_MYSQL and -I for the directory containing the mysql headers, and
-the mysqlclient library (and libm) to AUXLIBS, for example: </p>
+the mysqlclient library (and libm) to <a href="MYSQL_README.html">AUXLIBS_MYSQL</a>, for example: </p>
 
 <blockquote>
 <pre>
 make -f Makefile.init makefiles \
     'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
-    'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
+    '<a href="MYSQL_README.html">AUXLIBS_MYSQL</a>=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="MYSQL_README.html">AUXLIBS_MYSQL</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded MySQL database client, but only the new
+<a href="MYSQL_README.html">AUXLIBS_MYSQL</a> variable supports building a dynamically-loaded or 
+statically-loaded MySQL database client.  </p>
+
+<blockquote>
+<p> Failure to use the <a href="MYSQL_README.html">AUXLIBS_MYSQL</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have MYSQL database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> On Solaris, use this instead: </p>
 
 <blockquote>
 <pre>
 make -f Makefile.init makefiles \
     'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
-    'AUXLIBS=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
+    '<a href="MYSQL_README.html">AUXLIBS_MYSQL</a>=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
         -lmysqlclient -lz -lm'
 </pre>
 </blockquote>
index 6e619c616d5d46f522a2fdb7e3405364f6438e12..80ec7ee03c8081b02ade42b60609f5d495c9c180 100644 (file)
@@ -55,25 +55,30 @@ Expressions), which can be obtained from: </p>
 <p> NOTE: pcre versions prior to 2.06 cannot be used. </p>
 
 <p> In order to build Postfix with PCRE support you need to add
--DHAS_PCRE and a -I for the PCRE include file to CCARGS, and add
-the path to the PCRE library to AUXLIBS, for example: </p>
+-DHAS_PCRE and a -I option for the PCRE include file to CCARGS, and
+add the path to the PCRE library to <a href="PCRE_README.html">AUXLIBS_PCRE</a>, for example: </p>
 
 <blockquote>
 <pre>
 make -f Makefile.init makefiles \
-    "CCARGS=-DHAS_PCRE -I/usr/local/include" \
-    "AUXLIBS=-L/usr/local/lib -lpcre"
+    "CCARGS=-DHAS_PCRE `pcre-config --cflags`" \
+    "<a href="PCRE_README.html">AUXLIBS_PCRE</a>=`pcre-config --libs`"
 </pre>
 </blockquote>
 
-<p> Solaris needs run-time path information too: </p>
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="PCRE_README.html">AUXLIBS_PCRE</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded PCRE database client, but only the new
+<a href="PCRE_README.html">AUXLIBS_PCRE</a> variable supports building a dynamically-loaded or 
+statically-loaded PCRE database client.  </p>
 
 <blockquote>
-<pre>
-make -f Makefile.init makefiles \
-    "CCARGS=-DHAS_PCRE -I/usr/local/include" \
-    "AUXLIBS=-L/usr/local/lib -R/usr/local/lib -lpcre"
-</pre>
+<p> Failure to use the <a href="PCRE_README.html">AUXLIBS_PCRE</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have PCRE library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
 </blockquote>
 
 <h2>Things to know</h2>
index c7e3fed4fe6f767ec570c782709cd9a8bb431936..7aa4a254ef141410aff8d5efbf974d2bae87ceaf 100644 (file)
@@ -53,10 +53,25 @@ the location of the libpq library file. </p>
 % make tidy
 % make -f Makefile.init makefiles \
         'CCARGS=-DHAS_PGSQL -I/usr/local/include/pgsql' \
-        'AUXLIBS=-L/usr/local/lib -lpq'
+        '<a href="PGSQL_README.html">AUXLIBS_PGSQL</a>=-L/usr/local/lib -lpq'
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="PGSQL_README.html">AUXLIBS_PGSQL</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded PostgreSQL database client, but only
+the new <a href="PGSQL_README.html">AUXLIBS_PGSQL</a> variable supports building a dynamically-loaded
+or statically-loaded PostgreSQL database client.  </p>
+
+<blockquote>
+<p> Failure to use the <a href="PGSQL_README.html">AUXLIBS_PGSQL</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have PGSQL database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> Then just run 'make'.  </p>
 
 <h2>Configuring PostgreSQL lookup tables</h2>
index c452f40524ed26d82b5467a3237d900f85aa5167..53fdf0ad2d3f44990a5f99a95147930439cbc30b 100644 (file)
@@ -44,10 +44,25 @@ name of the standard POSIX thread library (pthread).  For example:
 <pre>
 make -f Makefile.init makefiles \
      'CCARGS=-DHAS_SQLITE -I/usr/local/include' \
-     'AUXLIBS=-L/usr/local/lib -lsqlite3 -lpthread'
+     '<a href="SQLITE_README.html">AUXLIBS_SQLITE</a>=-L/usr/local/lib -lsqlite3 -lpthread'
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of <a href="SQLITE_README.html">AUXLIBS_SQLITE</a>.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded SQLite database client, but only the new
+<a href="SQLITE_README.html">AUXLIBS_SQLITE</a> variable supports building a dynamically-loaded or 
+statically-loaded SQLite database client.  </p>
+
+<blockquote>
+<p> Failure to use the <a href="SQLITE_README.html">AUXLIBS_SQLITE</a> variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have SQLITE database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> Then, just run 'make'.</p>
 
 <h2>Using SQLite tables</h2>
index 71b730a2523df216a92b87240fd574cd8dbc0151..9ebfa0ffa1eaf2f30340fdaf21094b77c1f284e3 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>
@@ -9535,6 +9548,24 @@ earlier: "<b>/etc/postfix/post-install set-permissions</b>".
 </p>
 
 
+</DD>
+
+<DT><b><a name="shlib_directory">shlib_directory</a>
+(default: see 'postconf -d' output)</b></DT><DD>
+
+<p> The location of Postfix shared libraries (libpostfix-*.so.*).
+This parameter defaults to "no" when Postfix shared libraries are
+disabled at compile time. </p>
+
+<p> NOTE: 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 compiled-in
+default $<a href="postconf.5.html#shlib_directory">shlib_directory</a> location. </p>
+
+<p> This feature is available in Postfix 2.12 and later. </p>
+
+
 </DD>
 
 <DT><b><a name="show_user_unknown_table_name">show_user_unknown_table_name</a>
index b002433d1c3e6c1faf9db45691f32b8ba4574cfa..87ab7ceb008b49ee17584519ba35e1a64c530490 100644 (file)
@@ -127,86 +127,92 @@ POSTFIX(1)                                                          POSTFIX(1)
        The following <a href="postconf.5.html"><b>main.cf</b></a> configuration parameters are exported as environ-
        ment variables with the same names:
 
+       <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
+              The default location of the Postfix <a href="postconf.5.html">main.cf</a> and  <a href="master.5.html">master.cf</a>  con-
+              figuration files.
+
        <b><a href="postconf.5.html#command_directory">command_directory</a> (see 'postconf -d' output)</b>
               The location of all postfix administrative commands.
 
        <b><a href="postconf.5.html#daemon_directory">daemon_directory</a> (see 'postconf -d' output)</b>
               The directory with Postfix support programs and daemon programs.
 
-       <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The  default  location of the Postfix <a href="postconf.5.html">main.cf</a> and <a href="master.5.html">master.cf</a> con-
-              figuration files.
-
-       <b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
-              The location of the Postfix top-level queue directory.
+       <b><a href="postconf.5.html#html_directory">html_directory</a> (see 'postconf -d' output)</b>
+              The location of Postfix HTML files that describe how  to  build,
+              configure or operate a specific Postfix subsystem or feature.
 
        <b><a href="postconf.5.html#mail_owner">mail_owner</a> (postfix)</b>
-              The UNIX system account that owns the  Postfix  queue  and  most
+              The  UNIX  system  account  that owns the Postfix queue and most
               Postfix daemon processes.
 
-       <b><a href="postconf.5.html#setgid_group">setgid_group</a> (postdrop)</b>
-              The  group  ownership  of set-gid Postfix commands and of group-
-              writable Postfix directories.
-
-       <b><a href="postconf.5.html#sendmail_path">sendmail_path</a> (see 'postconf -d' output)</b>
-              A Sendmail compatibility feature that specifies the location  of
-              the Postfix <a href="sendmail.1.html"><b>sendmail</b>(1)</a> command.
-
-       <b><a href="postconf.5.html#newaliases_path">newaliases_path</a> (see 'postconf -d' output)</b>
-              Sendmail  compatibility  feature  that specifies the location of
-              the <a href="newaliases.1.html"><b>newaliases</b>(1)</a> command.
-
        <b><a href="postconf.5.html#mailq_path">mailq_path</a> (see 'postconf -d' output)</b>
               Sendmail compatibility feature that specifies where the  Postfix
               <a href="mailq.1.html"><b>mailq</b>(1)</a> command is installed.
 
-       <b><a href="postconf.5.html#html_directory">html_directory</a> (see 'postconf -d' output)</b>
-              The  location  of Postfix HTML files that describe how to build,
-              configure or operate a specific Postfix subsystem or feature.
-
        <b><a href="postconf.5.html#manpage_directory">manpage_directory</a> (see 'postconf -d' output)</b>
               Where the Postfix manual pages are installed.
 
+       <b><a href="postconf.5.html#newaliases_path">newaliases_path</a> (see 'postconf -d' output)</b>
+              Sendmail  compatibility  feature  that specifies the location of
+              the <a href="newaliases.1.html"><b>newaliases</b>(1)</a> command.
+
+       <b><a href="postconf.5.html#queue_directory">queue_directory</a> (see 'postconf -d' output)</b>
+              The location of the Postfix top-level queue directory.
+
        <b><a href="postconf.5.html#readme_directory">readme_directory</a> (see 'postconf -d' output)</b>
               The location of Postfix README files that describe how to build,
               configure or operate a specific Postfix subsystem or feature.
 
+       <b><a href="postconf.5.html#sendmail_path">sendmail_path</a> (see 'postconf -d' output)</b>
+              A  Sendmail compatibility feature that specifies the location of
+              the Postfix <a href="sendmail.1.html"><b>sendmail</b>(1)</a> command.
+
+       <b><a href="postconf.5.html#setgid_group">setgid_group</a> (postdrop)</b>
+              The group ownership of set-gid Postfix commands  and  of  group-
+              writable Postfix directories.
+
        Available in Postfix version 2.5 and later:
 
        <b><a href="postconf.5.html#data_directory">data_directory</a> (see 'postconf -d' output)</b>
               The  directory  with  Postfix-writable  data files (for example:
               caches, pseudo-random numbers).
 
-       Other configuration parameters:
+       Available in Postfix version 2.12 and later:
 
-       <b><a href="postconf.5.html#config_directory">config_directory</a> (see 'postconf -d' output)</b>
-              The default location of the Postfix <a href="postconf.5.html">main.cf</a> and  <a href="master.5.html">master.cf</a>  con-
-              figuration files.
+       <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.*).
+
+       Other configuration parameters:
 
        <b><a href="postconf.5.html#import_environment">import_environment</a> (see 'postconf -d' output)</b>
-              The  list  of environment parameters that a Postfix process will
+              The list of environment parameters that a Postfix  process  will
               import from a non-Postfix parent process.
 
        <b><a href="postconf.5.html#syslog_facility">syslog_facility</a> (mail)</b>
               The syslog facility of Postfix logging.
 
        <b><a href="postconf.5.html#syslog_name">syslog_name</a> (see 'postconf -d' output)</b>
-              The mail system name that is prepended to the  process  name  in
-              syslog  records,  so  that  "smtpd" becomes, for example, "post-
+              The  mail  system  name that is prepended to the process name in
+              syslog records, so that "smtpd"  becomes,  for  example,  "post-
               fix/smtpd".
 
        Available in Postfix version 2.6 and later:
 
        <b><a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a> (empty)</b>
-              An optional list of non-default Postfix  configuration  directo-
-              ries;  these  directories belong to additional Postfix instances
-              that share the Postfix executable files and  documentation  with
-              the  default  Postfix  instance,  and that are started, stopped,
+              An  optional  list of non-default Postfix configuration directo-
+              ries; these directories belong to additional  Postfix  instances
+              that  share  the Postfix executable files and documentation with
+              the default Postfix instance, and  that  are  started,  stopped,
               etc., together with the default Postfix instance.
 
        <b><a href="postconf.5.html#multi_instance_wrapper">multi_instance_wrapper</a> (empty)</b>
-              The pathname of a multi-instance manager command that the  <a href="postfix.1.html"><b>post-</b></a>
-              <a href="postfix.1.html"><b>fix</b>(1)</a>   command  invokes  when  the  <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a>
+              The  pathname of a multi-instance manager command that the <a href="postfix.1.html"><b>post-</b></a>
+              <a href="postfix.1.html"><b>fix</b>(1)</a>  command  invokes  when  the   <a href="postconf.5.html#multi_instance_directories">multi_instance_directories</a>
               parameter value is non-empty.
 
        <b><a href="postconf.5.html#multi_instance_group">multi_instance_group</a> (empty)</b>
@@ -216,15 +222,15 @@ POSTFIX(1)                                                          POSTFIX(1)
               The optional instance name of this Postfix instance.
 
        <b><a href="postconf.5.html#multi_instance_enable">multi_instance_enable</a> (no)</b>
-              Allow this Postfix instance to be started, stopped, etc.,  by  a
+              Allow  this  Postfix instance to be started, stopped, etc., by a
               multi-instance manager.
 
 <b>FILES</b>
-       Prior  to Postfix version 2.6, all of the following files were in <b>$<a href="postconf.5.html#config_directory">con</a>-</b>
+       Prior to Postfix version 2.6, all of the following files were in  <b>$<a href="postconf.5.html#config_directory">con</a>-</b>
        <b><a href="postconf.5.html#config_directory">fig_directory</a></b>. Some files are now in <b>$<a href="postconf.5.html#daemon_directory">daemon_directory</a></b> so that they can
        be shared among multiple instances that run the same Postfix version.
 
-       Use  the command "<b>postconf <a href="postconf.5.html#config_directory">config_directory</a></b>" or "<b>postconf <a href="postconf.5.html#daemon_directory">daemon_direc</a>-</b>
+       Use the command "<b>postconf <a href="postconf.5.html#config_directory">config_directory</a></b>" or "<b>postconf  <a href="postconf.5.html#daemon_directory">daemon_direc</a>-</b>
        <b><a href="postconf.5.html#daemon_directory">tory</a></b>" to expand the names into their actual values.
 
        $<a href="postconf.5.html#config_directory">config_directory</a>/<a href="postconf.5.html">main.cf</a>, Postfix configuration parameters
@@ -232,6 +238,7 @@ POSTFIX(1)                                                          POSTFIX(1)
        $<a href="postconf.5.html#daemon_directory">daemon_directory</a>/postfix-files, file/directory permissions
        $<a href="postconf.5.html#daemon_directory">daemon_directory</a>/postfix-script, administrative commands
        $<a href="postconf.5.html#daemon_directory">daemon_directory</a>/post-install, post-installation configuration
+       $<a href="postconf.5.html#daemon_directory">daemon_directory</a>/dynamicmaps.cf, plug-in database clients
 
 <b>SEE ALSO</b>
        Commands:
index 5f3bcc7474835b76ee462eb312768685cffb5cd9..cd7bec92503b294ffbbe42a56887e45ed9b89ee9 100644 (file)
 #      environment variables. Use quotes if variables contain
 #      whitespace or shell meta characters.
 # .IP \fBAUXLIBS=\fIobject_library...\fR
-#      Specifies one or more non-default object libraries.
+#      Specifies one or more non-default object libraries. Postfix
+#      2,12 and later specify some of their database library
+#      dependencies with AUXLIBS_CDB, AUXLIBS_LDAP, AUXLIBS_LMDB,
+#      AUXLIBS_MYSQL, AUXLIBS_PCRE, AUXLIBS_PGSQL, AUXLIBS_SDBM,
+#      and AUXLIBS_SQLITE, respectively.
 # .IP \fBCC=\fIcompiler_command\fR
 #      Specifies a non-default compiler. On many systems, the default
 #      is \fBgcc\fR.
 # .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 dynamically-loadable
+#      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
+#      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 plugin_directory
+#      queue_directory readme_directory sendmail_path shlib_directory
+#
+#      See the postconf(5) manpage for a description of these
+#      parameters.
+# .IP \fBSHLIB_VERSION=\fIversion\fR
+#      Specifies a non-default shared-library version for Postfix
+#      libraries and database plugins.  By default, the version
+#      equals the default value for the $mail_version parameter.
 # .IP \fBWARN=\fIwarning_flags\fR
 #      Specifies non-default gcc compiler warning options for use when
 #      "make" is invoked in a source subdirectory only.
@@ -155,8 +185,20 @@ case "$SYSTEM.$RELEASE" in
   FreeBSD.7*)  SYSTYPE=FREEBSD7
                ;;
   FreeBSD.8*)  SYSTYPE=FREEBSD8
+               : ${SHLIB_SUFFIX=.so}
+               : ${SHLIB_CFLAGS=-fPIC}
+               : ${SHLIB_LD='gcc -shared -Wl,-soname,${LIB}'}
+               : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
+               : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
+               : ${PLUGIN_LD='gcc -shared'}
                ;;
   FreeBSD.9*)  SYSTYPE=FREEBSD9
+               : ${SHLIB_SUFFIX=.so}
+               : ${SHLIB_CFLAGS=-fPIC}
+               : ${SHLIB_LD='gcc -shared -Wl,-soname,${LIB}'}
+               : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
+               : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
+               : ${PLUGIN_LD='gcc -shared'}
                ;;
  DragonFly.*)  SYSTYPE=DRAGONFLY
                ;;
@@ -202,6 +244,12 @@ case "$SYSTEM.$RELEASE" in
     SunOS.5*)  SYSTYPE=SUNOS5
                RANLIB=echo
                SYSLIBS="-lresolv -lsocket -lnsl -ldl"
+               : ${SHLIB_SUFFIX=.so}
+               : ${SHLIB_CFLAGS=-fPIC}
+               : ${SHLIB_LD='gcc -shared -Wl,-h,${LIB}'}
+               : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
+               : ${SHLIB_RPATH='-Wl,-R,${SHLIB_DIR}'}
+               : ${PLUGIN_LD='gcc -shared'}
                # Stock awk breaks with >10 files.
                test -x /usr/xpg4/bin/awk && AWK=/usr/xpg4/bin/awk
                # Solaris 2.5 added usleep(), POSIX regexp, POSIX getpwnam/uid_r
@@ -361,6 +409,13 @@ EOF
                           rm -f makedefs.test makedefs.test.[co]
                       fi;;
                esac
+               SYSLIBS="$SYSLIBS -ldl"
+               : ${SHLIB_SUFFIX=.so}
+               : ${SHLIB_CFLAGS=-fPIC}
+               : ${SHLIB_LD='gcc -shared -Wl,-soname,${LIB}'}
+               : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
+               : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
+               : ${PLUGIN_LD='gcc -shared'}
                ;;
     Linux.3*)  SYSTYPE=LINUX3
                case "$CCARGS" in
@@ -392,6 +447,13 @@ EOF
                        }
                    done
                done
+               SYSLIBS="$SYSLIBS -ldl"
+               : ${SHLIB_SUFFIX=.so}
+               : ${SHLIB_CFLAGS=-fPIC}
+               : ${SHLIB_LD='gcc -shared -Wl,-soname,${LIB}'}
+               : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
+               : ${SHLIB_ENV="LD_LIBRARY_PATH=`pwd`/lib"}
+               : ${PLUGIN_LD='gcc -shared'}
                ;;
      GNU.0*|GNU/kFreeBSD.[567]*)
                SYSTYPE=GNU0
@@ -470,7 +532,9 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
     Darwin.*)   SYSTYPE=MACOSX
                # Use the native compiler by default
                : ${CC=cc}
-               CCARGS="$CCARGS \$(WARN)"
+               CCARGS="$CCARGS"
+               CCWARN='$(WARN)'
+               MAKE_FIX=cant-move-relative-symlink
                # Darwin > 1.3 uses awk and flat_namespace
                case $RELEASE in
                 1.[0-3]) AWK=gawk;;
@@ -501,6 +565,12 @@ ReliantUNIX-?.5.43) SYSTYPE=ReliantUnix543
                case $RELEASE in
            ?.*|1[0-1].*) CCARGS="$CCARGS -DNO_KQUEUE";;
                esac
+               : ${SHLIB_CFLAGS=-fPIC}
+               : ${SHLIB_SUFFIX=.dylib}
+               : ${SHLIB_LD='cc -shared -Wl,-flat_namespace -Wl,-undefined,dynamic_lookup -Wl,-install_name,@rpath/${LIB}'}
+               : ${SHLIB_RPATH='-Wl,-rpath,${SHLIB_DIR}'}
+               : ${SHLIB_ENV="DYLD_LIBRARY_PATH=`pwd`/lib"}
+               : ${PLUGIN_LD='cc -shared -Wl,-flat_namespace -Wl,-undefined,dynamic_lookup'}
                ;;
     dcosx.1*)  SYSTYPE=DCOSX1
                RANLIB=echo
@@ -599,7 +669,7 @@ case "$CCARGS" in
           *)   pcre_cflags=`(pcre-config --cflags) 2>/dev/null` &&
                    pcre_libs=`(pcre-config --libs) 2>/dev/null` && {
                        CCARGS="$CCARGS -DHAS_PCRE $pcre_cflags"
-                       AUXLIBS="$AUXLIBS $pcre_libs"
+                       AUXLIBS_PCRE="$pcre_libs"
                }
                ;;
 esac
@@ -617,7 +687,202 @@ case "$CC" in
       *CC) error "Don't use CC. That's the C++ compiler";;
        *) : ${OPT='-O'};;
 esac
-#
+
+# Snapshot only.
+CCARGS="$CCARGS -DSNAPSHOT"
+
+# Non-production: needs thorough testing, or major changes are still
+# needed before the code stabilizes.
+#CCARGS="$CCARGS -DNONPROD"
+
+# Workaround: prepend Postfix include files before other include files.
+CCARGS="-I. -I../../include $CCARGS"
+
+# Optionally override installation-parameter default settings.
+
+command_directory_macro=DEF_COMMAND_DIR
+config_directory_macro=DEF_CONFIG_DIR
+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 and plugin_directory are checked here because "no"
+# is not a good answer.  Instead, build with "dynamicmaps=no" or
+# "shared=no" as appropriate.
+
+for parm_name in command_directory config_directory daemon_directory \
+       data_directory mailq_path newaliases_path plugin_directory \
+       queue_directory sendmail_path shlib_directory
+do
+    eval parm_val=\"\$$parm_name\"
+    eval parm_macro=\"\$${parm_name}_macro\"
+    case "$parm_val" in
+    "") ;;
+    /*) CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\"";;
+     *) error "$parm_name must specify an absolute path name";;
+    esac
+done
+
+html_directory_macro=DEF_HTML_DIR
+manpage_directory_macro=DEF_MANPAGE_DIR
+readme_directory_macro=DEF_README_DIR
+
+for parm_name in html_directory manpage_directory
+do
+    eval parm_val=\"\$$parm_name\"
+    eval parm_macro=\"\$${parm_name}_macro\"
+    case "$parm_val" in
+    "") ;;
+ /*|no) CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\"";;
+     *) error "$parm_name must specify \"no\" or an absolute path name";;
+    esac
+done
+
+default_database_type_macro=DEF_DB_TYPE
+
+for parm_name in default_database_type
+do
+    eval parm_val=\"\$$parm_name\"
+    eval parm_macro=\"\$${parm_name}_macro\"
+    case "$parm_val" in
+    "") ;;
+     *) CCARGS="$CCARGS -D$parm_macro=\\\"$parm_val\\\"";;
+    esac
+done
+
+# The following are for non-shared libsasl and libmilter builds.
+
+_AR=$AR
+_RANLIB=$RANLIB
+
+# Choose between shared and non-shared library builds.
+
+case "$dynamicmaps" in
+  yes) shared=yes;;
+""|no) ;;
+    *) error "Specify \"dynamicmaps=yes\" or \"dynamicmaps=no\"";;
+esac
+
+case "$shared" in
+yes)
+    if [ -z "$SHLIB_SUFFIX" ]
+    then 
+       error "Shared libraries are requested, but not supported on this platform"
+    fi
+    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_LD=
+        plugin_directory=no
+        CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS -DDEF_PLUGIN_DIR=\\\"no\\\""
+        ;;
+    esac
+
+    # 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", $parm_macro);
+    fflush(stdout);
+    exit(ferror(stdout) ? 1 : 0);
+}
+EOF
+           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" && {
+       trap 'rm -f makedefs.test makedefs.test.[co]' 1 2 3 15
+       (cat <<'EOF'
+#include <stdlib.h>
+#include <stdio.h>
+EOF
+       # Avoid "nested comment" warnings. Top-of-file comments start in
+       # column 1 and have no code after "*/", not even in header files.
+       # If this is insufficient, kill the problem with #ifndef MAKEDEFS.
+       sed '/^\/\*/,/\*\//d' src/global/mail_version.h
+       cat <<'EOF'
+int     main(void)
+{
+    printf("%s\n", DEF_MAIL_VERSION);
+    fflush(stdout);
+    exit(ferror(stdout) ? 1 : 0);
+}
+EOF
+    ) >makedefs.test.c
+       eval ${CC-gcc} -DMAKEDEFS ${CCARGS} -o makedefs.test makedefs.test.c || exit 1
+       SHLIB_VERSION=`./makedefs.test` || exit 1
+       rm -f makedefs.test makedefs.test.[co]
+    }
+    LIB_PREFIX=postfix-
+    LIB_SUFFIX=${SHLIB_SUFFIX}.${SHLIB_VERSION}
+    CCARGS="$CCARGS -DSHLIB_VERSION=\\\"$SHLIB_VERSION\\\""
+    ;;
+
+no|"")
+    shlib_directory=no
+    plugin_directory=no
+    CCARGS="$CCARGS -UUSE_DYNAMIC_LIBS -DDEF_SHLIB_DIR=\\\"no\\\""
+    CCARGS="$CCARGS -UUSE_DYNAMIC_MAPS -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=
+    PLUGIN_LD=
+    ;;
+
+*)  error "Specify \"shared=yes\" or \"shared=no\""
+    ;;
+esac
+
 # "gcc -W" 3.4.2 no longer reports functions that fail to return a
 # result.  Use "gcc -Wall -Wno-comment" instead. We'll figure out
 # later if the other -Wmumble options are really redundant. Having
@@ -629,29 +894,72 @@ ${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
        -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
        -Wunused -Wno-missing-braces'}
 
-export SYSTYPE AR ARFL RANLIB SYSLIBS CC OPT DEBUG AWK OPTS
+# Extract map type names from -DHAS_XXX compiler options.  We avoid
+# problems with tr(1) range syntax by using enumerations instead,
+# and we don't try to figure out which awk versions have tolower().
+# The following was validated in 2014 on FreeBSD/Linux and Solaris 9.
 
-# Snapshot only.
-CCARGS="$CCARGS -DSNAPSHOT"
+DEFINED_MAP_TYPES=`
+    echo $CCARGS | tr -cd '\- _ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' | 
+       tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | ${AWK} '
+       { for (n = 1; n <= NF; n++)
+             if ($n ~ /^-dhas_/)
+                 if (seen[name = substr($n, 7)]++ == 0)
+                     names = name " " names }
+       END { print names }
+'`
 
-# Non-production: needs thorough testing, or major changes are still
-# needed before the code stabilizes.
-#CCARGS="$CCARGS -DNONPROD"
+# Propagate AUXLIBS_FOO or merge them into global AUXLIBS (i.e. SYSLIBS).
 
-# Workaround: prepend Postfix include files before other include files.
-CCARGS="-I. -I../../include $CCARGS"
+PLUGGABLE_MAPS="CDB LDAP LMDB MYSQL PCRE PGSQL SDBM SQLITE"
+
+case "$plugin_directory" in
+/*) for name in $PLUGGABLE_MAPS
+    do
+       eval test -n "\"\$AUXLIBS_$name\"" && 
+           eval PLUGIN_AUXLIBS="\"\$PLUGIN_AUXLIBS
+AUXLIBS_$name = \$AUXLIBS_$name\""
+    done;;
+ *) for name in $PLUGGABLE_MAPS
+    do
+       eval AUXLIBS="\"\$AUXLIBS \$AUXLIBS_$name\""
+    done;;
+esac
 
-sed 's/  / /g' <<EOF
+sed 's/   */ /g' <<EOF
+# System-dependent settings and compiler/linker overrides.
 SYSTYPE        = $SYSTYPE
-AR     = $AR
+_AR    = $_AR
 ARFL   = $ARFL
-RANLIB = $RANLIB
-SYSLIBS        = $AUXLIBS $SYSLIBS
-CC     = $CC $CCARGS
+_RANLIB        = $_RANLIB
+SYSLIBS        = $AUXLIBS $SYSLIBS $PLUGIN_AUXLIBS
+CC     = $CC $CCARGS $CCWARN
 OPT    = $OPT
 DEBUG  = $DEBUG
 AWK    = $AWK
 STRCASE = $STRCASE
-EXPORT = AUXLIBS='$AUXLIBS' CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
+EXPORT = CCARGS='$CCARGS' OPT='$OPT' DEBUG='$DEBUG'
 WARN   = $WARN
+DEFINED_MAP_TYPES = $DEFINED_MAP_TYPES
+MAKE_FIX = $MAKE_FIX
+# Switch between Postfix static and shared libraries.
+AR     = $AR
+RANLIB = $RANLIB
+LIB_PREFIX = $LIB_PREFIX
+LIB_SUFFIX = $LIB_SUFFIX
+SHLIB_CFLAGS = $SHLIB_CFLAGS
+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
+PLUGIN_LD = $PLUGIN_LD
+# Application-specific rules.
 EOF
index 3b71774c6e0af7b15d36b4057258ac77ee12db0c..6d7c3c0dadb803060739e6db2804618eafe5151a 100644 (file)
@@ -126,48 +126,52 @@ This is set when the -D command-line option is present.
 .fi
 The following \fBmain.cf\fR configuration parameters are
 exported as environment variables with the same names:
+.IP "\fBconfig_directory (see 'postconf -d' output)\fR"
+The default location of the Postfix main.cf and master.cf
+configuration files.
 .IP "\fBcommand_directory (see 'postconf -d' output)\fR"
 The location of all postfix administrative commands.
 .IP "\fBdaemon_directory (see 'postconf -d' output)\fR"
 The directory with Postfix support programs and daemon programs.
-.IP "\fBconfig_directory (see 'postconf -d' output)\fR"
-The default location of the Postfix main.cf and master.cf
-configuration files.
-.IP "\fBqueue_directory (see 'postconf -d' output)\fR"
-The location of the Postfix top-level queue directory.
+.IP "\fBhtml_directory (see 'postconf -d' output)\fR"
+The location of Postfix HTML files that describe how to build,
+configure or operate a specific Postfix subsystem or feature.
 .IP "\fBmail_owner (postfix)\fR"
 The UNIX system account that owns the Postfix queue and most Postfix
 daemon processes.
-.IP "\fBsetgid_group (postdrop)\fR"
-The group ownership of set-gid Postfix commands and of group-writable
-Postfix directories.
-.IP "\fBsendmail_path (see 'postconf -d' output)\fR"
-A Sendmail compatibility feature that specifies the location of
-the Postfix \fBsendmail\fR(1) command.
-.IP "\fBnewaliases_path (see 'postconf -d' output)\fR"
-Sendmail compatibility feature that specifies the location of the
-\fBnewaliases\fR(1) command.
 .IP "\fBmailq_path (see 'postconf -d' output)\fR"
 Sendmail compatibility feature that specifies where the Postfix
 \fBmailq\fR(1) command is installed.
-.IP "\fBhtml_directory (see 'postconf -d' output)\fR"
-The location of Postfix HTML files that describe how to build,
-configure or operate a specific Postfix subsystem or feature.
 .IP "\fBmanpage_directory (see 'postconf -d' output)\fR"
 Where the Postfix manual pages are installed.
+.IP "\fBnewaliases_path (see 'postconf -d' output)\fR"
+Sendmail compatibility feature that specifies the location of the
+\fBnewaliases\fR(1) command.
+.IP "\fBqueue_directory (see 'postconf -d' output)\fR"
+The location of the Postfix top-level queue directory.
 .IP "\fBreadme_directory (see 'postconf -d' output)\fR"
 The location of Postfix README files that describe how to build,
 configure or operate a specific Postfix subsystem or feature.
+.IP "\fBsendmail_path (see 'postconf -d' output)\fR"
+A Sendmail compatibility feature that specifies the location of
+the Postfix \fBsendmail\fR(1) command.
+.IP "\fBsetgid_group (postdrop)\fR"
+The group ownership of set-gid Postfix commands and of group-writable
+Postfix directories.
 .PP
 Available in Postfix version 2.5 and later:
 .IP "\fBdata_directory (see 'postconf -d' output)\fR"
 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
 Other configuration parameters:
-.IP "\fBconfig_directory (see 'postconf -d' output)\fR"
-The default location of the Postfix main.cf and master.cf
-configuration files.
 .IP "\fBimport_environment (see 'postconf -d' output)\fR"
 The list of environment parameters that a Postfix process will
 import from a non-Postfix parent process.
@@ -216,6 +220,7 @@ $config_directory/master.cf, Postfix daemon processes
 $daemon_directory/postfix-files, file/directory permissions
 $daemon_directory/postfix-script, administrative commands
 $daemon_directory/post-install, post-installation configuration
+$daemon_directory/dynamicmaps.cf, plug-in database clients
 .SH "SEE ALSO"
 .na
 .nf
index e1eb62e01a535aa036c52abac51d6e1c903a3251..7e0ae6db5491c90342375d53c48df7e48443b92b 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
@@ -5837,6 +5844,18 @@ The group ownership of set-gid Postfix commands and of group-writable
 Postfix directories. When this parameter value is changed you need
 to re-run "\fBpostfix set-permissions\fR" (with Postfix version 2.0 and
 earlier: "\fB/etc/postfix/post-install set-permissions\fR".
+.SH shlib_directory (default: see 'postconf -d' output)
+The location of Postfix shared libraries (libpostfix-*.so.*).
+This parameter defaults to "no" when Postfix shared libraries are
+disabled at compile time.
+.PP
+NOTE: 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 compiled-in
+default $shlib_directory location.
+.PP
+This feature is available in Postfix 2.12 and later.
 .SH show_user_unknown_table_name (default: yes)
 Display the name of the recipient table in the "User unknown"
 responses.  The extra detail makes trouble shooting easier but also
index 0afd34830e5b4da114c11a9071dce8ee0e686ea6..72181e65d45b2a34a07fa8b1691ec6811b0fff44 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;
@@ -435,6 +436,7 @@ while (<>) {
     s;\bsendmail_fix_line_endings\b;<a href="postconf.5.html#sendmail_fix_line_endings">$&</a>;g;
     s;\bservice_throttle_time\b;<a href="postconf.5.html#service_throttle_time">$&</a>;g;
     s;\bsetgid_group\b;<a href="postconf.5.html#setgid_group">$&</a>;g;
+    s;\bshlib_directory\b;<a href="postconf.5.html#shlib_directory">$&</a>;g;
 
     s;\bconnection_cache_service_name\b;<a href="postconf.5.html#connection_cache_service_name">$&</a>;g;
     s;\bconnection_cache_status_update_time\b;<a href="postconf.5.html#connection_cache_status_update_time">$&</a>;g;
@@ -1129,6 +1131,10 @@ while (<>) {
     s/\b(lmtp):/<a href="lmtp.8.html">$1<\/a>:/g;
     s/\b(local):/<a href="local.8.html">$1<\/a>:/g;
     s/([^\/])\b(virtual):/$1<a href="virtual.8.html">$2<\/a>:/g;
+
+    # Database library dependencies.
+
+    s/\b(AUXLIBS_)([A-Z]+)\b/<a href="$2_README.html">$1$2<\/a>/g;
 }
 continue {
     if ($printit)
diff --git a/postfix/plugins/.keep b/postfix/plugins/.keep
new file mode 100644 (file)
index 0000000..e69de29
index 055fa080eea2c10e29d355182ebb04b872556710..416bd0aa6975bbdd09b7e4dd612e32b98e245c6e 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.
+# .IP shlib_directory
+#      The final destination directory for Postfix shared-library files.
+#      The built-in default value is specified at compile time.
+#      If you change this at installation time, then you should specify
+#      only "standard" system directories. Otherwise, additional
+#      configuration will be required with ldconfig(1) or equivalent.
 # SEE ALSO
 #      post-install(1) post-installation procedure
 # FILES
@@ -253,7 +264,7 @@ compare_or_replace() {
 }
 
 myreadlink() {
-    ls -l -- "$@" | awk '
+    ls -ld -- "$@" 2>/dev/null | awk '
        /->/ { print $NF; next } 
        { exit(1) }  
     '
@@ -376,6 +387,13 @@ 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."
+
+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.
 
 : ${install_root=/}
@@ -438,8 +456,9 @@ 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"
+html_directory mail_owner mailq_path manpage_directory newaliases_path \
+queue_directory readme_directory sendmail_path setgid_group shlib_directory \
+plugin_directory"
 
 # Extract parameter settings from the installed main.cf file.
 
@@ -501,7 +520,7 @@ case "$manpage_directory" in
      exit 1;;
 esac
 
-for path in "$html_directory" "$readme_directory"
+for path in "$html_directory" "$readme_directory" "$shlib_directory" "$plugin_directory"
 do
    case "$path" in
    /*) ;;
@@ -529,12 +548,16 @@ do
 done
 
 for path in command_directory config_directory daemon_directory data_directory \
-    manpage_directory queue_directory html_directory readme_directory
+    manpage_directory queue_directory shlib_directory plugin_directory html_directory \
+    readme_directory
 do
-    eval test -f $install_root\$$path && {
+   case "$path" in
+   no) ;;
+    *) eval test -f $install_root\$$path && {
        echo $0: Error: \"$path\" specifies a regular file. 1>&2
        exit 1
-    }
+   };;
+   esac
 done
 
 test -d $tempdir || mkdir -p $tempdir || exit 1
@@ -581,12 +604,18 @@ SENDMAIL_PATH=$install_root$sendmail_path
 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 $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 || 
        mkdir -p $HTML_DIRECTORY || exit 1
 test "$readme_directory" = "no" -o -d $README_DIRECTORY || 
@@ -674,6 +703,13 @@ do
 
      f) echo $path | (IFS=/ read prefix file; IFS="$BACKUP_IFS"
        case $prefix in
+       '$shlib_directory')
+           compare_or_replace $mode "$owner" "$group" lib/$file \
+                   $SHLIB_DIRECTORY/$file || exit 1;;
+       '$plugin_directory')
+           test ! -f plugins/$file ||
+               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;;
@@ -755,6 +791,8 @@ bin/postconf -c $CONFIG_DIRECTORY -e \
     "manpage_directory = $manpage_directory" \
     "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 afe8a82eeea7135e800bcefdadc90a0e97f0101f..7cd8d7250e1beb743f6fd5616cf5cdf9e27ceb2c 100644 (file)
@@ -67,7 +67,7 @@ like: </p>
 % make tidy
 % CDB=../../../tinycdb-0.5
 % make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
-    "AUXLIBS=$CDB/libcdb.a"
+    "AUXLIBS_CDB=$CDB/libcdb.a"
 % make
 </pre>
 </blockquote>
@@ -79,11 +79,26 @@ like: </p>
 % make tidy
 % CDB=../../../cdb-0.75
 % make -f Makefile.init makefiles "CCARGS=-DHAS_CDB -I$CDB" \
-    "AUXLIBS=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
+    "AUXLIBS_CDB=$CDB/cdb.a $CDB/alloc.a $CDB/buffer.a $CDB/unix.a $CDB/byte.a"
 % make
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_CDB.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded CDB database client, but only the new
+AUXLIBS_CDB variable supports building a dynamically-loaded or
+statically-loaded CDB database client.  </p>
+
+<blockquote>
+
+<p> Failure to use the AUXLIBS_CDB variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have CDB database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+
+</blockquote>
+
 <p> After Postfix has been built with cdb support, you can use
 "cdb" tables wherever you can use read-only "hash", "btree" or
 "dbm" tables. However, the "<b>postmap -i</b>" (incremental record
index 383e9faecc33af183f0e899fc23a52b1dd9d1a49..47e958ed00d92aad70fd94d2bfa8003a202110fb 100644 (file)
@@ -229,7 +229,158 @@ $ make
 
 <p> and so on. In some cases, optimization is turned off automatically. </p>
 
-<h3>4.3 - Building with optional features</h3>
+<h3>4.3 - Building with Postfix shared libraries and database plugins
+(Postfix &ge; 2.12) </h3>
+
+<p> Postfix shared-library and database plugin support exists for
+recent versions of Linux, FreeBSD and MacOS X. Shared-library builds
+may become the default at some point in the future. </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> Specify "shared=yes" on the "make makefiles" command line to
+build Postfix with shared-library support. </p>
+
+<blockquote>
+<pre>
+$ make makefiles shared=yes ...other arguments...
+$ make makefiles shared=no ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> This defaults to installing shared libraries in /usr/local/lib,
+typically with names like libpostfix-<i>name</i>.so.<i>version</i>,
+where the <i>name</i> is a source-code directory name such as "util"
+or "global", and the <i>version</i> is the Postfix version:
+<i>x.y.z</i> for stable releases, <i>x.y</i>-<i>date</i> for snapshot
+(development) releases, or <i>x.y</i>-<i>date</i>-nonprod for
+non-production releases.  </p>
+
+<p> To override the default location or shared-library version,
+specify, for example: </p>
+
+<blockquote>
+<pre>
+$ make makefiles shared=yes shlib_directory=/usr/lib \
+    SHLIB_VERSION=1 ...other arguments...
+</pre>
+</blockquote>
+
+<p> You can change the shlib_directory setting after Postfix is
+built, with "make install" or "make upgrade". However, you may have
+to run ldconfig if you change shlib_directory after Postfix is built
+and install the libpostfix-*.so.* files in a non-system directory.
+No ldconfig is needed if you keep the libpostfix-*.so.* files in
+the compiled-in default $shlib_directory location. </p>
+
+<p> Additionally, Postfix can be built to support dynamic loading
+of Postfix database clients with the Debian-style dynamicmaps
+feature. Postfix 2.12 supports dynamic loading of cdb:, ldap:,
+lmdb:, mysql:, pcre:, pgsql:, sdbm:, and sqlite: database clients.
+Dynamic loading is useful when you distribute or install 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 (database plugins) with the Debian-style dynamicmaps feature.
+</p>
+
+<blockquote>
+<pre>
+$ make makefiles dynamicmaps=yes ...other arguments...
+$ make makefiles dynamicmaps=no ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> This implicitly enables shared-library support, and defaults
+to installing dynamicmaps.cf and database plugins in /usr/libexec/postfix.
+Database plugins are typically named postfix-<i>type</i>.so.<i>version</i>
+where the <i>type</i> is a database type such as "cdb" or "ldap",
+and where 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>
+
+<blockquote>
+
+<p> NOTE: The Postfix 2.12 build procedure expects that you specify
+database library dependencies with variables named AUXLIBS_CDB,
+AUXLIBS_LDAP, etc.  With Postfix 2.12 and later, the old AUXLIBS
+variable still supports building a statically-loaded database client,
+but only the new AUXLIBS_CDB etc. variables support building a
+dynamically-loaded or statically-loaded CDB etc. database client.
+See CDB_README, LDAP_README, etc. for details.  </p>
+
+<p> Failure to follow this advice will defeat the purpose of dynamic
+database client loading. Every Postfix executable file will have
+database library dependencies. And that was exactly what dynamic
+database client loading was meant to avoid. </p>
+
+</blockquote>
+
+<p> To override the default location or shared-library version,
+specify, for example: </p>
+
+<blockquote>
+<pre>
+% make makefiles dynamicmaps=yes plugin_directory=/usr/lib/postfix \
+    SHLIB_VERSION=1  ...
+</pre>
+</blockquote>
+
+<p> You can also override the plugin_directory setting after Postfix
+is built, with "make install" or "make upgrade". In this case, there
+is no need to run the ldconfig command. </p>
+
+<p> Tips for distribution maintainers: 
+
+<ul>
+
+<li> <p> The postfix-install procedure creates a compatibility
+symlink dynamicmaps.cf -> dynamicmaps.cf.<i>version</i> (as well
+as a symlink dynamicmaps.cf.d -> dynamicmaps.cf.<i>version</i>.d;
+more on that below).  It is therefore safe to use "unversioned"
+configuration file names when installing or deinstalling a database
+plugin. However, Postfix itself will use the "versioned" names, to
+allow minor upgrades to happen without having to stop Postfix. </p>
+
+<li> <p> The configuration file dynamicmaps.cf.<i>version</i> will
+automatically include files under the directory
+dynamicmaps.cf.d.<i>version</i>, just like the configuration file
+postfix-files will automatically include files under the directory
+postfix-files.d.  Thanks to this, you don't have to edit postfix-files
+or dynamicmaps.cf, when installing or deinstalling a database plugin
+package. Instead, each plugin can have its own configuration file.
+</p>
+
+<li> <p> The plugin_directory setting provides the default directory
+for shared-library objects with a relative pathname in the file
+dynamicmaps.cf.<i>version</i>.
+
+<li> <p> Each configuration file under the directory
+dynamicmaps.cf.d.<i>version</i> must have a name that ends in ".cf"
+and must have the same format as the file dynamicmaps.cf.<i>version</i>.
+</p>
+
+<li> <p> The directory dynamicmaps.cf.d.<i>version</i> is the default
+directory for shared-library objects with a relative pathname in
+the files dynamicmaps.cf.d.<i>version</i>/*.cf.  Thus, the directory
+dynamicmaps.cf.d.<i>version</i> may contain both configuration files
+and shared-library object files.  Hence, the requirement that
+configuration file names must end in ".cf".  </p>
+
+<li> <p> Each configuration file under the directory postfix-files.d
+must have the same format as the configuration file postfix-files.
+There is no requirement that these configuration file names have a
+specific format.  </p>
+
+</ul>
+
+<h3>4.4 - Building with optional features</h3>
 
 By default, Postfix builds as a mail system with relatively few
 bells and whistles. Support for third-party databases etc.
@@ -277,7 +428,66 @@ Postfix 2.2 </td> </tr>
 systems that have IPv6 support. See the IPV6_README file for details.
 </p>
 
-<h3>4.4 - Overriding built-in parameter default settings</h3>
+<h3>4.5 - Overriding built-in parameter default settings</h3>
+
+<h4>4.5.1 - Postfix 2.12 and later </h4>
+
+<p> All Postfix configuration parameters can be changed by editing
+a Postfix configuration file, except for one: the parameter that
+specifies the location of Postfix configuration files. In order to
+build Postfix with a configuration directory other than /etc/postfix,
+use: </p>
+
+<blockquote>
+<pre>
+$ make makefiles config_directory=/some/where ...other arguments...
+$ make
+</pre>
+</blockquote>
+
+<p> Parameters whose defaults can be specified in this way are
+listed below. See the postconf(5) manpage for a description
+(command: "<tt>nroff -man man/man5/postconf.5 | less</tt>").  </p>
+
+<blockquote>
+
+<table border="1">
+
+<tr> <th>parameter name</th>  <th>typical default</th> </tr>
+
+<tr> <td>command_directory</td> <td>/usr/sbin</td> </tr>
+
+<tr> <td>config_directory</td> <td>/etc/postfix</td> </tr>
+
+<tr> <td>default_database_type</td> <td>hash</td> </tr>
+
+<tr> <td>daemon_directory</td> <td>/usr/libexec/postfix</td> </tr>
+
+<tr> <td>data_directory</td> <td>/var/lib/postfix</td> </tr>
+
+<tr> <td>html_directory</td> <td>no</td> </tr>
+
+<tr> <td>mailq_path</td> <td>/usr/bin/mailq</td> </tr>
+
+<tr> <td>manpage_directory</td> <td>/usr/local/man</td> </tr>
+
+<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>
+
+<tr> <td>sendmail_path</td> <td>/usr/sbin/sendmail</td> </tr>
+
+<tr> <td>shlib_directory</td> <td>/usr/local/lib</td> </tr>
+
+</table>
+
+</blockquote>
+
+<h4>4.5.2 - All Postfix versions </h4>
 
 <p> All Postfix configuration parameters can be changed by editing
 a Postfix configuration file, except for one: the parameter that
@@ -295,7 +505,9 @@ $ make
 <p> IMPORTANT: Be sure to get the quotes right. These details matter
 a lot. </p>
 
-<p> Parameters whose defaults can be specified in this way are: </p>
+<p> Parameters whose defaults can be specified in this way are
+listed below. See the postconf(5) manpage for a description
+(command: "<tt>nroff -man man/man5/postconf.5 | less</tt>").  </p>
 
 <blockquote>
 
@@ -347,7 +559,7 @@ default</th> </tr>
 <p> Note: the data_directory parameter (for caches and pseudo-random
 numbers) was introduced with Postfix version 2.5. </p>
 
-<h3>4.5 - Overriding other compile-time features</h3>
+<h3>4.6 - Overriding other compile-time features</h3>
 
 <p> The general method to override Postfix compile-time features
 is as follows: </p>
@@ -366,7 +578,10 @@ $ make
 <tr> <th colspan="2"> Name/Value </th> <th> Description </th> </tr>
 
 <tr> <td colspan="2"> AUXLIBS="object_library..."</td> <td> Specifies
-one or more non-default object libraries. </td> </tr>
+one or more non-default object libraries. Postfix 2,12 and later
+specify some of their database library dependencies with AUXLIBS_CDB,
+AUXLIBS_LDAP, AUXLIBS_LMDB, AUXLIBS_MYSQL, AUXLIBS_PCRE, AUXLIBS_PGSQL,
+AUXLIBS_SDBM, and AUXLIBS_SQLITE, respectively. </td> </tr>
 
 <tr> <td colspan="2"> CC=compiler_command</td> <td> Specifies a
 non-default compiler. On many systems, the default is <tt>gcc</tt>.
@@ -381,7 +596,7 @@ off Postfix features at compile time:</td> </tr>
 DB support. By default, Berkeley DB support is compiled in on
 platforms that are known to support this feature. If you override
 this, then you probably should also override DEF_DB_TYPE as described
-in section 4.4.  </td> </tr>
+in section 4.5.  </td> </tr>
 
 <tr> <td> </td> <td> -DNO_DEVPOLL </td> <td> Do not build with
 Solaris <tt>/dev/poll</tt> support. By default, <tt>/dev/poll</tt>
@@ -432,6 +647,12 @@ Specify DEBUG= to turn off debugging. </td> </tr>
 a non-default optimization level. The default is -O.  Specify OPT=
 to turn off optimization. </td> </tr>
 
+<tr> <td colspan="2"> SHLIB_VERSION=version </td> <td> Specifies a
+non-default Postfix shared-library version number. The default is
+to use the Postfix version: X.Y.Z for stable releases, X.Y-DATE for
+snapshot releases, X.Y-DATE-nonprod for non-production releases.
+</td> </tr>
+
 <tr> <td colspan="2"> WARN="warning_flags..." </td> <td> Specifies
 non-default <tt>gcc</tt> compiler warning options for use when
 "<tt>make</tt>" is invoked in a source subdirectory only. </td>
@@ -439,7 +660,7 @@ non-default <tt>gcc</tt> compiler warning options for use when
 
 </table>
 
-<h3>4.6 - Support for thousands of processes</h3>
+<h3>4.7 - Support for thousands of processes</h3>
 
 <p> The number of connections that Postfix can manage simultaneously
 is limited by the number of processes that it can run.  This number
@@ -487,7 +708,7 @@ operating system is configured to handle thousands of connections.
 See the TUNING_README guide for examples of how to increase the
 number of open sockets or files. </p>
 
-<h3>4.7 - Compiling Postfix, at last</h3>
+<h3>4.8 - Compiling Postfix, at last</h3>
 
 <p> If the command </p>
 
index 62905a7f12fa3509afdac72b977ffa23b942c567..4d63e710115ddf7e3d0004ba9502ab2878ba7d66 100644 (file)
@@ -92,10 +92,25 @@ your Postfix source tree should work: </p>
 <pre>
 % make tidy
 % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
-    AUXLIBS="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
+    AUXLIBS_LDAP="-L/usr/local/lib -lldap -L/usr/local/lib -llber"
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_LDAP.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded LDAP database client, but only the new
+AUXLIBS_LDAP variable supports building a dynamically-loaded or
+statically-loaded LDAP database client.  </p>
+
+<blockquote>
+<p> Failure to use the AUXLIBS_LDAP variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have LDAP database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> On Solaris 2.x you may have to specify run-time link information,
 otherwise ld.so will not find some of the shared libraries: </p>
 
@@ -103,7 +118,7 @@ otherwise ld.so will not find some of the shared libraries: </p>
 <pre>
 % make tidy
 % make makefiles CCARGS="-I/usr/local/include -DHAS_LDAP" \
-    AUXLIBS="-L/usr/local/lib -R/usr/local/lib -lldap \
+    AUXLIBS_LDAP="-L/usr/local/lib -R/usr/local/lib -lldap \
             -L/usr/local/lib -R/usr/local/lib -llber"
 </pre>
 </blockquote>
index a0d4c332a20b1649121121cf2ba91c34b1a715c8..ddbb9f3b219e54b686be2a17e6a7d70e48201d5f 100644 (file)
@@ -50,17 +50,33 @@ build Postfix with LMDB support, use something like: </p>
 <blockquote>
 <pre>
 % make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
-    AUXLIBS="-L/usr/local/lib -llmdb"
+    AUXLIBS_LMDB="-L/usr/local/lib -llmdb"
 % make
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_LMDB.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded LMDB database client, but only the new
+AUXLIBS_LMDB variable supports building a dynamically-loaded or 
+statically-loaded LMDB database client.  </p>
+
+<blockquote>
+<p> Failure to use the AUXLIBS_LMDB variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have LMDB database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
+
 <p> Solaris may need this: </p>
 
 <blockquote>
 <pre>
 % make makefiles CCARGS="-DHAS_LMDB -I/usr/local/include" \
-    AUXLIBS="-R/usr/local/lib -L/usr/local/lib -llmdb"
+    AUXLIBS_LMDB="-R/usr/local/lib -L/usr/local/lib -llmdb"
 % make
 </pre>
 </blockquote>
@@ -81,7 +97,7 @@ undefined reference to `pthread_mutex_lock'
 
 <blockquote>
 <pre>
-% make makefiles .... AUXLIBS="... -lpthread"
+% make makefiles .... AUXLIBS_LMDB="... -lpthread"
 </pre>
 </blockquote>
 
index 5ec69fccbf19f29f8dd5b6cac59379dd328039b2..43fb08ff9499aa2280d8b7658fcb4ca3fb3fbc6a 100644 (file)
@@ -52,23 +52,38 @@ which can be obtained from: </p>
 
 <p> In order to build Postfix with mysql map support, you will need to add
 -DHAS_MYSQL and -I for the directory containing the mysql headers, and
-the mysqlclient library (and libm) to AUXLIBS, for example: </p>
+the mysqlclient library (and libm) to AUXLIBS_MYSQL, for example: </p>
 
 <blockquote>
 <pre>
 make -f Makefile.init makefiles \
     'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
-    'AUXLIBS=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
+    'AUXLIBS_MYSQL=-L/usr/local/mysql/lib -lmysqlclient -lz -lm'
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_MYSQL.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded MySQL database client, but only the new
+AUXLIBS_MYSQL variable supports building a dynamically-loaded or 
+statically-loaded MySQL database client.  </p>
+
+<blockquote>
+<p> Failure to use the AUXLIBS_MYSQL variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have MYSQL database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> On Solaris, use this instead: </p>
 
 <blockquote>
 <pre>
 make -f Makefile.init makefiles \
     'CCARGS=-DHAS_MYSQL -I/usr/local/mysql/include' \
-    'AUXLIBS=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
+    'AUXLIBS_MYSQL=-L/usr/local/mysql/lib -R/usr/local/mysql/lib \
         -lmysqlclient -lz -lm'
 </pre>
 </blockquote>
index b22e0a95850adc1fd7558a09160b2630123a54bf..afaa99888401a683a5041483ecfce01803e26d61 100644 (file)
@@ -94,6 +94,8 @@ README        = ../README_FILES/ADDRESS_CLASS_README \
 
 MAN    = ../man/man5/postconf.5
 
+TOP    = ../INSTALL
+
 AWK    = awk '{ print; if (NR == 1) print ".pl 9999\n.ll 65" }'
 SRCTOMAN= ../mantools/srctoman
 POSTLINK= ../mantools/postlink
@@ -104,7 +106,7 @@ MAKEAAA     = ../mantools/makereadme
 MAKESOHO= ../mantools/make_soho_readme
 DEPSOHO        = SASL_README.html STANDARD_CONFIGURATION_README.html
 
-update:        $(CONFIG) $(HTML) $(README) $(MAN)
+update:        $(CONFIG) $(HTML) $(README) $(MAN) $(TOP)
 
 clean:
        :
@@ -486,3 +488,7 @@ clobber:
        (cat postconf.html.prolog; ../mantools/xpostconf postconf.proto | \
            ../mantools/postconf2html | ../mantools/postlink; \
            cat postconf.html.epilog ) | $(DETAB) > $@
+
+../INSTALL: ../README_FILES/INSTALL
+       rm -f $@
+       col -b < $? > $@
index f48a82dcea0eed50832b45ed335d0abfa7a65cef..21cc28844fab3dea56d12fc7ee5156f9ea48c7b8 100644 (file)
@@ -55,25 +55,30 @@ ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/.
 <p> NOTE: pcre versions prior to 2.06 cannot be used. </p>
 
 <p> In order to build Postfix with PCRE support you need to add
--DHAS_PCRE and a -I for the PCRE include file to CCARGS, and add
-the path to the PCRE library to AUXLIBS, for example: </p>
+-DHAS_PCRE and a -I option for the PCRE include file to CCARGS, and
+add the path to the PCRE library to AUXLIBS_PCRE, for example: </p>
 
 <blockquote>
 <pre>
 make -f Makefile.init makefiles \
-    "CCARGS=-DHAS_PCRE -I/usr/local/include" \
-    "AUXLIBS=-L/usr/local/lib -lpcre"
+    "CCARGS=-DHAS_PCRE `pcre-config --cflags`" \
+    "AUXLIBS_PCRE=`pcre-config --libs`"
 </pre>
 </blockquote>
 
-<p> Solaris needs run-time path information too: </p>
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_PCRE.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded PCRE database client, but only the new
+AUXLIBS_PCRE variable supports building a dynamically-loaded or 
+statically-loaded PCRE database client.  </p>
 
 <blockquote>
-<pre>
-make -f Makefile.init makefiles \
-    "CCARGS=-DHAS_PCRE -I/usr/local/include" \
-    "AUXLIBS=-L/usr/local/lib -R/usr/local/lib -lpcre"
-</pre>
+<p> Failure to use the AUXLIBS_PCRE variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have PCRE library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
 </blockquote>
 
 <h2>Things to know</h2>
index eb31a9826a1de261097662bb23e1833eef8c244d..449a2e63bbb8fc772c8cdab3cce3046c57aefe64 100644 (file)
@@ -53,10 +53,25 @@ the location of the libpq library file. </p>
 % make tidy
 % make -f Makefile.init makefiles \
         'CCARGS=-DHAS_PGSQL -I/usr/local/include/pgsql' \
-        'AUXLIBS=-L/usr/local/lib -lpq'
+        'AUXLIBS_PGSQL=-L/usr/local/lib -lpq'
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_PGSQL.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded PostgreSQL database client, but only
+the new AUXLIBS_PGSQL variable supports building a dynamically-loaded
+or statically-loaded PostgreSQL database client.  </p>
+
+<blockquote>
+<p> Failure to use the AUXLIBS_PGSQL variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have PGSQL database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> Then just run 'make'.  </p>
 
 <h2>Configuring PostgreSQL lookup tables</h2>
index 676e411ac50b237e2452fac528e161f0554778da..8cde238d17d96ff7db7cf619746f2e579248155a 100644 (file)
@@ -44,10 +44,25 @@ name of the standard POSIX thread library (pthread).  For example:
 <pre>
 make -f Makefile.init makefiles \
      'CCARGS=-DHAS_SQLITE -I/usr/local/include' \
-     'AUXLIBS=-L/usr/local/lib -lsqlite3 -lpthread'
+     'AUXLIBS_SQLITE=-L/usr/local/lib -lsqlite3 -lpthread'
 </pre>
 </blockquote>
 
+<p> Postfix versions before 2.12 use AUXLIBS instead of AUXLIBS_SQLITE.
+With Postfix 2.12 and later, the old AUXLIBS variable still supports
+building a statically-loaded SQLite database client, but only the new
+AUXLIBS_SQLITE variable supports building a dynamically-loaded or 
+statically-loaded SQLite database client.  </p>
+
+<blockquote>
+<p> Failure to use the AUXLIBS_SQLITE variable will defeat the purpose
+of dynamic database client loading. Every Postfix executable file
+will have SQLITE database library dependencies. And that was exactly
+what dynamic database client loading was meant to avoid. </p>
+</blockquote>
+
 <p> Then, just run 'make'.</p>
 
 <h2>Using SQLite tables</h2>
index cd82f401c93b465c82681f1b3c046a63fb68e896..79e9581f079afb924fd99891581db11a1be26a9a 100644 (file)
@@ -15897,3 +15897,26 @@ status code or explanatory text of successful or unsuccessful
 deliveries.  See default_delivery_status_filter for details.  </p>
 
 <p> This feature is available in Postfix 2.12 and later. </p>
+
+%PARAM shlib_directory see 'postconf -d' output
+
+<p> The location of Postfix shared libraries (libpostfix-*.so.*).
+This parameter defaults to "no" when Postfix shared libraries are
+disabled at compile time. </p>
+
+<p> NOTE: 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 compiled-in
+default $shlib_directory location. </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 6b2cab9156180447f2926678bfe1872f101216bf..821d26e05c44e35b304b431962d34148a23e732a 100644 (file)
@@ -1304,3 +1304,32 @@ kbyte
 llmdb
 lockfiles
 slmdb
+DEVPOLL
+DNO
+EPOLL
+GETPW
+KQUEUE
+MacOS
+NISPLUS
+SHLIB
+SIGSETJMP
+SQLITE
+SQLite
+deinstalling
+dynamicmaps
+gcc
+getpwnam
+getpwuid
+ldconfig
+libpostfix
+longjmp
+nonprod
+setjmp
+shlib
+siglongjmp
+sigsetjmp
+sqlite
+unversioned
+versioned
+DNSWL
+cbc
index 14772fa32222505f15e09eb9b9a72ac2b29bde74..3d6539bb7c205a712aad848bad5a8a7d4111caf2 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = anvil
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 8c98151db2470b5691c7455b24e8c69678825669..f070b21820cda0e40f8cc38ae96b7036356a364c 100644 (file)
@@ -15,14 +15,16 @@ TESTPROG=
 PROG   = bounce
 SAMPLES        = ../../conf/bounce.cf.default
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:;  $(CC) $(CFLAGS) -c $*.c
 
 all:   $(PROG) ../../conf/bounce.cf.default
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 # Eliminate dependency on installed Postfix.
 ../../conf/bounce.cf.default: template_test.ref annotate.sh
index 289cea2629c50f48df7dfd8f0661809944506e0b..25d04197d2db92f9ded0776d26b82e9860940e90 100644 (file)
@@ -18,13 +18,15 @@ CFLAGS      = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= cleanup_masquerade cleanup_milter
 PROG   = cleanup
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libmilter.a ../../lib/libglobal.a \
-       ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/libmilter.a \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
@@ -88,15 +90,15 @@ root_tests:
 
 cleanup_masquerade_test: cleanup_masquerade cleanup_masq.ref
        rm -f cleanup_masq.tmp
-       ./cleanup_masquerade '' a.b.c,b.c xxx@aa.a.b.c    >>cleanup_masq.tmp
-       ./cleanup_masquerade 'xxx' a.b.c,b.c xxx@aa.a.b.c >>cleanup_masq.tmp
-       ./cleanup_masquerade 'yyy' a.b.c,b.c xxx@aa.a.b.c >>cleanup_masq.tmp
-       ./cleanup_masquerade '' !a.b.c,b.c xxx@aa.a.b.c   >>cleanup_masq.tmp
-       ./cleanup_masquerade '' a.b.c,b.c xxx@a.b.c       >>cleanup_masq.tmp
-       ./cleanup_masquerade '' !a.b.c,b.c xxx@a.b.c      >>cleanup_masq.tmp
-       ./cleanup_masquerade '' a.b.c,b.c xxx@aaa.b.c     >>cleanup_masq.tmp
-       ./cleanup_masquerade '' a.b.c,b.c xxx@b.c         >>cleanup_masq.tmp
-       ./cleanup_masquerade 'fail:whatever' xy xxx@b.c   >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade '' a.b.c,b.c xxx@aa.a.b.c    >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade 'xxx' a.b.c,b.c xxx@aa.a.b.c >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade 'yyy' a.b.c,b.c xxx@aa.a.b.c >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade '' !a.b.c,b.c xxx@aa.a.b.c   >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade '' a.b.c,b.c xxx@a.b.c       >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade '' !a.b.c,b.c xxx@a.b.c      >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade '' a.b.c,b.c xxx@aaa.b.c     >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade '' a.b.c,b.c xxx@b.c         >>cleanup_masq.tmp
+       $(SHLIB_ENV) ./cleanup_masquerade 'fail:whatever' xy xxx@b.c   >>cleanup_masq.tmp
        diff cleanup_masq.ref cleanup_masq.tmp
        rm -f cleanup_masq.tmp
 
@@ -109,10 +111,10 @@ bug1_test: cleanup_milter bug1.file bug1.in bug1.ref bug1.text.ref \
        ../postcat/postcat
        cp bug1.file bug1.file.tmp
        chmod u+w bug1.file.tmp
-       ./cleanup_milter <bug1.in
-       ../postcat/postcat -ov bug1.file.tmp 2>/dev/null >bug1.tmp
+       $(SHLIB_ENV) ./cleanup_milter <bug1.in
+       $(SHLIB_ENV) ../postcat/postcat -ov bug1.file.tmp 2>/dev/null >bug1.tmp
        diff bug1.ref bug1.tmp
-       ../postcat/postcat bug1.file.tmp 2>/dev/null >bug1.tmp
+       $(SHLIB_ENV) ../postcat/postcat bug1.file.tmp 2>/dev/null >bug1.tmp
        diff bug1.text.ref bug1.tmp
        rm -f bug1.file.tmp bug1.tmp
 
@@ -120,10 +122,10 @@ bug2_test: cleanup_milter bug2.file bug2.in bug2.ref bug2.text.ref \
        ../postcat/postcat
        cp bug2.file bug2.file.tmp
        chmod u+w bug2.file.tmp
-       ./cleanup_milter <bug2.in
-       ../postcat/postcat -ov bug2.file.tmp 2>/dev/null >bug2.tmp
+       $(SHLIB_ENV) ./cleanup_milter <bug2.in
+       $(SHLIB_ENV) ../postcat/postcat -ov bug2.file.tmp 2>/dev/null >bug2.tmp
        diff bug2.ref bug2.tmp
-       ../postcat/postcat bug2.file.tmp 2>/dev/null >bug2.tmp
+       $(SHLIB_ENV) ../postcat/postcat bug2.file.tmp 2>/dev/null >bug2.tmp
        diff bug2.text.ref bug2.tmp
        rm -f bug2.file.tmp bug2.tmp
 
@@ -131,10 +133,10 @@ bug3_test: cleanup_milter bug3.file bug3.in bug3.ref bug3.text.ref \
        ../postcat/postcat
        cp bug3.file bug3.file.tmp
        chmod u+w bug3.file.tmp
-       ./cleanup_milter <bug3.in
-       ../postcat/postcat -ov bug3.file.tmp 2>/dev/null >bug3.tmp
+       $(SHLIB_ENV) ./cleanup_milter <bug3.in
+       $(SHLIB_ENV) ../postcat/postcat -ov bug3.file.tmp 2>/dev/null >bug3.tmp
        diff bug3.ref bug3.tmp
-       ../postcat/postcat bug3.file.tmp 2>/dev/null >bug3.tmp
+       $(SHLIB_ENV) ../postcat/postcat bug3.file.tmp 2>/dev/null >bug3.tmp
        diff bug3.text.ref bug3.tmp
        rm -f bug3.file.tmp bug3.tmp
 
@@ -144,8 +146,8 @@ cleanup_milter_test: cleanup_milter test-queue-file cleanup_milter.in1 \
        cleanup_milter.ref1 ../postcat/postcat
        cp test-queue-file test-queue-file.tmp
        chmod u+w test-queue-file.tmp
-       ./cleanup_milter <cleanup_milter.in1
-       ../postcat/postcat -ov test-queue-file.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in1
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref1 cleanup_milter.tmp
        rm -f test-queue-file.tmp cleanup_milter.tmp
 
@@ -153,8 +155,8 @@ cleanup_milter_test2: cleanup_milter test-queue-file2 cleanup_milter.in2 \
        cleanup_milter.ref2 ../postcat/postcat
        cp test-queue-file2 test-queue-file2.tmp
        chmod u+w test-queue-file2.tmp
-       ./cleanup_milter <cleanup_milter.in2
-       ../postcat/postcat -ov test-queue-file2.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file2.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref2 cleanup_milter.tmp
        rm -f test-queue-file2.tmp cleanup_milter.tmp
 
@@ -162,8 +164,8 @@ cleanup_milter_test3: cleanup_milter test-queue-file3 cleanup_milter.in3 \
        cleanup_milter.ref3 ../postcat/postcat
        cp test-queue-file3 test-queue-file3.tmp
        chmod u+w test-queue-file3.tmp
-       ./cleanup_milter <cleanup_milter.in3
-       ../postcat/postcat -ov test-queue-file3.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in3
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file3.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref3 cleanup_milter.tmp
        rm -f test-queue-file3.tmp cleanup_milter.tmp
 
@@ -172,18 +174,18 @@ cleanup_milter_test4: cleanup_milter test-queue-file4 cleanup_milter.in4a \
        test-queue-file4 ../postcat/postcat
        cp test-queue-file4 test-queue-file4.tmp
        chmod u+w test-queue-file4.tmp
-       ./cleanup_milter <cleanup_milter.in4a
-       ../postcat/postcat -ov test-queue-file4.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in4a
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file4.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref4 cleanup_milter.tmp
        cp test-queue-file4 test-queue-file4.tmp
        chmod u+w test-queue-file4.tmp
-       ./cleanup_milter <cleanup_milter.in4b
-       ../postcat/postcat -ov test-queue-file4.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in4b
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file4.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref4 cleanup_milter.tmp
        cp test-queue-file4 test-queue-file4.tmp
        chmod u+w test-queue-file4.tmp
-       ./cleanup_milter <cleanup_milter.in4c
-       ../postcat/postcat -ov test-queue-file4.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in4c
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file4.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref4 cleanup_milter.tmp
        rm -f test-queue-file4.tmp cleanup_milter.tmp
 
@@ -191,8 +193,8 @@ cleanup_milter_test5: cleanup_milter test-queue-file5 cleanup_milter.in5 \
        cleanup_milter.ref5 ../postcat/postcat
        cp test-queue-file5 test-queue-file5.tmp
        chmod u+w test-queue-file5.tmp
-       ./cleanup_milter <cleanup_milter.in5
-       ../postcat/postcat -ov test-queue-file5.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in5
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file5.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref5 cleanup_milter.tmp
        rm -f test-queue-file5.tmp cleanup_milter.tmp
 
@@ -203,8 +205,8 @@ cleanup_milter_test6a: cleanup_milter test-queue-file6 cleanup_milter.in6a \
        cleanup_milter.ref6a test-queue-file6 ../postcat/postcat
        cp test-queue-file6 test-queue-file6.tmp
        chmod u+w test-queue-file6.tmp
-       ./cleanup_milter <cleanup_milter.in6a
-       ../postcat/postcat -ov test-queue-file6.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in6a
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file6.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref6a cleanup_milter.tmp
        rm -f test-queue-file6.tmp cleanup_milter.tmp
 
@@ -212,8 +214,8 @@ cleanup_milter_test6b: cleanup_milter test-queue-file6 cleanup_milter.in6b \
        cleanup_milter.ref6b ../postcat/postcat
        cp test-queue-file6 test-queue-file6.tmp
        chmod u+w test-queue-file6.tmp
-       ./cleanup_milter <cleanup_milter.in6b
-       ../postcat/postcat -ov test-queue-file6.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in6b
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file6.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref6b cleanup_milter.tmp
        rm -f test-queue-file6.tmp cleanup_milter.tmp
 
@@ -221,8 +223,8 @@ cleanup_milter_test6c: cleanup_milter test-queue-file6 cleanup_milter.in6c \
        cleanup_milter.ref6c ../postcat/postcat
        cp test-queue-file6 test-queue-file6.tmp
        chmod u+w test-queue-file6.tmp
-       ./cleanup_milter <cleanup_milter.in6c
-       ../postcat/postcat -ov test-queue-file6.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in6c
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file6.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref6c cleanup_milter.tmp
        rm -f test-queue-file6.tmp cleanup_milter.tmp
 
@@ -230,8 +232,8 @@ cleanup_milter_test7: cleanup_milter test-queue-file7 cleanup_milter.in7 \
        cleanup_milter.ref7 ../postcat/postcat
        cp test-queue-file7 test-queue-file7.tmp
        chmod u+w test-queue-file7.tmp
-       ./cleanup_milter <cleanup_milter.in7
-       ../postcat/postcat -ov test-queue-file7.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in7
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file7.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref7 cleanup_milter.tmp
        rm -f test-queue-file7.tmp cleanup_milter.tmp
 
@@ -239,8 +241,8 @@ cleanup_milter_test8: cleanup_milter test-queue-file8 cleanup_milter.in8 \
        cleanup_milter.ref8 ../postcat/postcat
        cp test-queue-file8 test-queue-file8.tmp
        chmod u+w test-queue-file8.tmp
-       ./cleanup_milter <cleanup_milter.in8
-       ../postcat/postcat -ov test-queue-file8.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in8
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file8.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref8 cleanup_milter.tmp
        rm -f test-queue-file8.tmp cleanup_milter.tmp
 
@@ -248,8 +250,8 @@ cleanup_milter_test9: cleanup_milter test-queue-file9 cleanup_milter.in9 \
        cleanup_milter.ref9 ../postcat/postcat
        cp test-queue-file9 test-queue-file9.tmp
        chmod u+w test-queue-file9.tmp
-       ./cleanup_milter <cleanup_milter.in9
-       ../postcat/postcat -ov test-queue-file9.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in9
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file9.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref9 cleanup_milter.tmp
        rm -f test-queue-file9.tmp cleanup_milter.tmp
 
@@ -257,8 +259,8 @@ cleanup_milter_test10a: cleanup_milter test-queue-file10 cleanup_milter.in10a \
        cleanup_milter.ref10a ../postcat/postcat
        cp test-queue-file10 test-queue-file10.tmp
        chmod u+w test-queue-file10.tmp
-       ./cleanup_milter <cleanup_milter.in10a
-       ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in10a
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref10a cleanup_milter.tmp
        rm -f test-queue-file10.tmp cleanup_milter.tmp
 
@@ -266,8 +268,8 @@ cleanup_milter_test10b: cleanup_milter test-queue-file10 cleanup_milter.in10b \
        cleanup_milter.ref10b ../postcat/postcat
        cp test-queue-file10 test-queue-file10.tmp
        chmod u+w test-queue-file10.tmp
-       ./cleanup_milter <cleanup_milter.in10b
-       ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in10b
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref10b cleanup_milter.tmp
        rm -f test-queue-file10.tmp cleanup_milter.tmp
 
@@ -275,8 +277,8 @@ cleanup_milter_test10c: cleanup_milter test-queue-file10 cleanup_milter.in10c \
        cleanup_milter.ref10c ../postcat/postcat
        cp test-queue-file10 test-queue-file10.tmp
        chmod u+w test-queue-file10.tmp
-       ./cleanup_milter <cleanup_milter.in10c
-       ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in10c
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref10c cleanup_milter.tmp
        rm -f test-queue-file10.tmp cleanup_milter.tmp
 
@@ -284,8 +286,8 @@ cleanup_milter_test10d: cleanup_milter test-queue-file10 cleanup_milter.in10c \
        cleanup_milter.ref10d ../postcat/postcat
        cp test-queue-file10 test-queue-file10.tmp
        chmod u+w test-queue-file10.tmp
-       ./cleanup_milter <cleanup_milter.in10d
-       ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in10d
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref10d cleanup_milter.tmp
        rm -f test-queue-file10.tmp cleanup_milter.tmp
 
@@ -293,8 +295,8 @@ cleanup_milter_test10e: cleanup_milter test-queue-file10 cleanup_milter.in10c \
        cleanup_milter.ref10e ../postcat/postcat
        cp test-queue-file10 test-queue-file10.tmp
        chmod u+w test-queue-file10.tmp
-       ./cleanup_milter <cleanup_milter.in10e
-       ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in10e
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file10.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref10e cleanup_milter.tmp
        rm -f test-queue-file10.tmp cleanup_milter.tmp
 
@@ -302,8 +304,8 @@ cleanup_milter_test11: cleanup_milter test-queue-file11 cleanup_milter.in11 \
        cleanup_milter.ref11 ../postcat/postcat
        cp test-queue-file11 test-queue-file11.tmp
        chmod u+w test-queue-file11.tmp
-       ./cleanup_milter <cleanup_milter.in11
-       ../postcat/postcat -ov test-queue-file11.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in11
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file11.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref11 cleanup_milter.tmp
        rm -f test-queue-file11.tmp cleanup_milter.tmp
 
@@ -311,8 +313,8 @@ cleanup_milter_test12: cleanup_milter test-queue-file12 cleanup_milter.in12 \
        cleanup_milter.ref12 ../postcat/postcat
        cp test-queue-file12 test-queue-file12.tmp
        chmod u+w test-queue-file12.tmp
-       ./cleanup_milter <cleanup_milter.in12
-       ../postcat/postcat -ov test-queue-file12.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in12
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file12.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref12 cleanup_milter.tmp
        rm -f test-queue-file12.tmp cleanup_milter.tmp
 
@@ -320,8 +322,8 @@ cleanup_milter_test13a: cleanup_milter test-queue-file13a cleanup_milter.in13a \
        cleanup_milter.ref13a ../postcat/postcat
        cp test-queue-file13a test-queue-file13a.tmp
        chmod u+w test-queue-file13a.tmp
-       ./cleanup_milter <cleanup_milter.in13a
-       ../postcat/postcat -ov test-queue-file13a.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in13a
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file13a.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref13a cleanup_milter.tmp
        rm -f test-queue-file13a.tmp cleanup_milter.tmp
 
@@ -329,8 +331,8 @@ cleanup_milter_test13b: cleanup_milter test-queue-file13b cleanup_milter.in13b \
        cleanup_milter.ref13b ../postcat/postcat
        cp test-queue-file13b test-queue-file13b.tmp
        chmod u+w test-queue-file13b.tmp
-       ./cleanup_milter <cleanup_milter.in13b
-       ../postcat/postcat -ov test-queue-file13b.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in13b
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file13b.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref13b cleanup_milter.tmp
        rm -f test-queue-file13b.tmp cleanup_milter.tmp
 
@@ -338,8 +340,8 @@ cleanup_milter_test13c: cleanup_milter test-queue-file13c cleanup_milter.in13c \
        cleanup_milter.ref13c ../postcat/postcat
        cp test-queue-file13c test-queue-file13c.tmp
        chmod u+w test-queue-file13c.tmp
-       ./cleanup_milter <cleanup_milter.in13c
-       ../postcat/postcat -ov test-queue-file13c.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in13c
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file13c.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref13c cleanup_milter.tmp
        rm -f test-queue-file13c.tmp cleanup_milter.tmp
 
@@ -347,8 +349,8 @@ cleanup_milter_test13d: cleanup_milter test-queue-file13d cleanup_milter.in13d \
        cleanup_milter.ref13d ../postcat/postcat
        cp test-queue-file13d test-queue-file13d.tmp
        chmod u+w test-queue-file13d.tmp
-       ./cleanup_milter <cleanup_milter.in13d
-       ../postcat/postcat -ov test-queue-file13d.tmp 2>/dev/null >cleanup_milter.tmp
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in13d
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file13d.tmp 2>/dev/null >cleanup_milter.tmp
        diff cleanup_milter.ref13d cleanup_milter.tmp
        rm -f test-queue-file13d.tmp cleanup_milter.tmp
 
@@ -356,9 +358,9 @@ cleanup_milter_test14a: cleanup_milter test-queue-file14 cleanup_milter.in14a \
        cleanup_milter.ref14a1 ../postcat/postcat cleanup_milter.ref14a2
        cp test-queue-file14 test-queue-file14a.tmp
        chmod u+w test-queue-file14a.tmp
-       ./cleanup_milter <cleanup_milter.in14a 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14a 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14a1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14a.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14a.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14a2 cleanup_milter.tmp2
        rm -f test-queue-file14a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -366,9 +368,9 @@ cleanup_milter_test14b: cleanup_milter test-queue-file14 cleanup_milter.in14b \
        cleanup_milter.ref14b1 ../postcat/postcat cleanup_milter.ref14b2
        cp test-queue-file14 test-queue-file14b.tmp
        chmod u+w test-queue-file14b.tmp
-       ./cleanup_milter <cleanup_milter.in14b 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14b 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14b1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14b.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14b.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14b2 cleanup_milter.tmp2
        rm -f test-queue-file14b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -376,9 +378,9 @@ cleanup_milter_test14c: cleanup_milter test-queue-file14 cleanup_milter.in14c \
        cleanup_milter.ref14c1 ../postcat/postcat cleanup_milter.ref14c2
        cp test-queue-file14 test-queue-file14c.tmp
        chmod u+w test-queue-file14c.tmp
-       ./cleanup_milter <cleanup_milter.in14c 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14c 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14c1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14c.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14c.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14c2 cleanup_milter.tmp2
        rm -f test-queue-file14c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -386,9 +388,9 @@ cleanup_milter_test14d: cleanup_milter test-queue-file14 cleanup_milter.in14d \
        cleanup_milter.ref14d1 ../postcat/postcat cleanup_milter.ref14d2
        cp test-queue-file14 test-queue-file14d.tmp
        chmod u+w test-queue-file14d.tmp
-       ./cleanup_milter <cleanup_milter.in14d 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14d 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14d1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14d.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14d.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14d2 cleanup_milter.tmp2
        rm -f test-queue-file14d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -396,9 +398,9 @@ cleanup_milter_test14e: cleanup_milter test-queue-file14 cleanup_milter.in14e \
        cleanup_milter.ref14e1 ../postcat/postcat cleanup_milter.ref14e2
        cp test-queue-file14 test-queue-file14e.tmp
        chmod u+w test-queue-file14e.tmp
-       ./cleanup_milter <cleanup_milter.in14e 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14e 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14e1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14e.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14e.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14e2 cleanup_milter.tmp2
        rm -f test-queue-file14e.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -406,9 +408,9 @@ cleanup_milter_test14f: cleanup_milter test-queue-file14 cleanup_milter.in14f \
        cleanup_milter.ref14f1 ../postcat/postcat cleanup_milter.ref14f2
        cp test-queue-file14 test-queue-file14f.tmp
        chmod u+w test-queue-file14f.tmp
-       ./cleanup_milter <cleanup_milter.in14f 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14f 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14f1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14f.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14f.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14f2 cleanup_milter.tmp2
        rm -f test-queue-file14f.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -416,9 +418,9 @@ cleanup_milter_test14g: cleanup_milter test-queue-file14 cleanup_milter.in14g \
        cleanup_milter.ref14g1 ../postcat/postcat cleanup_milter.ref14g2
        cp test-queue-file14 test-queue-file14g.tmp
        chmod u+w test-queue-file14g.tmp
-       ./cleanup_milter <cleanup_milter.in14g 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in14g 2>cleanup_milter.tmp1
        diff cleanup_milter.ref14g1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file14g.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file14g.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref14g2 cleanup_milter.tmp2
        rm -f test-queue-file14g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -426,9 +428,9 @@ cleanup_milter_test15a: cleanup_milter test-queue-file15 cleanup_milter.in15a \
        cleanup_milter.ref15a1 ../postcat/postcat cleanup_milter.ref15a2
        cp test-queue-file15 test-queue-file15a.tmp
        chmod u+w test-queue-file15a.tmp
-       ./cleanup_milter <cleanup_milter.in15a 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15a 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15a1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15a.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15a.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15a2 cleanup_milter.tmp2
        rm -f test-queue-file15a.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -436,9 +438,9 @@ cleanup_milter_test15b: cleanup_milter test-queue-file15 cleanup_milter.in15b \
        cleanup_milter.ref15b1 ../postcat/postcat cleanup_milter.ref15b2
        cp test-queue-file15 test-queue-file15b.tmp
        chmod u+w test-queue-file15b.tmp
-       ./cleanup_milter <cleanup_milter.in15b 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15b 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15b1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15b.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15b.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15b2 cleanup_milter.tmp2
        rm -f test-queue-file15b.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -446,9 +448,9 @@ cleanup_milter_test15c: cleanup_milter test-queue-file15 cleanup_milter.in15c \
        cleanup_milter.ref15c1 ../postcat/postcat cleanup_milter.ref15c2
        cp test-queue-file15 test-queue-file15c.tmp
        chmod u+w test-queue-file15c.tmp
-       ./cleanup_milter <cleanup_milter.in15c 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15c 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15c1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15c.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15c.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15c2 cleanup_milter.tmp2
        rm -f test-queue-file15c.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -456,9 +458,9 @@ cleanup_milter_test15d: cleanup_milter test-queue-file15 cleanup_milter.in15d \
        cleanup_milter.ref15d1 ../postcat/postcat cleanup_milter.ref15d2
        cp test-queue-file15 test-queue-file15d.tmp
        chmod u+w test-queue-file15d.tmp
-       ./cleanup_milter <cleanup_milter.in15d 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15d 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15d1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15d.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15d.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15d2 cleanup_milter.tmp2
        rm -f test-queue-file15d.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -466,9 +468,9 @@ cleanup_milter_test15e: cleanup_milter test-queue-file15 cleanup_milter.in15e \
        cleanup_milter.ref15e1 ../postcat/postcat cleanup_milter.ref15e2
        cp test-queue-file15 test-queue-file15e.tmp
        chmod u+w test-queue-file15e.tmp
-       ./cleanup_milter <cleanup_milter.in15e 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15e 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15e1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15e.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15e.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15e2 cleanup_milter.tmp2
        rm -f test-queue-file15e.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -476,9 +478,9 @@ cleanup_milter_test15f: cleanup_milter test-queue-file15 cleanup_milter.in15f \
        cleanup_milter.ref15f1 ../postcat/postcat cleanup_milter.ref15f2
        cp test-queue-file15 test-queue-file15f.tmp
        chmod u+w test-queue-file15f.tmp
-       ./cleanup_milter <cleanup_milter.in15f 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15f 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15f1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15f.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15f.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15f2 cleanup_milter.tmp2
        rm -f test-queue-file15f.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -486,9 +488,9 @@ cleanup_milter_test15g: cleanup_milter test-queue-file15 cleanup_milter.in15g \
        cleanup_milter.ref15g1 ../postcat/postcat cleanup_milter.ref15g2
        cp test-queue-file15 test-queue-file15g.tmp
        chmod u+w test-queue-file15g.tmp
-       ./cleanup_milter <cleanup_milter.in15g 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15g 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15g1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15g.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15g.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15g2 cleanup_milter.tmp2
        rm -f test-queue-file15g.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -496,9 +498,9 @@ cleanup_milter_test15h: cleanup_milter test-queue-file15 cleanup_milter.in15h \
        cleanup_milter.ref15h1 ../postcat/postcat cleanup_milter.ref15h2
        cp test-queue-file15 test-queue-file15h.tmp
        chmod u+w test-queue-file15h.tmp
-       ./cleanup_milter <cleanup_milter.in15h 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15h 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15h1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15h.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15h.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15h2 cleanup_milter.tmp2
        rm -f test-queue-file15h.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
@@ -506,9 +508,9 @@ cleanup_milter_test15i: cleanup_milter test-queue-file15 cleanup_milter.in15i \
        cleanup_milter.ref15i1 ../postcat/postcat cleanup_milter.ref15i2
        cp test-queue-file15 test-queue-file15i.tmp
        chmod u+w test-queue-file15i.tmp
-       ./cleanup_milter <cleanup_milter.in15i 2>cleanup_milter.tmp1
+       $(SHLIB_ENV) ./cleanup_milter <cleanup_milter.in15i 2>cleanup_milter.tmp1
        diff cleanup_milter.ref15i1 cleanup_milter.tmp1
-       ../postcat/postcat -ov test-queue-file15i.tmp 2>/dev/null >cleanup_milter.tmp2
+       $(SHLIB_ENV) ../postcat/postcat -ov test-queue-file15i.tmp 2>/dev/null >cleanup_milter.tmp2
        diff cleanup_milter.ref15i2 cleanup_milter.tmp2
        rm -f test-queue-file15i.tmp cleanup_milter.tmp1 cleanup_milter.tmp2
 
index a8540308cfd0a8805e0270d8af64f1b060d761a5..9bf9761bf01f6a163cdda271b355e5311d5de124 100644 (file)
@@ -219,6 +219,7 @@ int     main(int argc, char **argv)
     vstream_printf("address:    %s\n", argv[3]);
 
     state.errs = 0;
+    state.queue_id = "NOQUEUE";
     cleanup_masquerade_external(&state, addr, masq_domains);
 
     vstream_printf("result:     %s\n", STR(addr));
index 00a5d5c34a5d6eb336766b64621d5b598b076323..797f1c619dc75125e9fbc2868ae2a706e7f64420 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = discard
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index bbc5e9884b3074208197fb644d50458bc426aff6..a82915f89c6fc5c54dd43575c6b86c3b25cc865f 100644 (file)
@@ -8,13 +8,13 @@ TESTSRC       = test_dns_lookup.c test_alias_token.c
 DEFS   = -I. -I$(INC_DIR) -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
 INCL   =
-LIB    = libdns.a
+LIB    = lib$(LIB_PREFIX)dns$(LIB_SUFFIX)
 TESTPROG= test_dns_lookup dns_rr_to_pa dns_rr_to_sa dns_sa_to_rr dns_rr_eq_sa
-LIBS   = ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
 
-.c.o:; $(CC) $(CFLAGS) -c $*.c
+.c.o:; $(CC) $(SHLIB_CFLAGS) $(CFLAGS) -c $*.c
 
 all: $(LIB)
 
@@ -33,6 +33,7 @@ root_tests:
 $(LIB):        $(OBJS)
        $(AR) $(ARFL) $(LIB) $?
        $(RANLIB) $(LIB)
+       $(SHLIB_LD) -o $(LIB) $(OBJS)
 
 $(LIB_DIR)/$(LIB): $(LIB)
        cp $(LIB) $(LIB_DIR)
@@ -69,22 +70,22 @@ dns_rr_eq_sa: $(LIB) $(LIBS)
        mv junk $@.o
 
 dns_rr_to_pa_test: dns_rr_to_pa dns_rr_to_pa.in dns_rr_to_pa.ref
-       ./dns_rr_to_pa `cat dns_rr_to_pa.in` >dns_rr_to_pa.tmp
+       $(SHLIB_ENV) ./dns_rr_to_pa `cat dns_rr_to_pa.in` >dns_rr_to_pa.tmp
        diff dns_rr_to_pa.ref dns_rr_to_pa.tmp
        rm -f dns_rr_to_pa.tmp
 
 dns_rr_to_sa_test: dns_rr_to_sa dns_rr_to_sa.in dns_rr_to_sa.ref
-       ./dns_rr_to_sa `cat dns_rr_to_sa.in` >dns_rr_to_sa.tmp
+       $(SHLIB_ENV) ./dns_rr_to_sa `cat dns_rr_to_sa.in` >dns_rr_to_sa.tmp
        diff dns_rr_to_sa.ref dns_rr_to_sa.tmp
        rm -f dns_rr_to_sa.tmp
 
 dns_sa_to_rr_test: dns_sa_to_rr dns_sa_to_rr.in dns_sa_to_rr.ref
-       ./dns_sa_to_rr `cat dns_sa_to_rr.in` >dns_sa_to_rr.tmp
+       $(SHLIB_ENV) ./dns_sa_to_rr `cat dns_sa_to_rr.in` >dns_sa_to_rr.tmp
        diff dns_sa_to_rr.ref dns_sa_to_rr.tmp
        rm -f dns_sa_to_rr.tmp
 
 dns_rr_eq_sa_test: dns_rr_eq_sa dns_rr_eq_sa.in dns_rr_eq_sa.ref
-       ./dns_rr_eq_sa `cat dns_rr_eq_sa.in` >dns_rr_eq_sa.tmp
+       $(SHLIB_ENV) ./dns_rr_eq_sa `cat dns_rr_eq_sa.in` >dns_rr_eq_sa.tmp
        diff dns_rr_eq_sa.ref dns_rr_eq_sa.tmp
        rm -f dns_rr_eq_sa.tmp
 
index ec5391912a69ecbb92bd20a38247851233930507..6cfc08b83c9ce09075669059a2cfefdf515cfe46 100644 (file)
@@ -8,13 +8,15 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = dnsblog
 INC_DIR = ../../include
-LIBS   = ../../lib/libdns.a ../../lib/libmaster.a ../../lib/libglobal.a \
-       ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index a9453126feca03e873dea5c430c222ab59f32905..2aafa5b4039939035184b3b47fce384468806b68 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = error
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index b3533bd507cd3053d3b90684852642e14e2f8410..b60ed87a131fb24289411797cd3ef76cbcd34053 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = flush
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index bfc9842acddebfb7ceeec901e345051650c63d5f..564a3009a7e9f673df752ac784f2dc49c6da4f45 100644 (file)
@@ -8,7 +8,8 @@ CFLAGS  = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = fsstone
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
@@ -20,7 +21,7 @@ Makefile: Makefile.in
        cat ../../conf/makedefs.out $? >$@
 
 fsstone: fsstone.o $(LIBS)
-       $(CC) $(CFLAGS) -o $@ fsstone.o $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ fsstone.o $(LIBS) $(SYSLIBS)
 
 test:  $(TESTPROG)
 
index 2e7ec04ec40bab6b1f6420d8629af3f9839c7e6d..16e62a6a5595ef02db36fe2cc0a3060dda2c8ef3 100644 (file)
@@ -32,13 +32,13 @@ SRCS        = abounce.c anvil_clnt.c been_here.c bounce.c bounce_log.c \
        match_service.c mail_conf_nint.c addr_match_list.c mail_conf_nbool.c \
        smtp_reply_footer.c safe_ultostr.c verify_sender_addr.c \
        dict_memcache.c mail_version.c memcache_proto.c server_acl.c \
-       mkmap_fail.c haproxy_srvr.c dsn_filter.c
+       mkmap_fail.c haproxy_srvr.c dsn_filter.c dynamicmaps.c
 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,13 @@ 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
+       mkmap_fail.o haproxy_srvr.o dsn_filter.o dynamicmaps.o \
+       $(NON_PLUGIN_MAP_OBJ)
+# 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 the PLUGIN_* macros.
+MAP_OBJ = dict_ldap.o dict_mysql.o dict_pgsql.o dict_sqlite.o mkmap_cdb.o \
+       mkmap_lmdb.o mkmap_sdbm.o 
 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 \
@@ -93,12 +99,12 @@ HDRS        = abounce.h anvil_clnt.h been_here.h bounce.h bounce_log.h \
        fold_addr.h header_body_checks.h data_redirect.h match_service.h \
        addr_match_list.h smtp_reply_footer.h safe_ultostr.h \
        verify_sender_addr.h dict_memcache.h memcache_proto.h server_acl.h \
-       haproxy_srvr.h dsn_filter.h
+       haproxy_srvr.h dsn_filter.h dynamicmaps.h
 TESTSRC        = rec2stream.c stream2rec.c recdump.c
 DEFS   = -I. -I$(INC_DIR) -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
 INCL   =
-LIB    = libglobal.a
+LIB    = lib$(LIB_PREFIX)global$(LIB_SUFFIX)
 TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \
        mail_addr_map mail_date maps mynetworks mypwd namadr_list \
        off_cvt quote_822_local rec2stream recdump resolve_clnt \
@@ -109,16 +115,21 @@ TESTPROG= domain_list dot_lockfile mail_addr_crunch mail_addr_find \
        data_redirect addr_match_list safe_ultostr verify_sender_addr \
        mail_version mail_dict server_acl
 
-LIBS   = ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
+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)sdbm$(LIB_SUFFIX)
 MAKES  =
 
-.c.o:; $(CC) $(CFLAGS) -c $*.c
+.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 $? >$@
@@ -128,18 +139,56 @@ test:     $(TESTPROG)
 $(LIB):        $(OBJS)
        $(AR) $(ARFL) $(LIB) $?
        $(RANLIB) $(LIB)
+       $(SHLIB_LD) -o $(LIB) $(OBJS)
 
 $(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)ldap$(LIB_SUFFIX): dict_ldap.o
+       $(PLUGIN_LD) -o $@ dict_ldap.o $(AUXLIBS_LDAP)
+
+$(LIB_PREFIX)mysql$(LIB_SUFFIX): dict_mysql.o
+       $(PLUGIN_LD) -o $@ dict_mysql.o $(AUXLIBS_MYSQL)
+
+$(LIB_PREFIX)pgsql$(LIB_SUFFIX): dict_pgsql.o
+       $(PLUGIN_LD) -o $@ dict_pgsql.o $(AUXLIBS_PGSQL)
+
+$(LIB_PREFIX)sqlite$(LIB_SUFFIX): dict_sqlite.o
+       $(PLUGIN_LD) -o $@ dict_sqlite.o $(AUXLIBS_SQLITE)
+
+$(LIB_PREFIX)cdb$(LIB_SUFFIX): mkmap_cdb.o $(LIB_DIR)/dict_cdb.o
+       $(PLUGIN_LD) -o $@ mkmap_cdb.o $(LIB_DIR)/dict_cdb.o $(AUXLIBS_CDB)
+
+$(LIB_PREFIX)lmdb$(LIB_SUFFIX): mkmap_lmdb.o $(LIB_DIR)/dict_lmdb.o \
+           $(LIB_DIR)/slmdb.o
+       $(PLUGIN_LD) -o $@ mkmap_lmdb.o $(LIB_DIR)/dict_lmdb.o \
+           $(LIB_DIR)/slmdb.o $(AUXLIBS_LMDB)
+
+$(LIB_PREFIX)sdbm$(LIB_SUFFIX): mkmap_sdbm.o $(LIB_DIR)/dict_sdbm.o
+       $(PLUGIN_LD) -o $@ mkmap_sdbm.o $(LIB_DIR)/dict_sdbm.o $(AUXLIBS_SDBM)
+
+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 \
+         for type in $(DEFINED_MAP_TYPES); do \
+             case $$i in $(LIB_PREFIX)$$type$(LIB_SUFFIX)) \
+                 cmp -s $$i $(PLG_DIR)/$$i 2>/dev/null || cp $$i $(PLG_DIR); \
+                 continue 2;; \
+             esac; \
+         done; \
+         rm -f $(PLG_DIR)/$$i; \
+       done
+
 dot_lockfile: $(LIB) $(LIBS)
        mv $@.o junk
        $(CC) -DTEST $(CFLAGS) -o $@ $@.c $(LIB) $(LIBS) $(SYSLIBS)
@@ -311,7 +360,7 @@ server_acl: server_acl.c $(LIB) $(LIBS)
 tests: tok822_test mime_tests strip_addr_test tok822_limit_test \
        xtext_test scache_multi_test ehlo_mask_test \
        namadr_list_test mail_conf_time_test header_body_checks_tests \
-       mail_version_test server_acl_test resolve_local_test maps_test
+       mail_version_test server_acl_test resolve_local_test maps_test \
        safe_ultostr_test
 
 mime_tests: mime_test mime_nest mime_8bit mime_dom mime_trunc mime_cvt \
@@ -324,117 +373,117 @@ header_body_checks_tests: header_body_checks_null_test \
 root_tests: rewrite_clnt_test resolve_clnt_test verify_sender_addr_test
 
 tok822_test: tok822_parse tok822_parse.in tok822_parse.ref
-       ./tok822_parse <tok822_parse.in >tok822_parse.tmp 2>&1
+       $(SHLIB_ENV) ./tok822_parse <tok822_parse.in >tok822_parse.tmp 2>&1
        diff tok822_parse.ref tok822_parse.tmp
        rm -f tok822_parse.tmp
 
 mime_test: mime_state mime_test.in mime_test.ref
-       ./mime_state <mime_test.in >mime_test.tmp
+       $(SHLIB_ENV) ./mime_state <mime_test.in >mime_test.tmp
        diff  mime_test.ref mime_test.tmp
        rm -f mime_test.tmp
 
 mime_nest: mime_state mime_nest.in mime_nest.ref
-       ./mime_state <mime_nest.in >mime_nest.tmp
+       $(SHLIB_ENV) ./mime_state <mime_nest.in >mime_nest.tmp
        diff  mime_nest.ref mime_nest.tmp
        rm -f mime_nest.tmp
 
 mime_8bit: mime_state mime_8bit.in mime_8bit.ref
-       ./mime_state <mime_8bit.in >mime_8bit.tmp
+       $(SHLIB_ENV) ./mime_state <mime_8bit.in >mime_8bit.tmp
        diff  mime_8bit.ref mime_8bit.tmp
        rm -f mime_8bit.tmp
 
 mime_dom: mime_state mime_dom.in mime_dom.ref
-       ./mime_state <mime_dom.in >mime_dom.tmp
+       $(SHLIB_ENV) ./mime_state <mime_dom.in >mime_dom.tmp
        diff  mime_dom.ref mime_dom.tmp
        rm -f mime_dom.tmp
 
 mime_trunc: mime_state mime_trunc.in mime_trunc.ref
-       ./mime_state <mime_trunc.in >mime_trunc.tmp
+       $(SHLIB_ENV) ./mime_state <mime_trunc.in >mime_trunc.tmp
        diff  mime_trunc.ref mime_trunc.tmp
        rm -f mime_trunc.tmp
 
 mime_cvt: mime_state mime_cvt.in mime_cvt.ref
-       ./mime_state <mime_cvt.in >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_cvt.in >mime_cvt.tmp
        diff  mime_cvt.ref mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 mime_cvt2: mime_state mime_cvt.in2 mime_cvt.ref2
-       ./mime_state <mime_cvt.in2 >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_cvt.in2 >mime_cvt.tmp
        diff  mime_cvt.ref2 mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 mime_cvt3: mime_state mime_cvt.in3 mime_cvt.ref3
-       ./mime_state <mime_cvt.in3 >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_cvt.in3 >mime_cvt.tmp
        diff  mime_cvt.ref3 mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 mime_garb1: mime_state mime_garb1.in mime_garb1.ref
-       ./mime_state <mime_garb1.in >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_garb1.in >mime_cvt.tmp
        diff  mime_garb1.ref mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 mime_garb2: mime_state mime_garb2.in mime_garb2.ref
-       ./mime_state <mime_garb2.in >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_garb2.in >mime_cvt.tmp
        diff  mime_garb2.ref mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 mime_garb3: mime_state mime_garb3.in mime_garb3.ref
-       ./mime_state <mime_garb3.in >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_garb3.in >mime_cvt.tmp
        diff  mime_garb3.ref mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 mime_garb4: mime_state mime_garb4.in mime_garb4.ref
-       ./mime_state <mime_garb4.in >mime_cvt.tmp
+       $(SHLIB_ENV) ./mime_state <mime_garb4.in >mime_cvt.tmp
        diff  mime_garb4.ref mime_cvt.tmp
        rm -f mime_cvt.tmp
 
 tok822_limit_test: tok822_parse tok822_limit.in tok822_limit.ref
-       ./tok822_parse <tok822_limit.in >tok822_limit.tmp
+       $(SHLIB_ENV) ./tok822_parse <tok822_limit.in >tok822_limit.tmp
        diff tok822_limit.ref tok822_limit.tmp
        rm -f tok822_limit.tmp
 
 strip_addr_test: strip_addr strip_addr.ref
-       ./strip_addr 2>strip_addr.tmp
+       $(SHLIB_ENV) ./strip_addr 2>strip_addr.tmp
        diff strip_addr.ref strip_addr.tmp
        rm -f strip_addr.tmp
 
 xtext_test: xtext
-       ./xtext <xtext.c | od -cb >xtext.tmp
+       $(SHLIB_ENV) ./xtext <xtext.c | od -cb >xtext.tmp
        od -cb <xtext.c >xtext.ref
        cmp xtext.ref xtext.tmp
        rm -f xtext.ref xtext.tmp
 
 mail_version_test: mail_version mail_version.in mail_version.ref
-       ./mail_version <mail_version.in >mail_version.tmp
+       $(SHLIB_ENV) ./mail_version <mail_version.in >mail_version.tmp
        diff  mail_version.ref mail_version.tmp
        rm -f mail_version.tmp
 
 server_acl_test: server_acl server_acl.in server_acl.ref
-       ./server_acl <server_acl.in >server_acl.tmp 2>&1
+       $(SHLIB_ENV) ./server_acl <server_acl.in >server_acl.tmp 2>&1
        diff  server_acl.ref server_acl.tmp
        rm -f server_acl.tmp
 
 resolve_local_test: resolve_local resolve_local.in resolve_local.ref
-       sh resolve_local.in >resolve_local.tmp 2>&1
+       $(SHLIB_ENV) sh resolve_local.in >resolve_local.tmp 2>&1
        diff  resolve_local.ref resolve_local.tmp
        rm -f resolve_local.tmp
 
 maps_test: maps maps.in maps.ref
-       sh maps.in >maps.tmp 2>&1
+       $(SHLIB_ENV) sh maps.in >maps.tmp 2>&1
        diff  maps.ref maps.tmp
        rm -f maps.tmp
 
 surrogate_test: mail_dict surrogate.ref
        cp /dev/null surrogate.tmp
-       echo get foo|./mail_dict ldap:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict ldap:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict mysql:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict mysql:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict pgsql:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict pgsql:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict sqlite:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict sqlite:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./mail_dict memcache:/xx read >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict ldap:/xx write >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict ldap:/xx read >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict mysql:/xx write >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict mysql:/xx read >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict pgsql:/xx write >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict pgsql:/xx read >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict sqlite:/xx write >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict sqlite:/xx read >>surrogate.tmp 2>&1
+       echo get foo| $(SHLIB_ENV) ./mail_dict memcache:/xx read >>surrogate.tmp 2>&1
        diff surrogate.ref surrogate.tmp
        rm -f surrogate.tmp
 
@@ -447,7 +496,7 @@ rewrite_clnt_test: rewrite_clnt rewrite_clnt.in rewrite_clnt.ref
        esac
        @test -n "`postconf -h remote_header_rewrite_domain`" || { \
            echo 'This test requires non-empty remote_header_rewrite_domain'; exit 1; }
-       ./rewrite_clnt <rewrite_clnt.in >rewrite_clnt.tmp
+       $(SHLIB_ENV) ./rewrite_clnt <rewrite_clnt.in >rewrite_clnt.tmp
        sed -e "s/MYDOMAIN/`postconf -h mydomain`/" \
            -e "s/INVALID_DOMAIN/`postconf -h remote_header_rewrite_domain`/" \
                rewrite_clnt.ref | diff - rewrite_clnt.tmp
@@ -466,7 +515,7 @@ resolve_clnt_test: resolve_clnt resolve_clnt.in resolve_clnt.ref
            echo 'This test requires no transport map'; exit 1; }
        sed -e "s/MYDOMAIN/`postconf -h mydomain`/g" \
            -e "s/MYHOSTNAME/`postconf -h myhostname`/g" \
-           resolve_clnt.in | ./resolve_clnt >resolve_clnt.tmp
+           resolve_clnt.in |  $(SHLIB_ENV) ./resolve_clnt >resolve_clnt.tmp
        sed -e "s/MYDOMAIN/`postconf -h mydomain`/g" \
            -e "s/MYHOSTNAME/`postconf -h myhostname`/g" \
            -e "s/RELAYHOST/`postconf -h mydomain`/g" \
@@ -482,12 +531,12 @@ verify_sender_addr_test: verify_sender_addr verify_sender_addr.ref
        esac
        @test "X`postconf -h append_dot_mydomain`" = Xyes || { \
            echo 'This test requires append_dot_mydomain=yes'; exit 1; }
-       (./verify_sender_addr aa@bb 0; \
-       ./verify_sender_addr aa@bb 1; \
-       ./verify_sender_addr aa 0; \
-       ./verify_sender_addr aa 1; \
-       ./verify_sender_addr '' 0; \
-       ./verify_sender_addr '' 1) | \
+       ($(SHLIB_ENV) ./verify_sender_addr aa@bb 0; \
+       $(SHLIB_ENV) ./verify_sender_addr aa@bb 1; \
+       $(SHLIB_ENV) ./verify_sender_addr aa 0; \
+       $(SHLIB_ENV) ./verify_sender_addr aa 1; \
+       $(SHLIB_ENV) ./verify_sender_addr '' 0; \
+       $(SHLIB_ENV) ./verify_sender_addr '' 1) | \
            sed 's/[A-Z0-9][A-Z0-9]*@/STAMP@/' > verify_sender_addr.tmp
        sed -e "s/MYDOMAIN/`postconf -h mydomain`/g" \
            -e "s/MYORIGIN/`postconf -h myorigin`/g" \
@@ -498,12 +547,12 @@ verify_sender_addr_test: verify_sender_addr verify_sender_addr.ref
        rm -f verify_sender_addr.tmp
 
 scache_multi_test: scache scache_multi.in scache_multi.ref
-       ./scache <scache_multi.in >scache_multi.tmp
+       $(SHLIB_ENV) ./scache <scache_multi.in >scache_multi.tmp
        diff scache_multi.ref scache_multi.tmp
        rm -f scache_multi.tmp
 
 ehlo_mask_test: ehlo_mask ehlo_mask.in ehlo_mask.ref
-       ./ehlo_mask <ehlo_mask.in >ehlo_mask.tmp
+       $(SHLIB_ENV) ./ehlo_mask <ehlo_mask.in >ehlo_mask.tmp
        diff ehlo_mask.ref ehlo_mask.tmp
        rm -f ehlo_mask.tmp
 
@@ -513,29 +562,29 @@ namadr_list_test: namadr_list namadr_list.in namadr_list.ref
        rm -f namadr_list.tmp
 
 mail_conf_time_test: mail_conf_time mail_conf_time.ref
-       ./mail_conf_time >mail_conf_time.tmp
+       $(SHLIB_ENV) ./mail_conf_time >mail_conf_time.tmp
        diff mail_conf_time.ref mail_conf_time.tmp
        rm -f mail_conf_time.tmp
 
 safe_ultostr_test: safe_ultostr safe_ultostr.in safe_ultostr.ref
-       ./safe_ultostr <safe_ultostr.in >safe_ultostr.tmp 2>&1
+       $(SHLIB_ENV) ./safe_ultostr <safe_ultostr.in >safe_ultostr.tmp 2>&1
        diff safe_ultostr.ref safe_ultostr.tmp
        rm -f safe_ultostr.tmp
 
 header_body_checks_null_test: header_body_checks header_body_checks_null.ref
-       ./header_body_checks "" "" "" "" \
+       $(SHLIB_ENV) ./header_body_checks "" "" "" "" \
                <mime_test.in >header_body_checks_null.tmp 2>&1
        cmp header_body_checks_null.ref header_body_checks_null.tmp
-       ./header_body_checks static:dunno static:dunno static:dunno static:dunno \
+       $(SHLIB_ENV) ./header_body_checks static:dunno static:dunno static:dunno static:dunno \
                <mime_test.in >header_body_checks_null.tmp 2>&1
        cmp header_body_checks_null.ref header_body_checks_null.tmp
-       ./header_body_checks static:ok static:ok static:ok static:ok \
+       $(SHLIB_ENV) ./header_body_checks static:ok static:ok static:ok static:ok \
                <mime_test.in >header_body_checks_null.tmp 2>&1
        cmp header_body_checks_null.ref header_body_checks_null.tmp
        rm -f header_body_checks_null.tmp
 
 header_body_checks_warn_test: header_body_checks header_body_checks_warn.ref
-       ./header_body_checks static:warn static:warn static:warn static:warn \
+       $(SHLIB_ENV) ./header_body_checks static:warn static:warn static:warn static:warn \
                <mime_test.in >header_body_checks_warn.tmp 2>&1
        cmp header_body_checks_warn.ref header_body_checks_warn.tmp
        rm -f header_body_checks_warn.tmp
@@ -545,7 +594,7 @@ header_body_checks_prepend_test: header_body_checks header_body_checks_prepend.r
        echo /./ prepend header: mime >header_body_checks_mime
        echo /./ prepend header: nest >header_body_checks_nest
        echo /./ prepend body >header_body_checks_body
-       ./header_body_checks regexp:header_body_checks_head regexp:header_body_checks_mime \
+       $(SHLIB_ENV) ./header_body_checks regexp:header_body_checks_head regexp:header_body_checks_mime \
                regexp:header_body_checks_nest regexp:header_body_checks_body \
                <mime_test.in >header_body_checks_prepend.tmp 2>&1
        cmp header_body_checks_prepend.ref header_body_checks_prepend.tmp
@@ -556,7 +605,7 @@ header_body_checks_prepend_test: header_body_checks header_body_checks_prepend.r
 # errors. We can eliminate this restriction by allowing individual
 # map types to advertise whether they can handle null queries.
 header_body_checks_ignore_test: header_body_checks header_body_checks_ignore.ref
-       ./header_body_checks static:ignore static:ignore static:ignore static:ignore \
+       $(SHLIB_ENV) ./header_body_checks static:ignore static:ignore static:ignore static:ignore \
                <mime_test.in >header_body_checks_ignore.tmp 2>&1
        cmp header_body_checks_ignore.ref header_body_checks_ignore.tmp
        rm -f header_body_checks_ignore.tmp header_body_checks_head header_body_checks_mime header_body_checks_nest header_body_checks_body
@@ -566,7 +615,7 @@ header_body_checks_replace_test: header_body_checks header_body_checks_replace.r
        echo /./ replace header: mime >header_body_checks_mime
        echo /./ replace header: nest >header_body_checks_nest
        echo /./ replace body >header_body_checks_body
-       ./header_body_checks regexp:header_body_checks_head regexp:header_body_checks_mime \
+       $(SHLIB_ENV) ./header_body_checks regexp:header_body_checks_head regexp:header_body_checks_mime \
                regexp:header_body_checks_nest regexp:header_body_checks_body \
                <mime_test.in >header_body_checks_replace.tmp 2>&1
        cmp header_body_checks_replace.ref header_body_checks_replace.tmp
@@ -584,7 +633,7 @@ lint:
        lint $(DEFS) $(SRCS) $(LINTFIX)
 
 clean:
-       rm -f *.o $(LIB) *core $(TESTPROG) junk
+       rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAPS)
        rm -rf printfck
 
 tidy:  clean
@@ -1089,6 +1138,24 @@ dsn_util.o: ../../include/vbuf.h
 dsn_util.o: ../../include/vstring.h
 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/myflock.h
+dynamicmaps.o: ../../include/mymalloc.h
+dynamicmaps.o: ../../include/scan_dir.h
+dynamicmaps.o: ../../include/split_at.h
+dynamicmaps.o: ../../include/stringops.h
+dynamicmaps.o: ../../include/sys_defs.h
+dynamicmaps.o: ../../include/vbuf.h
+dynamicmaps.o: ../../include/vstream.h
+dynamicmaps.o: ../../include/vstring.h
+dynamicmaps.o: ../../include/vstring_vstream.h
+dynamicmaps.o: dynamicmaps.c
+dynamicmaps.o: dynamicmaps.h
+dynamicmaps.o: mkmap.h
 ehlo_mask.o: ../../include/name_mask.h
 ehlo_mask.o: ../../include/sys_defs.h
 ehlo_mask.o: ../../include/vbuf.h
@@ -1417,6 +1484,8 @@ mail_dict.o: ../../include/argv.h
 mail_dict.o: ../../include/dict.h
 mail_dict.o: ../../include/msg.h
 mail_dict.o: ../../include/myflock.h
+mail_dict.o: ../../include/mymalloc.h
+mail_dict.o: ../../include/stringops.h
 mail_dict.o: ../../include/sys_defs.h
 mail_dict.o: ../../include/vbuf.h
 mail_dict.o: ../../include/vstream.h
@@ -1427,8 +1496,10 @@ mail_dict.o: dict_mysql.h
 mail_dict.o: dict_pgsql.h
 mail_dict.o: dict_proxy.h
 mail_dict.o: dict_sqlite.h
+mail_dict.o: dynamicmaps.h
 mail_dict.o: mail_dict.c
 mail_dict.o: mail_dict.h
+mail_dict.o: mail_params.h
 mail_error.o: ../../include/name_mask.h
 mail_error.o: ../../include/sys_defs.h
 mail_error.o: ../../include/vbuf.h
@@ -1739,6 +1810,7 @@ mkmap_open.o: ../../include/dict_dbm.h
 mkmap_open.o: ../../include/dict_fail.h
 mkmap_open.o: ../../include/dict_lmdb.h
 mkmap_open.o: ../../include/dict_sdbm.h
+mkmap_open.o: ../../include/htable.h
 mkmap_open.o: ../../include/msg.h
 mkmap_open.o: ../../include/myflock.h
 mkmap_open.o: ../../include/mymalloc.h
diff --git a/postfix/src/global/dynamicmaps.c b/postfix/src/global/dynamicmaps.c
new file mode 100644 (file)
index 0000000..e5bb34a
--- /dev/null
@@ -0,0 +1,368 @@
+/*++
+/* NAME
+/*     dynamicmaps 3
+/* SUMMARY
+/*     load dictionaries dynamically
+/* SYNOPSIS
+/*     #include <dynamicmaps.h>
+/*
+/*     void dymap_init(const char *path)
+/* DESCRIPTION
+/*     This module reads the dynamicmaps.cf file and performs
+/*     run-time loading of Postfix dictionaries. Each dynamicmaps.cf
+/*     entry specifies the name of a dictionary type, the pathname
+/*     of a shared-library object, the name of a "dict_open"
+/*     function for access to individual dictionary entries, and
+/*     optionally the name of a "mkmap_open" function for bulk-mode
+/*     dictionary creation. The configuration file's parent directory
+/*     is the default directory for shared-library objects with a
+/*     relative pathname.
+/*
+/*     A dictionary may be installed without editing the file
+/*     dynamicmaps.cf, by placing a configuration file under the
+/*     directory dynamicmaps.cf.d, with the same format as
+/*     dynamicmaps.cf.  These configuration file names must end in
+/*     ".cf".  As before, a configuration file's parent directory
+/*     is the default directory for shared-library objects with a
+/*     relative pathname. Thus, the directory dynamicmaps.cf.d may
+/*     contain both configuration files and shared-library object
+/*     files.
+/*
+/*     dymap_init() reads the specified configuration file which
+/*     is in dynamicmaps.cf format, and hooks itself into the
+/*     dict_open(), dict_mapnames(), and mkmap_open() functions.
+/*
+/*     dymap_init() may be called multiple times during a process
+/*     lifetime, but it will not "unload" dictionaries that have
+/*     already been linked into the process address space, nor
+/*     will it hide their dictionaries types from later "open"
+/*     requests.
+/* SEE ALSO
+/*     load_lib(3) low-level run-time linker adapter
+/* DIAGNOSTICS
+/*     Fatal errors: memory allocation problem, dictionary or
+/*     dictionary function not available.  Panic: invalid use.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     LaMont Jones
+/*     Hewlett-Packard Company
+/*     3404 Harmony Road
+/*     Fort Collins, CO 80528, USA
+/*
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+ /*
+  * System library.
+  */
+#include <sys_defs.h>
+#include <sys/stat.h>
+#include <errno.h>
+#include <string.h>
+#include <ctype.h>
+
+ /*
+  * Utility library.
+  */
+#include <msg.h>
+#include <mymalloc.h>
+#include <htable.h>
+#include <argv.h>
+#include <dict.h>
+#include <load_lib.h>
+#include <vstring.h>
+#include <vstream.h>
+#include <vstring_vstream.h>
+#include <stringops.h>
+#include <split_at.h>
+#include <scan_dir.h>
+
+ /*
+  * Global library.
+  */
+#include <mkmap.h>
+#include <dynamicmaps.h>
+
+#ifdef USE_DYNAMIC_MAPS
+
+ /*
+  * Contents of one dynamicmaps.cf entry.
+  */
+typedef struct {
+    char   *soname;                    /* shared-object file name */
+    char   *dict_name;                 /* dict_xx_open() function name */
+    char   *mkmap_name;                        /* mkmap_xx_open() function name */
+} DYMAP_INFO;
+
+static HTABLE *dymap_info;
+static int dymap_hooks_done = 0;
+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;
+
+ /*
+  * Mandatory dynamicmaps.cf.d/ configuration file suffix.
+  */
+#define DYMAP_CF_SUFFIX        ".cf"
+
+#define STREQ(x, y) (strcmp((x), (y)) == 0)
+
+/* dymap_dict_lookup - look up "dict_foo_open" function */
+
+static DICT_OPEN_FN dymap_dict_lookup(const char *dict_type)
+{
+    struct stat st;
+    LIB_FN  fn[2];
+    DICT_OPEN_FN dict_open_fn;
+    DYMAP_INFO *dp;
+
+    /*
+     * Respect the hook nesting order.
+     */
+    if (saved_dict_open_hook != 0
+       && (dict_open_fn = saved_dict_open_hook(dict_type)) != 0)
+       return (dict_open_fn);
+
+    /*
+     * Allow for graceful degradation when a database is unavailable. This
+     * allows Postfix daemon processes to continue handling email with
+     * reduced functionality.
+     */
+    if ((dp = (DYMAP_INFO *) htable_find(dymap_info, dict_type)) == 0)
+       return (0);
+    if (stat(dp->soname, &st) < 0) {
+       msg_warn("unsupported dictionary type: %s (%s: %m)",
+                dict_type, dp->soname);
+       return (0);
+    }
+    if (st.st_uid != 0 || (st.st_mode & (S_IWGRP | S_IWOTH)) != 0) {
+       msg_warn("unsupported dictionary type: %s "
+                "(%s: file is writable by non-root users)",
+                dict_type, dp->soname);
+       return (0);
+    }
+    fn[0].name = dp->dict_name;
+    fn[1].name = 0;
+    load_library_symbols(dp->soname, fn, (LIB_DP *) 0);
+    return ((DICT_OPEN_FN) fn[0].fptr);
+}
+
+/* dymap_mkmap_lookup - look up "mkmap_foo_open" function */
+
+static MKMAP_OPEN_FN dymap_mkmap_lookup(const char *dict_type)
+{
+    struct stat st;
+    LIB_FN  fn[2];
+    MKMAP_OPEN_FN mkmap_open_fn;
+    DYMAP_INFO *dp;
+
+    /*
+     * Respect the hook nesting order.
+     */
+    if (saved_mkmap_open_hook != 0
+       && (mkmap_open_fn = saved_mkmap_open_hook(dict_type)) != 0)
+       return (mkmap_open_fn);
+
+    /*
+     * All errors are fatal. If the postmap(1) or postalias(1) command can't
+     * create the requested database, then graceful degradation is not
+     * useful.
+     */
+    if ((dp = (DYMAP_INFO *) htable_find(dymap_info, dict_type)) == 0)
+       msg_fatal("unsupported dictionary type: %s. "
+                 "Is the postfix-%s package installed?",
+                 dict_type, dict_type);
+    if (!dp->mkmap_name)
+       msg_fatal("unsupported dictionary type: %s does not support "
+                 "bulk-mode creation.", dict_type);
+    if (stat(dp->soname, &st) < 0)
+       msg_fatal("unsupported dictionary type: %s (%s: %m). "
+                 "Is the postfix-%s package installed?",
+                 dict_type, dp->soname, dict_type);
+    if (st.st_uid != 0 || (st.st_mode & (S_IWGRP | S_IWOTH)) != 0)
+       msg_fatal("unsupported dictionary type: %s "
+                 "(%s: file is writable by non-root users)",
+                 dict_type, dp->soname);
+    fn[0].name = dp->mkmap_name;
+    fn[1].name = 0;
+    load_library_symbols(dp->soname, fn, (LIB_DP *) 0);
+    return ((MKMAP_OPEN_FN) fn[0].fptr);
+}
+
+/* dymap_list - enumerate dynamically-linked database type names */
+
+static void dymap_list(ARGV *map_names)
+{
+    HTABLE_INFO **ht_list, **ht;
+
+    /*
+     * Respect the hook nesting order.
+     */
+    if (saved_dict_mapnames_hook != 0)
+       saved_dict_mapnames_hook(map_names);
+
+    for (ht_list = ht = htable_list(dymap_info); *ht != 0; ht++)
+       argv_add(map_names, ht[0]->key, ARGV_END);
+    myfree((char *) ht_list);
+}
+
+/* dymap_entry_alloc - allocate dynamicmaps.cf entry */
+
+static DYMAP_INFO *dymap_entry_alloc(char **argv)
+{
+    DYMAP_INFO *dp;
+
+    dp = (DYMAP_INFO *) mymalloc(sizeof(*dp));
+    dp->soname = mystrdup(argv[0]);
+    dp->dict_name = mystrdup(argv[1]);
+    dp->mkmap_name = argv[2] ? mystrdup(argv[2]) : 0;
+    return (dp);
+}
+
+/* dymap_entry_free - htable(3) call-back to destroy dynamicmaps.cf entry */
+
+static void dymap_entry_free(char *ptr)
+{
+    DYMAP_INFO *dp = (DYMAP_INFO *) ptr;
+
+    myfree(dp->soname);
+    myfree(dp->dict_name);
+    if (dp->mkmap_name)
+       myfree(dp->mkmap_name);
+    myfree((char *) dp);
+}
+
+/* dymap_read_conf - read dynamicmaps.cf-like file */
+
+static void dymap_read_conf(const char *path, const char *base)
+{
+    VSTREAM *fp;
+    VSTRING *buf;
+    char   *cp;
+    ARGV   *argv;
+    int     linenum = 0;
+    struct stat st;
+
+    /*
+     * Silently ignore a missing dynamicmaps.cf file, but be explicit about
+     * problems when the file does exist.
+     */
+    if ((fp = vstream_fopen(path, O_RDONLY, 0)) != 0) {
+       if (fstat(vstream_fileno(fp), &st) < 0)
+           msg_fatal("%s: fstat failed; %m", path);
+       if (st.st_uid != 0 || (st.st_mode & (S_IWGRP | S_IWOTH)) != 0) {
+           msg_warn("%s: file is writable by non-root users"
+                    " -- skipping this file", path);
+       } else {
+           buf = vstring_alloc(100);
+           while (vstring_get_nonl(buf, fp) != VSTREAM_EOF) {
+               cp = vstring_str(buf);
+               linenum++;
+               if (*cp == '#' || *cp == '\0')
+                   continue;
+               argv = argv_split(cp, " \t");
+               if (argv->argc != 3 && argv->argc != 4)
+                   msg_fatal("%s, line %d: Expected \"dict-type .so-name dict"
+                             "-function [mkmap-function]\"", path, linenum);
+               if (!ISALNUM(argv->argv[0][0]))
+                   msg_fatal("%s, line %d: unsupported syntax \"%s\"",
+                             path, linenum, argv->argv[0]);
+               if (argv->argv[1][0] != '/') {
+                   cp = concatenate(base, "/", argv->argv[1], (char *) 0);
+                   argv_replace_one(argv, 1, cp);
+                   myfree(cp);
+               }
+               if (htable_locate(dymap_info, argv->argv[0]) != 0)
+                   msg_warn("%s: ignoring duplicate entry for \"%s\"",
+                            path, argv->argv[0]);
+               else
+                   htable_enter(dymap_info, argv->argv[0],
+                                (char *) dymap_entry_alloc(argv->argv + 1));
+               argv_free(argv);
+           }
+           vstring_free(buf);
+
+           /*
+            * Once-only: hook into the dict_open(3) and mkmap_open(3)
+            * infrastructure,
+            */
+           if (dymap_hooks_done == 0) {
+               dymap_hooks_done = 1;
+               saved_dict_open_hook = dict_open_extend(dymap_dict_lookup);
+               saved_mkmap_open_hook = mkmap_open_extend(dymap_mkmap_lookup);
+               saved_dict_mapnames_hook = dict_mapnames_extend(dymap_list);
+           }
+       }
+       vstream_fclose(fp);
+    } else if (errno != ENOENT) {
+       msg_fatal("%s: file open failed: %m", path);
+    }
+}
+
+/* dymap_init - initialize dictionary type to soname etc. mapping */
+
+void    dymap_init(const char *path)
+{
+    const char myname[] = "dymap_init";
+    SCAN_DIR *dir;
+    char   *path_base;
+    char   *path_d;
+    const char *conf_name;
+    char   *path_d_conf;
+    char   *suffix;
+
+    /*
+     * Reload dynamicsmaps.cf, but don't reload already-loaded plugins.
+     */
+    if (dymap_info != 0)
+       htable_free(dymap_info, dymap_entry_free);
+    dymap_info = htable_create(3);
+
+    /*
+     * Read dynamicmaps.cf.
+     */
+    path_base = mystrdup(path);
+    (void) split_at_right(path_base, '/');
+    dymap_read_conf(path, path_base);
+    myfree(path_base);
+
+    /*
+     * Read dynamicmaps.cf.d/filename entries. We allow shared-object files
+     * in dynamicmaps.cf.d. Therefore, configuration file names must have a
+     * distinct suffix.
+     */
+    path_d = concatenate(path, ".d", (char *) 0);
+    if ((dir = scan_dir_open(path_d)) != 0) {
+       while ((conf_name = scan_dir_next(dir)) != 0) {
+           if ((suffix = strrchr(conf_name, '.')) != 0
+               && strcmp(suffix, DYMAP_CF_SUFFIX) == 0) {
+               path_d_conf = concatenate(path_d, "/", conf_name, (char *) 0);
+               dymap_read_conf(path_d_conf, path_d);
+               myfree(path_d_conf);
+           } else if (errno != 0) {
+               /* Don't crash all programs - degrade gracefully. */
+               msg_warn("%s: directory read error: %m", path_d);
+           }
+       }
+       scan_dir_close(dir);
+    } else if (errno != ENOENT) {
+       /* Don't crash all programs - degrade gracefully. */
+       msg_warn("%s: directory open failed: %m", path_d);
+    }
+    myfree(path_d);
+
+    /*
+     * Future proofing, in case someone "improves" the code. We can't hook
+     * into other functions without initializing our private lookup table.
+     */
+    if (dymap_hooks_done != 0 && dymap_info == 0)
+       msg_panic("%s: post-condition botch", myname);
+}
+
+#endif
diff --git a/postfix/src/global/dynamicmaps.h b/postfix/src/global/dynamicmaps.h
new file mode 100644 (file)
index 0000000..d1613d4
--- /dev/null
@@ -0,0 +1,38 @@
+#ifndef _DYNAMICMAPS_H_INCLUDED_
+#define _DYNAMICMAPS_H_INCLUDED_
+
+/*++
+/* NAME
+/*     dynamicmaps 3h
+/* SUMMARY
+/*     load dictionaries dynamically
+/* SYNOPSIS
+/*     #include <dynamicmaps.h>
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+#ifdef USE_DYNAMIC_LIBS
+
+extern void dymap_init(const char *);
+
+#endif
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     LaMont Jones
+/*     Hewlett-Packard Company
+/*     3404 Harmony Road
+/*     Fort Collins, CO 80528, USA
+/*
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
index ae0ae9886caf7a493ce1dd1eb1771a745aeab626..9ad465e2c01f7a2e7b05707a167690923864496c 100644 (file)
@@ -194,10 +194,10 @@ void    mail_conf_suck(void)
 
 /* mail_conf_flush - discard configuration dictionary */
 
-void mail_conf_flush(void)
+void    mail_conf_flush(void)
 {
     if (dict_handle(CONFIG_DICT) != 0)
-        dict_unregister(CONFIG_DICT);
+       dict_unregister(CONFIG_DICT);
 }
 
 /* mail_conf_eval - expand macros in string */
index 6dbf6eecc5fafedbc829838f25fdcffc25eab429..8716c300ad8fc7ec20bd7291eb58ccfdb2fc7e54 100644 (file)
 /* DESCRIPTION
 /*     This module registers dictionary types that depend on higher-level
 /*     Postfix-specific interfaces and protocols.
+/*
+/*     This also initializes the support for run-time loading of
+/*     lookup tables, if applicable.
+/*
+/*     The latter requires basic parameter initialization
+/*     by either mail_conf_read() or mail_params_init().
 /* LICENSE
 /* .ad
 /* .fi
@@ -29,6 +35,9 @@
 
 #include <dict.h>
 #include <msg.h>
+#include <mymalloc.h>
+#include <stringops.h>
+#include <dynamicmaps.h>
 
 /* Global library. */
 
@@ -39,6 +48,8 @@
 #include <dict_sqlite.h>
 #include <dict_memcache.h>
 #include <mail_dict.h>
+#include <mail_params.h>
+#include <mail_dict.h>
 
 typedef struct {
     char   *type;
@@ -47,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
@@ -59,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,
 };
@@ -69,11 +82,24 @@ void    mail_dict_init(void)
 {
     const DICT_OPEN_INFO *dp;
 
+#ifdef USE_DYNAMIC_MAPS
+    char   *path;
+
+    path = concatenate(var_plugin_dir, "/", "dynamicmaps.cf",
+#ifdef SHLIB_VERSION
+                      ".", SHLIB_VERSION,
+#endif
+                      (char *) 0);
+    dymap_init(path);
+    myfree(path);
+#endif
+
     for (dp = dict_open_info; dp->type; dp++)
        dict_open_register(dp->type, dp->open);
 }
 
 #ifdef TEST
+
  /*
   * Proof-of-concept test program.
   */
index 6e4378c2f3f263f735475a27702e448dddb84916..0708ffd582a14321671eb89acad2fb23d5892dc9 100644 (file)
@@ -28,7 +28,9 @@
 /*     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;
 /*     int     var_idle_limit;
 /*     int     var_event_drain;
 #ifdef HAS_DB
 #include <dict_db.h>
 #endif
-#ifdef HAS_LMDB
 #include <dict_lmdb.h>
-#endif
 #include <inet_proto.h>
 #include <vstring_vstream.h>
 #include <iostuff.h>
@@ -222,7 +222,9 @@ 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;
 int     var_event_drain;
 int     var_idle_limit;
@@ -319,6 +321,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)
@@ -553,7 +557,9 @@ 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,
        VAR_INET_INTERFACES, DEF_INET_INTERFACES, &var_inet_interfaces, 0, 0,
        VAR_PROXY_INTERFACES, DEF_PROXY_INTERFACES, &var_proxy_interfaces, 0, 0,
@@ -728,9 +734,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 174fdf906cac4b8a69eae72d77697dffb873dcba..c268b6ec8215ad3a2439dcb5ed0109fcb45ce304 100644 (file)
@@ -3777,6 +3777,28 @@ extern char *var_virt_dsn_filter;
 #define DEF_LOCAL_DSN_FILTER           "$" VAR_DSN_FILTER
 extern char *var_local_dsn_filter;
 
+ /*
+  * Location of shared-library files.
+  * 
+  * If the files will be installed into a known directory, such as a directory
+  * that is processed with the ldconfig(1) command, then the shlib_directory
+  * parameter may be configured at installation time.
+  * 
+  * Otherwise, the shlib_directory parameter must be specified at compile time,
+  * and it cannot be changed afterwards.
+  */
+#define VAR_SHLIB_DIR  "shlib_directory"
+#ifndef DEF_SHLIB_DIR
+#define DEF_SHLIB_DIR  "/usr/local/lib"
+#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 ab05f85471c5c0af1ede8ae50e3d5c9c2d3739ba..cfdf8b794584167d3c684e883d73597052c5cb1b 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      "20140524"
+#define MAIL_RELEASE_DATE      "20140530"
 #define MAIL_VERSION_NUMBER    "2.12"
 
 #ifdef SNAPSHOT
index fa5f889b66fc23b3ab47d4785612b001ff9cee0a..e49311474231d35013fae09b44c41450bd52cac3 100644 (file)
   * acquire the lock after the DB/DBM initialization.
   */
 typedef struct MKMAP {
-    struct DICT *(*open) (const char *, int, int);     /* dict_xx_open() */
+    DICT_OPEN_FN open;                 /* dict_xx_open() */
     struct DICT *dict;                 /* dict_xx_open() result */
     void    (*after_open) (struct MKMAP *);    /* may be null */
     void    (*after_close) (struct MKMAP *);   /* may be null */
-    int     multi_writer;                      /* multi-writer safe */
+    int     multi_writer;              /* multi-writer safe */
 } MKMAP;
 
 extern MKMAP *mkmap_open(const char *, const char *, int, int);
@@ -45,6 +45,11 @@ extern MKMAP *mkmap_sdbm_open(const char *);
 extern MKMAP *mkmap_proxy_open(const char *);
 extern MKMAP *mkmap_fail_open(const char *);
 
+typedef MKMAP *(*MKMAP_OPEN_FN) (const char *);
+typedef MKMAP_OPEN_FN (*MKMAP_OPEN_EXTEND_FN) (const char *);
+extern void mkmap_open_register(const char *, MKMAP_OPEN_FN);
+extern MKMAP_OPEN_EXTEND_FN mkmap_open_extend(MKMAP_OPEN_EXTEND_FN);
+
 /* LICENSE
 /* .ad
 /* .fi
index dfa9bc2ff58af8f201b2ef8d5baeea748392d41d..63f525fd10b74a8a914ea2a61d683a7a1383f9b3 100644 (file)
@@ -6,6 +6,14 @@
 /* SYNOPSIS
 /*     #include <mkmap.h>
 /*
+/*     typedef struct MKMAP {
+/*         DICT_OPEN_FN open;                          /* dict_xx_open() */
+/*         DICT *dict;                                 /* dict_xx_open() result */
+/*         void    (*after_open) (struct MKMAP *);     /* may be null */
+/*         void    (*after_close) (struct MKMAP *);    /* may be null */
+/*         int     multi_writer;                       /* multi-writer safe */
+/*     } MKMAP;
+/*
 /*     MKMAP   *mkmap_open(type, path, open_flags, dict_flags)
 /*     char    *type;
 /*     char    *path;
 /*
 /*     void    mkmap_close(mkmap)
 /*     MKMAP   *mkmap;
+/*
+/*     typedef MKMAP *(*MKMAP_OPEN_FN) (const char *);
+/*     typedef MKMAP_OPEN_FN *(*MKMAP_OPEN_EXTEND_FN) (const char *);
+/*
+/*     void    mkmap_open_register(type, open_fn)
+/*     const char *type;
+/*     MKMAP_OPEN_FN open_fn;
+/*
+/*     MKMAP_OPEN_EXTEND_FN mkmap_open_extend(call_back)
+/*     MKMAP_OPEN_EXTEND_FN call_back;
 /* DESCRIPTION
 /*     This module implements support for creating Postfix databases.
 /*     It is a dict(3) wrapper that adds global locking to dict-level
@@ -29,8 +47,8 @@
 /*     appending the appropriate suffixes to the specified filename.
 /*     Before the database is updated, it is locked for exclusive
 /*     access, and signal delivery is suspended.
-/*     See dict(3) for a description of \fBopen_flags\fR and \fBdict_flags\fR.
-/*     All errors are fatal.
+/*     See dict(3) for a description of \fBopen_flags\fR and
+/*     \fBdict_flags\fR.  All errors are fatal.
 /*
 /*     mkmap_append() appends the named (key, value) pair to the
 /*     database. Update errors are fatal; duplicate keys are ignored
 /*
 /*     mkmap_close() closes the database, releases any locks,
 /*     and resumes signal delivery. All errors are fatal.
+/*
+/*     mkmap_open_register() adds support for a new database type.
+/*
+/*     mkmap_open_extend() registers a call-back function that looks
+/*     up the mkmap open() function for a database type that is not
+/*     registered, or null in case of error. The result value is the
+/*     last previously-registered call-back or null. A mkmap open()
+/*     function is cached after it is looked up through this extension
+/*     mechanism.
 /* SEE ALSO
 /*     sigdelay(3) suspend/resume signal delivery
 /* LICENSE
@@ -61,6 +88,7 @@
 /* Utility library. */
 
 #include <msg.h>
+#include <htable.h>
 #include <dict.h>
 #include <dict_db.h>
 #include <dict_cdb.h>
 
  /*
   * Information about available database types. Here, we list only those map
-  * types that support "create" operations.
+  * types that support "bulk create" operations.
   * 
-  * We use a different table (in dict_open.c) when querying maps.
+  * We use a different table (in dict_open.c and mail_dict.c) when querying maps
+  * or when making incremental updates.
   */
 typedef struct {
-    char   *type;
-    MKMAP  *(*before_open) (const char *);
+    const char *type;
+    MKMAP_OPEN_FN before_open;
 } MKMAP_OPEN_INFO;
 
-static const MKMAP_OPEN_INFO mkmap_types[] = {
-    DICT_TYPE_PROXY, mkmap_proxy_open,
+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,
 };
 
+static HTABLE *mkmap_open_hash;
+
+static MKMAP_OPEN_EXTEND_FN mkmap_open_extend_hook = 0;
+
+/* mkmap_open_init - one-off initialization */
+
+static void mkmap_open_init(void)
+{
+    const char myname[] = "mkmap_open_init";
+    const MKMAP_OPEN_INFO *mp;
+
+    if (mkmap_open_hash != 0)
+       msg_panic("%s: multiple initialization", myname);
+    mkmap_open_hash = htable_create(10);
+
+    for (mp = mkmap_open_info; mp->type; mp++)
+       htable_enter(mkmap_open_hash, mp->type, (char *) mp);
+}
+
+/* mkmap_open_register - register dictionary type */
+
+void    mkmap_open_register(const char *type, MKMAP_OPEN_FN open_fn)
+{
+    const char myname[] = "mkmap_open_register";
+    MKMAP_OPEN_INFO *mp;
+    HTABLE_INFO *ht;
+
+    if (mkmap_open_hash == 0)
+       mkmap_open_init();
+    if (htable_find(mkmap_open_hash, type))
+       msg_panic("%s: database type exists: %s", myname, type);
+    mp = (MKMAP_OPEN_INFO *) mymalloc(sizeof(*mp));
+    mp->before_open = open_fn;
+    ht = htable_enter(mkmap_open_hash, type, (char *) mp);
+    mp->type = ht->key;
+}
+
+/* mkmap_open_extend - register alternate lookup function */
+
+MKMAP_OPEN_EXTEND_FN mkmap_open_extend(MKMAP_OPEN_EXTEND_FN new_cb)
+{
+    MKMAP_OPEN_EXTEND_FN old_cb;
+
+    old_cb = mkmap_open_extend_hook;
+    mkmap_open_extend_hook = new_cb;
+    return (old_cb);
+}
+
 /* mkmap_append - append entry to map */
 
 #undef mkmap_append
@@ -160,15 +238,21 @@ MKMAP  *mkmap_open(const char *type, const char *path,
 {
     MKMAP  *mkmap;
     const MKMAP_OPEN_INFO *mp;
+    MKMAP_OPEN_FN open_fn;
 
     /*
      * Find out what map type to use.
      */
-    for (mp = mkmap_types; /* void */ ; mp++) {
-       if (mp->type == 0)
+    if (mkmap_open_hash == 0)
+       mkmap_open_init();
+    if ((mp = (MKMAP_OPEN_INFO *) htable_find(mkmap_open_hash, type)) == 0) {
+       if (mkmap_open_extend_hook != 0 &&
+           (open_fn = mkmap_open_extend_hook(type)) != 0) {
+           mkmap_open_register(type, open_fn);
+           mp = (MKMAP_OPEN_INFO *) htable_find(mkmap_open_hash, type);
+       }
+       if (mp == 0)
            msg_fatal("unsupported map type for this operation: %s", type);
-       if (strcmp(type, mp->type) == 0)
-           break;
     }
     if (msg_verbose)
        msg_info("open %s %s", type, path);
index e11bc7540d6fad549596929e09f4b4660d7d74ac..1471a632756a64ff085746b6ec79161c2eba847d 100644 (file)
@@ -14,12 +14,14 @@ CFLAGS      = $(DEBUG) $(OPT) $(DEFS)
 PROG   = local
 TESTPROG= 
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index d1be8fec7ff13c347ef5f712153bd6dfee788c63..466159d4ca668801c1dc1bba6f84ef40b17a5eb1 100644 (file)
@@ -14,15 +14,16 @@ HDRS        = mail_server.h master_proto.h mail_flow.h
 INT_HDR        = master.h
 DEFS   = -I. -I$(INC_DIR) -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
-LIB    = libmaster.a
+LIB    = lib$(LIB_PREFIX)master$(LIB_SUFFIX)
 PROG   = master
 TESTPROG= 
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
 BIN_DIR        = ../../libexec
 
-.c.o:; $(CC) $(CFLAGS) -c $*.c
+.c.o:; $(CC) `for i in $(LIB_OBJ); do if [ $$i = $@ ]; then echo $(SHLIB_CFLAGS); else true; fi; done` $(CFLAGS) -c $*.c
 
 all:   $(PROG) $(LIB)
 
@@ -32,7 +33,7 @@ Makefile: Makefile.in
        cat ../../conf/makedefs.out $? >$@
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 test:  $(TESTPROG)
 
@@ -43,6 +44,7 @@ root_tests:
 $(LIB):        $(LIB_OBJ)
        $(AR) $(ARFL) $(LIB) $?
        $(RANLIB) $(LIB)
+       $(SHLIB_LD) -o $(LIB) $(LIB_OBJ)
 
 $(LIB_DIR)/$(LIB): $(LIB)
        cp $(LIB) $(LIB_DIR)/$(LIB)
@@ -51,7 +53,7 @@ $(LIB_DIR)/$(LIB): $(LIB)
 $(BIN_DIR)/$(PROG): $(PROG)
         cp $(PROG) $(BIN_DIR)
 
-update: $(LIB_DIR)/$(LIB) $(BIN_DIR)/$(PROG)
+update: $(LIB_DIR)/$(LIB) $(BIN_DIR)/$(PROG) $(HDRS)
        -for i in $(HDRS); \
        do \
          cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
index 876800db072f067bf604c04386d065b3b14b5d72..b3f9586624f77c4c6458134dc73824a649ba729d 100644 (file)
@@ -608,11 +608,6 @@ NORETURN event_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
      */
     mail_conf_suck();
 
-    /*
-     * Register dictionaries that use higher-level interfaces and protocols.
-     */
-    mail_dict_init();
-
     /*
      * After database open error, continue execution with reduced
      * functionality.
@@ -692,6 +687,12 @@ NORETURN event_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
     if (redo_syslog_init)
        msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
 
+    /*
+     * Register higher-level dictionaries and initialize the support for
+     * dynamically-loaded dictionarles.
+     */
+    mail_dict_init();
+
     /*
      * If not connected to stdin, stdin must not be a terminal.
      */
index c4f9d82ce33fa26985975ee774981123523826b1..72e3425db05ea21018d0b9e965ba74e4bef1c244 100644 (file)
@@ -604,11 +604,6 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
      */
     mail_conf_suck();
 
-    /*
-     * Register dictionaries that use higher-level interfaces and protocols.
-     */
-    mail_dict_init();
-
     /*
      * After database open error, continue execution with reduced
      * functionality.
@@ -688,6 +683,12 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...)
     if (redo_syslog_init)
        msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
 
+    /*
+     * Register higher-level dictionaries and initialize the support for
+     * dynamically-loaded dictionarles.
+     */
+    mail_dict_init();
+
     /*
      * If not connected to stdin, stdin must not be a terminal.
      */
index 8dc765004a9e88225c0f0fd9f73b6bc802e7bcd5..8c4e83deee709f454d5d176b38c7bcb61ebfe72c 100644 (file)
@@ -482,11 +482,6 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...)
      */
     mail_conf_suck();
 
-    /*
-     * Register dictionaries that use higher-level interfaces and protocols.
-     */
-    mail_dict_init();
-
     /*
      * After database open error, continue execution with reduced
      * functionality.
@@ -566,6 +561,12 @@ NORETURN single_server_main(int argc, char **argv, SINGLE_SERVER_FN service,...)
     if (redo_syslog_init)
        msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
 
+    /*
+     * Register higher-level dictionaries and initialize the support for
+     * dynamically-loaded dictionarles.
+     */
+    mail_dict_init();
+
     /*
      * If not connected to stdin, stdin must not be a terminal.
      */
index 591c3543c145ffc020fd223e2d59d15e6edfc5c7..68b5f6b58ab141d1238978130bab4c88c7655dd7 100644 (file)
@@ -485,11 +485,6 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,..
      */
     mail_conf_suck();
 
-    /*
-     * Register dictionaries that use higher-level interfaces and protocols.
-     */
-    mail_dict_init();
-
     /*
      * After database open error, continue execution with reduced
      * functionality.
@@ -569,6 +564,12 @@ NORETURN trigger_server_main(int argc, char **argv, TRIGGER_SERVER_FN service,..
     if (redo_syslog_init)
        msg_syslog_init(mail_task(var_procname), LOG_PID, LOG_FACILITY);
 
+    /*
+     * Register higher-level dictionaries and initialize the support for
+     * dynamically-loaded dictionarles.
+     */
+    mail_dict_init();
+
     /*
      * If not connected to stdin, stdin must not be a terminal.
      */
index 99b646902544d371f788d717576a3b996c5ce7bc..2266d18aaae8b3fc72a62394e7b215ef5085ff0f 100644 (file)
@@ -9,7 +9,8 @@ INCL    =
 LIB    = libmilter.a
 TESTPROG= milter test-milter
 
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../$(LIB_PREFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
 MAKES  =
@@ -30,12 +31,12 @@ tests:
 root_tests:
 
 $(LIB):        $(OBJS)
-       $(AR) $(ARFL) $(LIB) $?
-       $(RANLIB) $(LIB)
+       $(_AR) $(ARFL) $(LIB) $?
+       $(_RANLIB) $(LIB)
 
 $(LIB_DIR)/$(LIB): $(LIB)
        cp $(LIB) $(LIB_DIR)
-       $(RANLIB) $(LIB_DIR)/$(LIB)
+       $(_RANLIB) $(LIB_DIR)/$(LIB)
 
 update: $(LIB_DIR)/$(LIB) $(HDRS)
        -for i in $(HDRS); \
index 3604e3249186c457fdf4957204f1e11176260de2..780061d7160a2d3d6dd86367ce6938de4760eeeb 100644 (file)
@@ -14,12 +14,14 @@ CFLAGS      = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = qmgr
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 07e39f2e13dfca9b4e11bd8455d6179a5fa14791..ea876c22a0ce442b268233f7a32bad9bda25841f 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = pickup
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index cfbd2e0d708b1330a3f72693b901986dc0d68b85..9763faa49c490bed8fc94db6ca63eab6db9db850 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = pipe
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index a2e11f86a2e70097d4958629575da6734bbb9a7a..2f731eb80f60680722760364251f0a62cfabe20b 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = postalias
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 1760824c609d8b6dc795c15d014a62943041fea0..1abda27a01da64c0e56401736d6fbed0f8560ddf 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = postcat
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 4db4defefdeca6aa5168c9733a229db8fc6ae4f1..45d894760e6140d62c01702db03b28193ad0e421 100644 (file)
@@ -21,18 +21,20 @@ DUMMIES     = makes_dummy # for "make -j"
 PROG   = postconf
 SAMPLES        = ../../conf/main.cf.default
 INC_DIR        = ../../include
-LIBS   = ../../lib/libxsasl.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/libxsasl.a \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 ../../conf/main.cf.default: $(PROG) Makefile
        rm -f $@
        (echo "# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE"; \
         echo "# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX."; \
-        echo "#"; ./$(PROG) -d -c ../../conf) | \
+        echo "#"; $(SHLIB_ENV) ./$(PROG) -d -c ../../conf) | \
            egrep -v '^(myhostname|mydomain|mynetworks|process_name|process_id) ' >$@
 
 $(OBJS): ../../conf/makedefs.out
index 23bcbb082eff1228b578eda00676b2786e78c7ff..973628ee840ae797dc0eaf34fb819b6c9e6a1480 100644 (file)
@@ -849,6 +849,7 @@ int     main(int argc, char **argv)
      * If showing map types, show them and exit
      */
     if (pcf_cmd_mode & PCF_SHOW_MAPS) {
+       mail_conf_read();
        mail_dict_init();
        pcf_show_maps();
     }
index cfdc692c8c06a284ee50648849164b73882f2da4..9559943357b4ed48183df1f99a8c1b3864c30970 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = postdrop
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
@@ -63,6 +64,7 @@ postdrop.o: ../../include/clean_env.h
 postdrop.o: ../../include/cleanup_user.h
 postdrop.o: ../../include/iostuff.h
 postdrop.o: ../../include/mail_conf.h
+postdrop.o: ../../include/mail_dict.h
 postdrop.o: ../../include/mail_params.h
 postdrop.o: ../../include/mail_proto.h
 postdrop.o: ../../include/mail_queue.h
index 232217d85a9936ac8d5a7a36f6fea8ae754de3e2..24a0f117d145bfadfd0f8df6e3f4f80964a933e6 100644 (file)
 #include <cleanup_user.h>
 #include <record.h>
 #include <rec_type.h>
+#include <mail_dict.h>
 #include <user_acl.h>
 #include <rec_attr_map.h>
 
@@ -312,6 +313,7 @@ int     main(int argc, char **argv)
      * Mail submission access control. Should this be in the user-land gate,
      * or in the daemon process?
      */
+    mail_dict_init();
     if ((errstr = check_user_acl_byuid(var_submit_acl, uid)) != 0)
        msg_fatal("User %s(%ld) is not allowed to submit mail",
                  errstr, (long) uid);
index 71e1224e1bec2912c9c7d3df3342be864cb5d30d..4b72df12f8c54d4564403022b332a62f5170d1c5 100644 (file)
@@ -9,12 +9,13 @@ FILES = Makefile $(SRCS) $(HDRS)
 INC_DIR        = ../../include
 TESTPROG=
 PROG   = postfix
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 183c825e52816d193bb31dd457de688679a33c15..c8f08a3077592ad4a76e74f6d8f6701af195fac8 100644 (file)
 /* .fi
 /*     The following \fBmain.cf\fR configuration parameters are
 /*     exported as environment variables with the same names:
+/* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
+/*     The default location of the Postfix main.cf and master.cf
+/*     configuration files.
 /* .IP "\fBcommand_directory (see 'postconf -d' output)\fR"
 /*     The location of all postfix administrative commands.
 /* .IP "\fBdaemon_directory (see 'postconf -d' output)\fR"
 /*     The directory with Postfix support programs and daemon programs.
-/* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
-/*     The default location of the Postfix main.cf and master.cf
-/*     configuration files.
-/* .IP "\fBqueue_directory (see 'postconf -d' output)\fR"
-/*     The location of the Postfix top-level queue directory.
+/* .IP "\fBhtml_directory (see 'postconf -d' output)\fR"
+/*     The location of Postfix HTML files that describe how to build,
+/*     configure or operate a specific Postfix subsystem or feature.
 /* .IP "\fBmail_owner (postfix)\fR"
 /*     The UNIX system account that owns the Postfix queue and most Postfix
 /*     daemon processes.
-/* .IP "\fBsetgid_group (postdrop)\fR"
-/*     The group ownership of set-gid Postfix commands and of group-writable
-/*     Postfix directories.
-/* .IP "\fBsendmail_path (see 'postconf -d' output)\fR"
-/*     A Sendmail compatibility feature that specifies the location of
-/*     the Postfix \fBsendmail\fR(1) command.
-/* .IP "\fBnewaliases_path (see 'postconf -d' output)\fR"
-/*     Sendmail compatibility feature that specifies the location of the
-/*     \fBnewaliases\fR(1) command.
 /* .IP "\fBmailq_path (see 'postconf -d' output)\fR"
 /*     Sendmail compatibility feature that specifies where the Postfix
 /*     \fBmailq\fR(1) command is installed.
-/* .IP "\fBhtml_directory (see 'postconf -d' output)\fR"
-/*     The location of Postfix HTML files that describe how to build,
-/*     configure or operate a specific Postfix subsystem or feature.
 /* .IP "\fBmanpage_directory (see 'postconf -d' output)\fR"
 /*     Where the Postfix manual pages are installed.
+/* .IP "\fBnewaliases_path (see 'postconf -d' output)\fR"
+/*     Sendmail compatibility feature that specifies the location of the
+/*     \fBnewaliases\fR(1) command.
+/* .IP "\fBqueue_directory (see 'postconf -d' output)\fR"
+/*     The location of the Postfix top-level queue directory.
 /* .IP "\fBreadme_directory (see 'postconf -d' output)\fR"
 /*     The location of Postfix README files that describe how to build,
 /*     configure or operate a specific Postfix subsystem or feature.
+/* .IP "\fBsendmail_path (see 'postconf -d' output)\fR"
+/*     A Sendmail compatibility feature that specifies the location of
+/*     the Postfix \fBsendmail\fR(1) command.
+/* .IP "\fBsetgid_group (postdrop)\fR"
+/*     The group ownership of set-gid Postfix commands and of group-writable
+/*     Postfix directories.
 /* .PP
 /*     Available in Postfix version 2.5 and later:
 /* .IP "\fBdata_directory (see 'postconf -d' output)\fR"
 /*     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
 /*     Other configuration parameters:
-/* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
-/*     The default location of the Postfix main.cf and master.cf
-/*     configuration files.
 /* .IP "\fBimport_environment (see 'postconf -d' output)\fR"
 /*     The list of environment parameters that a Postfix process will
 /*     import from a non-Postfix parent process.
 /*     $daemon_directory/postfix-files, file/directory permissions
 /*     $daemon_directory/postfix-script, administrative commands
 /*     $daemon_directory/post-install, post-installation configuration
+/*     $daemon_directory/dynamicmaps.cf, plug-in database clients
 /* SEE ALSO
 /*     Commands:
 /*     postalias(1), create/update/query alias database
@@ -503,8 +508,10 @@ 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 */
 
     /*
      * Do we want to keep adding things here as shell scripts evolve?
index 72fde2102fdff086429745958af8c5136c697324..74f1cddaef8480685508dfcfb51e2166928b018c 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = postkick
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index de6546bd39cef631bace3ede9a9fdf979b9acecb..1715d719cb2d2bcdb88c942884e3e4dba3cb7161 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = postlock
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index effad6c4e8520c7e5162378d7e39f11d0656c641..0cc87284244fb4c28e7c50532525ea0c6cfba618 100644 (file)
@@ -9,12 +9,13 @@ FILES = Makefile $(SRCS) $(HDRS)
 INC_DIR        = ../../include
 TESTPROG=
 PROG   = postlog
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 75e7b21ec06a3bf6b62846d4c923b55f36bacf40..5f7dc6ad7d1b1a6072e73a5be568e276bf7f0289 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = postmap
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 2c8f4137f095692b283df4c060c04ed74baf286a..b37583ef84edf4924f514da93cff015eadbb089e 100644 (file)
@@ -9,12 +9,13 @@ FILES = Makefile $(SRCS) $(HDRS)
 INC_DIR        = ../../include
 TESTPROG=
 PROG   = postmulti
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 396ab97c6e1d4dbb3c4c44683ea4845d3ac40718..6ba697223c48afd80a316fdfeb7278f54ecb53c2 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = postqueue
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index ecbf3da13e1c3bcc6dfa77b664be802d5e571699..a5951b32ca17cf2b98db15babfbcf9ac4a7d4ad1 100644 (file)
@@ -17,13 +17,16 @@ TESTPROG=
 PROG   = postscreen
 INC_DIR = ../../include
 # Fake libdns dependency, for early-binding shared-library builds.
-LIBS   = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a \
-       ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index fe86fda947f027e804234b267c2c482a250be49c..e38b62420c66f71140995f04683784d3e4c4e6d5 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = postsuper
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index c5ab762be6843de20f52a296116cfb356c5b78e4..1b427b0830371c286cda6fa37afa4c4cc3a94018 100644 (file)
@@ -8,8 +8,10 @@ CFLAGS = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 INC_DIR        = ../../include
 PROG   = posttls-finger
-LIBS   = ../../lib/libtls.a ../../lib/libdns.a \
-       ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
@@ -21,7 +23,7 @@ Makefile: Makefile.in
        cat ../../conf/makedefs.out $? >$@
 
 posttls-finger: $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 test:  $(TESTPROG)
 
index 96358faa31c70b8b4a7de5869fd5fa8d99d1d21b..387bb890f65b2c9ecb79747b2c8666841447354d 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = proxymap
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index bd63a9b4347eef8d0e293313bb18ca6142133781..1286518eaf057a69288b815722f280689e0ac4ec 100644 (file)
@@ -16,12 +16,14 @@ CFLAGS      = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = qmgr
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index f99e266958a7e51e69693c1314291a2ec60bedeb..4a0098e2cd3f2c1610bda70c8cfc81dd858d90ba 100644 (file)
@@ -8,12 +8,15 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = qmqpd
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libdns.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index c6ab06562e31d48fd20a9df0d6a1dd5fc9abe88c..274fb8aaa94552e9d13dd8e191976fee7897d5fa 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = scache
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 02111628fad1899dd951da5209a87a7b7b8f0042..740d745a29ae7259d4c0d7f9a65014ac5c780129 100644 (file)
@@ -8,12 +8,13 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG=
 PROG   = sendmail
 INC_DIR        = ../../include
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index d4cd349cba04f3e3296bdf304b73faa53bea6982..ecfea376b21b318a93a5706769896778d7e91f81 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = showq
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index e5013e4a2e9ced942b43f67a81d0aae8aaf52b9c..bc284e68da4db442aed1b5a154712612f262ca10 100644 (file)
@@ -14,13 +14,17 @@ CFLAGS      = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= smtp_unalias smtp_map11
 PROG   = smtp
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a \
-       ../../lib/libxsasl.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/libxsasl.a \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
@@ -69,8 +73,8 @@ smtp_map11: smtp_map11.c $(LIBS)
 
 # This needs trivial-rewrite service and myorigin==mydomain
 smtp_map11_test: smtp_map11 map11_map smtp_map11.ref
-       ../postmap/postmap map11_map
-       ./smtp_map11 hash:map11_map foo@example.com bar@example.com \
+       $(SHLIB_ENV) ../postmap/postmap map11_map
+       $(SHLIB_ENV) ./smtp_map11 hash:map11_map foo@example.com bar@example.com \
            baz@example.com foo@example.net >smtp_map11.tmp 2>&1
        sed -e "s/MYDOMAIN/`postconf -h mydomain`/" \
            -e "s/MYHOSTNAME/`postconf -h myhostname`/" smtp_map11.ref | \
index 87160dc280c0eb799c19edf779aa6337302a2d89..b0c375ef944c64742b581998bf1790e7c9df3158 100644 (file)
@@ -17,14 +17,19 @@ TESTPROG= smtpd_token smtpd_check
 PROG   = smtpd
 INC_DIR        = ../../include
 # Fake libdns dependency, for early-binding shared-library builds.
-LIBS   = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a \
-       ../../lib/libxsasl.a ../../lib/libmilter.a ../../lib/libdns.a \
-       ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/libxsasl.a \
+       ../../lib/libmilter.a \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
@@ -76,66 +81,66 @@ root_tests:
 # This requires that the DNS server can query porcupine.org.
 
 smtpd_check_test: smtpd_check smtpd_check.in smtpd_check.ref smtpd_check_access
-       ../postmap/postmap hash:smtpd_check_access
-       ./smtpd_check <smtpd_check.in >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap hash:smtpd_check_access
+       $(SHLIB_ENV) ./smtpd_check <smtpd_check.in >smtpd_check.tmp 2>&1
        diff smtpd_check.ref smtpd_check.tmp
        rm -f smtpd_check.tmp smtpd_check_access.*
 
 # This requires that the DNS server can query porcupine.org.
 
 smtpd_check_test2: smtpd_check smtpd_check.in2 smtpd_check.ref2 smtpd_check_access
-       ../postmap/postmap hash:smtpd_check_access
-       ./smtpd_check <smtpd_check.in2 >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap hash:smtpd_check_access
+       $(SHLIB_ENV) ./smtpd_check <smtpd_check.in2 >smtpd_check.tmp 2>&1
        diff smtpd_check.ref2 smtpd_check.tmp
        rm -f smtpd_check.tmp smtpd_check_access.*
 
 smtpd_check_test4: smtpd_check smtpd_check.in4 smtpd_check.ref4 smtpd_check_access
-       ../postmap/postmap hash:smtpd_check_access
-       ./smtpd_check <smtpd_check.in4 >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap hash:smtpd_check_access
+       $(SHLIB_ENV) ./smtpd_check <smtpd_check.in4 >smtpd_check.tmp 2>&1
        diff smtpd_check.ref4 smtpd_check.tmp
        rm -f smtpd_check.tmp smtpd_check_access.*
 
 smtpd_acl_test: smtpd_check smtpd_acl.in smtpd_acl.ref smtpd_check_access
-       ../postmap/postmap hash:smtpd_check_access
-       ./smtpd_check <smtpd_acl.in >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap hash:smtpd_check_access
+       $(SHLIB_ENV) ./smtpd_check <smtpd_acl.in >smtpd_check.tmp 2>&1
        diff smtpd_acl.ref smtpd_check.tmp
        rm -f smtpd_check.tmp smtpd_check_access.*
 
 # This requires that the DNS server can query porcupine.org.
 
 smtpd_exp_test: smtpd_check smtpd_exp.in smtpd_exp.ref
-       ../postmap/postmap hash:smtpd_check_access
-       ./smtpd_check <smtpd_exp.in >smtpd_exp.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap hash:smtpd_check_access
+       $(SHLIB_ENV) ./smtpd_check <smtpd_exp.in >smtpd_exp.tmp 2>&1
        diff smtpd_exp.ref smtpd_exp.tmp
        rm -f smtpd_exp.tmp smtpd_check_access.*
 
 smtpd_check_dsn_test: smtpd_check smtpd_check_dsn.in smtpd_check_dsn.ref smtpd_check_access
-       ../postmap/postmap hash:smtpd_check_access
-       ./smtpd_check <smtpd_check_dsn.in >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap hash:smtpd_check_access
+       $(SHLIB_ENV) ./smtpd_check <smtpd_check_dsn.in >smtpd_check.tmp 2>&1
        diff smtpd_check_dsn.ref smtpd_check.tmp
        rm -f smtpd_check.tmp smtpd_check_access.*
 
 # This requires that 168,100.189.7 is a local or virtual interface.
 
 smtpd_check_backup_test: smtpd_check smtpd_check_backup.in smtpd_check_backup.ref
-       ./smtpd_check <smtpd_check_backup.in >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ./smtpd_check <smtpd_check_backup.in >smtpd_check.tmp 2>&1
        diff smtpd_check_backup.ref smtpd_check.tmp
        rm -f smtpd_check.tmp
 
 smtpd_token_test: smtpd_token smtpd_token.in smtpd_token.ref
-       ./smtpd_token <smtpd_token.in >smtpd_token.tmp 2>&1
+       $(SHLIB_ENV) ./smtpd_token <smtpd_token.in >smtpd_token.tmp 2>&1
        diff smtpd_token.ref smtpd_token.tmp
        rm -f smtpd_token.tmp
 
 # This requires that the DNS server can query porcupine.org and rfc-ignorant.org
 
 smtpd_dnswl_test: smtpd_check smtpd_dnswl.in smtpd_dnswl.ref
-       ./smtpd_check <smtpd_dnswl.in >smtpd_dnswl.tmp 2>&1
+       $(SHLIB_ENV) ./smtpd_check <smtpd_dnswl.in >smtpd_dnswl.tmp 2>&1
        diff smtpd_dnswl.ref smtpd_dnswl.tmp
        rm -f smtpd_dnswl.tmp
 
 smtpd_error_test: smtpd_check smtpd_error.in smtpd_error.ref
-       ./smtpd_check <smtpd_error.in >smtpd_check.tmp 2>&1
+       $(SHLIB_ENV) ./smtpd_check <smtpd_error.in >smtpd_check.tmp 2>&1
        diff smtpd_error.ref smtpd_check.tmp
        rm -f smtpd_check.tmp
 
index 79a3ecad623df5c3cf33dd60df974a2aed3a19b0..1dec35497a06357d39a525bc1663d749ddaef13a 100644 (file)
@@ -8,7 +8,8 @@ CFLAGS  = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 INC_DIR        = ../../include
 PROG   = smtp-source smtp-sink qmqp-source qmqp-sink
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
@@ -20,16 +21,16 @@ Makefile: Makefile.in
        cat ../../conf/makedefs.out $? >$@
 
 smtp-sink: smtp-sink.o $(LIBS)
-       $(CC) $(CFLAGS) -o $@ smtp-sink.o $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ smtp-sink.o $(LIBS) $(SYSLIBS)
 
 smtp-source: smtp-source.o $(LIBS)
-       $(CC) $(CFLAGS) -o $@ smtp-source.o $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ smtp-source.o $(LIBS) $(SYSLIBS)
 
 qmqp-sink: qmqp-sink.o $(LIBS)
-       $(CC) $(CFLAGS) -o $@ qmqp-sink.o $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ qmqp-sink.o $(LIBS) $(SYSLIBS)
 
 qmqp-source: qmqp-source.o $(LIBS)
-       $(CC) $(CFLAGS) -o $@ qmqp-source.o $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ qmqp-source.o $(LIBS) $(SYSLIBS)
 
 test:  $(TESTPROG)
 
index 33c075a9e44cb8ccfcb154221d92e097b5a88eb6..b4800556390a0e0d43fa2c820e9bb55c129e6efa 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = spawn
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 1af94190268abe0b086699a1a3343e8f03eaaa1d..3daf50b51d229cabf12cbe648ee9464dd40d191b 100644 (file)
@@ -16,15 +16,17 @@ TESTSRC     =
 DEFS   = -I. -I$(INC_DIR) -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
 INCL   =
-LIB    = libtls.a
+LIB    = lib$(LIB_PREFIX)tls$(LIB_SUFFIX)
 TESTPROG= tls_dh tls_mgr tls_rsa tls_dane
 
-LIBS   = ../../lib/libdns.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
 MAKES  =
 
-.c.o:; $(CC) $(CFLAGS) -c $*.c
+.c.o:; $(CC) $(SHLIB_CFLAGS) $(CFLAGS) -c $*.c
 
 all: $(LIB)
 
@@ -42,6 +44,7 @@ root_tests:
 $(LIB):        $(OBJS)
        $(AR) $(ARFL) $(LIB) $?
        $(RANLIB) $(LIB)
+       $(SHLIB_LD) -o $(LIB) $(OBJS)
 
 $(LIB_DIR)/$(LIB): $(LIB)
        cp $(LIB) $(LIB_DIR)
index 6ee269582f970a70e605612c2e1f793dc745564b..5f2cd95ed1155d81410b94065ed91b9b55c0d19d 100644 (file)
@@ -9,13 +9,16 @@ TESTPROG=
 PROG   = tlsmgr
 INC_DIR        = ../../include
 # Fake libdns dependency, for early-binding shared-library builds.
-LIBS   = ../../lib/libmaster.a ../../lib/libtls.a ../../lib/libdns.a \
-       ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 137752a9fb994358d6933fdb4eb15b0b2cc8f0e6..0435f0dd5e8e63a56b63e81ae32b3f1ecbc13a40 100644 (file)
@@ -8,13 +8,16 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = tlsproxy
 INC_DIR = ../../include
-LIBS   = ../../lib/libtls.a ../../lib/libmaster.a ../../lib/libglobal.a \
-       ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)tls$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)dns$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index c1860672f6d373918ccdbdd1e5e81e515a916506..516c851d807aef0e49c782e30860d1aaf2e57e4b 100644 (file)
@@ -8,7 +8,9 @@ CFLAGS  = $(DEBUG) $(OPT) $(DEFS)
 LIB    = 
 TESTPROG= 
 PROG   = trivial-rewrite
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
 BIN_DIR        = ../../libexec
@@ -18,7 +20,7 @@ BIN_DIR       = ../../libexec
 all:   $(PROG) $(LIB)
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 5ab2232601736a773998689147166ecf24ad77ae..d9c332bccca45550a02d38d86c449e72197c14b6 100644 (file)
@@ -21,6 +21,7 @@ SRCS  = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
        readlline.c ring.c safe_getenv.c safe_open.c \
        sane_accept.c sane_connect.c sane_link.c sane_rename.c \
        sane_socketpair.c sane_time.c scan_dir.c set_eugid.c set_ugid.c \
+       load_lib.c \
        sigdelay.c skipblanks.c sock_addr.c spawn_command.c split_at.c \
        split_nameval.c stat_as.c strcasecmp.c stream_connect.c \
        stream_listen.c stream_recv_fd.c stream_send_fd.c stream_trigger.c \
@@ -41,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 \
@@ -51,6 +52,7 @@ OBJS  = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
        host_port.o htable.o inet_addr_host.o inet_addr_list.o \
        inet_addr_local.o inet_connect.o inet_listen.o inet_proto.o \
        inet_trigger.o line_wrap.o lowercase.o lstat_as.o mac_expand.o \
+       load_lib.o \
        mac_parse.o make_dirs.o mask_addr.o match_list.o match_ops.o msg.o \
        msg_output.o msg_syslog.o msg_vstream.o mvect.o myaddrinfo.o myflock.o \
        mymalloc.o myrand.o mystrtok.o name_code.o name_mask.o netstring.o \
@@ -74,7 +76,12 @@ 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 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 the PLUGIN_* macros.
+MAP_OBJ        = dict_pcre.o $(LIB_MAP_OBJ)
+LIB_MAP_OBJ = dict_cdb.o dict_lmdb.o dict_sdbm.o slmdb.o
 HDRS   = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
        chroot_uid.h cidr_match.h clean_env.h connect.h ctable.h dict.h \
        dict_cdb.h dict_cidr.h dict_db.h dict_dbm.h dict_env.h dict_ht.h \
@@ -89,6 +96,7 @@ HDRS  = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
        mymalloc.h myrand.h name_code.h name_mask.h netstring.h nvtable.h \
        open_as.h open_lock.h percentm.h posix_signals.h readlline.h ring.h \
        safe.h safe_open.h sane_accept.h sane_connect.h sane_fsops.h \
+       load_lib.h \
        sane_socketpair.h sane_time.h scan_dir.h set_eugid.h set_ugid.h \
        sigdelay.h sock_addr.h spawn_command.h split_at.h stat_as.h \
        stringops.h sys_defs.h timed_connect.h timed_wait.h trigger.h \
@@ -103,7 +111,7 @@ DEFS        = -I. -D$(SYSTYPE)
 CFLAGS = $(DEBUG) $(OPT) $(DEFS)
 FILES  = Makefile $(SRCS) $(HDRS)
 INCL   =
-LIB    = libutil.a
+LIB    = lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
        fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
        inet_addr_host inet_addr_local mac_parse make_dirs msg_syslog \
@@ -116,15 +124,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) $(CFLAGS) -c $*.c
+.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 $? >$@
@@ -134,18 +144,43 @@ test:     $(TESTPROG)
 $(LIB):        $(OBJS)
        $(AR) $(ARFL) $(LIB) $?
        $(RANLIB) $(LIB)
+       $(SHLIB_LD) -o $(LIB) $(OBJS)
 
 $(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
+       $(PLUGIN_LD) -o $@ dict_pcre.o $(AUXLIBS_PCRE)
+
+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 \
+         for type in $(DEFINED_MAP_TYPES); do \
+             case $$i in $(LIB_PREFIX)$$type$(LIB_SUFFIX)) \
+                 cmp -s $$i $(PLG_DIR)/$$i 2>/dev/null || cp $$i $(PLG_DIR); \
+                 continue 2;; \
+             esac; \
+         done; \
+         rm -f $(PLG_DIR)/$$i; \
+       done
+
+plugin_map_obj_update: $(LIB_MAP_OBJ)
+       -for i in $(LIB_MAP_OBJ); \
+       do \
+         cmp -s $$i $(LIB_DIR)/$$i 2>/dev/null || cp $$i $(LIB_DIR); \
+       done
+
 printfck: $(OBJS) $(PROG)
        rm -rf printfck
        mkdir printfck
@@ -475,128 +510,128 @@ tests: valid_hostname_test mac_expand_test dict_test unescape_test \
 root_tests:
 
 valid_hostname_test: valid_hostname valid_hostname.in valid_hostname.ref
-       ./valid_hostname <valid_hostname.in 2>valid_hostname.tmp
+       $(SHLIB_ENV) ./valid_hostname <valid_hostname.in 2>valid_hostname.tmp
        diff valid_hostname.ref valid_hostname.tmp
        rm -f valid_hostname.tmp
 
 mac_expand_test: mac_expand mac_expand.in mac_expand.ref
-       ./mac_expand <mac_expand.in >mac_expand.tmp 2>&1
+       $(SHLIB_ENV) ./mac_expand <mac_expand.in >mac_expand.tmp 2>&1
        diff mac_expand.ref mac_expand.tmp
        rm -f mac_expand.tmp
 
 unescape_test: unescape unescape.in unescape.ref
-       ./unescape <unescape.in | od -cb >unescape.tmp
+       $(SHLIB_ENV) ./unescape <unescape.in | od -cb >unescape.tmp
        diff -b unescape.ref unescape.tmp
        rm -f unescape.tmp
 
 hex_quote_test: hex_quote
-       ./hex_quote <hex_quote.c | od -cb >hex_quote.tmp
+       $(SHLIB_ENV) ./hex_quote <hex_quote.c | od -cb >hex_quote.tmp
        od -cb <hex_quote.c >hex_quote.ref
        cmp hex_quote.ref hex_quote.tmp
        rm -f hex_quote.ref hex_quote.tmp
 
 ctable_test: ctable
-       ./ctable <ctable.in >ctable.tmp 2>&1
+       $(SHLIB_ENV) ./ctable <ctable.in >ctable.tmp 2>&1
        diff ctable.ref ctable.tmp
        rm -f ctable.tmp
 
 # On Linux, following test may require "modprobe ipv6" to enable IPv6.
 
 inet_addr_list_test: inet_addr_list
-       ./inet_addr_list `cat inet_addr_list.in` >inet_addr_list.tmp 2>&1
+       $(SHLIB_ENV) ./inet_addr_list `cat inet_addr_list.in` >inet_addr_list.tmp 2>&1
        diff inet_addr_list.ref inet_addr_list.tmp
        rm -f inet_addr_list.tmp
 
 sane_basename_test: sane_basename
-       ./sane_basename <sane_basename.in >sane_basename.tmp 2>&1
+       $(SHLIB_ENV) ./sane_basename <sane_basename.in >sane_basename.tmp 2>&1
        diff sane_basename.ref sane_basename.tmp
        rm -f sane_basename.tmp
 
 base64_code_test: base64_code
-       ./base64_code
+       $(SHLIB_ENV) ./base64_code
 
 attr_scan64_test: attr_print64 attr_scan64 attr_scan64.ref
-       (./attr_print64 2>&3 | (sleep 1; ./attr_scan64)) >attr_scan64.tmp 2>&1 3>&1
+       ($(SHLIB_ENV) ./attr_print64 2>&3 | (sleep 1;  $(SHLIB_ENV) ./attr_scan64)) >attr_scan64.tmp 2>&1 3>&1
        diff attr_scan64.ref attr_scan64.tmp
        rm -f attr_scan64.tmp
 
 attr_scan0_test: attr_print0 attr_scan0 attr_scan0.ref
-       (./attr_print0 2>&3 | (sleep 1; ./attr_scan0)) >attr_scan0.tmp 2>&1 3>&1
+       ($(SHLIB_ENV) ./attr_print0 2>&3 | (sleep 1;  $(SHLIB_ENV) ./attr_scan0)) >attr_scan0.tmp 2>&1 3>&1
        diff attr_scan0.ref attr_scan0.tmp
        rm -f attr_scan0.tmp
 
 dict_test: dict_open testdb dict_test.in dict_test.ref
        rm -f testdb.db testdb.dir testdb.pag
-       ../postmap/postmap -N hash:testdb
-       ./dict_open hash:testdb write < dict_test.in > dict_test.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap -N hash:testdb
+       $(SHLIB_ENV) ./dict_open hash:testdb write < dict_test.in > dict_test.tmp 2>&1
        diff dict_test.ref dict_test.tmp
-       ../postmap/postmap -n hash:testdb
-       ./dict_open hash:testdb write < dict_test.in > dict_test.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap -n hash:testdb
+       $(SHLIB_ENV) ./dict_open hash:testdb write < dict_test.in > dict_test.tmp 2>&1
        diff dict_test.ref dict_test.tmp
        rm -f testdb.db testdb.dir testdb.pag dict_test.tmp
 
 dict_pcre_test: dict_open dict_pcre.in dict_pcre.map dict_pcre.ref
-       ./dict_open pcre:dict_pcre.map read <dict_pcre.in >dict_pcre.tmp 2>&1
+       $(SHLIB_ENV) ./dict_open pcre:dict_pcre.map read <dict_pcre.in >dict_pcre.tmp 2>&1
        diff dict_pcre.ref dict_pcre.tmp
        rm -f dict_pcre.tmp
 
 dict_regexp_test: dict_open dict_regexp.in dict_regexp.map dict_regexp.ref
-       ./dict_open regexp:dict_regexp.map read <dict_regexp.in >dict_regexp.tmp 2>&1
+       $(SHLIB_ENV) ./dict_open regexp:dict_regexp.map read <dict_regexp.in >dict_regexp.tmp 2>&1
        diff dict_regexp.ref dict_regexp.tmp
        rm -f dict_regexp.tmp
 
 dict_cidr_test: dict_open dict_cidr.in dict_cidr.map dict_cidr.ref
-       ./dict_open cidr:dict_cidr.map read <dict_cidr.in >dict_cidr.tmp 2>&1
+       $(SHLIB_ENV) ./dict_open cidr:dict_cidr.map read <dict_cidr.in >dict_cidr.tmp 2>&1
        diff dict_cidr.ref dict_cidr.tmp
        rm -f dict_cidr.tmp
 
 dict_seq_test: dict_open testdb dict_seq.in dict_seq.ref
        rm -f testdb.db testdb.dir testdb.pag
-       ./dict_open hash:testdb create sync < dict_seq.in > dict_seq.tmp 2>&1
+       $(SHLIB_ENV) ./dict_open hash:testdb create sync < dict_seq.in > dict_seq.tmp 2>&1
        diff dict_seq.ref dict_seq.tmp
        rm -f testdb.db testdb.dir testdb.pag dict_seq.tmp
 
 host_port_test: host_port host_port.in host_port.ref
-       ./host_port <host_port.in >host_port.tmp 2>&1
+       $(SHLIB_ENV) ./host_port <host_port.in >host_port.tmp 2>&1
        diff host_port.ref host_port.tmp
        rm -f host_port.tmp
 
 attr_scan_plain_test: attr_print_plain attr_scan_plain attr_scan_plain.ref
-       (./attr_print_plain 2>&3 | (sleep 1; ./attr_scan_plain)) >attr_scan_plain.tmp 2>&1 3>&1
+       ($(SHLIB_ENV) ./attr_print_plain 2>&3 | (sleep 1;  $(SHLIB_ENV) ./attr_scan_plain)) >attr_scan_plain.tmp 2>&1 3>&1
        diff attr_scan_plain.ref attr_scan_plain.tmp
        rm -f attr_scan_plain.tmp
 
 htable_test: htable /usr/share/dict/words
-       ./htable < /usr/share/dict/words
+       $(SHLIB_ENV) ./htable < /usr/share/dict/words
 
 hex_code_test: hex_code
-       ./hex_code
+       $(SHLIB_ENV) ./hex_code
 
 timecmp_test: timecmp
-       ./timecmp
+       $(SHLIB_ENV) ./timecmp
 
 myaddrinfo_test: myaddrinfo myaddrinfo.ref myaddrinfo.ref2
-       ./myaddrinfo all belly.porcupine.org 168.100.189.2 >myaddrinfo.tmp 2>&1
+       $(SHLIB_ENV) ./myaddrinfo all belly.porcupine.org 168.100.189.2 >myaddrinfo.tmp 2>&1
        diff myaddrinfo.ref myaddrinfo.tmp
        rm -f myaddrinfo.tmp
-       ./myaddrinfo all null.porcupine.org 10.0.0.0 >myaddrinfo.tmp 2>&1
+       $(SHLIB_ENV) ./myaddrinfo all null.porcupine.org 10.0.0.0 >myaddrinfo.tmp 2>&1
        diff myaddrinfo.ref2 myaddrinfo.tmp
        rm -f myaddrinfo.tmp
 
 myaddrinfo4_test: myaddrinfo4 myaddrinfo4.ref myaddrinfo4.ref2
-       ./myaddrinfo4 all belly.porcupine.org 168.100.189.2 >myaddrinfo4.tmp 2>&1
+       $(SHLIB_ENV) ./myaddrinfo4 all belly.porcupine.org 168.100.189.2 >myaddrinfo4.tmp 2>&1
        diff myaddrinfo4.ref myaddrinfo4.tmp
-       ./myaddrinfo4 all null.porcupine.org 10.0.0.0 >myaddrinfo4.tmp 2>&1
+       $(SHLIB_ENV) ./myaddrinfo4 all null.porcupine.org 10.0.0.0 >myaddrinfo4.tmp 2>&1
        diff myaddrinfo4.ref2 myaddrinfo4.tmp
        rm -f myaddrinfo4.tmp
 
 format_tv_test: format_tv format_tv.in format_tv.ref
-       ./format_tv <format_tv.in >format_tv.tmp
+       $(SHLIB_ENV) ./format_tv <format_tv.in >format_tv.tmp
        diff format_tv.ref format_tv.tmp
        rm -f format_tv.tmp
 
 ip_match_test: ip_match ip_match.in ip_match.ref
-       ./ip_match <ip_match.in >ip_match.tmp
+       $(SHLIB_ENV) ./ip_match <ip_match.in >ip_match.tmp
        diff ip_match.ref ip_match.tmp
        rm -f ip_match.tmp
 
@@ -605,76 +640,76 @@ name_mask_tests: name_mask_test0 name_mask_test1 name_mask_test2 \
        name_mask_test7 name_mask_test8 name_mask_test9
 
 name_mask_test0: name_mask name_mask.in name_mask.ref0
-       ./name_mask IGNORE IGNORE < name_mask.in > name_mask.tmp 2>&0
+       $(SHLIB_ENV) ./name_mask IGNORE IGNORE < name_mask.in > name_mask.tmp 2>&0
        diff name_mask.ref0 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test1: name_mask name_mask.in name_mask.ref1
-       ./name_mask NUMBER,WARN NUMBER < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,WARN NUMBER < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref1 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test2: name_mask name_mask.in name_mask.ref2
-       ./name_mask NUMBER,RETURN NUMBER < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,RETURN NUMBER < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref2 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test3: name_mask name_mask.in name_mask.ref3
-       ./name_mask WARN NUMBER < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask WARN NUMBER < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref3 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test4: name_mask name_mask.in name_mask.ref4
-       ./name_mask RETURN NUMBER < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask RETURN NUMBER < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref4 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test5: name_mask name_mask.in name_mask.ref5
-       ./name_mask NUMBER,WARN RETURN < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,WARN RETURN < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref5 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test6: name_mask name_mask.in name_mask.ref6
-       ./name_mask NUMBER,WARN WARN < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,WARN WARN < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref6 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test7: name_mask name_mask.in name_mask.ref7
-       ./name_mask NUMBER,WARN IGNORE < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,WARN IGNORE < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref7 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test8: name_mask name_mask.in name_mask.ref8
-       ./name_mask NUMBER,WARN NUMBER,COMMA < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,WARN NUMBER,COMMA < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref8 name_mask.tmp
        rm -f name_mask.tmp
 
 name_mask_test9: name_mask name_mask.in name_mask.ref9
-       ./name_mask NUMBER,WARN NUMBER,PIPE < name_mask.in > name_mask.tmp 2>&1
+       $(SHLIB_ENV) ./name_mask NUMBER,WARN NUMBER,PIPE < name_mask.in > name_mask.tmp 2>&1
        diff name_mask.ref9 name_mask.tmp
        rm -f name_mask.tmp
 
 base32_code_test: base32_code
-       ./base32_code
+       $(SHLIB_ENV) ./base32_code
 
 dict_thash_test: ../postmap/postmap dict_thash.map
-       ../postmap/postmap -s texthash:dict_thash.map >dict_thash.tmp 2>&1
+       $(SHLIB_ENV) ../postmap/postmap -s texthash:dict_thash.map >dict_thash.tmp 2>&1
        sort dict_thash.tmp | diff -b dict_thash.map -
        rm -f dict_thash.tmp
 
 surrogate_test: dict_open surrogate.ref
        cp /dev/null surrogate.tmp
-       echo get foo|./dict_open cidr:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./dict_open cidr:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./dict_open pcre:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./dict_open pcre:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./dict_open regexp:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./dict_open regexp:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./dict_open unix:xx write >>surrogate.tmp 2>&1
-       echo get foo|./dict_open unix:xx read >>surrogate.tmp 2>&1
-       echo get foo|./dict_open texthash:/xx write >>surrogate.tmp 2>&1
-       echo get foo|./dict_open texthash:/xx read >>surrogate.tmp 2>&1
-       echo get foo|./dict_open hash:/xx read >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open cidr:/xx write >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open cidr:/xx read >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open pcre:/xx write >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open pcre:/xx read >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open regexp:/xx write >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open regexp:/xx read >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open unix:xx write >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open unix:xx read >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open texthash:/xx write >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open texthash:/xx read >>surrogate.tmp 2>&1
+       echo get foo|$(SHLIB_ENV) ./dict_open hash:/xx read >>surrogate.tmp 2>&1
        diff surrogate.ref surrogate.tmp
        rm -f surrogate.tmp
 
@@ -1450,6 +1485,10 @@ load_file.o: sys_defs.h
 load_file.o: vbuf.h
 load_file.o: vstream.h
 load_file.o: warn_stat.h
+load_lib.o: load_lib.c
+load_lib.o: load_lib.h
+load_lib.o: msg.h
+load_lib.o: sys_defs.h
 lowercase.o: lowercase.c
 lowercase.o: stringops.h
 lowercase.o: sys_defs.h
index a217603e6b5501ac886a32c5697238d05e469c8c..e7a1d4d19604c9abc22781181e6432bbbeff7247 100644 (file)
@@ -165,6 +165,9 @@ extern DICT *dict_debug(DICT *);
   * Interface for dictionary types.
   */
 extern ARGV *dict_mapnames(void);
+typedef void (*DICT_MAPNAMES_EXTEND_FN) (ARGV *);
+extern DICT_MAPNAMES_EXTEND_FN dict_mapnames_extend(DICT_MAPNAMES_EXTEND_FN);
+
 
  /*
   * High-level interface, with logical dictionary names.
@@ -184,9 +187,12 @@ extern int dict_error(const char *);
  /*
   * Low-level interface, with physical dictionary handles.
   */
+typedef DICT *(*DICT_OPEN_FN) (const char *, int, int);
+typedef DICT_OPEN_FN (*DICT_OPEN_EXTEND_FN) (const char *);
 extern DICT *dict_open(const char *, int, int);
 extern DICT *dict_open3(const char *, const char *, int, int);
-extern void dict_open_register(const char *, DICT *(*) (const char *, int, int));
+extern void dict_open_register(const char *, DICT_OPEN_FN);
+extern DICT_OPEN_EXTEND_FN dict_open_extend(DICT_OPEN_EXTEND_FN);
 
 #define dict_get(dp, key)      ((const char *) (dp)->lookup((dp), (key)))
 #define dict_put(dp, key, val) (dp)->update((dp), (key), (val))
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 c8706da4e602834d2ac44d19787c54b4fbd6b11d..4408061ab4fab04de11ccacbb2293b284ede15bd 100644 (file)
 /*     void    dict_close(dict)
 /*     DICT    *dict;
 /*
+/*     typedef DICT *(*DICT_OPEN_FN) (const char *, int, int);
+/*
 /*     dict_open_register(type, open)
-/*     char    *type;
-/*     DICT    *(*open) (const char *, int, int);
+/*     const char *type;
+/*     DICT_OPEN_FN open;
+/*
+/*     typedef DICT_OPEN_FN (*DICT_OPEN_EXTEND_FN)(const char *type);
+/*
+/*     DICT_OPEN_EXTEND_FN dict_open_extend(call_back)
+/*     DICT_OPEN_EXTEND_FN call_back;
 /*
 /*     ARGV    *dict_mapnames()
 /*
+/*     typedef ARGV *(*DICT_MAPNAMES_EXTEND_FN)(ARGV *names);
+/*
+/*     DICT_MAPNAMES_EXTEND_FN dict_mapnames_extend(call_back)
+/*     DICT_MAPNAMES_EXTEND_FN call_back;
+/*
 /*     int     dict_isjmp(dict)
 /*     DICT    *dict;
 /*
 /*
 /*     dict_open_register() adds support for a new dictionary type.
 /*
+/*     dict_open_extend() registers a call-back function that looks
+/*     up the dictionary open() function for a type that is not
+/*     registered, or null in case of error. The result value is
+/*     the last previously-registered call-back or null.
+/*
 /*     dict_mapnames() returns a sorted list with the names of all available
 /*     dictionary types.
 /*
+/*     dict_mapnames_extend() registers a call-back function that
+/*     enumerates additional dictionary type names. The result
+/*     will be sorted by dict_mapnames().  The result value
+/*     is the last previously-registered call-back or null.
+/*
 /*     dict_setjmp() saves processing context and makes that context
 /*     available for use with dict_longjmp().  Normally, dict_setjmp()
 /*     returns zero.  A non-zero result means that dict_setjmp()
   */
 typedef struct {
     char   *type;
-    struct DICT *(*open) (const char *, int, int);
+    DICT_OPEN_FN open;
 } 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
@@ -307,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
@@ -319,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
@@ -330,11 +340,31 @@ 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,
 };
 
 static HTABLE *dict_open_hash;
 
+ /*
+  * Extension hooks.
+  */
+static DICT_OPEN_EXTEND_FN dict_open_extend_hook;
+static DICT_MAPNAMES_EXTEND_FN dict_mapnames_extend_hook;
+
 /* dict_open_init - one-off initialization */
 
 static void dict_open_init(void)
@@ -375,6 +405,7 @@ DICT   *dict_open3(const char *dict_type, const char *dict_name,
 {
     const char *myname = "dict_open";
     DICT_OPEN_INFO *dp;
+    DICT_OPEN_FN open_fn;
     DICT   *dict;
 
     if (*dict_type == 0 || *dict_name == 0)
@@ -382,9 +413,16 @@ DICT   *dict_open3(const char *dict_type, const char *dict_name,
                  dict_type, dict_name);
     if (dict_open_hash == 0)
        dict_open_init();
-    if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0)
-       return (dict_surrogate(dict_type, dict_name, open_flags, dict_flags,
+    if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) {
+       if (dict_open_extend_hook != 0
+           && (open_fn = dict_open_extend_hook(dict_type)) != 0) {
+           dict_open_register(dict_type, open_fn);
+           dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
+       }
+       if (dp == 0)
+           return (dict_surrogate(dict_type, dict_name, open_flags, dict_flags,
                             "unsupported dictionary type: %s", dict_type));
+    }
     if ((dict = dp->open(dict_name, open_flags, dict_flags)) == 0)
        return (dict_surrogate(dict_type, dict_name, open_flags, dict_flags,
                            "cannot open %s:%s: %m", dict_type, dict_name));
@@ -410,20 +448,31 @@ DICT   *dict_open3(const char *dict_type, const char *dict_name,
 
 /* dict_open_register - register dictionary type */
 
-void    dict_open_register(const char *type,
-                                  DICT *(*open) (const char *, int, int))
+void    dict_open_register(const char *type, DICT_OPEN_FN open)
 {
     const char *myname = "dict_open_register";
     DICT_OPEN_INFO *dp;
+    HTABLE_INFO *ht;
 
     if (dict_open_hash == 0)
        dict_open_init();
     if (htable_find(dict_open_hash, type))
        msg_panic("%s: dictionary type exists: %s", myname, type);
     dp = (DICT_OPEN_INFO *) mymalloc(sizeof(*dp));
-    dp->type = mystrdup(type);
     dp->open = open;
-    htable_enter(dict_open_hash, dp->type, (char *) dp);
+    ht = htable_enter(dict_open_hash, type, (char *) dp);
+    dp->type = ht->key;
+}
+
+/* dict_open_extend - register alternate dictionary search routine */
+
+DICT_OPEN_EXTEND_FN dict_open_extend(DICT_OPEN_EXTEND_FN new_cb)
+{
+    DICT_OPEN_EXTEND_FN old_cb;
+
+    old_cb = dict_open_extend_hook;
+    dict_open_extend_hook = new_cb;
+    return (old_cb);
 }
 
 /* dict_sort_alpha_cpp - qsort() callback */
@@ -449,6 +498,8 @@ ARGV   *dict_mapnames()
        dp = (DICT_OPEN_INFO *) ht[0]->value;
        argv_add(mapnames, dp->type, ARGV_END);
     }
+    if (dict_mapnames_extend_hook != 0)
+       (void) dict_mapnames_extend_hook(mapnames);
     qsort((void *) mapnames->argv, mapnames->argc, sizeof(mapnames->argv[0]),
          dict_sort_alpha_cpp);
     myfree((char *) ht_info);
@@ -456,6 +507,17 @@ ARGV   *dict_mapnames()
     return mapnames;
 }
 
+/* dict_mapnames_extend - register alternate dictionary type list routine */
+
+DICT_MAPNAMES_EXTEND_FN dict_mapnames_extend(DICT_MAPNAMES_EXTEND_FN new_cb)
+{
+    DICT_MAPNAMES_EXTEND_FN old_cb;
+
+    old_cb = dict_mapnames_extend_hook;
+    dict_mapnames_extend_hook = new_cb;
+    return (old_cb);
+}
+
 #ifdef TEST
 
  /*
index 55910f7566bb797bf95e89334ecc3d72c79ed6a9..a00c650a0b0d3fca18baf3bf81890203c917512f 100644 (file)
@@ -21,6 +21,9 @@
 #include <msg_vstream.h>
 #include <vstring_vstream.h>
 #include <dict.h>
+#include <dict_lmdb.h>
+
+DEFINE_DICT_LMDB_MAP_SIZE;
 
 static NORETURN usage(char *myname)
 {
diff --git a/postfix/src/util/load_lib.c b/postfix/src/util/load_lib.c
new file mode 100644 (file)
index 0000000..013c952
--- /dev/null
@@ -0,0 +1,146 @@
+/*++
+/* NAME
+/*     load_lib 3
+/* SUMMARY
+/*     library loading wrappers
+/* SYNOPSIS
+/*     #include <load_lib.h>
+/*
+/*     void    load_library_symbols(const char *, LIB_FN *, LIB_DP *);
+/*     const char *libname;
+/*     LIB_FN  *libfuncs;
+/*     LIB_DP  *libdata;
+/* DESCRIPTION
+/*     load_library_symbols() loads the specified shared object
+/*     and looks up the function or data pointers for the specified
+/*     symbols. All errors are fatal.
+/*
+/*     Arguments:
+/* .IP libname
+/*     shared-library pathname.
+/* .IP libfuncs
+/*     Array of LIB_FN strucures. The last name member must be null.
+/* .IP libdata
+/*     Array of LIB_DP strucures. The last name member must be null.
+/* SEE ALSO
+/*     msg(3) diagnostics interface
+/* DIAGNOSTICS
+/*     Problems are reported via the msg(3) diagnostics routines:
+/*     library not found, symbols not found, other fatal errors.
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     LaMont Jones
+/*     Hewlett-Packard Company
+/*     3404 Harmony Road
+/*     Fort Collins, CO 80528, USA
+/*
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+ /*
+  * System libraries.
+  */
+#include "sys_defs.h"
+#include <stdlib.h>
+#include <stddef.h>
+#include <string.h>
+#ifdef USE_DYNAMIC_MAPS
+#if defined(HAS_DLOPEN)
+#include <dlfcn.h>
+#elif defined(HAS_SHL_LOAD)
+#include <dl.h>
+#else
+#error "USE_DYNAMIC_LIBS requires HAS_DLOPEN or HAS_SHL_LOAD"
+#endif
+
+ /*
+  * Utility library.
+  */
+#include <msg.h>
+#include <load_lib.h>
+
+/* load_library_symbols - load shared library and look up symbols */
+
+void    load_library_symbols(const char *libname, LIB_FN *libfuncs,
+                                    LIB_DP *libdata)
+{
+    static const char myname[] = "load_library_symbols";
+    LIB_FN *fn;
+    LIB_DP *dp;
+
+#if defined(HAS_DLOPEN)
+    void   *handle;
+    char   *emsg;
+
+    /*
+     * XXX This is basically how FreeBSD dlfunc() silences a compiler warning
+     * about a data/function pointer conversion. The solution below is non-
+     * portable: it assumes that both data and function pointers are the same
+     * in size, and that both have the same representation.
+     */
+    union {
+       void   *dptr;                   /* data pointer */
+       void    (*fptr) (void);         /* function pointer */
+    }       non_portable_union;
+
+    if ((handle = dlopen(libname, RTLD_NOW)) == 0) {
+       emsg = dlerror();
+       msg_fatal("%s: dlopen failure loading %s: %s", myname, libname,
+                 emsg ? emsg : "don't know why");
+    }
+    if (libfuncs) {
+       for (fn = libfuncs; fn->name; fn++) {
+           if ((non_portable_union.dptr = dlsym(handle, fn->name)) == 0) {
+               emsg = dlerror();
+               msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
+                         fn->name, libname, emsg ? emsg : "don't know why");
+           }
+           fn->fptr = non_portable_union.fptr;
+           if (msg_verbose > 1)
+               msg_info("loaded %s = %p", fn->name, non_portable_union.dptr);
+       }
+    }
+    if (libdata) {
+       for (dp = libdata; dp->name; dp++) {
+           if ((dp->dptr = dlsym(handle, dp->name)) == 0) {
+               emsg = dlerror();
+               msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
+                         dp->name, libname, emsg ? emsg : "don't know why");
+           }
+           if (msg_verbose > 1)
+               msg_info("loaded %s = %p", dp->name, dp->dptr);
+       }
+    }
+#elif defined(HAS_SHL_LOAD)
+    shl_t   handle;
+
+    handle = shl_load(libname, BIND_IMMEDIATE, 0);
+
+    if (libfuncs) {
+       for (fn = libfuncs; fn->name; fn++) {
+           if (shl_findsym(&handle, fn->name, TYPE_PROCEDURE, &fn->fptr) != 0)
+               msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
+                         myname, fn->name, libname);
+           if (msg_verbose > 1)
+               msg_info("loaded %s = %p", fn->name, (void *) fn->fptr);
+       }
+    }
+    if (libdata) {
+       for (dp = libdata; dp->name; dp++) {
+           if (shl_findsym(&handle, dp->name, TYPE_DATA, &dp->dptr) != 0)
+               msg_fatal("%s: shl_findsym failure looking up %s in %s: %m",
+                         myname, dp->name, libname);
+           if (msg_verbose > 1)
+               msg_info("loaded %s = %p", dp->name, dp->dptr);
+       }
+    }
+#endif
+}
+
+#endif
diff --git a/postfix/src/util/load_lib.h b/postfix/src/util/load_lib.h
new file mode 100644 (file)
index 0000000..1c999c5
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef _LOAD_LIB_H_INCLUDED_
+#define _LOAD_LIB_H_INCLUDED_
+
+/*++
+/* NAME
+/*     load_lib 3h
+/* SUMMARY
+/*     library loading wrappers
+/* SYNOPSIS
+/*     #include "load_lib.h"
+/* DESCRIPTION
+/* .nf
+
+ /*
+  * External interface.
+  */
+/* NULL name terminates list */
+typedef struct LIB_FN {
+    const char *name;
+    void  (*fptr)(void);
+} LIB_FN;
+
+typedef struct LIB_DP {
+    const char *name;
+    void  *dptr;
+} LIB_DP;
+
+extern void load_library_symbols(const char *, LIB_FN *, LIB_DP *);
+
+/* LICENSE
+/* .ad
+/* .fi
+/*     The Secure Mailer license must be distributed with this software.
+/* AUTHOR(S)
+/*     LaMont Jones
+/*     Hewlett-Packard Company
+/*     3404 Harmony Road
+/*     Fort Collins, CO 80528, USA
+/*
+/*     Wietse Venema
+/*     IBM T.J. Watson Research
+/*     P.O. Box 704
+/*     Yorktown Heights, NY 10598, USA
+/*--*/
+
+#endif
index 6edde1e5630fdbafe3fe74d60ceb1ce638622540..5c37ac3fda209971c3caff75c0e06bd21beba5a3 100644 (file)
@@ -73,6 +73,7 @@
 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
 #define NATIVE_COMMAND_DIR "/usr/sbin"
 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
+#define HAS_DLOPEN
 #endif
 
 #ifdef FREEBSD2
 #ifndef NO_POSIX_GETPW_R
 # define HAVE_POSIX_GETPW_R
 #endif
-
+#define HAS_DLOPEN
 #endif
 
  /*
@@ -488,6 +489,8 @@ extern int opterr;
 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
 #define NATIVE_COMMAND_DIR "/usr/sbin"
 #define NATIVE_DAEMON_DIR "/usr/libexec/postfix"
+
+#define HAS_DLOPEN
 #endif
 
  /*
@@ -780,6 +783,7 @@ extern int initgroups(const char *, int);
 #define STATFS_IN_SYS_VFS_H
 #define PREPEND_PLUS_TO_OPTSTRING
 #define HAS_POSIX_REGEXP
+#define HAS_DLOPEN
 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
@@ -966,6 +970,7 @@ extern int h_errno;                 /* <netdb.h> imports too much stuff */
 #define USE_STATFS
 #define STATFS_IN_SYS_VFS_H
 #define HAS_POSIX_REGEXP
+#define HAS_DLOPEN
 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
@@ -1005,6 +1010,7 @@ extern int h_errno;                       /* <netdb.h> imports too much stuff */
 #define USE_STATFS
 #define STATFS_IN_SYS_VFS_H
 #define HAS_POSIX_REGEXP
+#define HAS_SHL_LOAD
 #define NATIVE_SENDMAIL_PATH "/usr/sbin/sendmail"
 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
@@ -1046,6 +1052,7 @@ extern int h_errno;
 #define USE_STATFS
 #define STATFS_IN_SYS_VFS_H
 #define HAS_POSIX_REGEXP
+#define HAS_SHL_LOAD
 #define NATIVE_SENDMAIL_PATH "/usr/bin/sendmail"
 #define NATIVE_MAILQ_PATH "/usr/bin/mailq"
 #define NATIVE_NEWALIAS_PATH "/usr/bin/newaliases"
index 78d985f13b98d22bccd84cf8dc1c9e64bc19920a..9328930576b24709b843dd0f16c3b0c3d1ab6d5e 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 TESTPROG= 
 PROG   = verify
 INC_DIR = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG): $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 068bc8232b450736c2c290d33b1769f62125e892..d648e9940e84217e5de36cc1a15727003e33af58 100644 (file)
@@ -8,12 +8,14 @@ CFLAGS        = $(DEBUG) $(OPT) $(DEFS)
 PROG   = virtual
 TESTPROG= 
 INC_DIR        = ../../include
-LIBS   = ../../lib/libmaster.a ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PREFIX)master$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PREFIX)util$(LIB_SUFFIX)
 
 .c.o:; $(CC) $(CFLAGS) -c $*.c
 
 $(PROG):       $(OBJS) $(LIBS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
+       $(CC) $(CFLAGS) $(SHLIB_RPATH) -o $@ $(OBJS) $(LIBS) $(SYSLIBS)
 
 $(OBJS): ../../conf/makedefs.out
 
index 0a46cbc641c3f7cafcf883a8b58df182b4dd7e6a..3abdfca3d222852e5e742f0b93e27bffd804e650 100644 (file)
@@ -13,7 +13,8 @@ INCL  =
 LIB    = libxsasl.a
 TESTPROG= 
 
-LIBS   = ../../lib/libglobal.a ../../lib/libutil.a
+LIBS   = ../../lib/lib$(LIB_PERFIX)global$(LIB_SUFFIX) \
+       ../../lib/lib$(LIB_PERFIX)util$(LIB_SUFFIX)
 LIB_DIR        = ../../lib
 INC_DIR        = ../../include
 MAKES  =
@@ -34,12 +35,12 @@ tests:
 root_tests:
 
 $(LIB):        $(OBJS)
-       $(AR) $(ARFL) $(LIB) $?
-       $(RANLIB) $(LIB)
+       $(_AR) $(ARFL) $(LIB) $?
+       $(_RANLIB) $(LIB)
 
 $(LIB_DIR)/$(LIB): $(LIB)
        cp $(LIB) $(LIB_DIR)
-       $(RANLIB) $(LIB_DIR)/$(LIB)
+       $(_RANLIB) $(LIB_DIR)/$(LIB)
 
 update: $(LIB_DIR)/$(LIB) $(HDRS)
        -for i in $(HDRS); \