summaryrefslogtreecommitdiffstats
path: root/main/postfix
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-04-28 08:49:35 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2015-04-28 08:56:25 +0000
commit228e06b4e65537325ca35b93d2418dadf1f7db55 (patch)
treefda1f2581e174b070d42251d461c3f9bdc19d56a /main/postfix
parent4fa7d32dfcdaf3511c6af4bc1479a2102e14345a (diff)
downloadaports-228e06b4e65537325ca35b93d2418dadf1f7db55.tar.bz2
aports-228e06b4e65537325ca35b93d2418dadf1f7db55.tar.xz
main/postfix: upgrade to 3.0.1
Diffstat (limited to 'main/postfix')
-rw-r--r--main/postfix/APKBUILD113
-rw-r--r--main/postfix/dynamic-maps.patch1106
-rw-r--r--main/postfix/dynamicmaps.cf16
-rw-r--r--main/postfix/no-glibc.patch15
-rw-r--r--main/postfix/postfix-ldap.post-install19
-rw-r--r--main/postfix/postfix-mysql.post-install19
-rw-r--r--main/postfix/postfix-pcre.post-install25
-rw-r--r--main/postfix/postfix-pgsql.post-install19
-rw-r--r--main/postfix/postfix-sqlite.post-install19
9 files changed, 45 insertions, 1306 deletions
diff --git a/main/postfix/APKBUILD b/main/postfix/APKBUILD
index 6aec13753..307a64da9 100644
--- a/main/postfix/APKBUILD
+++ b/main/postfix/APKBUILD
@@ -1,8 +1,8 @@
# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=postfix
-pkgver=2.11.3
-pkgrel=1
+pkgver=3.0.1
+pkgrel=0
pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
url="http://www.postfix.org/"
arch="all"
@@ -16,19 +16,9 @@ subpackages="$pkgname-doc $pkgname-ldap $pkgname-mysql $pkgname-pcre
options="suid"
source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgver.tar.gz
$pkgname.initd
- dynamic-maps.patch
no-glibc.patch
- dynamicmaps.cf
- postfix-ldap.post-install
- postfix-mysql.post-install
- postfix-pcre.post-install
- postfix-pgsql.post-install
- postfix-sqlite.post-install
"
-# the dynamic maps patch is taken from mandriva
-# http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/postfix/current/SOURCES
-
_shared_libs() {
file --mime-type "$@" | \
awk -F: '$2 ~ /sharedlib/ {print $1}'
@@ -41,7 +31,6 @@ prepare() {
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
- cp ../dynamicmaps.cf conf/
sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" \
-e "/^#define ALIAS_DB_MAP/s|:/etc/aliases|:/etc/postfix/aliases|" \
@@ -52,7 +41,7 @@ prepare() {
build () {
cd "$srcdir/$pkgname-$pkgver"
# needed for dynamic maps.
- local ccargs="-DHAS_DLOPEN -DHAS_SHL_LOAD"
+ local ccargs="-DHAS_SHL_LOAD"
local auxlibs="$LDFLAGS -lpthread -lcrypt"
ccargs="$ccargs -DDEF_DAEMON_DIR=\\\"/usr/lib/postfix\\\""
@@ -92,57 +81,56 @@ build () {
OPT="$CFLAGS" \
CCARGS="$ccargs" \
AUXLIBS="$auxlibs" \
+ dynamicmaps=yes \
+ shared=yes \
makefiles || return 1
- make -j1 OPT="$CFLAGS" || return 1
+ make OPT="$CFLAGS" || return 1
+}
+
+_mvline() {
+ local regex="$1"
+ local outfile="$3.d/$2"
+ local infile="$3"
+ sed -i -E -e "\|$regex|{
+w $outfile
+d
+}" $infile
}
package() {
cd "$srcdir/$pkgname-$pkgver"
- for i in $(_shared_libs lib/*.a); do
- j=${i#lib/lib}
- ln -s ${i#lib/} lib/libpostfix-${j%.a}.so.1
- done
-
- # install to pkgdir
- LD_LIBRARY_PATH=$PWD/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} make \
- non-interactive-package \
+ make non-interactive-package \
install_root="$pkgdir" \
- config_directory=/usr/share/doc/$pkgname/defaults \
readme_directory=/usr/share/doc/$pkgname/readme \
manpage_directory=/usr/share/man \
|| return 1
- install -d "$pkgdir"/usr/lib
- for i in $(_shared_libs lib/*.a); do
- j=${i#lib/lib}
- install $i "$pkgdir"/usr/lib/libpostfix-${j%.a}.so.1 || return 1
- done
-
# fix permissions
for i in postdrop postqueue; do
chgrp postdrop "$pkgdir"/usr/sbin/$i
chmod g+s "$pkgdir"/usr/sbin/$i
done
- mkdir -p "$pkgdir"/etc/postfix
- mv "$pkgdir"/usr/share/doc/$pkgname/defaults/*.cf \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/aliases \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/canonical \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/generic \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/header_checks \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/relocated \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/transport \
- "$pkgdir"/usr/share/doc/$pkgname/defaults/virtual \
- "$pkgdir"/etc/postfix/ || return 1
+ mkdir -p "$pkgdir"/usr/share/doc/postfix/defaults/ \
+ "$pkgdir"/usr/share/licenses/${pkgname}/
+ mv "$pkgdir"/etc/postfix/*.default \
+ "$pkgdir"/usr/share/doc/postfix/defaults/ || return 1
+ mv "$pkgdir"/etc/postfix/*LICENSE* \
+ "$pkgdir"/usr/share/licenses/${pkgname}/ || return 1
install -d -o postfix -g postfix "$pkgdir"/var/spool/postfix
install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
- install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
chown postfix "$pkgdir"/var/spool/postfix/* "$pkgdir"/var/lib/postfix \
|| return 1
chgrp postdrop "$pkgdir"/var/spool/postfix/maildrop \
"$pkgdir"/var/spool/postfix/public || return 1
+
+ cd "$pkgdir"/etc/postfix/ || return 1
+ for map in ldap mysql pcre pgsql sqlite; do
+ msg "split $map"
+ _mvline "^\s*$map" "$map" dynamicmaps.cf || return 1
+ done
}
_mv_dict() {
@@ -150,10 +138,12 @@ _mv_dict() {
shift
pkgdesc="$m map support for postfix"
depends=
- install="postfix-${m}.post-install"
- mkdir -p "$subpkgdir"/usr/lib/postfix
- mv "$pkgdir"/usr/lib/postfix/dict_${m}.so \
- "$subpkgdir"/usr/lib/postfix/
+ mkdir -p "$subpkgdir"/usr/lib/postfix \
+ "$subpkgdir"/etc/postfix/dynamicmaps.cf.d
+ mv "$pkgdir"/usr/lib/postfix/postfix-${m}.so \
+ "$subpkgdir"/usr/lib/postfix/ || return 1
+ mv "$pkgdir"/etc/postfix/dynamicmaps.cf.d/${m} \
+ "$subpkgdir"/etc/postfix/dynamicmaps.cf.d/ || return 1
}
ldap() { _mv_dict ldap ; }
@@ -162,33 +152,12 @@ pcre() { _mv_dict pcre ; }
pgsql() { _mv_dict pgsql ; }
sqlite() { _mv_dict sqlite ; }
-md5sums="c3f0f51d8865559b40e9350eb3816011 postfix-2.11.3.tar.gz
+md5sums="3ec1416e7d4fba9566297c8fcf7a348c postfix-3.0.1.tar.gz
d773f01dcc965d219a8a37b88f89c5bf postfix.initd
-c03239969df760e2a74c4e048ce514a1 dynamic-maps.patch
-cd39f4c05a6462c121a3ab3612d6a5bd no-glibc.patch
-442efd1a95b0c061dfb8ab75456e0f24 dynamicmaps.cf
-2ebe51a882eb9d6d7866583eb6af3969 postfix-ldap.post-install
-2ebe51a882eb9d6d7866583eb6af3969 postfix-mysql.post-install
-fd16ec00b60269c4ede4a0a0a514cefa postfix-pcre.post-install
-2ebe51a882eb9d6d7866583eb6af3969 postfix-pgsql.post-install
-2ebe51a882eb9d6d7866583eb6af3969 postfix-sqlite.post-install"
-sha256sums="04e5146e6e56261baae9f63c590348a4b12ce22d3d46260e26e97233f40802c3 postfix-2.11.3.tar.gz
+b7ed1614fafb5fed6253b1a62f76b709 no-glibc.patch"
+sha256sums="cd2bd6447fe3368bb1a39f482f8dd1eec87c63067a0eb75f9aec8e4eadd21328 postfix-3.0.1.tar.gz
6b3fe71542ab783c7adddbfa161f7e2dcb2325913ad5d611ca56f730876ce4ab postfix.initd
-cfa5000955f1941082567a9e50764f52851f33c468f534c0431f6932d73e8ffb dynamic-maps.patch
-ad2d6b6889ea2e8b1eab05c87f153a1a2ce82e3a877e1235b595a990266dfc04 no-glibc.patch
-2041ff6cd71fe16f3d75603ff40d90a08a8b97f0883e1de1d58563ab1521b5ea dynamicmaps.cf
-fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498 postfix-ldap.post-install
-fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498 postfix-mysql.post-install
-8dbe9339aeac4932e5ee383bfe497512607cd819fe67c38cbf7273118c4b0f71 postfix-pcre.post-install
-fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498 postfix-pgsql.post-install
-fbd75ef31a5d78d5f82b67e08e5bf5ada380afa58a69ef4a07d756c47b3bb498 postfix-sqlite.post-install"
-sha512sums="b371f1099b1e6e653242a9b4f3812b38b6a9145a4f4c1c9fa5bef6a02e1a9a8f4ec2979c8946f6c873e303ac54f5dd1a84b934eeea8169e2ce187028c36c857e postfix-2.11.3.tar.gz
+e8d7c4b3edab2388c9aba6c9ce70ff141ae7aacbd6480e233711241d90b14563 no-glibc.patch"
+sha512sums="17916f6dc7113589b011dbf6a6bb54cb9f6d0d5f176fb3c877d4a5a09ac62c4faf088bf1eba0b41c6d2b9d55660fd4c52d4ba2a01f82db3679322756b6da6f37 postfix-3.0.1.tar.gz
c179534a7243bcf8c19b5367a703b54fcc88b7587ce7ef07ec111cfe00053779eed23b3ccda81eb20059599b857cae0a57cc02613526209f3dd966d65abd9a3f postfix.initd
-1a92089410691d400953472be522c872be1456521203560a4feadb632cb85cfacaf3721108d62111873fb23478976b8a949077734cf801374ca58bcaf363922c dynamic-maps.patch
-4d2624ee98f798f8818789433b05cce4ee337750e93ee49c4074bc0c741c678d426c42bd09088596d5010f0bc680ec3b5aed630acfd3d5513512f6a6af15b61c no-glibc.patch
-49b8205166f575e5fb9bdaaaaa042dc1be9b556331bf659a55b1115c9fa48486896941f18ca9fb633dd54675079f29a9d69d53c214170731c2127862456ec90b dynamicmaps.cf
-b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138 postfix-ldap.post-install
-b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138 postfix-mysql.post-install
-845871cacebb8c4d2073783db06a704c993d258f3113ac6c416e742f87649e8eababceb5f8426849256e7815c492e24654468ee76e7607d91b506e8cba78f2ed postfix-pcre.post-install
-b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138 postfix-pgsql.post-install
-b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138 postfix-sqlite.post-install"
+cf9ef0d07e54011107da57e2855cbda10047c100047e2cc2fdede072ace1fc6c060a6b1cfc8c277417a28a23ecd3c6ffdc061da1673e8f61d2ed11899f1efb25 no-glibc.patch"
diff --git a/main/postfix/dynamic-maps.patch b/main/postfix/dynamic-maps.patch
deleted file mode 100644
index b19446c74..000000000
--- a/main/postfix/dynamic-maps.patch
+++ /dev/null
@@ -1,1106 +0,0 @@
-diff --git a/conf/postfix-files b/conf/postfix-files
-index 9e1804a..daa6328 100644
---- a/conf/postfix-files
-+++ b/conf/postfix-files
-@@ -65,6 +65,11 @@ $queue_directory/saved:d:$mail_owner:-:700:ucr
- $queue_directory/trace:d:$mail_owner:-:700:ucr
- $daemon_directory/anvil:f:root:-:755
- $daemon_directory/bounce:f:root:-:755
-+$daemon_directory/dict_ldap.so:f:root:-:755
-+$daemon_directory/dict_pcre.so:f:root:-:755
-+$daemon_directory/dict_mysql.so:f:root:-:755
-+$daemon_directory/dict_pgsql.so:f:root:-:755
-+$daemon_directory/dict_sqlite.so:f:root:-:755
- $daemon_directory/cleanup:f:root:-:755
- $daemon_directory/discard:f:root:-:755
- $daemon_directory/dnsblog:f:root:-:755
-@@ -97,6 +102,11 @@ $daemon_directory/tlsmgr:f:root:-:755
- $daemon_directory/trivial-rewrite:f:root:-:755
- $daemon_directory/verify:f:root:-:755
- $daemon_directory/virtual:f:root:-:755
-+/usr/lib/libpostfix-dns.so.1:f:root:-:755
-+/usr/lib/libpostfix-global.so.1:f:root:-:755
-+/usr/lib/libpostfix-tls.so.1:f:root:-:755
-+/usr/lib/libpostfix-master.so.1:f:root:-:755
-+/usr/lib/libpostfix-util.so.1:f:root:-:755
- $daemon_directory/nqmgr:h:$daemon_directory/qmgr
- $daemon_directory/lmtp:h:$daemon_directory/smtp
- $command_directory/postalias:f:root:-:755
-@@ -120,6 +130,7 @@ $config_directory/access:f:root:-:644:p1
- $config_directory/aliases:f:root:-:644:p1
- $config_directory/bounce.cf.default:f:root:-:644:1
- $config_directory/canonical:f:root:-:644:p1
-+$config_directory/dynamicmaps.cf:f:root:-:644:p
- $config_directory/cidr_table:f:root:-:644:o
- $config_directory/generic:f:root:-:644:p1
- $config_directory/generics:f:root:-:644:o
-diff --git a/src/dns/Makefile.in b/src/dns/Makefile.in
-index bbc5e98..e14c6fe 100644
---- a/src/dns/Makefile.in
-+++ b/src/dns/Makefile.in
-@@ -14,7 +14,7 @@ LIBS = ../../lib/libutil.a
- LIB_DIR = ../../lib
- INC_DIR = ../../include
-
--.c.o:; $(CC) $(CFLAGS) -c $*.c
-+.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
-
- all: $(LIB)
-
-@@ -31,12 +31,10 @@ tests: test dns_rr_to_pa_test dns_rr_to_sa_test dns_sa_to_rr_test \
- root_tests:
-
- $(LIB): $(OBJS)
-- $(AR) $(ARFL) $(LIB) $?
-- $(RANLIB) $(LIB)
-+ $(CC) -shared -Wl,-soname,libpostfix-dns.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
-
- $(LIB_DIR)/$(LIB): $(LIB)
- cp $(LIB) $(LIB_DIR)
-- $(RANLIB) $(LIB_DIR)/$(LIB)
-
- update: $(LIB_DIR)/$(LIB) $(HDRS)
- -for i in $(HDRS); \
-diff --git a/src/global/Makefile.in b/src/global/Makefile.in
-index 2e7ec04..8d541bc 100644
---- a/src/global/Makefile.in
-+++ b/src/global/Makefile.in
-@@ -37,8 +37,8 @@ OBJS = abounce.o anvil_clnt.o been_here.o bounce.o bounce_log.o \
- canon_addr.o cfg_parser.o cleanup_strerror.o cleanup_strflags.o \
- clnt_stream.o conv_time.o db_common.o debug_peer.o debug_process.o \
- defer.o deliver_completed.o deliver_flock.o deliver_pass.o \
-- deliver_request.o dict_ldap.o dict_mysql.o dict_pgsql.o \
-- dict_proxy.o dict_sqlite.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
-+ deliver_request.o \
-+ dict_proxy.o domain_list.o dot_lockfile.o dot_lockfile_as.o \
- dsb_scan.o dsn.o dsn_buf.o dsn_mask.o dsn_print.o dsn_util.o \
- ehlo_mask.o ext_prop.o file_id.o flush_clnt.o header_opts.o \
- header_token.o input_transp.o int_filt.o is_header.o log_adhoc.o \
-@@ -113,10 +113,14 @@ LIBS = ../../lib/libutil.a
- LIB_DIR = ../../lib
- INC_DIR = ../../include
- MAKES =
-+LDAPSO = dict_ldap.so
-+MYSQLSO = dict_mysql.so
-+PGSQLSO = dict_pgsql.so
-+SQLITESO = dict_sqlite.so
-
--.c.o:; $(CC) $(CFLAGS) -c $*.c
-+.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
-
--all: $(LIB)
-+all: $(LIB) $(LDAPSO) $(MYSQLSO) $(PGSQLSO) $(SQLITESO)
-
- $(OBJS): ../../conf/makedefs.out
-
-@@ -126,14 +130,36 @@ Makefile: Makefile.in
- test: $(TESTPROG)
-
- $(LIB): $(OBJS)
-- $(AR) $(ARFL) $(LIB) $?
-- $(RANLIB) $(LIB)
-+ $(CC) -shared -Wl,-soname,libpostfix-global.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
-+
-+$(LDAPSO): dict_ldap.o $(LIB) ../../lib/libglobal.a
-+ $(CC) -shared -Wl,-soname,dict_ldap.so -o $@ $? -lldap -llber -L../../lib -lutil -L. -lglobal
-+
-+$(MYSQLSO): dict_mysql.o $(LIB) ../../lib/libglobal.a
-+ $(CC) -shared -Wl,-soname,dict_mysql.so -o $@ $? -lmysqlclient -L. -lutil -lglobal
-+
-+$(PGSQLSO): dict_pgsql.o $(LIB) ../../lib/libglobal.a
-+ $(CC) -shared -Wl,-soname,dict_pgsql.so -o $@ $? -lpq -L. -lutil -lglobal
-+
-+$(SQLITESO): dict_sqlite.o $(LIB) ../../lib/libglobal.a
-+ $(CC) -shared -Wl,-soname,dict_sqlite.so -o $@ $? -lsqlite3 -L. -lutil -lglobal
-
- $(LIB_DIR)/$(LIB): $(LIB)
- cp $(LIB) $(LIB_DIR)
-- $(RANLIB) $(LIB_DIR)/$(LIB)
-
--update: $(LIB_DIR)/$(LIB) $(HDRS)
-+../../libexec/$(LDAPSO): $(LDAPSO)
-+ cp $(LDAPSO) ../../libexec
-+
-+../../libexec/$(MYSQLSO): $(MYSQLSO)
-+ cp $(MYSQLSO) ../../libexec
-+
-+../../libexec/$(PGSQLSO): $(PGSQLSO)
-+ cp $(PGSQLSO) ../../libexec
-+
-+../../libexec/$(SQLITESO): $(SQLITESO)
-+ cp $(SQLITESO) ../../libexec
-+
-+update: $(LIB_DIR)/$(LIB) ../../libexec/$(LDAPSO) ../../libexec/$(MYSQLSO) ../../libexec/$(PGSQLSO) ../../libexec/$(SQLITESO) $(HDRS)
- -for i in $(HDRS); \
- do \
- cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
-@@ -584,7 +610,7 @@ lint:
- lint $(DEFS) $(SRCS) $(LINTFIX)
-
- clean:
-- rm -f *.o $(LIB) *core $(TESTPROG) junk
-+ rm -f *.o $(LIB) $(LDAPSO) $(MYSQLSO) $(PGSQLSO) $(SQLITESO) *core $(TESTPROG) junk
- rm -rf printfck
-
- tidy: clean
-diff --git a/src/global/mail_conf.c b/src/global/mail_conf.c
-index ae0ae98..f414c47 100644
---- a/src/global/mail_conf.c
-+++ b/src/global/mail_conf.c
-@@ -190,6 +190,12 @@ void mail_conf_suck(void)
- if (dict_load_file_xt(CONFIG_DICT, path) == 0)
- msg_fatal("open %s: %m", path);
- myfree(path);
-+
-+#ifndef NO_DYNAMIC_MAPS
-+ path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0);
-+ dict_open_dlinfo(path);
-+ myfree(path);
-+#endif
- }
-
- /* mail_conf_flush - discard configuration dictionary */
-diff --git a/src/global/mail_dict.c b/src/global/mail_dict.c
-index 6dbf6ee..ff0eee6 100644
---- a/src/global/mail_dict.c
-+++ b/src/global/mail_dict.c
-@@ -47,6 +47,7 @@ typedef struct {
-
- static const DICT_OPEN_INFO dict_open_info[] = {
- DICT_TYPE_PROXY, dict_proxy_open,
-+#ifdef NO_DYNAMIC_MAPS
- #ifdef HAS_LDAP
- DICT_TYPE_LDAP, dict_ldap_open,
- #endif
-@@ -59,6 +60,7 @@ static const DICT_OPEN_INFO dict_open_info[] = {
- #ifdef HAS_SQLITE
- DICT_TYPE_SQLITE, dict_sqlite_open,
- #endif
-+#endif /* NO_DYNAMIC_MAPS */
- DICT_TYPE_MEMCACHE, dict_memcache_open,
- 0,
- };
-diff --git a/src/global/mail_params.c b/src/global/mail_params.c
-index 6e4378c..9dab202 100644
---- a/src/global/mail_params.c
-+++ b/src/global/mail_params.c
-@@ -79,6 +79,7 @@
- /* char *var_export_environ;
- /* char *var_debug_peer_list;
- /* int var_debug_peer_level;
-+/* int var_command_maxtime;
- /* int var_in_flow_delay;
- /* int var_fault_inj_code;
- /* char *var_bounce_service;
-@@ -91,6 +92,7 @@
- /* char *var_error_service;
- /* char *var_flush_service;
- /* char *var_verify_service;
-+/* char *var_scache_service;
- /* char *var_trace_service;
- /* char *var_proxymap_service;
- /* char *var_proxywrite_service;
-@@ -274,6 +276,7 @@ char *var_import_environ;
- char *var_export_environ;
- char *var_debug_peer_list;
- int var_debug_peer_level;
-+int var_command_maxtime;
- int var_fault_inj_code;
- char *var_bounce_service;
- char *var_cleanup_service;
-@@ -285,6 +288,7 @@ char *var_showq_service;
- char *var_error_service;
- char *var_flush_service;
- char *var_verify_service;
-+char *var_scache_service;
- char *var_trace_service;
- char *var_proxymap_service;
- char *var_proxywrite_service;
-diff --git a/src/global/mkmap_open.c b/src/global/mkmap_open.c
-index dfa9bc2..30409aa 100644
---- a/src/global/mkmap_open.c
-+++ b/src/global/mkmap_open.c
-@@ -83,7 +83,7 @@
- * We use a different table (in dict_open.c) when querying maps.
- */
- typedef struct {
-- char *type;
-+ const char *type;
- MKMAP *(*before_open) (const char *);
- } MKMAP_OPEN_INFO;
-
-@@ -166,7 +166,16 @@ MKMAP *mkmap_open(const char *type, const char *path,
- */
- for (mp = mkmap_types; /* void */ ; mp++) {
- if (mp->type == 0)
-+#ifndef NO_DYNAMIC_MAPS
-+ {
-+ static MKMAP_OPEN_INFO oi;
-+ oi.before_open=(MKMAP*(*)(const char*))dict_mkmap_func(type);
-+ oi.type=type;
-+ mp=&oi;
-+ }
-+#else
- msg_fatal("unsupported map type for this operation: %s", type);
-+#endif
- if (strcmp(type, mp->type) == 0)
- break;
- }
-diff --git a/src/master/Makefile.in b/src/master/Makefile.in
-index d1be8fe..be0bb69 100644
---- a/src/master/Makefile.in
-+++ b/src/master/Makefile.in
-@@ -22,7 +22,7 @@ LIB_DIR = ../../lib
- INC_DIR = ../../include
- BIN_DIR = ../../libexec
-
--.c.o:; $(CC) $(CFLAGS) -c $*.c
-+.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
-
- all: $(PROG) $(LIB)
-
-@@ -41,12 +41,10 @@ tests:
- root_tests:
-
- $(LIB): $(LIB_OBJ)
-- $(AR) $(ARFL) $(LIB) $?
-- $(RANLIB) $(LIB)
-+ $(CC) -shared -Wl,-soname,libpostfix-master.so.1 -o $(LIB) $(LIB_OBJ) $(LIBS) $(SYSLIBS)
-
- $(LIB_DIR)/$(LIB): $(LIB)
- cp $(LIB) $(LIB_DIR)/$(LIB)
-- $(RANLIB) $(LIB_DIR)/$(LIB)
-
- $(BIN_DIR)/$(PROG): $(PROG)
- cp $(PROG) $(BIN_DIR)
-diff --git a/src/milter/Makefile.in b/src/milter/Makefile.in
-index 99b6469..0769778 100644
---- a/src/milter/Makefile.in
-+++ b/src/milter/Makefile.in
-@@ -14,7 +14,7 @@ LIB_DIR = ../../lib
- INC_DIR = ../../include
- MAKES =
-
--.c.o:; $(CC) $(CFLAGS) -c $*.c
-+.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
-
- all: $(LIB)
-
-@@ -30,12 +30,10 @@ tests:
- root_tests:
-
- $(LIB): $(OBJS)
-- $(AR) $(ARFL) $(LIB) $?
-- $(RANLIB) $(LIB)
-+ $(CC) -shared -Wl,-soname,libpostfix-milter.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
-
- $(LIB_DIR)/$(LIB): $(LIB)
- cp $(LIB) $(LIB_DIR)
-- $(RANLIB) $(LIB_DIR)/$(LIB)
-
- update: $(LIB_DIR)/$(LIB) $(HDRS)
- -for i in $(HDRS); \
-diff --git a/src/postconf/postconf_other.c b/src/postconf/postconf_other.c
-index e93dfab..ac415ba 100644
---- a/src/postconf/postconf_other.c
-+++ b/src/postconf/postconf_other.c
-@@ -56,6 +56,10 @@
-
- #include <xsasl.h>
-
-+/* Global library. */
-+
-+#include <mail_params.h>
-+#include <stringops.h>
- /* Application-specific. */
-
- #include <postconf.h>
-@@ -66,7 +70,16 @@ void pcf_show_maps(void)
- {
- ARGV *maps_argv;
- int i;
--
-+#ifndef NO_DYNAMIC_MAPS
-+ char *path;
-+ char *config_dir;
-+
-+ if (var_config_dir == 0)
-+ pcf_set_config_dir();
-+ path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0);
-+ dict_open_dlinfo(path);
-+ myfree(path);
-+#endif
- maps_argv = dict_mapnames();
- for (i = 0; i < maps_argv->argc; i++)
- vstream_printf("%s\n", maps_argv->argv[i]);
-diff --git a/src/postmap/postmap.c b/src/postmap/postmap.c
-index e10ac16..92e85d6 100644
---- a/src/postmap/postmap.c
-+++ b/src/postmap/postmap.c
-@@ -5,7 +5,7 @@
- /* Postfix lookup table management
- /* SYNOPSIS
- /* .fi
--/* \fBpostmap\fR [\fB-Nbfhimnoprsvw\fR] [\fB-c \fIconfig_dir\fR]
-+/* \fBpostmap\fR [\fB-Nbfhimnoprsuvw\fR] [\fB-c \fIconfig_dir\fR]
- /* [\fB-d \fIkey\fR] [\fB-q \fIkey\fR]
- /* [\fIfile_type\fR:]\fIfile_name\fR ...
- /* DESCRIPTION
-@@ -151,6 +151,8 @@
- /* .sp
- /* This feature is available in Postfix version 2.2 and later,
- /* and is not available for all database types.
-+/* .IP \fB-u\fR
-+/* Upgrade the database to the current version.
- /* .IP \fB-v\fR
- /* Enable verbose logging for debugging purposes. Multiple \fB-v\fR
- /* options make the software increasingly verbose.
-@@ -764,6 +766,18 @@ static void postmap_seq(const char *map_type, const char *map_name,
- dict_close(dict);
- }
-
-+/* postmap_upgrade - upgrade a map */
-+
-+static int postmap_upgrade(const char *map_type, const char *map_name)
-+{
-+ DICT *dict;
-+
-+ dict = dict_open3(map_type, map_name, O_RDWR,
-+ DICT_FLAG_LOCK|DICT_FLAG_UPGRADE);
-+ dict_close(dict);
-+ return (dict != 0);
-+}
-+
- /* usage - explain */
-
- static NORETURN usage(char *myname)
-@@ -784,6 +798,7 @@ int main(int argc, char **argv)
- int postmap_flags = POSTMAP_FLAG_AS_OWNER | POSTMAP_FLAG_SAVE_PERM;
- int open_flags = O_RDWR | O_CREAT | O_TRUNC;
- int dict_flags = DICT_FLAG_DUP_WARN | DICT_FLAG_FOLD_FIX;
-+ int upgrade = 0;
- char *query = 0;
- char *delkey = 0;
- int sequence = 0;
-@@ -833,7 +848,7 @@ int main(int argc, char **argv)
- /*
- * Parse JCL.
- */
-- while ((ch = GETOPT(argc, argv, "Nbc:d:fhimnopq:rsvw")) > 0) {
-+ while ((ch = GETOPT(argc, argv, "Nbc:d:fhimnopq:rsuvw")) > 0) {
- switch (ch) {
- default:
- usage(argv[0]);
-@@ -850,8 +865,8 @@ int main(int argc, char **argv)
- msg_fatal("out of memory");
- break;
- case 'd':
-- if (sequence || query || delkey)
-- msg_fatal("specify only one of -s -q or -d");
-+ if (sequence || query || delkey || upgrade)
-+ msg_fatal("specify only one of -s -q -u or -d");
- delkey = optarg;
- break;
- case 'f':
-@@ -877,8 +892,8 @@ int main(int argc, char **argv)
- postmap_flags &= ~POSTMAP_FLAG_SAVE_PERM;
- break;
- case 'q':
-- if (sequence || query || delkey)
-- msg_fatal("specify only one of -s -q or -d");
-+ if (sequence || query || delkey || upgrade)
-+ msg_fatal("specify only one of -s -q -u or -d");
- query = optarg;
- break;
- case 'r':
-@@ -886,10 +901,15 @@ int main(int argc, char **argv)
- dict_flags |= DICT_FLAG_DUP_REPLACE;
- break;
- case 's':
-- if (query || delkey)
-- msg_fatal("specify only one of -s or -q or -d");
-+ if (query || delkey || upgrade)
-+ msg_fatal("specify only one of -s -q -u or -d");
- sequence = 1;
- break;
-+ case 'u':
-+ if (sequence || query || delkey || upgrade)
-+ msg_fatal("specify only one of -s -q -u or -d");
-+ upgrade=1;
-+ break;
- case 'v':
- msg_verbose++;
- break;
-@@ -964,6 +984,21 @@ int main(int argc, char **argv)
- exit(0);
- }
- exit(1);
-+ } else if (upgrade) { /* Upgrade the map(s) */
-+ int success = 1;
-+ if (optind + 1 > argc)
-+ usage(argv[0]);
-+ while (optind < argc) {
-+ if ((path_name = split_at(argv[optind], ':')) != 0) {
-+ success &= postmap_upgrade(argv[optind], path_name);
-+ } else {
-+ success &= postmap_upgrade(var_db_type, path_name);
-+ }
-+ if (!success)
-+ exit(1);
-+ optind++;
-+ }
-+ exit(0);
- } else { /* create/update map(s) */
- if (optind + 1 > argc)
- usage(argv[0]);
-diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in
-index 1af9419..5a9a814 100644
---- a/src/tls/Makefile.in
-+++ b/src/tls/Makefile.in
-@@ -24,7 +24,7 @@ LIB_DIR = ../../lib
- INC_DIR = ../../include
- MAKES =
-
--.c.o:; $(CC) $(CFLAGS) -c $*.c
-+.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
-
- all: $(LIB)
-
-@@ -40,12 +40,10 @@ tests:
- root_tests:
-
- $(LIB): $(OBJS)
-- $(AR) $(ARFL) $(LIB) $?
-- $(RANLIB) $(LIB)
-+ $(CC) -shared -Wl,-soname,libpostfix-tls.so.1 -o $(LIB) $(OBJS) $(LIBS) $(SYSLIBS)
-
- $(LIB_DIR)/$(LIB): $(LIB)
- cp $(LIB) $(LIB_DIR)
-- $(RANLIB) $(LIB_DIR)/$(LIB)
-
- update: $(LIB_DIR)/$(LIB) $(HDRS)
- -for i in $(HDRS); \
-diff --git a/src/tlsproxy/Makefile.in b/src/tlsproxy/Makefile.in
-index 137752a..b669790 100644
---- a/src/tlsproxy/Makefile.in
-+++ b/src/tlsproxy/Makefile.in
-@@ -9,7 +9,7 @@ TESTPROG=
- PROG = tlsproxy
- INC_DIR = ../../include
- LIBS = ../../lib/libtls.a ../../lib/libmaster.a ../../lib/libglobal.a \
-- ../../lib/libutil.a
-+ ../../lib/libutil.a ../../lib/libdns.a
-
- .c.o:; $(CC) $(CFLAGS) -c $*.c
-
-diff --git a/src/util/Makefile.in b/src/util/Makefile.in
-index 5ab2232..c3c37b1 100644
---- a/src/util/Makefile.in
-+++ b/src/util/Makefile.in
-@@ -1,5 +1,6 @@
- SHELL = /bin/sh
- SRCS = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
-+ load_lib.c \
- attr_print64.c attr_print_plain.c attr_scan0.c attr_scan64.c \
- attr_scan_plain.c auto_clnt.c base64_code.c basename.c binhash.c \
- chroot_uid.c cidr_match.c clean_env.c close_on_exec.c concatenate.c \
-@@ -12,7 +13,7 @@ SRCS = alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
- fullname.c get_domainname.c get_hostname.c hex_code.c hex_quote.c \
- host_port.c htable.c inet_addr_host.c inet_addr_list.c \
- inet_addr_local.c inet_connect.c inet_listen.c inet_proto.c \
-- inet_trigger.c line_wrap.c lowercase.c lstat_as.c mac_expand.c \
-+ inet_trigger.c load_lib.c line_wrap.c lowercase.c lstat_as.c mac_expand.c \
- mac_parse.c make_dirs.c mask_addr.c match_list.c match_ops.c msg.c \
- msg_output.c msg_syslog.c msg_vstream.c mvect.c myaddrinfo.c myflock.c \
- mymalloc.c myrand.c mystrtok.c name_code.c name_mask.c netstring.c \
-@@ -43,14 +44,14 @@ OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.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 \
-- dict_static.o dict_tcp.o dict_unix.o dir_forest.o doze.o dummy_read.o \
-+ dict_nisplus.o dict_open.o dict_regexp.o dict_sdbm.o \
-+ dict_static.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 \
- fullname.o get_domainname.o get_hostname.o hex_code.o hex_quote.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 \
-+ inet_trigger.o load_lib.o line_wrap.o lowercase.o lstat_as.o mac_expand.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 \
-@@ -76,6 +77,7 @@ OBJS = alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
- dict_sockmap.o line_number.o recv_pass_attr.o pass_accept.o \
- poll_fd.o timecmp.o slmdb.o
- HDRS = argv.h attr.h attr_clnt.h auto_clnt.h base64_code.h binhash.h \
-+ load_lib.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 \
- dict_lmdb.h dict_ni.h dict_nis.h dict_nisplus.h dict_pcre.h dict_regexp.h \
-@@ -103,6 +105,7 @@ DEFS = -I. -D$(SYSTYPE)
- CFLAGS = $(DEBUG) $(OPT) $(DEFS)
- FILES = Makefile $(SRCS) $(HDRS)
- INCL =
-+PCRESO = dict_pcre.so
- LIB = libutil.a
- TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
- fifo_rdonly_bug fifo_rdwr_bug fifo_trigger fsspace fullname \
-@@ -119,10 +122,11 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
-
- LIB_DIR = ../../lib
- INC_DIR = ../../include
-+LIBS = $(LIB_DIR)/$(LIB) $(PCRESO)
-
--.c.o:; $(CC) $(CFLAGS) -c $*.c
-+.c.o:; $(CC) -fPIC $(CFLAGS) -c $*.c
-
--all: $(LIB)
-+all: $(LIB) $(PCRESO)
-
- $(OBJS): ../../conf/makedefs.out
-
-@@ -131,15 +135,19 @@ Makefile: Makefile.in
-
- test: $(TESTPROG)
-
-+$(PCRESO): dict_pcre.o libutil.a
-+ $(CC) -shared -Wl,-soname,dict_pcre.so -o $@ $? -lpcre -L. -lutil
-+
- $(LIB): $(OBJS)
-- $(AR) $(ARFL) $(LIB) $?
-- $(RANLIB) $(LIB)
-+ $(CC) -shared -Wl,-soname,libpostfix-util.so.1 -o $(LIB) $(OBJS) -ldl $(SYSLIBS)
-
- $(LIB_DIR)/$(LIB): $(LIB)
- cp $(LIB) $(LIB_DIR)
-- $(RANLIB) $(LIB_DIR)/$(LIB)
-
--update: $(LIB_DIR)/$(LIB) $(HDRS)
-+../../libexec/$(PCRESO): $(PCRESO)
-+ cp $(PCRESO) ../../libexec
-+
-+update: $(LIBS) $(HDRS) ../../libexec/$(PCRESO)
- -for i in $(HDRS); \
- do \
- cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
-@@ -161,7 +169,7 @@ lint:
- lint $(DEFS) $(SRCS) $(LINTFIX)
-
- clean:
-- rm -f *.o $(LIB) *core $(TESTPROG) junk $(MAKES) *.tmp
-+ rm -f *.o $(LIB) $(PCRESO) *core $(TESTPROG) junk $(MAKES) *.tmp
- rm -rf printfck
-
- tidy: clean
-diff --git a/src/util/dict.h b/src/util/dict.h
-index a217603..9a84b1d 100644
---- a/src/util/dict.h
-+++ b/src/util/dict.h
-@@ -94,6 +94,7 @@ extern DICT *dict_debug(DICT *);
- #define DICT_FLAG_NO_UNAUTH (1<<13) /* disallow unauthenticated data */
- #define DICT_FLAG_FOLD_FIX (1<<14) /* case-fold key with fixed-case map */
- #define DICT_FLAG_FOLD_MUL (1<<15) /* case-fold key with multi-case map */
-+#define DICT_FLAG_UPGRADE (1<<30) /* Upgrade the db */
- #define DICT_FLAG_FOLD_ANY (DICT_FLAG_FOLD_FIX | DICT_FLAG_FOLD_MUL)
- #define DICT_FLAG_OPEN_LOCK (1<<16) /* perm lock if not multi-writer safe */
- #define DICT_FLAG_BULK_UPDATE (1<<17) /* optimize for bulk updates */
-@@ -187,6 +188,11 @@ extern int dict_error(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));
-+#ifndef NO_DYNAMIC_MAPS
-+extern void dict_open_dlinfo(const char *path);
-+typedef void* (*dict_mkmap_func_t)(const char *);
-+dict_mkmap_func_t dict_mkmap_func(const char *dict_type);
-+#endif
-
- #define dict_get(dp, key) ((const char *) (dp)->lookup((dp), (key)))
- #define dict_put(dp, key, val) (dp)->update((dp), (key), (val))
-diff --git a/src/util/dict_db.c b/src/util/dict_db.c
-index 93ee480..cf382e3 100644
---- a/src/util/dict_db.c
-+++ b/src/util/dict_db.c
-@@ -693,6 +693,12 @@ static DICT *dict_db_open(const char *class, const char *path, int open_flags,
- msg_fatal("set DB cache size %d: %m", dict_db_cache_size);
- if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
- msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
-+ if (dict_flags & DICT_FLAG_UPGRADE) {
-+ if (msg_verbose)
-+ msg_info("upgrading database %s",db_path);
-+ if ((errno = db->upgrade(db,db_path,0)) != 0)
-+ msg_fatal("upgrade of database %s: %m",db_path);
-+ }
- #if DB_VERSION_MAJOR == 5 || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
- if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0)
- FREE_RETURN(dict_surrogate(class, path, open_flags, dict_flags,
-diff --git a/src/util/dict_dbm.c b/src/util/dict_dbm.c
-index a1f25ff..5c64412 100644
---- a/src/util/dict_dbm.c
-+++ b/src/util/dict_dbm.c
-@@ -417,6 +417,10 @@ DICT *dict_dbm_open(const char *path, int open_flags, int dict_flags)
- char *dbm_path = 0;
- int lock_fd;
-
-+#ifdef HAVE_GDBM
-+ msg_fatal("%s: gdbm maps use locking that is incompatible with postfix. Use a hash map instead.",
-+ path);
-+#endif
- /*
- * Let the optimizer worry about eliminating redundant code.
- */
-diff --git a/src/util/dict_open.c b/src/util/dict_open.c
-index c8706da..2bad6dc 100644
---- a/src/util/dict_open.c
-+++ b/src/util/dict_open.c
-@@ -45,6 +45,7 @@
- /*
- /* ARGV *dict_mapnames()
- /*
-+/* void (*)() dict_mkmap_func(const char *dict_type)
- /* int dict_isjmp(dict)
- /* DICT *dict;
- /*
-@@ -193,6 +194,9 @@
- /* dict_mapnames() returns a sorted list with the names of all available
- /* dictionary types.
- /*
-+/* dict_mkmap_func() returns a pointer to the mkmap setup function
-+/* for the given map type, as given in /etc/dynamicmaps.cf
-+/*
- /* 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()
-@@ -251,6 +255,12 @@
- #include <strings.h>
- #endif
-
-+#include <sys/stat.h>
-+#include <unistd.h>
-+
-+#include <sys/stat.h>
-+#include <unistd.h>
-+
- /* Utility library. */
-
- #include <argv.h>
-@@ -281,6 +291,27 @@
- #include <htable.h>
- #include <myflock.h>
-
-+#ifndef NO_DYNAMIC_MAPS
-+#include <load_lib.h>
-+#include <vstring.h>
-+#include <vstream.h>
-+#include <vstring_vstream.h>
-+#include <mvect.h>
-+
-+ /*
-+ * Interface for dynamic map loading.
-+ */
-+typedef struct {
-+ const char *pattern;
-+ const char *soname;
-+ const char *openfunc;
-+ const char *mkmapfunc;
-+} DLINFO;
-+
-+static DLINFO *dict_dlinfo;
-+static DLINFO *dict_open_dlfind(const char *type);
-+#endif
-+
- /*
- * lookup table for available map types.
- */
-@@ -296,7 +327,9 @@ static const DICT_OPEN_INFO dict_open_info[] = {
- DICT_TYPE_ENVIRON, dict_env_open,
- DICT_TYPE_HT, dict_ht_open,
- DICT_TYPE_UNIX, dict_unix_open,
-+#ifdef NO_DYNAMIC_MAPS
- DICT_TYPE_TCP, dict_tcp_open,
-+#endif
- #ifdef HAS_SDBM
- DICT_TYPE_SDBM, dict_sdbm_open,
- #endif
-@@ -319,9 +352,11 @@ static const DICT_OPEN_INFO dict_open_info[] = {
- #ifdef HAS_NETINFO
- DICT_TYPE_NETINFO, dict_ni_open,
- #endif
-+#ifdef NO_DYNAMIC_MAPS
- #ifdef HAS_PCRE
- DICT_TYPE_PCRE, dict_pcre_open,
- #endif
-+#endif /* NO_DYNAMIC_MAPS */
- #ifdef HAS_POSIX_REGEXP
- DICT_TYPE_REGEXP, dict_regexp_open,
- #endif
-@@ -382,9 +417,28 @@ 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)
-+ if ((dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type)) == 0) {
-+#ifdef NO_DYNAMIC_MAPS
- return (dict_surrogate(dict_type, dict_name, open_flags, dict_flags,
- "unsupported dictionary type: %s", dict_type));
-+#else
-+ struct stat st;
-+ LIB_FN fn[2];
-+ DICT *(*open) (const char *, int, int);
-+ DLINFO *dl=dict_open_dlfind(dict_type);
-+ if ((!dl) || (stat(dl->soname, &st) < 0))
-+ return (dict_surrogate(dict_type, dict_name, open_flags, dict_flags,
-+ "unsupported dictionary type: %s: "
-+ "Is the postfix-%s package installed?",
-+ dict_type, dict_type));
-+ fn[0].name = dl->openfunc;
-+ fn[0].ptr = (void**)&open;
-+ fn[1].name = NULL;
-+ load_library_symbols(dl->soname, fn, NULL);
-+ dict_open_register(dict_type, open);
-+ dp = (DICT_OPEN_INFO *) htable_find(dict_open_hash, dict_type);
-+#endif
-+ }
- 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));
-@@ -408,6 +462,36 @@ DICT *dict_open3(const char *dict_type, const char *dict_name,
- return (dict);
- }
-
-+dict_mkmap_func_t dict_mkmap_func(const char *dict_type)
-+{
-+ char *myname="dict_mkmap_func";
-+ struct stat st;
-+ LIB_FN fn[2];
-+ dict_mkmap_func_t mkmap;
-+ DLINFO *dl;
-+#ifndef NO_DYNAMIC_MAPS
-+ if (!dict_dlinfo)
-+ msg_fatal("dlinfo==NULL");
-+ dl=dict_open_dlfind(dict_type);
-+ if (!dl)
-+ msg_fatal("%s: unsupported dictionary type: %s: Is the postfix-%s package installed?", myname, dict_type, dict_type);
-+ if (stat(dl->soname,&st) < 0) {
-+ msg_fatal("%s: unsupported dictionary type: %s (%s not found. Is the postfix-%s package installed?)",
-+ myname, dict_type, dl->soname, dict_type);
-+ }
-+ if (!dl->mkmapfunc)
-+ msg_fatal("%s: unsupported dictionary type: %s does not allow map creation.", myname, dict_type);
-+
-+ fn[0].name = dl->mkmapfunc;
-+ fn[0].ptr = (void**)&mkmap;
-+ fn[1].name = NULL;
-+ load_library_symbols(dl->soname, fn, NULL);
-+ return mkmap;
-+#else
-+ return (void(*)())NULL;
-+#endif
-+}
-+
- /* dict_open_register - register dictionary type */
-
- void dict_open_register(const char *type,
-@@ -441,6 +525,9 @@ ARGV *dict_mapnames()
- HTABLE_INFO **ht;
- DICT_OPEN_INFO *dp;
- ARGV *mapnames;
-+#ifndef NO_DYNAMIC_MAPS
-+ DLINFO *dlp;
-+#endif
-
- if (dict_open_hash == 0)
- dict_open_init();
-@@ -449,6 +536,13 @@ ARGV *dict_mapnames()
- dp = (DICT_OPEN_INFO *) ht[0]->value;
- argv_add(mapnames, dp->type, ARGV_END);
- }
-+#ifndef NO_DYNAMIC_MAPS
-+ if (!dict_dlinfo)
-+ msg_fatal("dlinfo==NULL");
-+ for (dlp=dict_dlinfo; dlp->pattern; dlp++) {
-+ argv_add(mapnames, dlp->pattern, ARGV_END);
-+ }
-+#endif
- qsort((void *) mapnames->argv, mapnames->argc, sizeof(mapnames->argv[0]),
- dict_sort_alpha_cpp);
- myfree((char *) ht_info);
-@@ -456,6 +550,89 @@ ARGV *dict_mapnames()
- return mapnames;
- }
-
-+#ifndef NO_DYNAMIC_MAPS
-+#define STREQ(x,y) (x == y || (x[0] == y[0] && strcmp(x,y) == 0))
-+
-+void dict_open_dlinfo(const char *path)
-+{
-+ char *myname="dict_open_dlinfo";
-+ VSTREAM *conf_fp=vstream_fopen(path,O_RDONLY,0);
-+ VSTRING *buf = vstring_alloc(100);
-+ char *cp;
-+ ARGV *argv;
-+ MVECT vector;
-+ int nelm=0;
-+ int linenum=0;
-+
-+ dict_dlinfo=(DLINFO*)mvect_alloc(&vector,sizeof(DLINFO),3,NULL,NULL);
-+
-+ if (!conf_fp) {
-+ msg_warn("%s: cannot open %s. No dynamic maps will be allowed.",
-+ myname, path);
-+ } else {
-+ while (vstring_get_nonl(buf,conf_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: Expected \"pattern .so-name open-function [mkmap-function]\" at line %d",
-+ myname, linenum);
-+ }
-+ if (STREQ(argv->argv[0],"*")) {
-+ msg_warn("%s: wildcard dynamic map entry no longer supported.",
-+ myname);
-+ continue;
-+ }
-+ if (argv->argv[1][0] != '/') {
-+ msg_fatal("%s: .so name must begin with a \"/\" at line %d",
-+ myname, linenum);
-+ }
-+ if (nelm >= vector.nelm) {
-+ dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+3);
-+ }
-+ dict_dlinfo[nelm].pattern = mystrdup(argv->argv[0]);
-+ dict_dlinfo[nelm].soname = mystrdup(argv->argv[1]);
-+ dict_dlinfo[nelm].openfunc = mystrdup(argv->argv[2]);
-+ if (argv->argc==4)
-+ dict_dlinfo[nelm].mkmapfunc = mystrdup(argv->argv[3]);
-+ else
-+ dict_dlinfo[nelm].mkmapfunc = NULL;
-+ nelm++;
-+ argv_free(argv);
-+ }
-+ }
-+ if (nelm >= vector.nelm) {
-+ dict_dlinfo=(DLINFO*)mvect_realloc(&vector,vector.nelm+1);
-+ }
-+ dict_dlinfo[nelm].pattern = NULL;
-+ dict_dlinfo[nelm].soname = NULL;
-+ dict_dlinfo[nelm].openfunc = NULL;
-+ dict_dlinfo[nelm].mkmapfunc = NULL;
-+ if (conf_fp)
-+ vstream_fclose(conf_fp);
-+ vstring_free(buf);
-+}
-+
-+static DLINFO *dict_open_dlfind(const char *type)
-+{
-+ DLINFO *dp;
-+
-+ if (!dict_dlinfo)
-+ return NULL;
-+
-+ for (dp=dict_dlinfo; dp->pattern; dp++) {
-+ if (STREQ(dp->pattern,type))
-+ return dp;
-+ }
-+ return NULL;
-+}
-+
-+#endif /* !NO_DYNAMIC_MAPS */
-+
-+
-+
- #ifdef TEST
-
- /*
-diff --git a/src/util/load_lib.c b/src/util/load_lib.c
-new file mode 100644
-index 0000000..b6526ef
---- /dev/null
-+++ b/src/util/load_lib.c
-@@ -0,0 +1,135 @@
-+/*++
-+/* NAME
-+/* load_lib 3
-+/* SUMMARY
-+/* library loading wrappers
-+/* SYNOPSIS
-+/* #include <load_lib.h>
-+/*
-+/* extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
-+/* const char *libname;
-+/* LIB_FN *libfuncs;
-+/* LIB_FN *libdata;
-+/*
-+/* DESCRIPTION
-+/* This module loads functions from libraries, returnine pointers
-+/* to the named functions.
-+/*
-+/* load_library_symbols() loads all of the desired functions, and
-+/* returns zero for success, or exits via msg_fatal().
-+/*
-+/* 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>
-+#if defined(HAS_DLOPEN)
-+#include <dlfcn.h>
-+#elif defined(HAS_SHL_LOAD)
-+#include <dl.h>
-+#endif
-+
-+/* Application-specific. */
-+
-+#include "msg.h"
-+#include "load_lib.h"
-+
-+extern int load_library_symbols(const char * libname, LIB_FN * libfuncs, LIB_FN * libdata)
-+{
-+ char *myname = "load_library_symbols";
-+ LIB_FN *fn;
-+
-+#if defined(HAS_DLOPEN)
-+ void *handle;
-+ char *emsg;
-+
-+ handle=dlopen(libname,RTLD_NOW);
-+ emsg=dlerror();
-+ if (emsg) {
-+ msg_fatal("%s: dlopen failure loading %s: %s", myname, libname, emsg);
-+ }
-+
-+ if (libfuncs) {
-+ for (fn=libfuncs; fn->name; fn++) {
-+ *(fn->ptr) = dlsym(handle,fn->name);
-+ emsg=dlerror();
-+ if (emsg) {
-+ msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
-+ fn->name, libname, emsg);
-+ }
-+ if (msg_verbose>1) {
-+ msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
-+ }
-+ }
-+ }
-+
-+ if (libdata) {
-+ for (fn=libdata; fn->name; fn++) {
-+ *(fn->ptr) = dlsym(handle,fn->name);
-+ emsg=dlerror();
-+ if (emsg) {
-+ msg_fatal("%s: dlsym failure looking up %s in %s: %s", myname,
-+ fn->name, libname, emsg);
-+ }
-+ if (msg_verbose>1) {
-+ msg_info("loaded %s = %lx",fn->name, *((long*)(fn->ptr)));
-+ }
-+ }
-+ }
-+#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->ptr) != 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 = %x",fn->name, *((long*)(fn->ptr)));
-+ }
-+ }
-+ }
-+
-+ if (libdata) {
-+ for (fn=libdata; fn->name; fn++) {
-+ if (shl_findsym(&handle,fn->name,TYPE_DATA,fn->ptr) != 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 = %x",fn->name, *((long*)(fn->ptr)));
-+ }
-+ }
-+ }
-+
-+#else
-+ msg_fatal("%s: need dlopen or shl_load support for dynamic libraries",
-+ myname);
-+#endif
-+ return 0;
-+}
-diff --git a/src/util/load_lib.h b/src/util/load_lib.h
-new file mode 100644
-index 0000000..adebd25
---- /dev/null
-+++ b/src/util/load_lib.h
-@@ -0,0 +1,41 @@
-+#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 **ptr;
-+} LIB_FN;
-+
-+extern int load_library_symbols(const char *, LIB_FN *, LIB_FN *);
-+
-+/* 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
diff --git a/main/postfix/dynamicmaps.cf b/main/postfix/dynamicmaps.cf
deleted file mode 100644
index dfe211055..000000000
--- a/main/postfix/dynamicmaps.cf
+++ /dev/null
@@ -1,16 +0,0 @@
-# Postfix dynamic maps configuration file.
-#
-# The first match found is the one that is used. Wildcards are not
-# supported.
-#
-#type location of .so file name of open function
-#==== ============================= =====================
-#ldap /usr/lib/postfix/dict_ldap.so dict_ldap_open
-#mysql /usr/lib/postfix/dict_mysql.so dict_mysql_open
-#pcre /usr/lib/postfix/dict_pcre.so dict_pcre_open
-#regex /usr/lib/postfix/dict_pcre.so dict_pcre_open
-#pgsql /usr/lib/postfix/dict_pgsql.so dict_pgsql_open
-
-# apk tools will manage the lines below
-## AUTO BEGIN ##
-## AUTO END ##
diff --git a/main/postfix/no-glibc.patch b/main/postfix/no-glibc.patch
index 2e5e83330..59ea01468 100644
--- a/main/postfix/no-glibc.patch
+++ b/main/postfix/no-glibc.patch
@@ -1,18 +1,11 @@
-Check if we have __GLIBC__ defined at all before checking version
-http://bugs.alpinelinux.org/issues/3423
-
-This fixes the following when compiled with musl libc:
-warning: unix_send_fd: your system has no support for file descriptor passing
-
-
--- ./src/util/sys_defs.h.orig
+++ ./src/util/sys_defs.h
-@@ -810,7 +810,7 @@
- # define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1)
+@@ -812,7 +812,7 @@
+ #define KERNEL_VERSION(a,b,c) (LINUX_VERSION_CODE + 1)
#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,2,0)) \
- || (__GLIBC__ < 2)
+ || (defined(__GLIBC__) && (__GLIBC__ < 2))
- # define CANT_USE_SEND_RECV_MSG
- # define DEF_SMTP_CACHE_DEMAND 0
+ #define CANT_USE_SEND_RECV_MSG
+ #define DEF_SMTP_CACHE_DEMAND 0
#else
diff --git a/main/postfix/postfix-ldap.post-install b/main/postfix/postfix-ldap.post-install
deleted file mode 100644
index b8d23833b..000000000
--- a/main/postfix/postfix-ldap.post-install
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# update the dynamicmaps.cf
-conf=/etc/postfix/dynamicmaps.cf
-
-sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
-
-(
-echo '## AUTO BEGIN ##'
-if cd /usr/lib/postfix/; then
- for i in *.so; do
- m=${i#dict_}
- m=${m%.so}
- echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
- done
-fi
-
-echo '## AUTO END ##'
-) >> $conf
diff --git a/main/postfix/postfix-mysql.post-install b/main/postfix/postfix-mysql.post-install
deleted file mode 100644
index b8d23833b..000000000
--- a/main/postfix/postfix-mysql.post-install
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# update the dynamicmaps.cf
-conf=/etc/postfix/dynamicmaps.cf
-
-sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
-
-(
-echo '## AUTO BEGIN ##'
-if cd /usr/lib/postfix/; then
- for i in *.so; do
- m=${i#dict_}
- m=${m%.so}
- echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
- done
-fi
-
-echo '## AUTO END ##'
-) >> $conf
diff --git a/main/postfix/postfix-pcre.post-install b/main/postfix/postfix-pcre.post-install
deleted file mode 100644
index f15b00cf7..000000000
--- a/main/postfix/postfix-pcre.post-install
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# update the dynamicmaps.cf
-conf=/etc/postfix/dynamicmaps.cf
-
-sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
-
-(
-echo '## AUTO BEGIN ##'
-if cd /usr/lib/postfix/; then
- for i in *.so; do
- m=${i#dict_}
- m=${m%.so}
- echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
- # pcre also handles regexp
- if [ "$m" = "pcre" ]; then
- echo -e "regex\t/usr/lib/postfix/$i\tdict_${m}_open"
- fi
-
- done
-fi
-
-echo '## AUTO END ##'
-) >> $conf
-
diff --git a/main/postfix/postfix-pgsql.post-install b/main/postfix/postfix-pgsql.post-install
deleted file mode 100644
index b8d23833b..000000000
--- a/main/postfix/postfix-pgsql.post-install
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# update the dynamicmaps.cf
-conf=/etc/postfix/dynamicmaps.cf
-
-sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
-
-(
-echo '## AUTO BEGIN ##'
-if cd /usr/lib/postfix/; then
- for i in *.so; do
- m=${i#dict_}
- m=${m%.so}
- echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
- done
-fi
-
-echo '## AUTO END ##'
-) >> $conf
diff --git a/main/postfix/postfix-sqlite.post-install b/main/postfix/postfix-sqlite.post-install
deleted file mode 100644
index b8d23833b..000000000
--- a/main/postfix/postfix-sqlite.post-install
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-# update the dynamicmaps.cf
-conf=/etc/postfix/dynamicmaps.cf
-
-sed -i -e '/\#\# AUTO BEGIN/,/\#\# AUTO END/d' $conf
-
-(
-echo '## AUTO BEGIN ##'
-if cd /usr/lib/postfix/; then
- for i in *.so; do
- m=${i#dict_}
- m=${m%.so}
- echo -e "$m\t/usr/lib/postfix/$i\tdict_${m}_open"
- done
-fi
-
-echo '## AUTO END ##'
-) >> $conf