Merge ~paride/ubuntu/+source/postfix:lp1906970-focal into ubuntu/+source/postfix:ubuntu/focal

Proposed by Paride Legovini
Status: Superseded
Proposed branch: ~paride/ubuntu/+source/postfix:lp1906970-focal
Merge into: ubuntu/+source/postfix:ubuntu/focal
Diff against target: 795 lines (+249/-88)
32 files modified
HISTORY (+81/-0)
Makefile.in (+1/-1)
README_FILES/MAILLOG_README (+1/-1)
RELEASE_NOTES (+8/-0)
conf/postfix-tls-script (+1/-1)
debian/changelog (+19/-0)
debian/patches/series (+0/-1)
debian/postfix.postinst (+1/-1)
dev/null (+0/-51)
html/MAILLOG_README.html (+1/-1)
html/postconf.5.html (+1/-1)
html/postfix.1.html (+1/-1)
makedefs (+14/-1)
man/man1/postfix.1 (+1/-1)
man/man5/postconf.5 (+1/-1)
proto/MAILLOG_README.html (+1/-1)
proto/postconf.proto (+1/-1)
src/dns/dns.h (+4/-0)
src/dns/dns_lookup.c (+5/-2)
src/dns/dns_str_resflags.c (+6/-0)
src/global/mail_params.c (+2/-0)
src/global/mail_params.h (+1/-1)
src/global/mail_version.h (+2/-2)
src/milter/milter.c (+5/-5)
src/postfix/postfix.c (+1/-1)
src/smtpd/smtpd_check.c (+8/-8)
src/tls/tls_bio_ops.c (+7/-0)
src/tls/tls_misc.c (+21/-0)
src/tls/tls_session.c (+1/-1)
src/tlsproxy/tlsproxy.c (+26/-4)
src/util/midna_domain.c (+26/-0)
src/util/midna_domain.h (+1/-0)
Reviewer Review Type Date Requested Status
Canonical Server Pending
Review via email: mp+407020@code.launchpad.net

This proposal has been superseded by a proposal from 2021-08-12.

Commit message

Focal SRU for LP: #1906970, same as https://code.launchpad.net/~paride/ubuntu/+source/postfix/+git/postfix/+merge/406805 but done against Focal.

Test PPA: https://launchpad.net/~paride/+archive/ubuntu/postfix-lp1906970

Test case: see [Test Plan] in the SRU bug description.

Autopkgtest summary (virt-server: lxd):

postfix PASS

To post a comment you must log in.

Unmerged commits

c4b999b... by Paride Legovini

Update d/changelog for 3.4.13-0ubuntu2

3759f2e... by Paride Legovini

d/postfix.postinst: tolerate search domain with a leading dot

Search domain with a leading dot cause postfix.postinst to fail because
it constructs a 'myhostname' with a duplicate dot (see #991950).

The glibc resolver tolerates such domains and strips the leading dot
from the search domain [1]. This change makes postfix.postinst do the
same.

This same fix has been proposed for inclusion in Debian [2].

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=resolv/res_query.c;h=ebbe5a6a4ed86abe3fccd4a134bfcf6f613c9bbb;hb=HEAD#l411
[2] https://salsa.debian.org/postfix-team/postfix-dev/-/merge_requests/12

Closes: #991950, LP: #1906970

9ce4102... by Lucas Kanashiro

Update changelog

4656c5f... by Lucas Kanashiro

Drop patch 80_glibc2.30-ftbfs.diff

This patch is not needed anymore and it does not cleanly apply to this
new upstream release.

4c073fe... by Lucas Kanashiro

New upstream release: 3.4.13

Workaround for broken DANE support after an incompatible change in
GLIBC 2.31 (LP: #1868955)

Fix "postfix tls deploy-server-cert", now it handles a missing optional
argument (LP: #1881196)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/HISTORY b/HISTORY
2index 1ebf42a..fe15290 100644
3--- a/HISTORY
4+++ b/HISTORY
5@@ -24346,3 +24346,84 @@ Apologies for any names omitted.
6 multi-Milter configuration during MAIL FROM. Milter client
7 state was not properly reset after one of the Milters failed.
8 Reported by WeiYu Wu.
9+
10+20200416
11+
12+ Workaround for broken builds after an incompatible change
13+ in GCC 10. Files: makedefs, Makefile.in.
14+
15+ Workaround for broken DANE support after an incompatible
16+ change in GLIBC 2.31. This avoids the need for new options
17+ in /etc/resolv.conf. Files: dns/dns.h, dns/dns_lookup.c.
18+
19+20200419
20+
21+ Bugfix: segfault in the tlsproxy client role when the server
22+ role was disabled. This typically happens on systems that
23+ do not receive mail, after configuring connection reuse for
24+ outbound TLS. Found during program maintenance. File:
25+ tlsproxy/tlsproxy.c.
26+
27+20200420
28+
29+ Noise suppression: shut up a compiler that special-cases
30+ string literals. Viktor Dukhovni. File milter/milter.c.
31+
32+20200422
33+
34+ Security: disable DANE support on Alpine Linux because
35+ libc-musl provides no indication whether DNS responses are
36+ authentic. This broke DANE support without a clear explanation.
37+ File: makedefs.
38+
39+20200505
40+
41+ Noise suppression: shut up a compiler that special-cases
42+ string literals. Viktor Dukhovni. File smtpd/smtpd_check.c.
43+
44+20200509
45+
46+ Bugfix (introduced: Postfix 3.5): maillog_file_rotate_suffix
47+ default value used the minute instead of the month. Reported
48+ by Larry Stone. Files: conf/postfix-tls-script,
49+ proto/MAILLOG_README.html, proto/postconf.proto.
50+ global/mail_params.h, postfix/postfix.c.
51+
52+20200510
53+
54+ Bitrot: avoid U_FILE_ACCESS_ERROR after chroot(), by
55+ initializing the ICU library before making the chroot()
56+ call. Files: util/midna_domain.[hc], global/mail_params.c.
57+
58+20200511
59+
60+ Noise suppression: avoid "SSL_Shutdown:shutdown while in
61+ init" warnings. File: tls/tls_session.c.
62+
63+20200515
64+
65+ Bugfix (introduced: Postfix 2.2): a TLS error for a PostgreSQL
66+ client caused a false 'lost connection' error for an SMTP
67+ over TLS session in the same Postfix process. Reported by
68+ Alexander Vasarab, diagnosed by Viktor Dukhovni. File:
69+ tls/tls_bio_ops.c.
70+
71+ Bugfix (introduced: Postfix 2.8): a TLS error for one TLS
72+ session may cause a false 'lost connection' error for a
73+ concurrent TLS session in the same tlsproxy process. File:
74+ tlsproxy/tlsproxy.c.
75+
76+20200530
77+
78+ Bugfix (introduced: Postfix 3.1): "postfix tls deploy-server-cert"
79+ did not handle a missing optional argument. File:
80+ conf/postfix-tls-script.
81+
82+20200610
83+
84+ Bugfix (introduced: Postfix 3.4): in the Postfix SMTP server,
85+ the SNI callback reported an error when it was called a
86+ second time. This happened after the server-side TLS engine
87+ sent a TLSv1.3 HelloRetryRequest (HRR) to a remote SMTP
88+ client. Reported by Ján Máté, fixed by Viktor Dukhovni.
89+ File: tls/tls_misc.c.
90diff --git a/Makefile.in b/Makefile.in
91index fa12b04..aaab94d 100644
92--- a/Makefile.in
93+++ b/Makefile.in
94@@ -1,5 +1,5 @@
95 SHELL = /bin/sh
96-WARN = -Wmissing-prototypes -Wformat -Wno-comment
97+WARN = -Wmissing-prototypes -Wformat -Wno-comment -fcommon
98 OPTS = 'WARN=$(WARN)'
99 DIRS = src/util src/global src/dns src/tls src/xsasl src/master src/milter \
100 src/postfix src/fsstone src/smtpstone \
101diff --git a/README_FILES/MAILLOG_README b/README_FILES/MAILLOG_README
102index 5184425..cc8b097 100644
103--- a/README_FILES/MAILLOG_README
104+++ b/README_FILES/MAILLOG_README
105@@ -64,7 +64,7 @@ implements the following steps:
106
107 * Rename the current logfile by appending a suffix that contains the date and
108 time. This suffix is configured with the maillog_file_rotate_suffix
109- parameter (default: %Y%M%d-%H%M%S).
110+ parameter (default: %Y%m%d-%H%M%S).
111
112 * Reload Postfix so that postlogd(8) immediately closes the old logfile.
113
114diff --git a/RELEASE_NOTES b/RELEASE_NOTES
115index 63e8e5a..c981244 100644
116--- a/RELEASE_NOTES
117+++ b/RELEASE_NOTES
118@@ -16,6 +16,14 @@ specifies the release date of a stable release or snapshot release.
119 If you upgrade from Postfix 3.2 or earlier, read RELEASE_NOTES-3.3
120 before proceeding.
121
122+libc-musl workaround for Postfix 3.2.15, 3.3.10, 3.4.12, and 3.5.2
123+------------------------------------------------------------------
124+
125+Security: this release disables DANE support on Linux systems with
126+libc-musl, because libc-musl provides no indication whether DNS
127+responses are authentic. This broke DANE support without a clear
128+explanation.
129+
130 TLS Workaround for Postfix 3.4.6, 3.3.5, 3.2.10 and 3.1.13
131 -----------------------------------------------------------
132
133diff --git a/conf/postfix-tls-script b/conf/postfix-tls-script
134index 2c3430a..1a364b7 100644
135--- a/conf/postfix-tls-script
136+++ b/conf/postfix-tls-script
137@@ -777,7 +777,7 @@ get_cache_db_type() {
138 deploy_server_cert() {
139 certfile=$1; shift
140 keyfile=$1; shift
141- deploy=$1; shift
142+ case $# in 0) deploy=;; *) deploy=$1; shift;; esac
143
144 # Sets key_algo, key_param and cert_param
145 check_key "$keyfile" || return 1
146diff --git a/debian/changelog b/debian/changelog
147index 86e71a2..43abc6c 100644
148--- a/debian/changelog
149+++ b/debian/changelog
150@@ -1,3 +1,22 @@
151+postfix (3.4.13-0ubuntu2) focal; urgency=medium
152+
153+ * d/postfix.postinst: tolerate search domain with a leading dot
154+ (LP: #1906970)
155+
156+ -- Paride Legovini <paride@ubuntu.com> Thu, 12 Aug 2021 14:26:09 +0200
157+
158+postfix (3.4.13-0ubuntu1) focal; urgency=medium
159+
160+ * New upstream release: 3.4.13
161+ - Workaround for broken DANE support after an incompatible change in
162+ GLIBC 2.31 (LP: #1868955)
163+ - Fix "postfix tls deploy-server-cert", now it handles a missing optional
164+ argument (LP: #1881196)
165+ * Drop patch 80_glibc2.30-ftbfs.diff. This patch is not needed anymore and
166+ it does not cleanly apply to this new upstream release.
167+
168+ -- Lucas Kanashiro <kanashiro@ubuntu.com> Fri, 19 Jun 2020 14:11:03 -0300
169+
170 postfix (3.4.10-1ubuntu1) focal; urgency=medium
171
172 * d/configure-instance.sh: fix typo in tls_CApath copying (LP: #1872288)
173diff --git a/debian/patches/80_glibc2.30-ftbfs.diff b/debian/patches/80_glibc2.30-ftbfs.diff
174deleted file mode 100644
175index c36baf0..0000000
176--- a/debian/patches/80_glibc2.30-ftbfs.diff
177+++ /dev/null
178@@ -1,51 +0,0 @@
179-Description: fix build with glibc 2.30
180- glibc 2.30 release notes at
181- https://savannah.gnu.org/forum/forum.php?forum_id=9515 states:
182- """
183- Support for the "inet6" option in /etc/resolv.conf and the RES_USE_INET6
184- resolver flag (deprecated in glibc 2.25) have been removed.
185- ...
186- The obsolete RES_INSECURE1 and RES_INSECURE2 option flags for the DNS stub
187- resolver have been removed from <resolv.h>.
188- """
189- And RES_AAONLY and RES_PRIMARY are already flagged as deprecated and are
190- being guarded with the same fix.
191-Origin: upstream, https://github.com/vdukhovni/postfix/commit/3274c3cea9d739f86e84b65664aabb692e37e83f#diff-777bfb681a1cd539ddc8e1e606959ffa
192-Bug: http://postfix.1071664.n5.nabble.com/build-failure-with-glibc-2-30-td102511.html
193-Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/postfix/+bug/1842923
194-Last-Update: 2019-09-05
195----
196-This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
197-diff --git a/postfix/src/dns/dns_str_resflags.c b/postfix/src/dns/dns_str_resflags.c
198-index 5f2cce5e..472394c3 100644
199---- a/src/dns/dns_str_resflags.c
200-+++ b/src/dns/dns_str_resflags.c
201-@@ -52,18 +52,28 @@
202- static const LONG_NAME_MASK resflag_table[] = {
203- "RES_INIT", RES_INIT,
204- "RES_DEBUG", RES_DEBUG,
205-+#ifdef RES_AAONLY
206- "RES_AAONLY", RES_AAONLY,
207-+#endif
208- "RES_USEVC", RES_USEVC,
209-+#ifdef RES_PRIMARY
210- "RES_PRIMARY", RES_PRIMARY,
211-+#endif
212- "RES_IGNTC", RES_IGNTC,
213- "RES_RECURSE", RES_RECURSE,
214- "RES_DEFNAMES", RES_DEFNAMES,
215- "RES_STAYOPEN", RES_STAYOPEN,
216- "RES_DNSRCH", RES_DNSRCH,
217-+#ifdef RES_INSECURE1
218- "RES_INSECURE1", RES_INSECURE1,
219-+#endif
220-+#ifdef RES_INSECURE2
221- "RES_INSECURE2", RES_INSECURE2,
222-+#endif
223- "RES_NOALIASES", RES_NOALIASES,
224-+#ifdef RES_USE_INET6
225- "RES_USE_INET6", RES_USE_INET6,
226-+#endif
227- #ifdef RES_ROTATE
228- "RES_ROTATE", RES_ROTATE,
229- #endif
230diff --git a/debian/patches/series b/debian/patches/series
231index 4976a63..fe67e62 100644
232--- a/debian/patches/series
233+++ b/debian/patches/series
234@@ -14,6 +14,5 @@
235 41_rmail.diff
236 50_LANG.diff
237 70_postfix-check.diff
238-80_glibc2.30-ftbfs.diff
239 tls_version.diff
240 debian-man-name.diff
241diff --git a/debian/postfix.postinst b/debian/postfix.postinst
242index dc28f3c..9ba7eac 100644
243--- a/debian/postfix.postinst
244+++ b/debian/postfix.postinst
245@@ -49,7 +49,7 @@ myfqdn() {
246 if [ $myhostname = ${myhostname%.*} ]; then
247 if [ -f /etc/resolv.conf ]; then
248 # The resolver uses the last one found, and ignores the rest
249- mydom=$(sed -n 's/^search[[:space:]]*\([^[:space:]]*\).*/\1/p;s/^domain[[:space:]]*\([^[:space:]]*\).*/\1/p' /etc/resolv.conf | tail -1)
250+ mydom=$(sed -n 's/^search[[:space:]]*\.*\([^[:space:]]*\).*/\1/p;s/^domain[[:space:]]*\.*\([^[:space:]]*\).*/\1/p' /etc/resolv.conf | tail -1)
251 myhostname="$myhostname${mydom:+.$mydom}"
252 else
253 myhostname="$myhostname.UNKNOWN"
254diff --git a/html/MAILLOG_README.html b/html/MAILLOG_README.html
255index b1f9702..c5b7978 100644
256--- a/html/MAILLOG_README.html
257+++ b/html/MAILLOG_README.html
258@@ -114,7 +114,7 @@ run from a terminal. This command implements the following steps:
259
260 <li> <p> Rename the current logfile by appending a suffix that
261 contains the date and time. This suffix is configured with the
262-<a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> parameter (default: %Y%M%d-%H%M%S). </p>
263+<a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> parameter (default: %Y%m%d-%H%M%S). </p>
264
265 <li> <p> Reload Postfix so that <a href="postlogd.8.html">postlogd(8)</a> immediately closes the
266 old logfile. </p>
267diff --git a/html/postconf.5.html b/html/postconf.5.html
268index cba1fac..aa94c32 100644
269--- a/html/postconf.5.html
270+++ b/html/postconf.5.html
271@@ -6284,7 +6284,7 @@ whitespace. </p>
272 </DD>
273
274 <DT><b><a name="maillog_file_rotate_suffix">maillog_file_rotate_suffix</a>
275-(default: %Y%M%d-%H%M%S)</b></DT><DD>
276+(default: %Y%m%d-%H%M%S)</b></DT><DD>
277
278 <p> The format of the suffix to append to $<a href="postconf.5.html#maillog_file">maillog_file</a> while rotating
279 the file with "postfix logrotate". See strftime(3) for syntax. The
280diff --git a/html/postfix.1.html b/html/postfix.1.html
281index 4c5c4f9..eb59ad3 100644
282--- a/html/postfix.1.html
283+++ b/html/postfix.1.html
284@@ -285,7 +285,7 @@ POSTFIX(1) POSTFIX(1)
285 <b><a href="postconf.5.html#maillog_file_prefixes">maillog_file_prefixes</a> (/var, /dev/stdout)</b>
286 A list of allowed prefixes for a <a href="postconf.5.html#maillog_file">maillog_file</a> value.
287
288- <b><a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> (%Y%M%d-%H%M%S)</b>
289+ <b><a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> (%Y%m%d-%H%M%S)</b>
290 The format of the suffix to append to $<a href="postconf.5.html#maillog_file">maillog_file</a> while rotat-
291 ing the file with "postfix logrotate".
292
293diff --git a/makedefs b/makedefs
294index 93731c2..64b42f4 100644
295--- a/makedefs
296+++ b/makedefs
297@@ -228,6 +228,19 @@ case $# in
298 *) echo usage: $0 [system release] 1>&2; exit 1;;
299 esac
300
301+case "$SYSTEM" in
302+ Linux)
303+ case "`PATH=/bin:/usr/bin ldd /bin/sh`" in
304+ *-musl-*)
305+ case "$CCARGS" in
306+ *-DNO_DNSSEC*) ;;
307+ *) echo Warning: libc-musl breaks DANE/TLSA security. 1>&2
308+ echo This build will not support DANE/TLSA. 1>&2
309+ CCARGS="$CCARGS -DNO_DNSSEC";;
310+ esac;;
311+ esac;;
312+esac
313+
314 case "$SYSTEM.$RELEASE" in
315 SCO_SV.3.2) SYSTYPE=SCO5
316 # Use the native compiler by default
317@@ -1136,7 +1149,7 @@ esac
318 : ${CC=gcc} ${OPT='-O'} ${DEBUG='-g'} ${AWK=awk} \
319 ${WARN='-Wall -Wno-comment -Wformat -Wimplicit -Wmissing-prototypes \
320 -Wparentheses -Wstrict-prototypes -Wswitch -Wuninitialized \
321- -Wunused -Wno-missing-braces'}
322+ -Wunused -Wno-missing-braces -fcommon'}
323
324 # Extract map type names from -DHAS_XXX compiler options. We avoid
325 # problems with tr(1) range syntax by using enumerations instead,
326diff --git a/man/man1/postfix.1 b/man/man1/postfix.1
327index 7a8a39c..412c0c9 100644
328--- a/man/man1/postfix.1
329+++ b/man/man1/postfix.1
330@@ -252,7 +252,7 @@ The program to run after rotating $maillog_file with "postfix
331 logrotate".
332 .IP "\fBmaillog_file_prefixes (/var, /dev/stdout)\fR"
333 A list of allowed prefixes for a maillog_file value.
334-.IP "\fBmaillog_file_rotate_suffix (%Y%M%d\-%H%M%S)\fR"
335+.IP "\fBmaillog_file_rotate_suffix (%Y%m%d\-%H%M%S)\fR"
336 The format of the suffix to append to $maillog_file while rotating
337 the file with "postfix logrotate".
338 .IP "\fBpostlog_service_name (postlog)\fR"
339diff --git a/man/man5/postconf.5 b/man/man5/postconf.5
340index fdf6b39..ccb087a 100644
341--- a/man/man5/postconf.5
342+++ b/man/man5/postconf.5
343@@ -3775,7 +3775,7 @@ mistake. Specify one or more prefix strings, separated by comma or
344 whitespace.
345 .PP
346 This feature is available in Postfix 3.4 and later.
347-.SH maillog_file_rotate_suffix (default: %Y%M%d\-%H%M%S)
348+.SH maillog_file_rotate_suffix (default: %Y%m%d\-%H%M%S)
349 The format of the suffix to append to $maillog_file while rotating
350 the file with "postfix logrotate". See \fBstrftime\fR(3) for syntax. The
351 default suffix, YYYYMMDD\-HHMMSS, allows logs to be rotated frequently.
352diff --git a/proto/MAILLOG_README.html b/proto/MAILLOG_README.html
353index 5fad103..9b56518 100644
354--- a/proto/MAILLOG_README.html
355+++ b/proto/MAILLOG_README.html
356@@ -114,7 +114,7 @@ run from a terminal. This command implements the following steps:
357
358 <li> <p> Rename the current logfile by appending a suffix that
359 contains the date and time. This suffix is configured with the
360-maillog_file_rotate_suffix parameter (default: %Y%M%d-%H%M%S). </p>
361+maillog_file_rotate_suffix parameter (default: %Y%m%d-%H%M%S). </p>
362
363 <li> <p> Reload Postfix so that postlogd(8) immediately closes the
364 old logfile. </p>
365diff --git a/proto/postconf.proto b/proto/postconf.proto
366index f29cdf6..a37fb01 100644
367--- a/proto/postconf.proto
368+++ b/proto/postconf.proto
369@@ -17611,7 +17611,7 @@ first argument. </p>
370
371 <p> This feature is available in Postfix 3.4 and later. </p>
372
373-%PARAM maillog_file_rotate_suffix %Y%M%d-%H%M%S
374+%PARAM maillog_file_rotate_suffix %Y%m%d-%H%M%S
375
376 <p> The format of the suffix to append to $maillog_file while rotating
377 the file with "postfix logrotate". See strftime(3) for syntax. The
378diff --git a/src/dns/dns.h b/src/dns/dns.h
379index f758e44..b8c4c4a 100644
380--- a/src/dns/dns.h
381+++ b/src/dns/dns.h
382@@ -59,6 +59,7 @@
383 */
384 #ifdef NO_DNSSEC
385 #undef RES_USE_DNSSEC
386+#undef RES_TRUSTAD
387 #endif
388
389 /*
390@@ -70,6 +71,9 @@
391 #ifndef RES_USE_EDNS0
392 #define RES_USE_EDNS0 0
393 #endif
394+#ifndef RES_TRUSTAD
395+#define RES_TRUSTAD 0
396+#endif
397
398 /*-
399 * TLSA: https://tools.ietf.org/html/rfc6698#section-7.1
400diff --git a/src/dns/dns_lookup.c b/src/dns/dns_lookup.c
401index 1bfeb7e..2ae6483 100644
402--- a/src/dns/dns_lookup.c
403+++ b/src/dns/dns_lookup.c
404@@ -116,6 +116,9 @@
405 /* Request DNSSEC validation. This flag is silently ignored
406 /* when the system stub resolver API, resolver(3), does not
407 /* implement DNSSEC.
408+/* Automatically turns on the RES_TRUSTAD flag on systems that
409+/* support this flag (this behavior will be more configurable
410+/* in a later release).
411 /* .RE
412 /* .IP lflags
413 /* Flags that control the operation of the dns_lookup*()
414@@ -453,10 +456,10 @@ static int dns_query(const char *name, int type, unsigned flags,
415 /*
416 * Set extra options that aren't exposed to the application.
417 */
418-#define XTRA_FLAGS (RES_USE_EDNS0)
419+#define XTRA_FLAGS (RES_USE_EDNS0 | RES_TRUSTAD)
420
421 if (flags & RES_USE_DNSSEC)
422- flags |= RES_USE_EDNS0;
423+ flags |= (RES_USE_EDNS0 | RES_TRUSTAD);
424
425 /*
426 * Save and restore resolver options that we overwrite, to avoid
427diff --git a/src/dns/dns_str_resflags.c b/src/dns/dns_str_resflags.c
428index 5f2cce5..df32345 100644
429--- a/src/dns/dns_str_resflags.c
430+++ b/src/dns/dns_str_resflags.c
431@@ -60,10 +60,16 @@ static const LONG_NAME_MASK resflag_table[] = {
432 "RES_DEFNAMES", RES_DEFNAMES,
433 "RES_STAYOPEN", RES_STAYOPEN,
434 "RES_DNSRCH", RES_DNSRCH,
435+#ifdef RES_INSECURE1
436 "RES_INSECURE1", RES_INSECURE1,
437+#endif
438+#ifdef RES_INSECURE2
439 "RES_INSECURE2", RES_INSECURE2,
440+#endif
441 "RES_NOALIASES", RES_NOALIASES,
442+#ifdef RES_USE_INET6
443 "RES_USE_INET6", RES_USE_INET6,
444+#endif
445 #ifdef RES_ROTATE
446 "RES_ROTATE", RES_ROTATE,
447 #endif
448diff --git a/src/global/mail_params.c b/src/global/mail_params.c
449index 8953fe6..4b6a058 100644
450--- a/src/global/mail_params.c
451+++ b/src/global/mail_params.c
452@@ -868,6 +868,8 @@ void mail_params_init()
453 var_smtputf8_enable = 0;
454 #else
455 midna_domain_transitional = var_idna2003_compat;
456+ if (var_smtputf8_enable)
457+ midna_domain_pre_chroot();
458 #endif
459 util_utf8_enable = var_smtputf8_enable;
460
461diff --git a/src/global/mail_params.h b/src/global/mail_params.h
462index 1f4c207..900ef51 100644
463--- a/src/global/mail_params.h
464+++ b/src/global/mail_params.h
465@@ -4178,7 +4178,7 @@ extern char *var_maillog_file_pfxs;
466 extern char *var_maillog_file_comp;
467
468 #define VAR_MAILLOG_FILE_STAMP "maillog_file_rotate_suffix"
469-#define DEF_MAILLOG_FILE_STAMP "%Y%M%d-%H%M%S"
470+#define DEF_MAILLOG_FILE_STAMP "%Y%m%d-%H%M%S"
471 extern char *var_maillog_file_stamp;
472
473 #define VAR_POSTLOG_SERVICE "postlog_service_name"
474diff --git a/src/global/mail_version.h b/src/global/mail_version.h
475index 41647d3..95afa7b 100644
476--- a/src/global/mail_version.h
477+++ b/src/global/mail_version.h
478@@ -20,8 +20,8 @@
479 * Patches change both the patchlevel and the release date. Snapshots have no
480 * patchlevel; they change the release date only.
481 */
482-#define MAIL_RELEASE_DATE "20200312"
483-#define MAIL_VERSION_NUMBER "3.4.10"
484+#define MAIL_RELEASE_DATE "20200614"
485+#define MAIL_VERSION_NUMBER "3.4.13"
486
487 #ifdef SNAPSHOT
488 #define MAIL_VERSION_DATE "-" MAIL_RELEASE_DATE
489diff --git a/src/milter/milter.c b/src/milter/milter.c
490index cee169c..3d71cc6 100644
491--- a/src/milter/milter.c
492+++ b/src/milter/milter.c
493@@ -620,14 +620,14 @@ void milter_disc_event(MILTERS *milters)
494 * names by skipping the redundant "milter_" prefix.
495 */
496 static ATTR_OVER_TIME time_table[] = {
497- 7 + VAR_MILT_CONN_TIME, DEF_MILT_CONN_TIME, 0, 1, 0,
498- 7 + VAR_MILT_CMD_TIME, DEF_MILT_CMD_TIME, 0, 1, 0,
499- 7 + VAR_MILT_MSG_TIME, DEF_MILT_MSG_TIME, 0, 1, 0,
500+ 7 + (const char *) VAR_MILT_CONN_TIME, DEF_MILT_CONN_TIME, 0, 1, 0,
501+ 7 + (const char *) VAR_MILT_CMD_TIME, DEF_MILT_CMD_TIME, 0, 1, 0,
502+ 7 + (const char *) VAR_MILT_MSG_TIME, DEF_MILT_MSG_TIME, 0, 1, 0,
503 0,
504 };
505 static ATTR_OVER_STR str_table[] = {
506- 7 + VAR_MILT_PROTOCOL, 0, 1, 0,
507- 7 + VAR_MILT_DEF_ACTION, 0, 1, 0,
508+ 7 + (const char *) VAR_MILT_PROTOCOL, 0, 1, 0,
509+ 7 + (const char *) VAR_MILT_DEF_ACTION, 0, 1, 0,
510 0,
511 };
512
513diff --git a/src/postfix/postfix.c b/src/postfix/postfix.c
514index f8b3de4..b2306fb 100644
515--- a/src/postfix/postfix.c
516+++ b/src/postfix/postfix.c
517@@ -242,7 +242,7 @@
518 /* logrotate".
519 /* .IP "\fBmaillog_file_prefixes (/var, /dev/stdout)\fR"
520 /* A list of allowed prefixes for a maillog_file value.
521-/* .IP "\fBmaillog_file_rotate_suffix (%Y%M%d-%H%M%S)\fR"
522+/* .IP "\fBmaillog_file_rotate_suffix (%Y%m%d-%H%M%S)\fR"
523 /* The format of the suffix to append to $maillog_file while rotating
524 /* the file with "postfix logrotate".
525 /* .IP "\fBpostlog_service_name (postlog)\fR"
526diff --git a/src/smtpd/smtpd_check.c b/src/smtpd/smtpd_check.c
527index d1caa5c..a25b401 100644
528--- a/src/smtpd/smtpd_check.c
529+++ b/src/smtpd/smtpd_check.c
530@@ -483,20 +483,20 @@ typedef struct {
531 * parameter names by skipping the redundant "smtpd_policy_service_" prefix.
532 */
533 static ATTR_OVER_TIME time_table[] = {
534- 21 + VAR_SMTPD_POLICY_TMOUT, DEF_SMTPD_POLICY_TMOUT, 0, 1, 0,
535- 21 + VAR_SMTPD_POLICY_IDLE, DEF_SMTPD_POLICY_IDLE, 0, 1, 0,
536- 21 + VAR_SMTPD_POLICY_TTL, DEF_SMTPD_POLICY_TTL, 0, 1, 0,
537- 21 + VAR_SMTPD_POLICY_TRY_DELAY, DEF_SMTPD_POLICY_TRY_DELAY, 0, 1, 0,
538+ 21 + (const char *) VAR_SMTPD_POLICY_TMOUT, DEF_SMTPD_POLICY_TMOUT, 0, 1, 0,
539+ 21 + (const char *) VAR_SMTPD_POLICY_IDLE, DEF_SMTPD_POLICY_IDLE, 0, 1, 0,
540+ 21 + (const char *) VAR_SMTPD_POLICY_TTL, DEF_SMTPD_POLICY_TTL, 0, 1, 0,
541+ 21 + (const char *) VAR_SMTPD_POLICY_TRY_DELAY, DEF_SMTPD_POLICY_TRY_DELAY, 0, 1, 0,
542 0,
543 };
544 static ATTR_OVER_INT int_table[] = {
545- 21 + VAR_SMTPD_POLICY_REQ_LIMIT, 0, 0, 0,
546- 21 + VAR_SMTPD_POLICY_TRY_LIMIT, 0, 1, 0,
547+ 21 + (const char *) VAR_SMTPD_POLICY_REQ_LIMIT, 0, 0, 0,
548+ 21 + (const char *) VAR_SMTPD_POLICY_TRY_LIMIT, 0, 1, 0,
549 0,
550 };
551 static ATTR_OVER_STR str_table[] = {
552- 21 + VAR_SMTPD_POLICY_DEF_ACTION, 0, 1, 0,
553- 21 + VAR_SMTPD_POLICY_CONTEXT, 0, 1, 0,
554+ 21 + (const char *) VAR_SMTPD_POLICY_DEF_ACTION, 0, 1, 0,
555+ 21 + (const char *) VAR_SMTPD_POLICY_CONTEXT, 0, 1, 0,
556 0,
557 };
558
559diff --git a/src/tls/tls_bio_ops.c b/src/tls/tls_bio_ops.c
560index 1f4ec41..9b66195 100644
561--- a/src/tls/tls_bio_ops.c
562+++ b/src/tls/tls_bio_ops.c
563@@ -194,6 +194,13 @@ int tls_bio(int fd, int timeout, TLS_SESS_STATE *TLScontext,
564 * handling any pending network I/O.
565 */
566 for (;;) {
567+
568+ /*
569+ * Flush the per-thread SSL error queue. Otherwise, errors from other
570+ * code that also uses TLS may confuse SSL_get_error(3).
571+ */
572+ ERR_clear_error();
573+
574 if (hsfunc)
575 status = hsfunc(TLScontext->con);
576 else if (rfunc)
577diff --git a/src/tls/tls_misc.c b/src/tls/tls_misc.c
578index 9fac444..1a1fd96 100644
579--- a/src/tls/tls_misc.c
580+++ b/src/tls/tls_misc.c
581@@ -686,6 +686,27 @@ static int server_sni_callback(SSL *ssl, int *alert, void *arg)
582 TLScontext->namaddr, sni);
583 return SSL_TLSEXT_ERR_NOACK;
584 }
585+
586+ /*
587+ * With TLS 1.3, when the client's proposed key share is not supported by
588+ * the server, the server may issue a HelloRetryRequest (HRR), and the
589+ * client will then retry with a new key share on a curve supported by
590+ * the server. This results in the SNI callback running twice for the
591+ * same connection.
592+ *
593+ * When that happens, The client MUST send the essentially the same hello
594+ * message, including the SNI name, and since we've already loaded our
595+ * certificate chain, we don't need to do it again! Therefore, if we've
596+ * already recorded the peer SNI name, just check that it has not
597+ * changed, and return success.
598+ */
599+ if (TLScontext->peer_sni) {
600+ if (strcmp(sni, TLScontext->peer_sni) == 0)
601+ return SSL_TLSEXT_ERR_OK;
602+ msg_warn("TLS SNI changed from %s initially %s, %s after hello retry",
603+ TLScontext->namaddr, TLScontext->peer_sni, sni);
604+ return SSL_TLSEXT_ERR_NOACK;
605+ }
606 do {
607 /* Don't silently skip maps opened with the wrong flags. */
608 pem = maps_file_find(tls_server_sni_maps, cp, 0);
609diff --git a/src/tls/tls_session.c b/src/tls/tls_session.c
610index 3f6027f..a4b7a8f 100644
611--- a/src/tls/tls_session.c
612+++ b/src/tls/tls_session.c
613@@ -118,7 +118,7 @@ void tls_session_stop(TLS_APPL_STATE *unused_ctx, VSTREAM *stream, int timeou
614 * so we will not perform SSL_shutdown() and the session will be removed
615 * as being bad.
616 */
617- if (!failure) {
618+ if (!failure && !SSL_in_init(TLScontext->con)) {
619 retval = tls_bio_shutdown(vstream_fileno(stream), timeout, TLScontext);
620 if (!var_tls_fast_shutdown && retval == 0)
621 tls_bio_shutdown(vstream_fileno(stream), timeout, TLScontext);
622diff --git a/src/tlsproxy/tlsproxy.c b/src/tlsproxy/tlsproxy.c
623index 50b4154..65c7201 100644
624--- a/src/tlsproxy/tlsproxy.c
625+++ b/src/tlsproxy/tlsproxy.c
626@@ -781,6 +781,7 @@ static void tlsp_strategy(TLSP_STATE *state)
627 */
628 if (state->flags & TLSP_FLAG_DO_HANDSHAKE) {
629 state->timeout = state->handshake_timeout;
630+ ERR_clear_error();
631 if (state->is_server_role)
632 ssl_stat = SSL_accept(tls_context->con);
633 else
634@@ -809,6 +810,7 @@ static void tlsp_strategy(TLSP_STATE *state)
635 if (NBBIO_ERROR_FLAGS(plaintext_buf)) {
636 if (NBBIO_ACTIVE_FLAGS(plaintext_buf))
637 nbbio_disable_readwrite(state->plaintext_buf);
638+ ERR_clear_error();
639 if (!SSL_in_init(tls_context->con)
640 && (ssl_stat = SSL_shutdown(tls_context->con)) < 0) {
641 handshake_err = SSL_get_error(tls_context->con, ssl_stat);
642@@ -835,6 +837,7 @@ static void tlsp_strategy(TLSP_STATE *state)
643 */
644 ssl_write_err = SSL_ERROR_NONE;
645 while (NBBIO_READ_PEND(plaintext_buf) > 0) {
646+ ERR_clear_error();
647 ssl_stat = SSL_write(tls_context->con, NBBIO_READ_BUF(plaintext_buf),
648 NBBIO_READ_PEND(plaintext_buf));
649 ssl_write_err = SSL_get_error(tls_context->con, ssl_stat);
650@@ -865,6 +868,7 @@ static void tlsp_strategy(TLSP_STATE *state)
651 */
652 ssl_read_err = SSL_ERROR_NONE;
653 while (NBBIO_WRITE_PEND(state->plaintext_buf) < NBBIO_BUFSIZE(plaintext_buf)) {
654+ ERR_clear_error();
655 ssl_stat = SSL_read(tls_context->con,
656 NBBIO_WRITE_BUF(plaintext_buf)
657 + NBBIO_WRITE_PEND(state->plaintext_buf),
658@@ -1489,16 +1493,15 @@ static void tlsp_service(VSTREAM *plaintext_stream,
659 TLSP_INIT_TIMEOUT, (void *) state);
660 }
661
662-/* pre_jail_init - pre-jail initialization */
663+/* pre_jail_init_server - pre-jail initialization */
664
665-static void pre_jail_init(char *unused_name, char **unused_argv)
666+static void pre_jail_init_server(void)
667 {
668 TLS_SERVER_INIT_PROPS props;
669 const char *cert_file;
670 int have_server_cert;
671 int no_server_cert_ok;
672 int require_server_cert;
673- int clnt_use_tls;
674
675 /*
676 * The code in this routine is pasted literally from smtpd(8). I am not
677@@ -1531,7 +1534,7 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
678 }
679 var_tlsp_use_tls = var_tlsp_use_tls || var_tlsp_enforce_tls;
680 if (!var_tlsp_use_tls) {
681- msg_warn("TLS service is requested, but disabled with %s or %s",
682+ msg_warn("TLS server role is disabled with %s or %s",
683 VAR_TLSP_TLS_LEVEL, VAR_TLSP_USE_TLS);
684 return;
685 }
686@@ -1622,6 +1625,13 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
687 SSL_CTX_set_mode(tlsp_server_ctx->ssl_ctx,
688 SSL_MODE_ENABLE_PARTIAL_WRITE
689 | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
690+}
691+
692+/* pre_jail_init_client - pre-jail initialization */
693+
694+static void pre_jail_init_client(void)
695+{
696+ int clnt_use_tls;
697
698 /*
699 * The cache with TLS_APPL_STATE instances for different TLS_CLIENT_INIT
700@@ -1733,6 +1743,18 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
701 msg_warn("TLS client initialization failed");
702 }
703 }
704+}
705+
706+/* pre_jail_init - pre-jail initialization */
707+
708+static void pre_jail_init(char *unused_name, char **unused_argv)
709+{
710+
711+ /*
712+ * Initialize roles separately.
713+ */
714+ pre_jail_init_server();
715+ pre_jail_init_client();
716
717 /*
718 * tlsp_client_init() needs to know if it is called pre-jail or
719diff --git a/src/util/midna_domain.c b/src/util/midna_domain.c
720index 667e75e..333a5c9 100644
721--- a/src/util/midna_domain.c
722+++ b/src/util/midna_domain.c
723@@ -20,6 +20,8 @@
724 /*
725 /* const char *midna_domain_suffix_to_utf8(
726 /* const char *name)
727+/* AUXILIARY FUNCTIONS
728+/* void midna_domain_pre_chroot(void)
729 /* DESCRIPTION
730 /* The functions in this module transform domain names from/to
731 /* ASCII and UTF-8 form. The result is cached to avoid repeated
732@@ -52,6 +54,8 @@
733 /*
734 /* midna_domain_transitional enables transitional conversion
735 /* between UTF8 and ASCII labels.
736+/*
737+/* midna_domain_pre_chroot() does some pre-chroot initialization.
738 /* SEE ALSO
739 /* http://unicode.org/reports/tr46/ Unicode IDNA Compatibility processing
740 /* msg(3) diagnostics interface
741@@ -144,6 +148,22 @@ static const char *midna_domain_strerror(UErrorCode error, int info_errors)
742 }
743 }
744
745+/* midna_domain_pre_chroot - pre-chroot initialization */
746+
747+void midna_domain_pre_chroot(void)
748+{
749+ UErrorCode error = U_ZERO_ERROR;
750+ UIDNAInfo info = UIDNA_INFO_INITIALIZER;
751+ UIDNA *idna;
752+
753+ idna = uidna_openUTS46(midna_domain_transitional ? UIDNA_DEFAULT
754+ : UIDNA_NONTRANSITIONAL_TO_ASCII, &error);
755+ if (U_FAILURE(error))
756+ msg_warn("ICU library initialization failed: %s",
757+ midna_domain_strerror(error, info.errors));
758+ uidna_close(idna);
759+}
760+
761 /* midna_domain_to_ascii_create - convert domain to ASCII */
762
763 static void *midna_domain_to_ascii_create(const char *name, void *unused_context)
764@@ -327,6 +347,7 @@ const char *midna_domain_suffix_to_utf8(const char *name)
765 /*
766 * Test program - reads names from stdin, reports invalid names to stderr.
767 */
768+#include <unistd.h>
769 #include <stdlib.h>
770 #include <locale.h>
771
772@@ -350,6 +371,11 @@ int main(int argc, char **argv)
773 /* msg_verbose = 1; */
774 util_utf8_enable = 1;
775
776+ if (geteuid() == 0) {
777+ midna_domain_pre_chroot();
778+ if (chroot(".") != 0)
779+ msg_fatal("chroot(\".\"): %m");
780+ }
781 while (vstring_fgets_nonl(buffer, VSTREAM_IN)) {
782 bp = STR(buffer);
783 msg_info("> %s", bp);
784diff --git a/src/util/midna_domain.h b/src/util/midna_domain.h
785index 03d875b..1abe2a1 100644
786--- a/src/util/midna_domain.h
787+++ b/src/util/midna_domain.h
788@@ -18,6 +18,7 @@ extern const char *midna_domain_to_ascii(const char *);
789 extern const char *midna_domain_to_utf8(const char *);
790 extern const char *midna_domain_suffix_to_ascii(const char *);
791 extern const char *midna_domain_suffix_to_utf8(const char *);
792+extern void midna_domain_pre_chroot(void);
793
794 extern int midna_domain_cache_size;
795 extern int midna_domain_transitional;

Subscribers

People subscribed via source and target branches