From 810d16ad4b7f172163ed4bb8adc45a3d7183659a Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 12 Apr 2015 18:47:03 +0100 Subject: client helo --- TODO | 4 ++-- doc/doc-txt/experimental-spec.txt | 19 +++++++++++++++++-- src/src/transports/smtp.c | 13 +++++++++++++ src/src/utf8.c | 1 + 4 files changed, 33 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 4445d0fe4..19c7ce7f6 100644 --- a/TODO +++ b/TODO @@ -14,8 +14,8 @@ destination supports the SMTPUTF8 extension ====================== -to-Alabel convert of helo name -- smtp transport +++ to-Alabel convert of helo name +++ - smtp transport ++ An "international" flag on the message? ++ An is-international expansion condition? diff --git a/doc/doc-txt/experimental-spec.txt b/doc/doc-txt/experimental-spec.txt index 3dbf13f9d..c22288bed 100644 --- a/doc/doc-txt/experimental-spec.txt +++ b/doc/doc-txt/experimental-spec.txt @@ -1278,7 +1278,7 @@ RFCs 6530, 6533, 5890 Compile with EXPERIMENTAL_INTERNATIONAL and libidn. -Main config option smtputf8_advertise_hosts, default '*', +New main config option smtputf8_advertise_hosts, default '*', a host list. If this matches the sending host and accept_8bitmime is true (the default) then the ESMTP option SMTPUTF8 will be advertised. @@ -1291,15 +1291,30 @@ The option allow_utf8_domains is set to true for this message. All DNS lookups are converted to a-label form whatever the setting of allow_utf8_domains. +Both localparts and domain are maintained as the original +utf8 form internally; any matching or regex use will +require appropriate care. Filenames created, eg. by +the appendfile transport, will have utf8 name. + +Helo names sent by the smtp transport will have any utf8 +components expanded to a-label form. + Log lines and Received-by: header lines will aquire a "utf8" prefix on the protocol element, eg. utf8esmtp. -Expansion operators: +New expansion operators: ${utf8_domain_to_alabel:str} ${utf8_domain_from_alabel:str} ${utf8_localpart_to_alabel:str} ${utf8_localpart_from_alabel:str} +Known issues: + - Currently LMTP is not supported. + - DSN unitext handling is not present + - no provision for converting logging from UTF-8 + - VRFY and EXPN not handled + - non-smtp input not handled (!) + - MSA mode not handled (!) -------------------------------------------------------------- End of file diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 0ca6b4e42..65bb1de22 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -1486,6 +1486,19 @@ if (continue_hostname == NULL) delayed till here so that $sending_interface and $sending_port are set. */ helo_data = expand_string(ob->helo_data); +#ifdef EXPERIMENTAL_INTERNATIONAL + if (helo_data) + { + uschar * errstr = NULL; + if ((helo_data = string_domain_utf8_to_alabel(helo_data, &errstr)), errstr) + { + errstr = string_sprintf("failed to expand helo_data: %s", errstr); + set_errno(addrlist, ERRNO_EXPANDFAIL, errstr, DEFER, FALSE, NULL); + yield = DEFER; + goto SEND_QUIT; + } + } +#endif /* The first thing is to wait for an initial OK response. The dreaded "goto" is nevertheless a reasonably clean way of programming this kind of logic, diff --git a/src/src/utf8.c b/src/src/utf8.c index 6d0c5029b..6bc0c2ed5 100644 --- a/src/src/utf8.c +++ b/src/src/utf8.c @@ -54,6 +54,7 @@ string_domain_alabel_to_utf8(const uschar * alabel, uschar ** err) uschar * s1; uschar * s; int rc; + if ( (rc = idna_to_unicode_8z8z(CCS alabel, CSS &s1, IDNA_USE_STD3_ASCII_RULES)) != IDNA_SUCCESS) { -- cgit v1.2.3