mirror of
https://github.com/curl/curl.git
synced 2025-09-26 05:56:48 +03:00
ftpserver.pl: Expanded the SMTP RCPT handler to validate TO addresses
RCPT_smtp() will now check for a correctly formatted TO address which allows for invalid recipient addresses to be added.
This commit is contained in:
parent
9d4a8c7936
commit
8880f84e1a
|
@ -849,14 +849,23 @@ sub RCPT_smtp {
|
||||||
|
|
||||||
logmsg "RCPT_smtp got $args\n";
|
logmsg "RCPT_smtp got $args\n";
|
||||||
|
|
||||||
|
# Get the TO parameter
|
||||||
if($args !~ /^TO:(.*)/) {
|
if($args !~ /^TO:(.*)/) {
|
||||||
sendcontrol "501 Unrecognized parameter\r\n";
|
sendcontrol "501 Unrecognized parameter\r\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$smtp_rcpt = $1;
|
$smtp_rcpt = $1;
|
||||||
|
|
||||||
|
# Validate the to address (only a valid email address inside <> is
|
||||||
|
# allowed, such as <user@example.com>)
|
||||||
|
if ($smtp_rcpt !~
|
||||||
|
/^<([a-zA-Z0-9._%+-]+)\@([a-zA-Z0-9.-]+).([a-zA-Z]{2,4})>$/) {
|
||||||
|
sendcontrol "501 Invalid address\r\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
sendcontrol "250 Recipient OK\r\n";
|
sendcontrol "250 Recipient OK\r\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user