summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-09-22 13:21:15 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-09-22 13:21:15 +0100
commit9d4a8c7936401ef76fac89d4888d26cac12e3a80 (patch)
tree1cd28dc507de469b199f3f4e6ef98f015dcdc865
parentfd8dc21fd02bc818c2b63cc64eac531ff6f2d837 (diff)
downloadcurl-9d4a8c7936401ef76fac89d4888d26cac12e3a80.tar.gz
ftpserver.pl: Added cURL SMTP server detection to HELO command handler
As curl will send a HELO command after an negative EHLO response, added the same detection from commit b07709f7417c3e to the HELO handler to ensure the test server is identified correctly and an upload isn't performed.
-rwxr-xr-xtests/ftpserver.pl49
1 files changed, 31 insertions, 18 deletions
diff --git a/tests/ftpserver.pl b/tests/ftpserver.pl
index 36e47571a..588f98d5d 100755
--- a/tests/ftpserver.pl
+++ b/tests/ftpserver.pl
@@ -758,6 +758,37 @@ sub EHLO_smtp {
return 0;
}
+sub HELO_smtp {
+ my ($client) = @_;
+
+ if($client eq "verifiedserver") {
+ # This is the secret command that verifies that this actually is
+ # the curl test server
+ sendcontrol "554 WE ROOLZ: $$\r\n";
+
+ if($verbose) {
+ print STDERR "FTPD: We returned proof we are the test server\n";
+ }
+
+ logmsg "return proof we are we\n";
+ }
+ else {
+ # TODO: Get the IP address of the client connection to use in the HELO
+ # response when the client doesn't specify one but for now use 127.0.0.1
+ if (!$client) {
+ $client = "[127.0.0.1]";
+ }
+
+ # Set the server type to SMTP
+ $smtp_type = "SMTP";
+
+ # Send the HELO response
+ sendcontrol "250 $smtp_type pingpong test server Hello $client\r\n";
+ }
+
+ return 0;
+}
+
sub MAIL_smtp {
my ($args) = @_;
@@ -895,24 +926,6 @@ sub DATA_smtp {
}
-sub HELO_smtp {
- my ($client) = @_;
-
- # TODO: Get the IP address of the client connection to use in the HELO
- # response when the client doesn't specify one but for now use 127.0.0.1
- if (!$client) {
- $client = "[127.0.0.1]";
- }
-
- # Set the server type to SMTP
- $smtp_type = "SMTP";
-
- # Send the HELO response
- sendcontrol "250 $smtp_type pingpong test server Hello $client\r\n";
-
- return 0;
-}
-
sub QUIT_smtp {
sendcontrol "221 cURL $smtp_type server signing off\r\n";