mirror of
https://github.com/curl/curl.git
synced 2025-09-26 05:56:48 +03:00
ftpserver.pl: Moved cURL SMTP server detection into EHLO command handler
Moved the special SMTP server detection code from the DATA command handler, which happens further down the operation chain after EHLO, MAIL and RCPT commands, to the EHLO command as it is the first command to be generated by a SMTP operation as well as containing the special "verifiedserver" string from the URL. This not only makes it easier and quicker to detect but also means that cURL doesn't need to specify "verifiedserver" as --mail-from and --mail-rcpt arguments. More importantly, this also makes the upcoming verification changes to the RCPT handler easier to implement.
This commit is contained in:
parent
9215cee4c6
commit
b07709f741
|
@ -693,10 +693,24 @@ my $smtp_type;
|
||||||
|
|
||||||
sub EHLO_smtp {
|
sub EHLO_smtp {
|
||||||
my ($client) = @_;
|
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;
|
my @data;
|
||||||
|
|
||||||
# TODO: Get the IP address of the client connection to use in the EHLO
|
# TODO: Get the IP address of the client connection to use in the
|
||||||
# response when the client doesn't specify one but for now use 127.0.0.1
|
# EHLO response when the client doesn't specify one but for now use
|
||||||
|
# 127.0.0.1
|
||||||
if (!$client) {
|
if (!$client) {
|
||||||
$client = "[127.0.0.1]";
|
$client = "[127.0.0.1]";
|
||||||
}
|
}
|
||||||
|
@ -739,6 +753,7 @@ sub EHLO_smtp {
|
||||||
sendcontrol "250 $d\r\n";
|
sendcontrol "250 $d\r\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -808,14 +823,8 @@ sub DATA_smtp {
|
||||||
return; # failure
|
return; # failure
|
||||||
}
|
}
|
||||||
|
|
||||||
if($testno eq "<verifiedserver>") {
|
|
||||||
sendcontrol "554 WE ROOLZ: $$\r\n";
|
|
||||||
return 0; # don't wait for data now
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$testno =~ s/^([^0-9]*)([0-9]+).*/$2/;
|
$testno =~ s/^([^0-9]*)([0-9]+).*/$2/;
|
||||||
sendcontrol "354 Show me the mail\r\n";
|
sendcontrol "354 Show me the mail\r\n";
|
||||||
}
|
|
||||||
|
|
||||||
logmsg "===> rcpt $testno was $smtp_rcpt\n";
|
logmsg "===> rcpt $testno was $smtp_rcpt\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user