]> git.ipfire.org Git - thirdparty/postfix.git/commitdiff
postfix-3.5.2 v3.5.2
authorWietse Venema <wietse@porcupine.org>
Sat, 16 May 2020 05:00:00 +0000 (00:00 -0500)
committerViktor Dukhovni <postfix-users@dukhovni.org>
Mon, 18 May 2020 08:38:08 +0000 (04:38 -0400)
22 files changed:
postfix/HISTORY
postfix/README_FILES/MAILLOG_README
postfix/RELEASE_NOTES
postfix/html/MAILLOG_README.html
postfix/html/postconf.5.html
postfix/html/postfix.1.html
postfix/makedefs
postfix/man/man1/postfix.1
postfix/man/man5/postconf.5
postfix/proto/MAILLOG_README.html
postfix/proto/postconf.proto
postfix/src/global/mail_params.c
postfix/src/global/mail_params.h
postfix/src/global/mail_version.h
postfix/src/milter/milter.c
postfix/src/postfix/postfix.c
postfix/src/smtpd/smtpd_check.c
postfix/src/tls/tls_bio_ops.c
postfix/src/tls/tls_session.c
postfix/src/tlsproxy/tlsproxy.c
postfix/src/util/midna_domain.c
postfix/src/util/midna_domain.h

index 3ba46cf5c6a11d7595465dd02e092aff1bec29f5..5b806f7f98bd03aab81f43d956706f493ba4c7f2 100644 (file)
@@ -24680,3 +24680,60 @@ Apologies for any names omitted.
        Workaround for broken DANE support after an incompatible
        change in GLIBC 2.31. This avoids the need for new options
        in /etc/resolv.conf. Files: dns/dns.h, dns/dns_lookup.c.
+
+20200419
+
+       Bugfix: segfault in the tlsproxy client role when the server
+       role was disabled. This typically happens on systems that
+       do not receive mail, after configuring connection reuse for
+       outbound TLS. Found during program maintenance. File:
+       tlsproxy/tlsproxy.c.
+
+20200420
+
+       Noise suppression: shut up a compiler that special-cases
+       string literals. Viktor Dukhovni. File milter/milter.c.
+
+20200422
+
+       Security: disable DANE support on Alpine Linux because
+       libc-musl provides no indication whether DNS responses are
+       authentic. This broke DANE support without a clear explanation.
+       File: makedefs.
+
+20200505
+
+       Noise suppression: shut up a compiler that special-cases
+       string literals. Viktor Dukhovni. File smtpd/smtpd_check.c.
+
+20200509
+
+       Bugfix (introduced: Postfix 3.5): maillog_file_rotate_suffix
+       default value used the minute instead of the month. Reported
+       by Larry Stone. Files: conf/postfix-tls-script,
+       proto/MAILLOG_README.html, proto/postconf.proto.
+       global/mail_params.h, postfix/postfix.c.
+
+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.
+
+20200511
+
+       Noise suppression: avoid "SSL_Shutdown:shutdown while in
+       init" warnings. File: tls/tls_session.c.
+
+20200515
+
+       Bugfix (introduced: Postfix 2.2): a TLS error for a PostgreSQL
+       client caused a false 'lost connection' error for an SMTP
+       over TLS session in the same Postfix process. Reported by
+       Alexander Vasarab, diagnosed by Viktor Dukhovni. File:
+       tls/tls_bio_ops.c.
+
+       Bugfix (introduced: Postfix 2.8): a TLS error for one TLS
+       session may cause a false 'lost connection' error for a
+       concurrent TLS session in the same tlsproxy process. File:
+       tlsproxy/tlsproxy.c.
index 11407598407e6b9dc80fbc5aee27e4f1bed0eb5d..d0849bb73c4d99c170927109c29780f03a49fc67 100644 (file)
@@ -64,7 +64,7 @@ implements the following steps:
 
   * Rename the current logfile by appending a suffix that contains the date and
     time. This suffix is configured with the maillog_file_rotate_suffix
-    parameter (default: %Y%M%d-%H%M%S).
+    parameter (default: %Y%m%d-%H%M%S).
 
   * Reload Postfix so that postlogd(8) immediately closes the old logfile.
 
index d3c41b83bae0d946c81cf8de8f029848a843a745..c121e7f014cc2469abf94b5ddeab45de4652e046 100644 (file)
@@ -25,6 +25,14 @@ more recent Eclipse Public License 2.0. Recipients can choose to take
 the software under the license of their choice. Those who are more
 comfortable with the IPL can continue with that license.
 
+libc-musl workaround for Postfix 3.2.15, 3.3.10, 3.4.12, and 3.5.2
+------------------------------------------------------------------
+
+Security: this release disables DANE support on Linux systems with
+libc-musl, because libc-musl provides no indication whether DNS
+responses are authentic. This broke DANE support without a clear
+explanation.
+
 Major changes - multiple relayhost in SMTP
 ------------------------------------------
 
index 0b9f250b33bf291b62ad5a2bbc17a3e8bdf7c167..aa371ba26cd672cacba12a9053f4a83ad63ac805 100644 (file)
@@ -114,7 +114,7 @@ run from a terminal. This command implements the following steps:
 
 <li> <p> Rename the current logfile by appending a suffix that
 contains the date and time. This suffix is configured with the
-<a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> parameter (default: %Y%M%d-%H%M%S). </p>
+<a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> parameter (default: %Y%m%d-%H%M%S). </p>
 
 <li> <p> Reload Postfix so that <a href="postlogd.8.html">postlogd(8)</a> immediately closes the
 old logfile. </p>
index 5930016ae4ce52694408b77be2c6b9b168467492..cf34baca6607185f4dd54b861562dbc65d8a8024 100644 (file)
@@ -6329,7 +6329,7 @@ whitespace. </p>
 </DD>
 
 <DT><b><a name="maillog_file_rotate_suffix">maillog_file_rotate_suffix</a>
-(default: %Y%M%d-%H%M%S)</b></DT><DD>
+(default: %Y%m%d-%H%M%S)</b></DT><DD>
 
 <p> The format of the suffix to append to $<a href="postconf.5.html#maillog_file">maillog_file</a> while rotating
 the file with "postfix logrotate". See strftime(3) for syntax. The
index 4c5c4f937115ee107404bf153cd53821abe8c5d8..eb59ad30d5c4a788a6a239a13f4d2a8e26e8b781 100644 (file)
@@ -285,7 +285,7 @@ POSTFIX(1)                                                          POSTFIX(1)
        <b><a href="postconf.5.html#maillog_file_prefixes">maillog_file_prefixes</a> (/var, /dev/stdout)</b>
               A list of allowed prefixes for a <a href="postconf.5.html#maillog_file">maillog_file</a> value.
 
-       <b><a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> (%Y%M%d-%H%M%S)</b>
+       <b><a href="postconf.5.html#maillog_file_rotate_suffix">maillog_file_rotate_suffix</a> (%Y%m%d-%H%M%S)</b>
               The format of the suffix to append to $<a href="postconf.5.html#maillog_file">maillog_file</a> while rotat-
               ing the file with "postfix logrotate".
 
index aea15d6f3ec0ada751c195f58435101a730b465b..64b42f448160ee4b25242fd16c04f04efec7123c 100644 (file)
@@ -228,6 +228,19 @@ case $# in
  *) echo usage: $0 [system release] 1>&2; exit 1;;
 esac
 
+case "$SYSTEM" in
+ Linux)
+    case "`PATH=/bin:/usr/bin ldd /bin/sh`" in
+     *-musl-*)
+       case "$CCARGS" in
+        *-DNO_DNSSEC*) ;;
+        *) echo Warning: libc-musl breaks DANE/TLSA security. 1>&2
+           echo This build will not support DANE/TLSA. 1>&2
+           CCARGS="$CCARGS -DNO_DNSSEC";;
+       esac;;
+    esac;;
+esac
+
 case "$SYSTEM.$RELEASE" in
    SCO_SV.3.2) SYSTYPE=SCO5
                # Use the native compiler by default
index 7a8a39cd24a300318c1f37abcba1252688ce7985..412c0c9d1c1bfd2354c6a3b358d29b0531cc1d99 100644 (file)
@@ -252,7 +252,7 @@ The program to run after rotating $maillog_file with "postfix
 logrotate".
 .IP "\fBmaillog_file_prefixes (/var, /dev/stdout)\fR"
 A list of allowed prefixes for a maillog_file value.
-.IP "\fBmaillog_file_rotate_suffix (%Y%M%d\-%H%M%S)\fR"
+.IP "\fBmaillog_file_rotate_suffix (%Y%m%d\-%H%M%S)\fR"
 The format of the suffix to append to $maillog_file while rotating
 the file with "postfix logrotate".
 .IP "\fBpostlog_service_name (postlog)\fR"
index d1e3147b5e42b794e5b192a588d10613720f3039..0d6dd271209ca918fc2f9233bdbc0fad748b4d01 100644 (file)
@@ -3822,7 +3822,7 @@ mistake. Specify one or more prefix strings, separated by comma or
 whitespace.
 .PP
 This feature is available in Postfix 3.4 and later.
-.SH maillog_file_rotate_suffix (default: %Y%M%d\-%H%M%S)
+.SH maillog_file_rotate_suffix (default: %Y%m%d\-%H%M%S)
 The format of the suffix to append to $maillog_file while rotating
 the file with "postfix logrotate". See \fBstrftime\fR(3) for syntax. The
 default suffix, YYYYMMDD\-HHMMSS, allows logs to be rotated frequently.
index 9804983a702849ee5bbeb2dd3729e9fa55f43934..9951c6c23ebf83ef482de80718b31536b1d98673 100644 (file)
@@ -114,7 +114,7 @@ run from a terminal. This command implements the following steps:
 
 <li> <p> Rename the current logfile by appending a suffix that
 contains the date and time. This suffix is configured with the
-maillog_file_rotate_suffix parameter (default: %Y%M%d-%H%M%S). </p>
+maillog_file_rotate_suffix parameter (default: %Y%m%d-%H%M%S). </p>
 
 <li> <p> Reload Postfix so that postlogd(8) immediately closes the
 old logfile. </p>
index ca384963b79c6557320e60f1b292d683f08ba120..3d5365743b8578d1f18c343b10524a01fabfc1a1 100644 (file)
@@ -17651,7 +17651,7 @@ first argument. </p>
 
 <p> This feature is available in Postfix 3.4 and later. </p>
 
-%PARAM maillog_file_rotate_suffix %Y%M%d-%H%M%S
+%PARAM maillog_file_rotate_suffix %Y%m%d-%H%M%S
 
 <p> The format of the suffix to append to $maillog_file while rotating
 the file with "postfix logrotate". See strftime(3) for syntax. The
index 8b4ad0ba4c563597080e415b8ac2b754f4a26adb..91c70f75e21ed2012f6a971589e4e6298083e176 100644 (file)
@@ -871,6 +871,8 @@ void    mail_params_init()
     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;
 
index f9576be28a25c721567d3ef9a05d7952dab4c611..a6119f1b2d9471b48fa6f3bb57356780b6592e5e 100644 (file)
@@ -4181,7 +4181,7 @@ extern char *var_maillog_file_pfxs;
 extern char *var_maillog_file_comp;
 
 #define VAR_MAILLOG_FILE_STAMP "maillog_file_rotate_suffix"
-#define DEF_MAILLOG_FILE_STAMP "%Y%M%d-%H%M%S"
+#define DEF_MAILLOG_FILE_STAMP "%Y%m%d-%H%M%S"
 extern char *var_maillog_file_stamp;
 
 #define VAR_POSTLOG_SERVICE    "postlog_service_name"
index 3896ea80f08f066e9f7303c1f50923d43006ca3e..da996319fc0f752e6cb7d0bcad64459017571414 100644 (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      "20200418"
-#define MAIL_VERSION_NUMBER    "3.5.1"
+#define MAIL_RELEASE_DATE      "20200516"
+#define MAIL_VERSION_NUMBER    "3.5.2"
 
 #ifdef SNAPSHOT
 #define MAIL_VERSION_DATE      "-" MAIL_RELEASE_DATE
index cee169cb47d2d18f58cdf7c2b603db6133ef491c..3d71cc6b45af195a15997e637a69f1a2b4961828 100644 (file)
@@ -620,14 +620,14 @@ void    milter_disc_event(MILTERS *milters)
   * names by skipping the redundant "milter_" prefix.
   */
 static ATTR_OVER_TIME time_table[] = {
-    7 + VAR_MILT_CONN_TIME, DEF_MILT_CONN_TIME, 0, 1, 0,
-    7 + VAR_MILT_CMD_TIME, DEF_MILT_CMD_TIME, 0, 1, 0,
-    7 + VAR_MILT_MSG_TIME, DEF_MILT_MSG_TIME, 0, 1, 0,
+    7 + (const char *) VAR_MILT_CONN_TIME, DEF_MILT_CONN_TIME, 0, 1, 0,
+    7 + (const char *) VAR_MILT_CMD_TIME, DEF_MILT_CMD_TIME, 0, 1, 0,
+    7 + (const char *) VAR_MILT_MSG_TIME, DEF_MILT_MSG_TIME, 0, 1, 0,
     0,
 };
 static ATTR_OVER_STR str_table[] = {
-    7 + VAR_MILT_PROTOCOL, 0, 1, 0,
-    7 + VAR_MILT_DEF_ACTION, 0, 1, 0,
+    7 + (const char *) VAR_MILT_PROTOCOL, 0, 1, 0,
+    7 + (const char *) VAR_MILT_DEF_ACTION, 0, 1, 0,
     0,
 };
 
index f8b3de45048a95f9510dd24173976dd7db2a770e..b2306fb606ed2f5f2e435ec9efe57c2a7a2f4625 100644 (file)
 /*     logrotate".
 /* .IP "\fBmaillog_file_prefixes (/var, /dev/stdout)\fR"
 /*     A list of allowed prefixes for a maillog_file value.
-/* .IP "\fBmaillog_file_rotate_suffix (%Y%M%d-%H%M%S)\fR"
+/* .IP "\fBmaillog_file_rotate_suffix (%Y%m%d-%H%M%S)\fR"
 /*     The format of the suffix to append to $maillog_file while rotating
 /*     the file with "postfix logrotate".
 /* .IP "\fBpostlog_service_name (postlog)\fR"
index 35c713158ef275ee1a3fbdc829ca002c177f1564..85d594498112b604bcddfbecd3a42740d16c1bf8 100644 (file)
@@ -486,20 +486,20 @@ typedef struct {
   * parameter names by skipping the redundant "smtpd_policy_service_" prefix.
   */
 static ATTR_OVER_TIME time_table[] = {
-    21 + VAR_SMTPD_POLICY_TMOUT, DEF_SMTPD_POLICY_TMOUT, 0, 1, 0,
-    21 + VAR_SMTPD_POLICY_IDLE, DEF_SMTPD_POLICY_IDLE, 0, 1, 0,
-    21 + VAR_SMTPD_POLICY_TTL, DEF_SMTPD_POLICY_TTL, 0, 1, 0,
-    21 + VAR_SMTPD_POLICY_TRY_DELAY, DEF_SMTPD_POLICY_TRY_DELAY, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_TMOUT, DEF_SMTPD_POLICY_TMOUT, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_IDLE, DEF_SMTPD_POLICY_IDLE, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_TTL, DEF_SMTPD_POLICY_TTL, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_TRY_DELAY, DEF_SMTPD_POLICY_TRY_DELAY, 0, 1, 0,
     0,
 };
 static ATTR_OVER_INT int_table[] = {
-    21 + VAR_SMTPD_POLICY_REQ_LIMIT, 0, 0, 0,
-    21 + VAR_SMTPD_POLICY_TRY_LIMIT, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_REQ_LIMIT, 0, 0, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_TRY_LIMIT, 0, 1, 0,
     0,
 };
 static ATTR_OVER_STR str_table[] = {
-    21 + VAR_SMTPD_POLICY_DEF_ACTION, 0, 1, 0,
-    21 + VAR_SMTPD_POLICY_CONTEXT, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_DEF_ACTION, 0, 1, 0,
+    21 + (const char *) VAR_SMTPD_POLICY_CONTEXT, 0, 1, 0,
     0,
 };
 
index 1f4ec41f17ea1e704428f5d6a777b991fc04a3b4..9b661954721563bfa2e252359f6cbfe06ad828fa 100644 (file)
@@ -194,6 +194,13 @@ int     tls_bio(int fd, int timeout, TLS_SESS_STATE *TLScontext,
      * handling any pending network I/O.
      */
     for (;;) {
+
+       /*
+        * Flush the per-thread SSL error queue. Otherwise, errors from other
+        * code that also uses TLS may confuse SSL_get_error(3).
+        */
+       ERR_clear_error();
+
        if (hsfunc)
            status = hsfunc(TLScontext->con);
        else if (rfunc)
index 3f6027fc4ef85a81ae66a02da00b007fb9f7f373..a4b7a8f25fe10b029ae93382a7dfd773fd999617 100644 (file)
@@ -118,7 +118,7 @@ void    tls_session_stop(TLS_APPL_STATE *unused_ctx, VSTREAM *stream, int timeou
      * so we will not perform SSL_shutdown() and the session will be removed
      * as being bad.
      */
-    if (!failure) {
+    if (!failure && !SSL_in_init(TLScontext->con)) {
        retval = tls_bio_shutdown(vstream_fileno(stream), timeout, TLScontext);
        if (!var_tls_fast_shutdown && retval == 0)
            tls_bio_shutdown(vstream_fileno(stream), timeout, TLScontext);
index 6eb70c0acea248854d426d51eb672c04df8adae9..70ea8042ecb41b955c4603d14f1a0bad085bc56f 100644 (file)
@@ -781,6 +781,7 @@ static void tlsp_strategy(TLSP_STATE *state)
         */
        if (state->flags & TLSP_FLAG_DO_HANDSHAKE) {
            state->timeout = state->handshake_timeout;
+           ERR_clear_error();
            if (state->is_server_role)
                ssl_stat = SSL_accept(tls_context->con);
            else
@@ -809,6 +810,7 @@ static void tlsp_strategy(TLSP_STATE *state)
        if (NBBIO_ERROR_FLAGS(plaintext_buf)) {
            if (NBBIO_ACTIVE_FLAGS(plaintext_buf))
                nbbio_disable_readwrite(state->plaintext_buf);
+           ERR_clear_error();
            if (!SSL_in_init(tls_context->con)
                && (ssl_stat = SSL_shutdown(tls_context->con)) < 0) {
                handshake_err = SSL_get_error(tls_context->con, ssl_stat);
@@ -838,6 +840,7 @@ static void tlsp_strategy(TLSP_STATE *state)
         */
        ssl_write_err = SSL_ERROR_NONE;
        while (NBBIO_READ_PEND(plaintext_buf) > 0) {
+           ERR_clear_error();
            ssl_stat = SSL_write(tls_context->con, NBBIO_READ_BUF(plaintext_buf),
                                 NBBIO_READ_PEND(plaintext_buf));
            ssl_write_err = SSL_get_error(tls_context->con, ssl_stat);
@@ -870,6 +873,7 @@ static void tlsp_strategy(TLSP_STATE *state)
         */
        ssl_read_err = SSL_ERROR_NONE;
        while (NBBIO_WRITE_PEND(state->plaintext_buf) < NBBIO_BUFSIZE(plaintext_buf)) {
+           ERR_clear_error();
            ssl_stat = SSL_read(tls_context->con,
                                NBBIO_WRITE_BUF(plaintext_buf)
                                + NBBIO_WRITE_PEND(state->plaintext_buf),
@@ -1493,16 +1497,15 @@ static void tlsp_service(VSTREAM *plaintext_stream,
                            TLSP_INIT_TIMEOUT, (void *) state);
 }
 
-/* pre_jail_init - pre-jail initialization */
+/* pre_jail_init_server - pre-jail initialization */
 
-static void pre_jail_init(char *unused_name, char **unused_argv)
+static void pre_jail_init_server(void)
 {
     TLS_SERVER_INIT_PROPS props;
     const char *cert_file;
     int     have_server_cert;
     int     no_server_cert_ok;
     int     require_server_cert;
-    int     clnt_use_tls;
 
     /*
      * The code in this routine is pasted literally from smtpd(8). I am not
@@ -1535,7 +1538,7 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
     }
     var_tlsp_use_tls = var_tlsp_use_tls || var_tlsp_enforce_tls;
     if (!var_tlsp_use_tls) {
-       msg_warn("TLS service is requested, but disabled with %s or %s",
+       msg_warn("TLS server role is disabled with %s or %s",
                 VAR_TLSP_TLS_LEVEL, VAR_TLSP_USE_TLS);
        return;
     }
@@ -1626,6 +1629,13 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
        SSL_CTX_set_mode(tlsp_server_ctx->ssl_ctx,
                         SSL_MODE_ENABLE_PARTIAL_WRITE
                         | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);
+}
+
+/* pre_jail_init_client - pre-jail initialization */
+
+static void pre_jail_init_client(void)
+{
+    int     clnt_use_tls;
 
     /*
      * The cache with TLS_APPL_STATE instances for different TLS_CLIENT_INIT
@@ -1737,6 +1747,18 @@ static void pre_jail_init(char *unused_name, char **unused_argv)
                msg_warn("TLS client initialization failed");
        }
     }
+}
+
+/* pre_jail_init - pre-jail initialization */
+
+static void pre_jail_init(char *unused_name, char **unused_argv)
+{
+
+    /*
+     * Initialize roles separately.
+     */
+    pre_jail_init_server();
+    pre_jail_init_client();
 
     /*
      * tlsp_client_init() needs to know if it is called pre-jail or
index 667e75e59f0c5415a9903faae5631e222ac18647..333a5c91d74819c10297ca7907e29bd556e881dc 100644 (file)
@@ -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 @@ static const char *midna_domain_strerror(UErrorCode error, int info_errors)
     }
 }
 
+/* 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 @@ const char *midna_domain_suffix_to_utf8(const char *name)
  /*
   * Test program - reads names from stdin, reports invalid names to stderr.
   */
+#include <unistd.h>
 #include <stdlib.h>
 #include <locale.h>
 
@@ -350,6 +371,11 @@ int     main(int argc, char **argv)
     /* 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);
index 03d875b106c4a0b4a944118e50652dfa09a36536..1abe2a173b7e70b064df67756c6368ddebe4c371 100644 (file)
@@ -18,6 +18,7 @@ extern const char *midna_domain_to_ascii(const char *);
 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;