From efce3ea5a85126d3e6c2084a7b581cc1df1b340b Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Thu, 13 Feb 2020 22:56:51 +0000 Subject: smtp: Support the SMTPUTF8 extension in the VRFY command --- tests/ftpserver.pl | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'tests/ftpserver.pl') diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index 9c4b88aef..63dc3342c 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -1037,13 +1037,15 @@ sub VRFY_smtp { sendcontrol "501 Unrecognized parameter\r\n"; } else { + my $smtputf8 = grep /^SMTPUTF8$/, @capabilities; + # Validate the username (only a valid local or external username is # allowed, such as user or user@example.com) - if ($username !~ - /^([a-zA-Z0-9._%+-]+)(\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4}))?$/) { - sendcontrol "501 Invalid address\r\n"; - } - else { + if ((!$smtputf8 && $username =~ + /^([a-zA-Z0-9._%+-]+)(\@(([a-zA-Z0-9-]+)\.)+([a-zA-Z]{2,4}))?$/) || + ($smtputf8 && $username =~ + /^([a-zA-Z0-9\x{80}-\x{ff}._%+-]+)(\@(([a-zA-Z0-9\x{80}-\x{ff}-]+)\.)+([a-zA-Z]{2,4}))?$/)) { + my @data = getreplydata($smtp_client); if(!@data) { @@ -1060,6 +1062,9 @@ sub VRFY_smtp { sendcontrol $d; } } + else { + sendcontrol "501 Invalid address\r\n"; + } } return 0; -- cgit v1.2.3