From: Wietse Venema
$ make -f Makefile.init makefiles \
"CCARGS=-DHAS_PCRE=2 `pcre2-config --cflags`" \
- "AUXLIBS_PCRE=`pcre2-config --libs`"
+ "AUXLIBS_PCRE=`pcre2-config --libs8`"
$ make
diff --git a/postfix/html/tlsproxy.8.html b/postfix/html/tlsproxy.8.html
index d0b8b0ea1..c15322bf3 100644
--- a/postfix/html/tlsproxy.8.html
+++ b/postfix/html/tlsproxy.8.html
@@ -323,14 +323,6 @@ TLSPROXY(8) TLSPROXY(8)
tlsproxy_client_scert_verifydepth ($smtp_tls_scert_verifydepth)
The verification depth for remote TLS server certificates.
- tlsproxy_client_level ($smtp_tls_security_level)
- The default TLS security level for the Postfix tlsproxy(8)
- client.
-
- tlsproxy_client_policy ($smtp_tls_policy_maps)
- Optional lookup tables with the Postfix tlsproxy(8) client TLS
- security policy by next-hop destination.
-
tlsproxy_client_use_tls ($smtp_use_tls)
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:
+
+ tlsproxy_client_level ($smtp_tls_security_level)
+ The default TLS security level for the Postfix tlsproxy(8)
+ client.
+
+ tlsproxy_client_policy ($smtp_tls_policy_maps)
+ Optional lookup tables with the Postfix tlsproxy(8) client TLS
+ security policy by next-hop destination.
+
Available in Postfix version 3.7 and later:
tlsproxy_client_security_level ($smtp_tls_security_level)
diff --git a/postfix/man/man8/tlsproxy.8 b/postfix/man/man8/tlsproxy.8
index 10b447606..5b6167089 100644
--- a/postfix/man/man8/tlsproxy.8
+++ b/postfix/man/man8/tlsproxy.8
@@ -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)
diff --git a/postfix/proto/PCRE_README.html b/postfix/proto/PCRE_README.html
index 896de9097..1741826a3 100644
--- a/postfix/proto/PCRE_README.html
+++ b/postfix/proto/PCRE_README.html
@@ -66,7 +66,7 @@ and later):
$ make -f Makefile.init makefiles \
"CCARGS=-DHAS_PCRE=2 `pcre2-config --cflags`" \
- "AUXLIBS_PCRE=`pcre2-config --libs`"
+ "AUXLIBS_PCRE=`pcre2-config --libs8`"
$ make
diff --git a/postfix/proto/stop b/postfix/proto/stop
index 8682f8e53..0189e961a 100644
--- a/postfix/proto/stop
+++ b/postfix/proto/stop
@@ -1562,3 +1562,4 @@ json
postlogd
proxied
raf
+fnvz
diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h
index aa50f1c37..2542fa37e 100644
--- a/postfix/src/global/mail_version.h
+++ b/postfix/src/global/mail_version.h
@@ -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 "20220204"
+#define MAIL_RELEASE_DATE "20220220"
#define MAIL_VERSION_NUMBER "3.8"
#ifdef SNAPSHOT
diff --git a/postfix/src/showq/showq.c b/postfix/src/showq/showq.c
index b8dd7e994..80e1e89e2 100644
--- a/postfix/src/showq/showq.c
+++ b/postfix/src/showq/showq.c
@@ -228,6 +228,7 @@ static void showq_report(VSTREAM *client, char *queue, char *id,
if (*start == 0)
start = var_empty_addr;
quote_822_local(printable_quoted_addr, start);
+ /* For consistency with REC_TYPE_RCPT below. */
printable(STR(printable_quoted_addr), '?');
if (sender_seen++ > 0) {
msg_warn("%s: duplicate sender address: %s "
@@ -257,6 +258,7 @@ static void showq_report(VSTREAM *client, char *queue, char *id,
if (*start == 0) /* can't happen? */
start = var_empty_addr;
quote_822_local(printable_quoted_addr, start);
+ /* For consistency with recipients in bounce logfile. */
printable(STR(printable_quoted_addr), '?');
if (dup_filter == 0
|| htable_locate(dup_filter, STR(printable_quoted_addr)) == 0)
diff --git a/postfix/src/tlsproxy/tlsproxy.c b/postfix/src/tlsproxy/tlsproxy.c
index 42b7a75e7..b8242df77 100644
--- a/postfix/src/tlsproxy/tlsproxy.c
+++ b/postfix/src/tlsproxy/tlsproxy.c
@@ -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)
diff --git a/postfix/src/util/Makefile.in b/postfix/src/util/Makefile.in
index c59cdf986..bfe146f5c 100644
--- a/postfix/src/util/Makefile.in
+++ b/postfix/src/util/Makefile.in
@@ -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 binhash
+ known_tcp_ports dict_stream find_inet binhash hash_fnv
PLUGIN_MAP_SO = $(LIB_PREFIX)pcre$(LIB_SUFFIX)
HTABLE_FIX = NORANDOMIZE=1
LIB_DIR = ../../lib
@@ -432,6 +432,11 @@ binhash: $(LIB)
$(CC) $(CFLAGS) -DTEST -o $@ $@.c $(LIB) $(SYSLIBS)
mv junk $@.o
+hash_fnv: $(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)
@@ -739,6 +744,9 @@ htable_test: htable /usr/share/dict/words
binhash_test: binhash /usr/share/dict/words
$(SHLIB_ENV) ${VALGRIND} ./binhash < /usr/share/dict/words
+hash_fnv_test: hash_fnv
+ $(SHLIB_ENV) ${VALGRIND} ./hash_fnv
+
hex_code_test: hex_code
$(SHLIB_ENV) ${VALGRIND} ./hex_code
diff --git a/postfix/src/util/hash_fnv.c b/postfix/src/util/hash_fnv.c
index 10e97f056..b56d176ac 100644
--- a/postfix/src/util/hash_fnv.c
+++ b/postfix/src/util/hash_fnv.c
@@ -9,9 +9,15 @@
/* HASH_FNV_T hash_fnv(
/* const void *src,
/* size_t len)
+/*
+/* HASH_FNV_T hash_fnvz(
+/* const char *src)
/* DESCRIPTION
/* hash_fnv() implements a modified FNV type 1a hash function.
/*
+/* hash_fnvz() provides the same functionality for null-terminated
+/* strings, avoiding an unnecessary strlen() call.
+/*
/* To thwart collision attacks, the hash function is seeded
/* once from /dev/urandom, and if that is unavailable, from
/* wallclock time, monotonic system clocks, and the process
@@ -21,11 +27,10 @@
/*
/* This function implements a workaround for a "sticky state"
/* problem with FNV hash functions: when an input produces a
-/* zero intermediate hash state, and the next input byte is
-/* zero, then the operations "hash ^= 0" and "hash *= FNV_prime"
-/* would not change the hash value. To avoid this, hash_fnv()
-/* adds 1 to each input byte. Compile with -DSTRICT_FNV1A to
-/* get the standard behavior.
+/* zero hash state, and the next input byte is zero, then the
+/* hash state would not change. To avoid this, hash_fnv() adds
+/* 1 to each input value. Compile with -DSTRICT_FNV1A to get
+/* the standard behavior.
/*
/* The default HASH_FNV_T result type is uint64_t. When compiled
/* with -DUSE_FNV_32BIT, the result type is uint32_t. On ancient
@@ -71,37 +76,164 @@
#define FNV_offset_basis 0xcbf29ce484222325ULL
#endif
+ /*
+ * Workaround for the sticky all-zero hash state: when the next input byte
+ * is zero, then the operations "hash ^= 0" and "hash *= FNV_prime" would
+ * not change the hash state. To avoid that, add 1 to the every input value.
+ */
+#ifdef STRICT_FNV1A
+#define HASH_FNV_NEW_BITS(new_bits) (new_bits)
+#else
+#define HASH_FNV_NEW_BITS(new_bits) (1 + (new_bits))
+#endif
+
+static HASH_FNV_T hash_fnv_basis = FNV_offset_basis;
+static int hash_fnv_must_init = 1;
+
+/* hash_fnv_init - seed the hash */
+
+static void hash_fnv_init(void)
+{
+ HASH_FNV_T seed;
+
+ if (!getenv("NORANDOMIZE")) {
+ ldseed(&seed, sizeof(seed));
+ hash_fnv_basis ^= seed;
+ }
+ hash_fnv_must_init = 0;
+}
+
/* hash_fnv - modified FNV 1a hash */
HASH_FNV_T hash_fnv(const void *src, size_t len)
{
- static HASH_FNV_T basis = FNV_offset_basis;
- static int randomize = 1;
HASH_FNV_T hash;
+ HASH_FNV_T new_bits;
- /*
- * Initialize.
- */
- if (randomize) {
- if (!getenv("NORANDOMIZE")) {
- HASH_FNV_T seed;
+ if (hash_fnv_must_init)
+ hash_fnv_init();
- ldseed(&seed, sizeof(seed));
- basis ^= seed;
- }
- randomize = 0;
+ hash = hash_fnv_basis;
+ while (len-- > 0) {
+ new_bits = *(unsigned char *) src++;
+ hash ^= HASH_FNV_NEW_BITS(new_bits);
+ hash *= FNV_prime;
+ }
+ return (hash);
+}
+
+/* hash_fnvz - modified FNV 1a hash for null-terminated strings */
+
+HASH_FNV_T hash_fnvz(const char *src)
+{
+ HASH_FNV_T hash;
+ HASH_FNV_T new_bits;
+
+ if (hash_fnv_must_init)
+ hash_fnv_init();
+
+ hash = hash_fnv_basis;
+ while ((new_bits = *(unsigned char *) src++) != 0) {
+ hash ^= HASH_FNV_NEW_BITS(new_bits);
+ hash *= FNV_prime;
}
+ return (hash);
+}
+#ifdef TEST
+#include