Wietse Venema: > Wietse Venema: > > Sascha H?depohl: > > > Hello! > > > > > > i found this in maillog: > > > > > > postfix/bounce[90860]: warning: midna_domain_to_utf8_create: Problem > > > translating domain "mail.huedepohl.de" to UTF8 form: U_FILE_ACCESS_ERROR > > > > > > i can't figure out what the problem ist. > > > U_FILE_ACCESS_ERROR? Which file? > > > > According to web search for "U_FILE_ACCESS_ERROR postfix" the ICU > > library could not access some required file. The ICU library is not > > part of Postfix. > > > > Usually this is fixed by turning off chroot for the bounce daemon: > > > > # postconf -F bounce/unix/chroot=n defer/unix/chroot=n trace/unix/chroot=n > > # postfix reload > > Fixed in Postfix 3.6, by calling some ICU library method before > making the chroot() call.
I expect that this will be in the next stable release updates. Wietse 20200510 Bitrot: avoid U_FILE_ACCESS_ERROR after chroot(), by initializing the ICU library before making the chroot() call. Files: util/midna_domain.[hc], global/mail_params.c. diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro -r -ur /var/tmp/postfix-3.6-20200509-nonprod/src/global/mail_params.c ./src/global/mail_params.c --- /var/tmp/postfix-3.6-20200509-nonprod/src/global/mail_params.c 2020-01-11 08:04:08.000000000 -0500 +++ ./src/global/mail_params.c 2020-05-11 09:45:42.000000000 -0400 @@ -871,6 +871,8 @@ var_smtputf8_enable = 0; #else midna_domain_transitional = var_idna2003_compat; + if (var_smtputf8_enable) + midna_domain_pre_chroot(); #endif util_utf8_enable = var_smtputf8_enable; diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro -r -ur /var/tmp/postfix-3.6-20200509-nonprod/src/util/midna_domain.c ./src/util/midna_domain.c --- /var/tmp/postfix-3.6-20200509-nonprod/src/util/midna_domain.c 2016-12-04 12:40:19.000000000 -0500 +++ ./src/util/midna_domain.c 2020-05-10 18:59:19.000000000 -0400 @@ -20,6 +20,8 @@ /* /* const char *midna_domain_suffix_to_utf8( /* const char *name) +/* AUXILIARY FUNCTIONS +/* void midna_domain_pre_chroot(void) /* DESCRIPTION /* The functions in this module transform domain names from/to /* ASCII and UTF-8 form. The result is cached to avoid repeated @@ -52,6 +54,8 @@ /* /* midna_domain_transitional enables transitional conversion /* between UTF8 and ASCII labels. +/* +/* midna_domain_pre_chroot() does some pre-chroot initialization. /* SEE ALSO /* http://unicode.org/reports/tr46/ Unicode IDNA Compatibility processing /* msg(3) diagnostics interface @@ -144,6 +148,22 @@ } } +/* midna_domain_pre_chroot - pre-chroot initialization */ + +void midna_domain_pre_chroot(void) +{ + UErrorCode error = U_ZERO_ERROR; + UIDNAInfo info = UIDNA_INFO_INITIALIZER; + UIDNA *idna; + + idna = uidna_openUTS46(midna_domain_transitional ? UIDNA_DEFAULT + : UIDNA_NONTRANSITIONAL_TO_ASCII, &error); + if (U_FAILURE(error)) + msg_warn("ICU library initialization failed: %s", + midna_domain_strerror(error, info.errors)); + uidna_close(idna); +} + /* midna_domain_to_ascii_create - convert domain to ASCII */ static void *midna_domain_to_ascii_create(const char *name, void *unused_context) @@ -327,6 +347,7 @@ /* * Test program - reads names from stdin, reports invalid names to stderr. */ +#include <unistd.h> #include <stdlib.h> #include <locale.h> @@ -350,6 +371,11 @@ /* msg_verbose = 1; */ util_utf8_enable = 1; + if (geteuid() == 0) { + midna_domain_pre_chroot(); + if (chroot(".") != 0) + msg_fatal("chroot(\".\"): %m"); + } while (vstring_fgets_nonl(buffer, VSTREAM_IN)) { bp = STR(buffer); msg_info("> %s", bp); diff --exclude=man --exclude=html --exclude=README_FILES --exclude=INSTALL --exclude=.indent.pro -r -ur /var/tmp/postfix-3.6-20200509-nonprod/src/util/midna_domain.h ./src/util/midna_domain.h --- /var/tmp/postfix-3.6-20200509-nonprod/src/util/midna_domain.h 2016-11-05 18:38:56.000000000 -0400 +++ ./src/util/midna_domain.h 2020-05-11 09:46:32.000000000 -0400 @@ -18,6 +18,7 @@ extern const char *midna_domain_to_utf8(const char *); extern const char *midna_domain_suffix_to_ascii(const char *); extern const char *midna_domain_suffix_to_utf8(const char *); +extern void midna_domain_pre_chroot(void); extern int midna_domain_cache_size; extern int midna_domain_transitional;