diff options
-rw-r--r-- | tests/data/test923 | 3 | ||||
-rwxr-xr-x | tests/ftpserver.pl | 18 |
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/data/test923 b/tests/data/test923 index cb811bb0e..9d9722f9a 100644 --- a/tests/data/test923 +++ b/tests/data/test923 @@ -9,9 +9,6 @@ VRFY # # Server-side <reply> -<data> -250 <recipient@example.com>
-</data> </reply> # diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl index e815619d6..6709769d7 100755 --- a/tests/ftpserver.pl +++ b/tests/ftpserver.pl @@ -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; + } } } |