ftpserver: Updated VRFY_smtp() so the response isn't necessary in the test case

This commit is contained in:
Steve Holme 2020-02-10 20:49:45 +00:00
parent 80ccc26415
commit 6995b77a52
No known key found for this signature in database
GPG Key ID: 4059CB85CA7E8F19
2 changed files with 15 additions and 6 deletions

View File

@ -9,9 +9,6 @@ VRFY
#
# Server-side
<reply>
<data>
250 <recipient@example.com>
</data>
</reply>
#

View File

@ -1030,10 +1030,22 @@ sub VRFY_smtp {
sendcontrol "501 Unrecognized parameter\r\n";
}
else {
my @data = getreplydata($smtp_client);
# 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 {
my @data = getreplydata($smtp_client);
for my $d (@data) {
sendcontrol $d;
if(!@data) {
push @data, "250 <$username\@example.com>\r\n"
}
for my $d (@data) {
sendcontrol $d;
}
}
}