2
0
mirror of https://github.com/vdukhovni/postfix synced 2025-08-29 05:07:58 +00:00

postfix-3.7.0

This commit is contained in:
Wietse Venema 2022-02-05 00:00:00 -05:00 committed by Viktor Dukhovni
parent ce13ee8880
commit d9dcbbcc7c
28 changed files with 212 additions and 56 deletions

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

View File

@ -66,7 +66,7 @@ to do $name expansion as it evaluates the parameter value.
Major changes - lmdb support
----------------------------
[Feature 20210605] Overhauled the LMDB client implementation, and
[Feature 20210605] Overhauled the LMDB client's error handling, and
added integration tests for future-proofing. There are no visible
changes in documented behavior.

View File

@ -6,6 +6,12 @@ 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.
Fix code that still uses "long" for data_size and data_offset,
and that uses "%ld" in sscanf().

View File

@ -323,14 +323,6 @@ TLSPROXY(8) TLSPROXY(8)
<b><a href="postconf.5.html#tlsproxy_client_scert_verifydepth">tlsproxy_client_scert_verifydepth</a> ($<a href="postconf.5.html#smtp_tls_scert_verifydepth">smtp_tls_scert_verifydepth</a>)</b>
The verification depth for remote TLS server certificates.
<b><a href="postconf.5.html#tlsproxy_client_level">tlsproxy_client_level</a> ($<a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a>)</b>
The default TLS security level for the Postfix <a href="tlsproxy.8.html"><b>tlsproxy</b>(8)</a>
client.
<b><a href="postconf.5.html#tlsproxy_client_policy">tlsproxy_client_policy</a> ($<a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a>)</b>
Optional lookup tables with the Postfix <a href="tlsproxy.8.html"><b>tlsproxy</b>(8)</a> client TLS
security policy by next-hop destination.
<b><a href="postconf.5.html#tlsproxy_client_use_tls">tlsproxy_client_use_tls</a> ($<a href="postconf.5.html#smtp_use_tls">smtp_use_tls</a>)</b>
Opportunistic mode: use TLS when a remote server announces TLS
support.
@ -343,6 +335,16 @@ TLSPROXY(8) TLSPROXY(8)
usage policy by next-hop destination and by remote TLS server
hostname.
Available in Postfix version 3.4-3.6:
<b><a href="postconf.5.html#tlsproxy_client_level">tlsproxy_client_level</a> ($<a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a>)</b>
The default TLS security level for the Postfix <a href="tlsproxy.8.html"><b>tlsproxy</b>(8)</a>
client.
<b><a href="postconf.5.html#tlsproxy_client_policy">tlsproxy_client_policy</a> ($<a href="postconf.5.html#smtp_tls_policy_maps">smtp_tls_policy_maps</a>)</b>
Optional lookup tables with the Postfix <a href="tlsproxy.8.html"><b>tlsproxy</b>(8)</a> client TLS
security policy by next-hop destination.
Available in Postfix version 3.7 and later:
<b><a href="postconf.5.html#tlsproxy_client_security_level">tlsproxy_client_security_level</a> ($<a href="postconf.5.html#smtp_tls_security_level">smtp_tls_security_level</a>)</b>

View File

@ -292,12 +292,6 @@ The name of the parameter that provides the tlsproxy_client_loglevel
value.
.IP "\fBtlsproxy_client_scert_verifydepth ($smtp_tls_scert_verifydepth)\fR"
The verification depth for remote TLS server certificates.
.IP "\fBtlsproxy_client_level ($smtp_tls_security_level)\fR"
The default TLS security level for the Postfix \fBtlsproxy\fR(8)
client.
.IP "\fBtlsproxy_client_policy ($smtp_tls_policy_maps)\fR"
Optional lookup tables with the Postfix \fBtlsproxy\fR(8) client TLS
security policy by next\-hop destination.
.IP "\fBtlsproxy_client_use_tls ($smtp_use_tls)\fR"
Opportunistic mode: use TLS when a remote server announces TLS
support.
@ -308,6 +302,14 @@ Optional lookup tables with the Postfix \fBtlsproxy\fR(8) client TLS
usage policy by next\-hop destination and by remote TLS server
hostname.
.PP
Available in Postfix version 3.4\-3.6:
.IP "\fBtlsproxy_client_level ($smtp_tls_security_level)\fR"
The default TLS security level for the Postfix \fBtlsproxy\fR(8)
client.
.IP "\fBtlsproxy_client_policy ($smtp_tls_policy_maps)\fR"
Optional lookup tables with the Postfix \fBtlsproxy\fR(8) client TLS
security policy by next\-hop destination.
.PP
Available in Postfix version 3.7 and later:
.IP "\fBtlsproxy_client_security_level ($smtp_tls_security_level)\fR"
The default TLS security level for the Postfix \fBtlsproxy\fR(8)

View 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

View File

@ -1781,3 +1781,4 @@ ldseed
softwareengineering
stackexchange
stdint
Noll

View File

@ -20,8 +20,8 @@
* 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_VERSION_NUMBER "3.7.0-RC2"
#define MAIL_RELEASE_DATE "20220205"
#define MAIL_VERSION_NUMBER "3.7.0"
#ifdef SNAPSHOT
#define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE

View 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;

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View 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

View File

@ -272,12 +272,6 @@
/* value.
/* .IP "\fBtlsproxy_client_scert_verifydepth ($smtp_tls_scert_verifydepth)\fR"
/* The verification depth for remote TLS server certificates.
/* .IP "\fBtlsproxy_client_level ($smtp_tls_security_level)\fR"
/* The default TLS security level for the Postfix \fBtlsproxy\fR(8)
/* client.
/* .IP "\fBtlsproxy_client_policy ($smtp_tls_policy_maps)\fR"
/* Optional lookup tables with the Postfix \fBtlsproxy\fR(8) client TLS
/* security policy by next-hop destination.
/* .IP "\fBtlsproxy_client_use_tls ($smtp_use_tls)\fR"
/* Opportunistic mode: use TLS when a remote server announces TLS
/* support.
@ -288,6 +282,14 @@
/* usage policy by next-hop destination and by remote TLS server
/* hostname.
/* .PP
/* Available in Postfix version 3.4-3.6:
/* .IP "\fBtlsproxy_client_level ($smtp_tls_security_level)\fR"
/* The default TLS security level for the Postfix \fBtlsproxy\fR(8)
/* client.
/* .IP "\fBtlsproxy_client_policy ($smtp_tls_policy_maps)\fR"
/* Optional lookup tables with the Postfix \fBtlsproxy\fR(8) client TLS
/* security policy by next-hop destination.
/* .PP
/* Available in Postfix version 3.7 and later:
/* .IP "\fBtlsproxy_client_security_level ($smtp_tls_security_level)\fR"
/* The default TLS security level for the Postfix \fBtlsproxy\fR(8)

View 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

View File

@ -51,6 +51,10 @@
/*
/* 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
@ -91,6 +95,13 @@
/* 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.
@ -100,6 +111,7 @@
/* to delete a non-existent entry.
/* SEE ALSO
/* mymalloc(3) memory management wrapper
/* hash_fnv(3) Fowler/Noll/Vo hash function
/* LICENSE
/* .ad
/* .fi
@ -109,6 +121,11 @@
/* 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 */
@ -124,6 +141,13 @@
/* 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

View 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

View 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)

View File

@ -28,9 +28,10 @@
/* 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

View File

@ -16,11 +16,11 @@
*/
#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);

View File

@ -103,8 +103,8 @@
/* terminate immediately: memory allocation failure; an attempt
/* to delete a non-existent entry.
/* SEE ALSO
/* hash_fnv() Fowler/Noll/Vo hash function
/* mymalloc(3) memory management wrapper
/* hash_fnv(3) Fowler/Noll/Vo hash function
/* LICENSE
/* .ad
/* .fi
@ -410,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 */ ;

View File

@ -51,6 +51,7 @@
*/
#include <iostuff.h>
#include <msg.h>
#include <ldseed.h>
/*
* Different systems have different names for non-wallclock time.