From 776c7a910ed979e3e6abcecd2ac7ed249a62152c Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Thu, 8 May 2014 11:13:20 +0000
Subject: [PATCH] main/postfix: upgrade to 2.11.1

---
 main/postfix/APKBUILD                         |  28 +--
 ...dynamic-maps3.patch => dynamic-maps.patch} | 193 ++++++++++--------
 2 files changed, 123 insertions(+), 98 deletions(-)
 rename main/postfix/{dynamic-maps3.patch => dynamic-maps.patch} (85%)

diff --git a/main/postfix/APKBUILD b/main/postfix/APKBUILD
index 063be4ec589d..c9e1961f2d79 100644
--- a/main/postfix/APKBUILD
+++ b/main/postfix/APKBUILD
@@ -1,7 +1,7 @@
 # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
 pkgname=postfix
-pkgver=2.10.2
-pkgrel=1
+pkgver=2.11.1
+pkgrel=0
 pkgdesc="Secure and fast drop-in replacement for Sendmail (MTA)"
 url="http://www.postfix.org/"
 arch="all"
@@ -14,7 +14,7 @@ subpackages="$pkgname-doc $pkgname-ldap $pkgname-mysql $pkgname-pcre
 	$pkgname-pgsql $pkgname-sqlite"
 source="ftp://ftp.porcupine.org/mirrors/$pkgname-release/official/$pkgname-$pkgver.tar.gz
 	$pkgname.initd
-	dynamic-maps3.patch
+	dynamic-maps.patch
 	dynamicmaps.cf
 	postfix-ldap.post-install
 	postfix-mysql.post-install
@@ -46,7 +46,7 @@ prepare() {
 	sed -i -e "s:/usr/local/:/usr/:g" conf/master.cf || return 1
 }
 
-build () { 
+build () {
 	cd "$srcdir/$pkgname-$pkgver"
 	# needed for dynamic maps.
 	local ccargs="-DHAS_DLOPEN -DHAS_SHL_LOAD"
@@ -60,7 +60,7 @@ build () {
 
 	# ssl
 	ccargs="$ccargs -DUSE_TLS"
-	auxlibs="$auxlibs -lssl -lcrypto" 
+	auxlibs="$auxlibs -lssl -lcrypto"
 
 	## dovecot-sasl
 	#ccargs="$ccargs -DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\\\"dovecot\\\""
@@ -80,7 +80,7 @@ build () {
 	# ldap
 	ccargs="$ccargs -DHAS_LDAP"
 	#auxlibs="$auxlibs -lldap -llber"
-	
+
 	# sqlite
 	ccargs="$ccargs -DHAS_SQLITE"
 
@@ -90,8 +90,8 @@ build () {
 		CCARGS="$ccargs" \
 		AUXLIBS="$auxlibs" \
 		makefiles || return 1
-	
-	make OPT="$CFLAGS" || return 1
+
+	make -j1 OPT="$CFLAGS" || return 1
 }
 
 package() {
@@ -159,27 +159,27 @@ pcre()  { _mv_dict pcre ; }
 pgsql() { _mv_dict pgsql ; }
 sqlite() { _mv_dict sqlite ; }
 
-md5sums="109e753aecafe487207b425dd46e6ee9  postfix-2.10.2.tar.gz
+md5sums="56ac1f1a79737c4ac1e24535a122a4a6  postfix-2.11.1.tar.gz
 d773f01dcc965d219a8a37b88f89c5bf  postfix.initd
-cf6b5ddf6adabd12224c083b8b2ec5e8  dynamic-maps3.patch
+c03239969df760e2a74c4e048ce514a1  dynamic-maps.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="f1a735a5a9ffeac8fca59046c437c3b76e7f923fb4249db2a55b2bff0306ddd4  postfix-2.10.2.tar.gz
+sha256sums="487f98a73b95a5799409caf21ec065efea91c1dcdfb84c038a0e3a265d6489e2  postfix-2.11.1.tar.gz
 6b3fe71542ab783c7adddbfa161f7e2dcb2325913ad5d611ca56f730876ce4ab  postfix.initd
-d91df2fb9a4d6d535c58ab839a05abc228ef9b4a7d26a9162a1355b0f07d1188  dynamic-maps3.patch
+cfa5000955f1941082567a9e50764f52851f33c468f534c0431f6932d73e8ffb  dynamic-maps.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="fa6c123da040a8e332c0bf2430f5b098523c2eff42a6cf4bfe6618b82d59be8e5a7f5c85b09ab8fd0312058b2135b174e00890423e4d3f8f732c3dc3c91f01c3  postfix-2.10.2.tar.gz
+sha512sums="988659ed7f256fdc831c6a211c33aede922d5baf32da7129afe0ec2fe5011ac95dacb21e59c92f658323b6ea773ebf2bcd66a796d9271c1e7b949d5d9b9ee977  postfix-2.11.1.tar.gz
 c179534a7243bcf8c19b5367a703b54fcc88b7587ce7ef07ec111cfe00053779eed23b3ccda81eb20059599b857cae0a57cc02613526209f3dd966d65abd9a3f  postfix.initd
-31f3900152444d6af019dda63cbbb715d401d0727d05b6a813a93f54f43d1f02fa4cfeee69b0e01ba279bdebcd0463e0691f9a0c4afcc98980a52ea043812d08  dynamic-maps3.patch
+1a92089410691d400953472be522c872be1456521203560a4feadb632cb85cfacaf3721108d62111873fb23478976b8a949077734cf801374ca58bcaf363922c  dynamic-maps.patch
 49b8205166f575e5fb9bdaaaaa042dc1be9b556331bf659a55b1115c9fa48486896941f18ca9fb633dd54675079f29a9d69d53c214170731c2127862456ec90b  dynamicmaps.cf
 b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138  postfix-ldap.post-install
 b35931865eb15b5cd6a2b95bbf486cd064d1447eac1a91d507a7d23155229ac7e7fdf6b8518e663c5c7072b201786c72aead0d95e94d8708a9b5a7c3f37be138  postfix-mysql.post-install
diff --git a/main/postfix/dynamic-maps3.patch b/main/postfix/dynamic-maps.patch
similarity index 85%
rename from main/postfix/dynamic-maps3.patch
rename to main/postfix/dynamic-maps.patch
index 81848ab7441e..b19446c74dc6 100644
--- a/main/postfix/dynamic-maps3.patch
+++ b/main/postfix/dynamic-maps.patch
@@ -1,5 +1,5 @@
 diff --git a/conf/postfix-files b/conf/postfix-files
-index 90ef957..c4c522a 100644
+index 9e1804a..daa6328 100644
 --- a/conf/postfix-files
 +++ b/conf/postfix-files
 @@ -65,6 +65,11 @@ $queue_directory/saved:d:$mail_owner:-:700:ucr
@@ -62,7 +62,7 @@ index bbc5e98..e14c6fe 100644
  update: $(LIB_DIR)/$(LIB) $(HDRS)
  	-for i in $(HDRS); \
 diff --git a/src/global/Makefile.in b/src/global/Makefile.in
-index d8fb3db..0b26b6f 100644
+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 \
@@ -76,7 +76,7 @@ index d8fb3db..0b26b6f 100644
  	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 \
-@@ -112,10 +112,14 @@ LIBS	= ../../lib/libutil.a
+@@ -113,10 +113,14 @@ LIBS	= ../../lib/libutil.a
  LIB_DIR	= ../../lib
  INC_DIR	= ../../include
  MAKES	=
@@ -93,7 +93,7 @@ index d8fb3db..0b26b6f 100644
  
  $(OBJS): ../../conf/makedefs.out
  
-@@ -125,14 +129,36 @@ Makefile: Makefile.in
+@@ -126,14 +130,36 @@ Makefile: Makefile.in
  test:	$(TESTPROG)
  
  $(LIB):	$(OBJS)
@@ -134,7 +134,7 @@ index d8fb3db..0b26b6f 100644
  	-for i in $(HDRS); \
  	do \
  	  cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
-@@ -577,7 +603,7 @@ lint:
+@@ -584,7 +610,7 @@ lint:
  	lint $(DEFS) $(SRCS) $(LINTFIX)
  
  clean:
@@ -181,7 +181,7 @@ index 6dbf6ee..ff0eee6 100644
      0,
  };
 diff --git a/src/global/mail_params.c b/src/global/mail_params.c
-index 0e098b3..dac095d 100644
+index 6e4378c..9dab202 100644
 --- a/src/global/mail_params.c
 +++ b/src/global/mail_params.c
 @@ -79,6 +79,7 @@
@@ -200,7 +200,7 @@ index 0e098b3..dac095d 100644
  /*	char   *var_trace_service;
  /*	char   *var_proxymap_service;
  /*	char   *var_proxywrite_service;
-@@ -268,6 +270,7 @@ char   *var_import_environ;
+@@ -274,6 +276,7 @@ char   *var_import_environ;
  char   *var_export_environ;
  char   *var_debug_peer_list;
  int     var_debug_peer_level;
@@ -208,7 +208,7 @@ index 0e098b3..dac095d 100644
  int     var_fault_inj_code;
  char   *var_bounce_service;
  char   *var_cleanup_service;
-@@ -279,6 +282,7 @@ char   *var_showq_service;
+@@ -285,6 +288,7 @@ char   *var_showq_service;
  char   *var_error_service;
  char   *var_flush_service;
  char   *var_verify_service;
@@ -217,10 +217,10 @@ index 0e098b3..dac095d 100644
  char   *var_proxymap_service;
  char   *var_proxywrite_service;
 diff --git a/src/global/mkmap_open.c b/src/global/mkmap_open.c
-index d939d44..b2e729e 100644
+index dfa9bc2..30409aa 100644
 --- a/src/global/mkmap_open.c
 +++ b/src/global/mkmap_open.c
-@@ -82,7 +82,7 @@
+@@ -83,7 +83,7 @@
    * We use a different table (in dict_open.c) when querying maps.
    */
  typedef struct {
@@ -229,28 +229,28 @@ index d939d44..b2e729e 100644
      MKMAP  *(*before_open) (const char *);
  } MKMAP_OPEN_INFO;
  
-@@ -161,7 +161,16 @@ MKMAP  *mkmap_open(const char *type, const char *path,
+@@ -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;
-+	}
++        {
++            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: %s", type);
+ 	    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 f1a59f6..0eb5d2d 100644
+index d1be8fe..be0bb69 100644
 --- a/src/master/Makefile.in
 +++ b/src/master/Makefile.in
-@@ -20,7 +20,7 @@ LIB_DIR	= ../../lib
+@@ -22,7 +22,7 @@ LIB_DIR	= ../../lib
  INC_DIR	= ../../include
  BIN_DIR	= ../../libexec
  
@@ -259,7 +259,7 @@ index f1a59f6..0eb5d2d 100644
  
  all:	$(PROG) $(LIB)
  
-@@ -39,12 +39,10 @@ tests:
+@@ -41,12 +41,10 @@ tests:
  root_tests:
  
  $(LIB):	$(LIB_OBJ)
@@ -274,7 +274,7 @@ index f1a59f6..0eb5d2d 100644
  $(BIN_DIR)/$(PROG): $(PROG)
  	 cp $(PROG) $(BIN_DIR)
 diff --git a/src/milter/Makefile.in b/src/milter/Makefile.in
-index c28263a..c475629 100644
+index 99b6469..0769778 100644
 --- a/src/milter/Makefile.in
 +++ b/src/milter/Makefile.in
 @@ -14,7 +14,7 @@ LIB_DIR	= ../../lib
@@ -301,10 +301,10 @@ index c28263a..c475629 100644
  update: $(LIB_DIR)/$(LIB) $(HDRS)
  	-for i in $(HDRS); \
 diff --git a/src/postconf/postconf_other.c b/src/postconf/postconf_other.c
-index 04f9404..1752450 100644
+index e93dfab..ac415ba 100644
 --- a/src/postconf/postconf_other.c
 +++ b/src/postconf/postconf_other.c
-@@ -55,6 +55,10 @@
+@@ -56,6 +56,10 @@
  
  #include <xsasl.h>
  
@@ -315,7 +315,7 @@ index 04f9404..1752450 100644
  /* Application-specific. */
  
  #include <postconf.h>
-@@ -65,7 +69,16 @@ void    show_maps(void)
+@@ -66,7 +70,16 @@ void    pcf_show_maps(void)
  {
      ARGV   *maps_argv;
      int     i;
@@ -325,7 +325,7 @@ index 04f9404..1752450 100644
 +    char   *config_dir;
 +
 +    if (var_config_dir == 0)
-+	set_config_dir();
++	pcf_set_config_dir();
 +    path = concatenate(var_config_dir, "/", "dynamicmaps.cf", (char *) 0);
 +    dict_open_dlinfo(path);
 +    myfree(path);
@@ -334,7 +334,7 @@ index 04f9404..1752450 100644
      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 8249d79..8833dc4 100644
+index e10ac16..92e85d6 100644
 --- a/src/postmap/postmap.c
 +++ b/src/postmap/postmap.c
 @@ -5,7 +5,7 @@
@@ -355,7 +355,7 @@ index 8249d79..8833dc4 100644
  /* .IP \fB-v\fR
  /*	Enable verbose logging for debugging purposes. Multiple \fB-v\fR
  /*	options make the software increasingly verbose.
-@@ -748,6 +750,18 @@ static void postmap_seq(const char *map_type, const char *map_name,
+@@ -764,6 +766,18 @@ static void postmap_seq(const char *map_type, const char *map_name,
      dict_close(dict);
  }
  
@@ -374,7 +374,7 @@ index 8249d79..8833dc4 100644
  /* usage - explain */
  
  static NORETURN usage(char *myname)
-@@ -768,6 +782,7 @@ int     main(int argc, char **argv)
+@@ -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;
@@ -382,7 +382,7 @@ index 8249d79..8833dc4 100644
      char   *query = 0;
      char   *delkey = 0;
      int     sequence = 0;
-@@ -817,7 +832,7 @@ int     main(int argc, char **argv)
+@@ -833,7 +848,7 @@ int     main(int argc, char **argv)
      /*
       * Parse JCL.
       */
@@ -391,7 +391,7 @@ index 8249d79..8833dc4 100644
  	switch (ch) {
  	default:
  	    usage(argv[0]);
-@@ -834,8 +849,8 @@ int     main(int argc, char **argv)
+@@ -850,8 +865,8 @@ int     main(int argc, char **argv)
  		msg_fatal("out of memory");
  	    break;
  	case 'd':
@@ -402,7 +402,7 @@ index 8249d79..8833dc4 100644
  	    delkey = optarg;
  	    break;
  	case 'f':
-@@ -861,8 +876,8 @@ int     main(int argc, char **argv)
+@@ -877,8 +892,8 @@ int     main(int argc, char **argv)
  	    postmap_flags &= ~POSTMAP_FLAG_SAVE_PERM;
  	    break;
  	case 'q':
@@ -413,7 +413,7 @@ index 8249d79..8833dc4 100644
  	    query = optarg;
  	    break;
  	case 'r':
-@@ -870,10 +885,15 @@ int     main(int argc, char **argv)
+@@ -886,10 +901,15 @@ int     main(int argc, char **argv)
  	    dict_flags |= DICT_FLAG_DUP_REPLACE;
  	    break;
  	case 's':
@@ -431,7 +431,7 @@ index 8249d79..8833dc4 100644
  	case 'v':
  	    msg_verbose++;
  	    break;
-@@ -944,6 +964,21 @@ int     main(int argc, char **argv)
+@@ -964,6 +984,21 @@ int     main(int argc, char **argv)
  	    exit(0);
  	}
  	exit(1);
@@ -454,7 +454,7 @@ index 8249d79..8833dc4 100644
  	if (optind + 1 > argc)
  	    usage(argv[0]);
 diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in
-index 1dbe154..b952aa4 100644
+index 1af9419..5a9a814 100644
 --- a/src/tls/Makefile.in
 +++ b/src/tls/Makefile.in
 @@ -24,7 +24,7 @@ LIB_DIR	= ../../lib
@@ -480,8 +480,21 @@ index 1dbe154..b952aa4 100644
  
  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 dc7a4bb..4454085 100644
+index 5ab2232..c3c37b1 100644
 --- a/src/util/Makefile.in
 +++ b/src/util/Makefile.in
 @@ -1,5 +1,6 @@
@@ -491,16 +504,19 @@ index dc7a4bb..4454085 100644
  	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 \
-@@ -36,13 +37,14 @@ SRCS	= alldig.c allprint.c argv.c argv_split.c attr_clnt.c attr_print0.c \
- 	ip_match.c nbbio.c stream_pass_connect.c base32_code.c dict_test.c \
- 	dict_fail.c msg_rate_delay.c dict_surrogate.c warn_stat.c
- OBJS	= alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
-+	load_lib.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 \
+@@ -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_ni.o dict_nis.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 \
@@ -508,15 +524,22 @@ index dc7a4bb..4454085 100644
  	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 \
-@@ -72,6 +74,7 @@ OBJS	= alldig.o allprint.o argv.o argv_split.o attr_clnt.o attr_print0.o \
- 	ip_match.o nbbio.o stream_pass_connect.o base32_code.o dict_test.o \
- 	dict_fail.o msg_rate_delay.o dict_surrogate.o warn_stat.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_ni.h dict_nis.h dict_nisplus.h dict_pcre.h dict_regexp.h \
-@@ -98,6 +101,7 @@ DEFS	= -I. -D$(SYSTYPE)
+ 	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	=
@@ -524,7 +547,7 @@ index dc7a4bb..4454085 100644
  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 \
-@@ -113,10 +117,11 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
+@@ -119,10 +122,11 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
  
  LIB_DIR	= ../../lib
  INC_DIR	= ../../include
@@ -538,7 +561,7 @@ index dc7a4bb..4454085 100644
  
  $(OBJS): ../../conf/makedefs.out
  
-@@ -125,15 +130,19 @@ Makefile: Makefile.in
+@@ -131,15 +135,19 @@ Makefile: Makefile.in
  
  test:	$(TESTPROG)
  
@@ -562,7 +585,7 @@ index dc7a4bb..4454085 100644
  	-for i in $(HDRS); \
  	do \
  	  cmp -s $$i $(INC_DIR)/$$i 2>/dev/null || cp $$i $(INC_DIR); \
-@@ -155,7 +164,7 @@ lint:
+@@ -161,7 +169,7 @@ lint:
  	lint $(DEFS) $(SRCS) $(LINTFIX)
  
  clean:
@@ -572,18 +595,18 @@ index dc7a4bb..4454085 100644
  
  tidy:	clean
 diff --git a/src/util/dict.h b/src/util/dict.h
-index f8e91a4..d7ae8fe 100644
+index a217603..9a84b1d 100644
 --- a/src/util/dict.h
 +++ b/src/util/dict.h
-@@ -80,6 +80,7 @@ extern DICT *dict_debug(DICT *);
+@@ -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)	/* open file with exclusive lock */
- 
-@@ -166,6 +167,11 @@ extern int dict_error(const char *);
+ #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));
@@ -613,11 +636,11 @@ index 93ee480..cf382e3 100644
      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 37e1463..56fd3dc 100644
+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;
+     char   *dbm_path = 0;
      int     lock_fd;
  
 +#ifdef HAVE_GDBM
@@ -625,42 +648,44 @@ index 37e1463..56fd3dc 100644
 +                path);
 +#endif
      /*
-      * Note: DICT_FLAG_LOCK is used only by programs that do fine-grained (in
-      * the time domain) locking while accessing individual database records.
+      * Let the optimizer worry about eliminating redundant code.
+      */
 diff --git a/src/util/dict_open.c b/src/util/dict_open.c
-index 7b7c0c5..241c337 100644
+index c8706da..2bad6dc 100644
 --- a/src/util/dict_open.c
 +++ b/src/util/dict_open.c
-@@ -44,6 +44,8 @@
- /*	DICT	*(*open) (const char *, int, int);
+@@ -45,6 +45,7 @@
  /*
  /*	ARGV	*dict_mapnames()
-+/*
-+/*     void (*)() dict_mkmap_func(const char *dict_type)
- /* DESCRIPTION
- /*	This module implements a low-level interface to multiple
- /*	physical dictionary types.
-@@ -166,6 +168,9 @@
  /*
++/*      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_mkmap_func() returns a pointer to the mkmap setup function
-+/*     for the given map type, as given in /etc/dynamicmaps.cf
- /* DIAGNOSTICS
- /*	Fatal error: open error, unsupported dictionary type, attempt to
- /*	update non-writable dictionary.
-@@ -213,6 +218,9 @@
+ /*	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>
-@@ -241,6 +249,27 @@
+@@ -281,6 +291,27 @@
  #include <htable.h>
  #include <myflock.h>
  
@@ -688,7 +713,7 @@ index 7b7c0c5..241c337 100644
   /*
    * lookup table for available map types.
    */
-@@ -256,7 +285,9 @@ static const DICT_OPEN_INFO dict_open_info[] = {
+@@ -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,
@@ -698,7 +723,7 @@ index 7b7c0c5..241c337 100644
  #ifdef HAS_SDBM
      DICT_TYPE_SDBM, dict_sdbm_open,
  #endif
-@@ -276,9 +307,11 @@ static const DICT_OPEN_INFO dict_open_info[] = {
+@@ -319,9 +352,11 @@ static const DICT_OPEN_INFO dict_open_info[] = {
  #ifdef HAS_NETINFO
      DICT_TYPE_NETINFO, dict_ni_open,
  #endif
@@ -710,7 +735,7 @@ index 7b7c0c5..241c337 100644
  #ifdef HAS_POSIX_REGEXP
      DICT_TYPE_REGEXP, dict_regexp_open,
  #endif
-@@ -338,9 +371,28 @@ DICT   *dict_open3(const char *dict_type, const char *dict_name,
+@@ -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();
@@ -740,7 +765,7 @@ index 7b7c0c5..241c337 100644
      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));
-@@ -359,6 +411,36 @@ DICT   *dict_open3(const char *dict_type, const char *dict_name,
+@@ -408,6 +462,36 @@ DICT   *dict_open3(const char *dict_type, const char *dict_name,
      return (dict);
  }
  
@@ -777,7 +802,7 @@ index 7b7c0c5..241c337 100644
  /* dict_open_register - register dictionary type */
  
  void    dict_open_register(const char *type,
-@@ -392,6 +474,9 @@ ARGV   *dict_mapnames()
+@@ -441,6 +525,9 @@ ARGV   *dict_mapnames()
      HTABLE_INFO **ht;
      DICT_OPEN_INFO *dp;
      ARGV   *mapnames;
@@ -787,7 +812,7 @@ index 7b7c0c5..241c337 100644
  
      if (dict_open_hash == 0)
  	dict_open_init();
-@@ -400,6 +485,13 @@ ARGV   *dict_mapnames()
+@@ -449,6 +536,13 @@ ARGV   *dict_mapnames()
  	dp = (DICT_OPEN_INFO *) ht[0]->value;
  	argv_add(mapnames, dp->type, ARGV_END);
      }
@@ -801,7 +826,7 @@ index 7b7c0c5..241c337 100644
      qsort((void *) mapnames->argv, mapnames->argc, sizeof(mapnames->argv[0]),
  	  dict_sort_alpha_cpp);
      myfree((char *) ht_info);
-@@ -407,6 +499,89 @@ ARGV   *dict_mapnames()
+@@ -456,6 +550,89 @@ ARGV   *dict_mapnames()
      return mapnames;
  }
  
-- 
GitLab