]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.8-20220204
authorWietse Venema <wietse@porcupine.org>
Fri, 4 Feb 2022 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Sat, 5 Feb 2022 18:04:04 +0000 (13:04 -0500)
25 files changed:
postfix/HISTORY
postfix/RELEASE_NOTES-3.7
postfix/WISHLIST
postfix/proto/stop.double-cc
postfix/proto/stop.spell-cc
postfix/src/global/mail_version.h
postfix/src/postconf/postconf_lookup.c
postfix/src/postconf/test2.ref
postfix/src/postconf/test28.ref
postfix/src/postconf/test29.ref
postfix/src/postconf/test34.ref
postfix/src/postconf/test35.ref
postfix/src/postconf/test41.ref
postfix/src/postconf/test42.ref
postfix/src/postconf/test57.ref
postfix/src/postconf/test59.ref
postfix/src/postconf/test67.ref
postfix/src/util/Makefile.in
postfix/src/util/binhash.c
postfix/src/util/binhash.h
postfix/src/util/dict_db.c
postfix/src/util/hash_fnv.c
postfix/src/util/hash_fnv.h
postfix/src/util/htable.c
postfix/src/util/ldseed.c

index 55d4d410904a0e5492c318422ced0fdd978cd12b..0d900728b678e49ecfaa433bde8b9eb7453c453a 100644 (file)
@@ -26267,3 +26267,16 @@ Apologies for any names omitted.
 
        Cleanup: factored out the non-cryptographic seeder. Files:
        ldseed.[hc].
+
+20220130
+
+       Cleanup: added a binhash unit test, and updated the htable
+       unit test. Files: util/Makefile.in, util/binhash.[hc],
+       util/htable.c.
+
+       Cleanup: names of hash_fnv(3) build options. File: hash:fnv.c.
+
+20220202
+
+       Bitrot: Berkeley DB 18 is like Berkeley DB 6. Yasuhiro
+       Kimura. File: util/dict_db.c.
index c765669fddeadd15065820dd107036348fd1a526..a15bf4ed9976c7551dfbc163a3c036f5ac0ba42f 100644 (file)
@@ -75,10 +75,10 @@ Major changes - logging
 
 [Feature 20210815] To make the maillog_file feature more useful,
 the postlog(1) command is now set-gid postdrop, so that unprivileged
-programs can write logging through the postlogd(8) daemon. This
-required hardening the postlog(1) command against privilege escalation
-attacks. DO NOT turn on the set-gid bit with older postlog(1)
-implementations.
+programs can use it to write logging through the postlogd(8) daemon.
+This required hardening the postlog(1) command against privilege
+escalation attacks. DO NOT turn on the set-gid bit with older
+postlog(1) implementations.
 
 Major changes - pcre2 support
 -----------------------------
@@ -93,16 +93,6 @@ build Postfix with a specific library.
 Visible differences: some error messages may have a different text,
 and the 'X' pattern flag is no longer supported with pcre2.
 
-Major changes - safety
-----------------------
-
-[Feature 20210926] Prevent sharing of xxx_tls_session_cache_database
-instances between different Postfix instances when a database is
-not multi-writer safe. These databases are now opened with a permanent
-lock. The tlsmgr(8) daemon will raise a fatal error when it attempts
-to open an xxx_tls_session_cache_database that is already opened
-by a different tlsmgr(8) process.
-
 Major changes - security
 ------------------------
 
index accd98735d01c9f9eb6b63c18183d3d4da40c98e..d0a0db45c07c8afdb70c650d30743e000f15aa71 100644 (file)
@@ -6,6 +6,9 @@ Wish list:
 
        Disable -DSNAPSHOT and -DNONPROD in makedefs.
 
+       Alias htable(3) calls to equivalent binhash(3) calls,
+       and obsolete the htable(3) module.
+
        FILTER_README needs some text on multi-instance implementations,
        and existing multi-instance references need to be updated.
 
index 9a4cc5aec51a0d79281371e90ba8db138869aacc..1e9b3de22b0c85f5897e3af47cd15e35e43da4fe 100644 (file)
@@ -327,4 +327,4 @@ more  more useful and more consistent
  Fatal error error opening existing file 
 XXX  XXX 
  int compar DNS_RR DNS_RR 
-NO_64_BITS  NO_64_BITS 
+USE_FNV_32BIT  USE_FNV_32BIT 
index 3f49e14217fc51be871e730a984985d73fd6c901..9166298536a870fad19ed77c9070015d37c56d1c 100644 (file)
@@ -1781,3 +1781,4 @@ ldseed
 softwareengineering
 stackexchange
 stdint
+Noll
index 282be696dbba7aa1bda573e7c895452788acf9d8..aa50f1c37e9f7f09d30f3f24e87e5cd39ddc3598 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      "20220129"
+#define MAIL_RELEASE_DATE      "20220204"
 #define MAIL_VERSION_NUMBER    "3.8"
 
 #ifdef SNAPSHOT
index 2237d9d89584fd6ee5e300ea11886d3b663bd9d9..5185681e72d03e1820a1ce08d3581a932f97d00d 100644 (file)
@@ -158,7 +158,6 @@ char   *pcf_expand_parameter_value(VSTRING *buf, int mode, const char *value,
                                           PCF_MASTER_ENT *local_scope)
 {
     const char *myname = "pcf_expand_parameter_value";
-    static VSTRING *local_buf;
     int     status;
     PCF_EVAL_CTX eval_ctx;
 
index ff25b0bd8de831a423abf6aa96e422e6f6140c88..49af249a357028ea9cef4ccaa2b82521ab9685ff 100644 (file)
@@ -1,3 +1,3 @@
 config_directory = .
-./postconf: warning: ./main.cf: unused parameter: foo=yes
 ./postconf: warning: ./main.cf: unused parameter: restriction_classes=foo bar
+./postconf: warning: ./main.cf: unused parameter: foo=yes
index cb117b009ee89c04c526120d032374d0f3c1d586..4e9373463f066e9f81025f6070149c50bfe11e27 100644 (file)
@@ -6,5 +6,5 @@ hh_domain = whatever
 yy = aap
 zz = $yy
 ./postconf: warning: ./main.cf: unused parameter: foo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: aa_domain=whatever
 ./postconf: warning: ./main.cf: unused parameter: xx=proxy:ldap:foo
+./postconf: warning: ./main.cf: unused parameter: aa_domain=whatever
index ce872f5537ca3f412a5fcab4b6650ae1833a1a5f..646890aaa1c54c02c8efe8973491a01966f9ceb4 100644 (file)
@@ -1,16 +1,16 @@
 config_directory = .
+./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domain=bar
 ./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domain=bar
+./postconf: warning: ./main.cf: unused parameter: ldapxx=proxy:ldap:ldapfoo
 ./postconf: warning: ./main.cf: unused parameter: sqlitexx=proxy:sqlite:sqlitefoo
-./postconf: warning: ./main.cf: unused parameter: pgsqlxx=proxy:pgsql:pgsqlfoo
+./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domain=bar
+./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domainx=bar
+./postconf: warning: ./main.cf: unused parameter: memcachefoo_domain=bar
 ./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: memcachexx=proxy:memcache:memcachefoo
 ./postconf: warning: ./main.cf: unused parameter: ldapfoo_domainx=bar
 ./postconf: warning: ./main.cf: unused parameter: ldapfoo_domain=bar
+./postconf: warning: ./main.cf: unused parameter: memcachexx=proxy:memcache:memcachefoo
 ./postconf: warning: ./main.cf: unused parameter: memcachefoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: sqlitefoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: ldapxx=proxy:ldap:ldapfoo
-./postconf: warning: ./main.cf: unused parameter: memcachefoo_domain=bar
-./postconf: warning: ./main.cf: unused parameter: mysqlxx=proxy:mysql:mysqlfoo
 ./postconf: warning: ./main.cf: unused parameter: mysqlfoo_domainx=bar
-./postconf: warning: ./main.cf: unused parameter: pgsqlfoo_domain=bar
+./postconf: warning: ./main.cf: unused parameter: mysqlxx=proxy:mysql:mysqlfoo
+./postconf: warning: ./main.cf: unused parameter: pgsqlxx=proxy:pgsql:pgsqlfoo
index e7712932f32e673770dd30da0837caabb7c50398..2c9d6bd55d14e337ee42d438a14ad5bdedc57c6c 100644 (file)
@@ -1,4 +1,4 @@
-./postconf: warning: ./main.cf: read-only parameter assignment: process_id=yyy
 ./postconf: warning: ./main.cf: read-only parameter assignment: process_name=xxx
+./postconf: warning: ./main.cf: read-only parameter assignment: process_id=yyy
 mydestination = whatever
 process_name = postconf
index dc27f397b107414d867f72b285478bf2c9b1e0d8..601648f7b228a7af5b20dec0ab2ea7ff6f179685 100644 (file)
@@ -1,3 +1,3 @@
-./postconf: warning: ./master.cf: read-only parameter assignment: process_id=bbb
 ./postconf: warning: ./master.cf: read-only parameter assignment: process_name=aaa
+./postconf: warning: ./master.cf: read-only parameter assignment: process_id=bbb
 process_name = postconf
index 852d309ee2a57cd61448f855d2db7250f1567f32..f8200d40146be1e5b3619d2d633749f76419a83d 100644 (file)
@@ -3,16 +3,16 @@ bar        unix  -       n       n       -       0       other
     -o xxx=yyy
     -o aaa=bbb
 baz        unix  -       n       n       -       0       other
-./postconf: warning: ./master.cf: unused parameter: xxx=yyy
 ./postconf: warning: ./master.cf: unused parameter: aaa=bbb
+./postconf: warning: ./master.cf: unused parameter: xxx=yyy
 foo        unix  -       n       n       -       0       other
 bar        unix  -       n       n       -       0       other
     -o xxx=YYY
     -o aaa=BBB
 baz        unix  -       n       n       -       0       other
-./postconf: warning: ./master.cf: unused parameter: xxx=YYY
 ./postconf: warning: ./master.cf: unused parameter: aaa=BBB
+./postconf: warning: ./master.cf: unused parameter: xxx=YYY
 bar/unix/aaa = BBB
 bar/unix/xxx = YYY
-./postconf: warning: ./master.cf: unused parameter: xxx=YYY
 ./postconf: warning: ./master.cf: unused parameter: aaa=BBB
+./postconf: warning: ./master.cf: unused parameter: xxx=YYY
index 98981183a15d9d1a7ff6ed6d614b2393037f0a46..80676f350b8a198732de7508a49b5dfb36b94cc1 100644 (file)
@@ -3,12 +3,12 @@ bar        unix  -       n       n       -       0       other
     -o xxx=yyy
     -o aaa=bbb
 baz        unix  -       n       n       -       0       other
-./postconf: warning: ./master.cf: unused parameter: xxx=yyy
 ./postconf: warning: ./master.cf: unused parameter: aaa=bbb
+./postconf: warning: ./master.cf: unused parameter: xxx=yyy
 bar/unix/aaa = bbb
 bar/unix/xxx = yyy
-./postconf: warning: ./master.cf: unused parameter: xxx=yyy
 ./postconf: warning: ./master.cf: unused parameter: aaa=bbb
+./postconf: warning: ./master.cf: unused parameter: xxx=yyy
 foo        unix  -       n       n       -       0       other
 bar        unix  -       n       n       -       0       other
 baz        unix  -       n       n       -       0       other
index 9bb13926e616a373199c0f5c1f54eb7b22e202c3..362fd167a887177c4afb86c34d06af4d6e2cd066 100644 (file)
@@ -6,5 +6,5 @@ config_directory = .
 t1 = Postfix 2.11 compatible
 x = x-value
 y = y-value
-./postconf: warning: ./main.cf: unused parameter: foo=$bar$baz
 ./postconf: warning: ./main.cf: unused parameter: t2=$t1
+./postconf: warning: ./main.cf: unused parameter: foo=$bar$baz
index 3a7e57f6aa97e5c12a6281f2c12ae0600e998f34..c5cb3f6a08236e785cba74aa2da19e472ad1f953 100644 (file)
@@ -6,5 +6,5 @@ bar        inet  -       n       n       0       0       other
     -o {name2=value2a value2b}
     arg1a arg1b {arg2a arg2b} {arg3a arg3b}
 baz        unix  -       n       n       0       0       other
-./postconf: warning: ./master.cf: unused parameter: name1=value1
 ./postconf: warning: ./master.cf: unused parameter: name2=value2a value2b
+./postconf: warning: ./master.cf: unused parameter: name1=value1
index 1fd053856cdc0718509ba0afc2b0b4370d4a409a..2014e99253b3fdf443895b9a8c4644b038d9716c 100644 (file)
@@ -6,5 +6,5 @@ smtp       unix  n       -       n       -       -       smtp
     -o test2_service_name=smtp
 ./postconf: warning: ./master.cf: unused parameter: test1_service_name=$service_name
 ./postconf: warning: ./master.cf: unused parameter: test1_process_name=$process_name
-./postconf: warning: ./master.cf: unused parameter: test2_process_name=$process_name
 ./postconf: warning: ./master.cf: unused parameter: test2_service_name=$service_name
+./postconf: warning: ./master.cf: unused parameter: test2_process_name=$process_name
index b0bfc2fa015ae643de601ebcc56a791bf1d4d642..c59cdf98615b99ac2e96b643f692ac8fcc01670f 100644 (file)
@@ -140,7 +140,7 @@ TESTPROG= dict_open dup2_pass_on_exec events exec_command fifo_open \
        valid_utf8_string ip_match base32_code msg_rate_delay netstring \
        vstream timecmp dict_cache midna_domain casefold strcasecmp_utf8 \
        vbuf_print split_qnameval vstream msg_logger byte_mask \
-       known_tcp_ports dict_stream find_inet
+       known_tcp_ports dict_stream find_inet binhash
 PLUGIN_MAP_SO = $(LIB_PREFIX)pcre$(LIB_SUFFIX)
 HTABLE_FIX = NORANDOMIZE=1
 LIB_DIR        = ../../lib
@@ -427,6 +427,11 @@ htable: $(LIB)
        $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
        mv junk $@.o
 
+binhash: $(LIB)
+       mv $@.o junk
+       $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
+       mv junk $@.o
+
 unix_recv_fd:  $(LIB)
        mv $@.o junk
        $(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
@@ -580,7 +585,7 @@ tests: all valid_hostname_test mac_expand_test dict_test unescape_test \
        dict_static_file_test dict_random_test dict_random_file_test \
        dict_inline_file_test byte_mask_tests mystrtok_test \
        known_tcp_ports_test dict_stream_test dict_inline_regexp_test \
-       dict_inline_cidr_test
+       dict_inline_cidr_test binhash_test
 
 dict_pcre_tests: dict_pcre_test miss_endif_pcre_test dict_pcre_file_test \
        dict_inline_pcre_test
@@ -731,6 +736,9 @@ attr_scan_plain_test: attr_print_plain attr_scan_plain attr_scan_plain.ref
 htable_test: htable /usr/share/dict/words
        $(SHLIB_ENV) ${VALGRIND} ./htable < /usr/share/dict/words
 
+binhash_test: binhash /usr/share/dict/words
+       $(SHLIB_ENV) ${VALGRIND} ./binhash < /usr/share/dict/words
+
 hex_code_test: hex_code
        $(SHLIB_ENV) ${VALGRIND} ./hex_code
 
@@ -1251,6 +1259,7 @@ basename.o: vbuf.h
 basename.o: vstring.h
 binhash.o: binhash.c
 binhash.o: binhash.h
+binhash.o: hash_fnv.h
 binhash.o: msg.h
 binhash.o: mymalloc.h
 binhash.o: sys_defs.h
@@ -2041,6 +2050,7 @@ known_tcp_ports.o: vbuf.h
 known_tcp_ports.o: vstring.h
 ldseed.o: iostuff.h
 ldseed.o: ldseed.c
+ldseed.o: ldseed.h
 ldseed.o: msg.h
 ldseed.o: sys_defs.h
 line_number.o: check_arg.h
@@ -2546,7 +2556,6 @@ stream_trigger.o: mymalloc.h
 stream_trigger.o: stream_trigger.c
 stream_trigger.o: sys_defs.h
 stream_trigger.o: trigger.h
-sys_compat.o: iostuff.h
 sys_compat.o: sys_compat.c
 sys_compat.o: sys_defs.h
 timecmp.o: timecmp.c
index ef8900dcce07d20f41f63720eb0080938880bd62..fd9bc877912b61ed4149c530c59d4a985f626d41 100644 (file)
 /*
 /*     BINHASH_INFO **binhash_list(table)
 /*     BINHASH *table;
+/*
+/*     BINHASH_INFO *binhash_sequence(table, how)
+/*     BINHASH *table;
+/*     int     how;
 /* DESCRIPTION
 /*     This module maintains one or more hash tables. Each table entry
 /*     consists of a unique binary-valued lookup key and a generic
 /*     binhash_list() returns a null-terminated list of pointers to
 /*     all elements in the named table. The list should be passed to
 /*     myfree().
+/*
+/*     binhash_sequence() returns the first or next element
+/*     depending on the value of the "how" argument. Specify
+/*     BINHASH_SEQ_FIRST to start a new sequence, BINHASH_SEQ_NEXT
+/*     to continue, and BINHASH_SEQ_STOP to terminate a sequence
+/*     early. The caller must not delete an element before it is
+/*     visited.
 /* RESTRICTIONS
 /*     A callback function should not modify the hash table that is
 /*     specified to its caller.
 /*     to delete a non-existent entry.
 /* SEE ALSO
 /*     mymalloc(3) memory management wrapper
+/*     hash_fnv(3) Fowler/Noll/Vo hash function
 /* LICENSE
 /* .ad
 /* .fi
 /*     IBM T.J. Watson Research
 /*     P.O. Box 704
 /*     Yorktown Heights, NY 10598, USA
+/*
+/*     Wietse Venema
+/*     Google, Inc.
+/*     111 8th Avenue
+/*     New York, NY 10011, USA
 /*--*/
 
 /* C library */
 
 /* binhash_hash - hash a string */
 
+#ifndef NO_HASH_FNV
+#include "hash_fnv.h"
+
+#define binhash_hash(key, len, size) (hash_fnv((key), (len)) % (size))
+
+#else
+
 static size_t binhash_hash(const void *key, ssize_t len, size_t size)
 {
     size_t  h = 0;
@@ -143,6 +167,8 @@ static size_t binhash_hash(const void *key, ssize_t len, size_t size)
     return (h % size);
 }
 
+#endif
+
 /* binhash_link - insert element into table */
 
 #define binhash_link(table, elm) { \
@@ -178,6 +204,7 @@ BINHASH *binhash_create(ssize_t size)
 
     table = (BINHASH *) mymalloc(sizeof(BINHASH));
     binhash_size(table, size < 13 ? 13 : size);
+    table->seq_bucket = table->seq_element = 0;
     return (table);
 }
 
@@ -295,6 +322,9 @@ void    binhash_free(BINHASH *table, void (*free_fn) (void *))
        }
        myfree((void *) table->data);
        table->data = 0;
+       if (table->seq_bucket)
+           myfree((void *) table->seq_bucket);
+       table->seq_bucket = 0;
        myfree((void *) table);
     }
 }
@@ -335,3 +365,83 @@ BINHASH *table;
     list[count] = 0;
     return (list);
 }
+
+/* binhash_sequence - dict(3) compatibility iterator */
+
+BINHASH_INFO *binhash_sequence(BINHASH *table, int how)
+{
+    if (table == 0)
+       return (0);
+
+    switch (how) {
+    case BINHASH_SEQ_FIRST:                    /* start new sequence */
+       if (table->seq_bucket)
+           myfree((void *) table->seq_bucket);
+       table->seq_bucket = binhash_list(table);
+       table->seq_element = table->seq_bucket;
+       return (*(table->seq_element)++);
+    case BINHASH_SEQ_NEXT:                     /* next element */
+       if (table->seq_element && *table->seq_element)
+           return (*(table->seq_element)++);
+       /* FALLTHROUGH */
+    default:                                   /* terminate sequence */
+       if (table->seq_bucket) {
+           myfree((void *) table->seq_bucket);
+           table->seq_bucket = table->seq_element = 0;
+       }
+       return (0);
+    }
+}
+
+#ifdef TEST
+#include <vstring_vstream.h>
+#include <myrand.h>
+
+int     main(int unused_argc, char **unused_argv)
+{
+    VSTRING *buf = vstring_alloc(10);
+    ssize_t count = 0;
+    BINHASH *hash;
+    BINHASH_INFO **ht_info;
+    BINHASH_INFO **ht;
+    BINHASH_INFO *info;
+    ssize_t i;
+    ssize_t r;
+    int     op;
+
+    /*
+     * Load a large number of strings including terminator, and delete them
+     * in a random order.
+     */
+    hash = binhash_create(10);
+    while (vstring_get(buf, VSTREAM_IN) != VSTREAM_EOF)
+       binhash_enter(hash, vstring_str(buf), VSTRING_LEN(buf) + 1,
+                     CAST_INT_TO_VOID_PTR(count++));
+    if (count != hash->used)
+       msg_panic("%ld entries stored, but %lu entries exist",
+                 (long) count, (unsigned long) hash->used);
+    for (i = 0, op = BINHASH_SEQ_FIRST; (info = binhash_sequence(hash, op)) != 0;
+        i++, op = BINHASH_SEQ_NEXT)
+       if (memchr(info->key, 0, info->key_len) == 0)
+           msg_panic("no null byte in lookup key");
+    if (i != hash->used)
+       msg_panic("%ld entries found, but %lu entries exist",
+                 (long) i, (unsigned long) hash->used);
+    ht_info = binhash_list(hash);
+    for (i = 0; i < hash->used; i++) {
+       r = myrand() % hash->used;
+       info = ht_info[i];
+       ht_info[i] = ht_info[r];
+       ht_info[r] = info;
+    }
+    for (ht = ht_info; *ht; ht++)
+       binhash_delete(hash, ht[0]->key, ht[0]->key_len, (void (*) (void *)) 0);
+    if (hash->used > 0)
+       msg_panic("%ld entries not deleted", (long) hash->used);
+    myfree((void *) ht_info);
+    binhash_free(hash, (void (*) (void *)) 0);
+    vstring_free(buf);
+    return (0);
+}
+
+#endif
index d9ff83f43de30ad2837e806e0aacf04adaab88f5..3b4e1a4793cf09a1bbd093cbc64af7d72bf95b9d 100644 (file)
@@ -27,6 +27,8 @@ typedef struct BINHASH {
     ssize_t size;                      /* length of entries array */
     ssize_t used;                      /* number of entries in table */
     BINHASH_INFO **data;               /* entries array, auto-resized */
+    BINHASH_INFO **seq_bucket;         /* current sequence hash bucket */
+    BINHASH_INFO **seq_element;                /* current sequence element */
 } BINHASH;
 
 extern BINHASH *binhash_create(ssize_t);
@@ -37,6 +39,11 @@ extern void binhash_delete(BINHASH *, const void *, ssize_t, void (*) (void *));
 extern void binhash_free(BINHASH *, void (*) (void *));
 extern void binhash_walk(BINHASH *, void (*) (BINHASH_INFO *, void *), void *);
 extern BINHASH_INFO **binhash_list(BINHASH *);
+extern BINHASH_INFO *binhash_sequence(BINHASH *, int);
+
+#define BINHASH_SEQ_FIRST      0
+#define BINHASH_SEQ_NEXT       1
+#define BINHASH_SEQ_STOP       (-1)
 
 /* LICENSE
 /* .ad
index 9cd1128ee71355eb08684c3ba2e695f34da7a632..b2d0c336f3bc441a88d86a9efa3404363b6d094b 100644 (file)
@@ -754,7 +754,7 @@ static DICT *dict_db_open(const char *class, const char *path, int open_flags,
     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);
     db_base_buf = vstring_alloc(100);
-#if DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \
+#if DB_VERSION_MAJOR == 18 || DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \
        (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
     if ((errno = db->open(db, 0, sane_basename(db_base_buf, db_path),
                          0, type, db_flags, 0644)) != 0)
index d8baac549195621b198bd54e37651f2e46335f44..10e97f056bcbec421353169cebcfa97207c84d57 100644 (file)
 /*     get the standard behavior.
 /*
 /*     The default HASH_FNV_T result type is uint64_t. When compiled
-/*     with -DNO_64_BITS, the result type is uint32_t. On ancient
+/*     with -DUSE_FNV_32BIT, the result type is uint32_t. On ancient
 /*     systems without <stdint.h>, define HASH_FNV_T on the compiler
-/*     command line as an unsigned 32-bit or 64-bit integer type.
+/*     command line as an unsigned 32-bit or 64-bit integer type,
+/*     and specify -DUSE_FNV_32BIT when HASH_FNV_T is a 32-bit type.
 /* SEE ALSO
 /*     http://www.isthe.com/chongo/tech/comp/fnv/index.html
 /*     https://softwareengineering.stackexchange.com/questions/49550/
@@ -62,7 +63,7 @@
  /*
   * Application-specific.
   */
-#ifdef NO_64_BITS
+#ifdef USE_FNV_32BIT
 #define FNV_prime              0x01000193UL
 #define FNV_offset_basis       0x811c9dc5UL
 #else
index 19122aeef2c1df718ad3fc589acc002183f193b3..dbbb383c57bc12e3810b945938e4aa0a845812ad 100644 (file)
   */
 #ifndef HASH_FNV_T
 #include <stdint.h>
-#ifdef NO_64_BITS
+#ifdef USE_FNV_32BIT
 #define HASH_FNV_T     uint32_t
-#else                                  /* NO_64_BITS */
+#else                                  /* USE_FNV_32BIT */
 #define HASH_FNV_T     uint64_t
-#endif                                 /* NO_64_BITS */
+#endif                                 /* USE_FNV_32BIT */
 #endif                                 /* HASH_FNV_T */
 
 extern HASH_FNV_T hash_fnv(const void *, size_t);
index f2ccf2ec3bc4edd7a34f05d6349543a7ada33f96..1c08e9797ea026a5f6cf67d2101d5124feb69f5a 100644 (file)
 /*     to delete a non-existent entry.
 /* SEE ALSO
 /*     mymalloc(3) memory management wrapper
+/*     hash_fnv(3) Fowler/Noll/Vo hash function
 /* LICENSE
 /* .ad
 /* .fi
@@ -409,6 +410,9 @@ int     main(int unused_argc, char **unused_argv)
     hash = htable_create(10);
     while (vstring_get(buf, VSTREAM_IN) != VSTREAM_EOF)
        htable_enter(hash, vstring_str(buf), CAST_INT_TO_VOID_PTR(count++));
+    if (count != hash->used)
+       msg_panic("%ld entries stored, but %lu entries exist",
+                 (long) count, (unsigned long) hash->used);
     for (i = 0, op = HTABLE_SEQ_FIRST; htable_sequence(hash, op) != 0;
         i++, op = HTABLE_SEQ_NEXT)
         /* void */ ;
index 7bce66831e4f55dba82bea3dd6e482733fe4ae97..c23115272ecafb6c58d90fd1141cd82fc133b851 100644 (file)
@@ -51,6 +51,7 @@
   */
 #include <iostuff.h>
 #include <msg.h>
+#include <ldseed.h>
 
  /*
   * Different systems have different names for non-wallclock time.