mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
ftpserver.pl: Reworked SMTP verified server detection
Following the addition of informational commands to the SMTP protocol, the test server is no longer required to return the verified server information in responses that curl only outputs in verbose mode. Instead, a similar detection mechanism to that used by FTP, IMAP and POP3 can now be used.
This commit is contained in:
parent
c9dd4022f4
commit
263616202b
@ -702,19 +702,6 @@ my $smtp_client;
|
||||
|
||||
sub EHLO_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 {
|
||||
my @data;
|
||||
|
||||
# TODO: Get the IP address of the client connection to use in the
|
||||
@ -773,18 +760,6 @@ sub EHLO_smtp {
|
||||
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) {
|
||||
@ -799,7 +774,6 @@ sub HELO_smtp {
|
||||
|
||||
# Store the client (as it may contain the test number)
|
||||
$smtp_client = $client;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -997,6 +971,18 @@ sub HELP_smtp {
|
||||
logmsg "HELP_smtp got $args\n";
|
||||
}
|
||||
|
||||
if($smtp_client eq "verifiedserver") {
|
||||
# This is the secret command that verifies that this actually is
|
||||
# the curl test server
|
||||
sendcontrol "214 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 {
|
||||
sendcontrol "214-This server supports the following commands:\r\n";
|
||||
|
||||
if(@auth_mechs) {
|
||||
@ -1005,6 +991,7 @@ sub HELP_smtp {
|
||||
else {
|
||||
sendcontrol "214 HELO EHLO RCPT DATA RSET MAIL VRFY EXPN QUIT HELP\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -790,14 +790,6 @@ sub verifyftp {
|
||||
if($proto eq "ftps") {
|
||||
$extra .= "--insecure --ftp-ssl-control ";
|
||||
}
|
||||
elsif($proto eq "smtp") {
|
||||
# SMTP is a bit different since it requires more options and it
|
||||
# has _no_ output!
|
||||
$extra .= "--mail-rcpt verifiedserver ";
|
||||
$extra .= "--mail-from fake\@example.com ";
|
||||
$extra .= "--upload /dev/null ";
|
||||
$extra .= "--stderr - "; # move stderr to parse the verbose stuff
|
||||
}
|
||||
|
||||
my $flags = "--max-time $server_response_maxtime ";
|
||||
$flags .= "--silent ";
|
||||
|
Loading…
Reference in New Issue
Block a user