diff options
author | Steve Holme <steve_holme@hotmail.com> | 2020-02-13 20:59:36 +0000 |
---|---|---|
committer | Steve Holme <steve_holme@hotmail.com> | 2020-02-26 14:49:40 +0000 |
commit | aba1bf630f13a77b1a92484feb365a29bb1a25da (patch) | |
tree | 5c3acff32d85dd725447d6d3c75b98a08a931b73 /tests/ftpserver.pl | |
parent | 4754c55cd7c0f16f2d7bef76d55f09679933571c (diff) | |
download | curl-aba1bf630f13a77b1a92484feb365a29bb1a25da.tar.gz |
smtp: Support the SMTPUTF8 extension in the MAIL command
Support the SMTPUTF8 extension when sending mailbox information in the
MAIL command (FROM and AUTH parameters). Non-ASCII domain names will
be ACE encoded, if IDN is supported, whilst non-ASCII characters in
the local address part are passed to the server.
Reported-by: ygthien on github
Fixes #4828
Diffstat (limited to 'tests/ftpserver.pl')
-rwxr-xr-x | tests/ftpserver.pl | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 59a1665bd..fe74f8b07 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -813,6 +813,7 @@ sub MAIL_smtp { else { my $from; my $size; + my $smtputf8 = grep /^SMTPUTF8$/, @capabilities; my @elements = split(/ /, $args); # Get the FROM and SIZE parameters @@ -827,11 +828,11 @@ sub MAIL_smtp { # Validate the from address (only <> and a valid email address inside # <> are allowed, such as <user@example.com>) - if ((!$from) || (($from ne "<>") && ($from !~ - /^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/))) { - sendcontrol "501 Invalid address\r\n"; - } - else { + if (($from eq "<>") || + (!$smtputf8 && $from =~ + /^<([a-zA-Z0-9._%+-]+)\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4})>$/) || + ($smtputf8 && $from =~ + /^<([a-zA-Z0-9\x{80}-\x{ff}._%+-]+)\@(([a-zA-Z0-9\x{80}-\x{ff}-]+)\.)+([a-zA-Z]{2,4})>$/)) { my @found; my $valid = 1; @@ -852,6 +853,9 @@ sub MAIL_smtp { sendcontrol "250 Sender OK\r\n"; } } + else { + sendcontrol "501 Invalid address\r\n"; + } } return 0; |