diff options
author | Steve Holme <steve_holme@hotmail.com> | 2020-02-08 00:37:03 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2020-02-26 11:02:38 +0000 |
commit | 2aa6c1735a84f6df11b5f5863a704034b820c925 (patch) | |
tree | 15598b3ed7640e57fc6392b9382ecc213a052259 /lib/smtp.c | |
parent | e7959c280c0361d2e448776d9ea11305e2f026bc (diff) | |
download | curl-2aa6c1735a84f6df11b5f5863a704034b820c925.tar.gz |
smtp: Support UTF-8 based host names in the VRFY command
Diffstat (limited to 'lib/smtp.c')
-rw-r--r-- | lib/smtp.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/lib/smtp.c b/lib/smtp.c index 1718cc2db..3c3dfcbd9 100644 --- a/lib/smtp.c +++ b/lib/smtp.c @@ -485,13 +485,35 @@ static CURLcode smtp_perform_command(struct connectdata *conn) struct Curl_easy *data = conn->data; struct SMTP *smtp = data->req.protop; - /* Send the command */ - if(smtp->rcpt) - result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s %s", - smtp->custom && smtp->custom[0] != '\0' ? - smtp->custom : "VRFY", - smtp->rcpt->data); + if(smtp->rcpt) { + if((!smtp->custom) || (!smtp->custom[0])) { + char *address = NULL; + struct hostname host = { NULL, NULL, NULL, NULL }; + + /* Parse the mailbox to verify into the local address and host name + parts, converting the host name to an IDN A-label if necessary */ + result = smtp_parse_address(conn, smtp->rcpt->data, + &address, &host); + if(result) + return result; + + /* Send the VRFY command (Note: The host name part may be absent when the + host is a local system) */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "VRFY %s%s%s", + address, + host.name ? "@" : "", + host.name ? host.name : ""); + + Curl_free_idnconverted_hostname(&host); + free(address); + } + else + /* Send the custom recipient based command such as the EXPN command */ + result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s %s", smtp->custom, + smtp->rcpt->data); + } else + /* Send the non-recipient based command such as HELP */ result = Curl_pp_sendf(&conn->proto.smtpc.pp, "%s", smtp->custom && smtp->custom[0] != '\0' ? smtp->custom : "HELP"); |