]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
ftpserver: Updated VRFY_smtp() so the response isn't necessary in the test case
authorSteve Holme <steve_holme@hotmail.com>
Mon, 10 Feb 2020 20:49:45 +0000 (20:49 +0000)
committerSteve Holme <steve_holme@hotmail.com>
Mon, 24 Feb 2020 23:01:05 +0000 (23:01 +0000)
tests/data/test923
tests/ftpserver.pl

index cb811bb0efee046fab8423dccc7f8dc458dbf9e8..9d9722f9aaa2c9239cf183c14a13ed397476815e 100644 (file)
@@ -9,9 +9,6 @@ VRFY
 #
 # Server-side
 <reply>
-<data>
-250 <recipient@example.com>\r
-</data>
 </reply>
 
 #
index e815619d699631477c88feb2988e2c767dd12ba3..6709769d729c461a8a442f972d5d079a2ef54790 100755 (executable)
@@ -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;
+            }
         }
     }