body\r
</stdin>
<command>
-smtp://smtp.1320:%SMTPPORT/user --mail-rcpt 1320@example.com --mail-from 1320@example.com -T - -p -x %HOSTIP:%PROXYPORT
+smtp://smtp.1320:%SMTPPORT/1320 --mail-rcpt 1320@example.com --mail-from 1320@example.com -T - -p -x %HOSTIP:%PROXYPORT
</command>
</client>
^User-Agent: curl/.*
</strip>
<protocol>
-EHLO user\r
+EHLO 1320\r
MAIL FROM:<1320@example.com>\r
RCPT TO:<1320@example.com>\r
DATA\r
body\r
</file>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 1406@example.com --mail-rcpt 1406@foobar.example.com --mail-from 1406@example.com -T log/test1406.eml --libcurl log/test1406.c
+smtp://%HOSTIP:%SMTPPORT/1406 --mail-rcpt 1406@example.com --mail-rcpt 1406@foobar.example.com --mail-from 1406@example.com -T log/test1406.eml --libcurl log/test1406.c
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 1406\r
MAIL FROM:<1406@example.com> SIZE=38\r
RCPT TO:<1406@example.com>\r
RCPT TO:<1406@foobar.example.com>\r
hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_INFILESIZE_LARGE, (curl_off_t)38);
- curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/user");
+ curl_easy_setopt(hnd, CURLOPT_URL, "smtp://%HOSTIP:%SMTPPORT/1406");
curl_easy_setopt(hnd, CURLOPT_HEADER, 1L);
curl_easy_setopt(hnd, CURLOPT_UPLOAD, 1L);
curl_easy_setopt(hnd, CURLOPT_USERAGENT, "stripped");
body
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user
+smtp://%HOSTIP:%SMTPPORT/1507
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 1507\r
MAIL FROM:<1507-realuser@example.com>\r
RCPT TO:<1507-recipient@example.com>\r
DATA\r
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 900@example.com --mail-from 900@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/900 --mail-rcpt 900@example.com --mail-from 900@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 900\r
MAIL FROM:<900@example.com>\r
RCPT TO:<900@example.com>\r
DATA\r
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 901@example.com --mail-from 901@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/901 --mail-rcpt 901@example.com --mail-from 901@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 901\r
MAIL FROM:<901@example.com>\r
RCPT TO:<901@example.com>\r
DATA\r
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 902@example.com --mail-from 902@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/902 --mail-rcpt 902@example.com --mail-from 902@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
-HELO user\r
+EHLO 902\r
+HELO 902\r
MAIL FROM:<902@example.com>\r
RCPT TO:<902@example.com>\r
DATA\r
mail body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 903@example.com --mail-from 903@example.com -u test:1234 -T -
+smtp://%HOSTIP:%SMTPPORT/903 --mail-rcpt 903@example.com --mail-from 903@example.com -u test:1234 -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 903\r
AUTH PLAIN\r
dGVzdAB0ZXN0ADEyMzQ=\r
MAIL FROM:<903@example.com>\r
mail body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 904@example.com --mail-from 904@example.com -u test:1234 -T -
+smtp://%HOSTIP:%SMTPPORT/904 --mail-rcpt 904@example.com --mail-from 904@example.com -u test:1234 -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 904\r
AUTH LOGIN\r
dGVzdA==\r
MTIzNA==\r
mail body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 905@example.com --mail-from 905@example.com -u tim:tanstaaftanstaaf -T -
+smtp://%HOSTIP:%SMTPPORT/905 --mail-rcpt 905@example.com --mail-from 905@example.com -u tim:tanstaaftanstaaf -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 905\r
AUTH CRAM-MD5\r
dGltIGI5MTNhNjAyYzdlZGE3YTQ5NWI0ZTZlNzMzNGQzODkw\r
MAIL FROM:<905@example.com>\r
mail body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 906@example.com --mail-from 906@example.com -u testuser:testpass -T -
+smtp://%HOSTIP:%SMTPPORT/906 --mail-rcpt 906@example.com --mail-from 906@example.com -u testuser:testpass -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 906\r
AUTH NTLM\r
TlRMTVNTUAABAAAABoIIAAAAAAAAAAAAAAAAAAAAAAA=\r
TlRMTVNTUAADAAAAGAAYAEAAAAAYABgAWAAAAAAAAABwAAAACAAIAHAAAAAIAAgAeAAAAAAAAAAAAAAABoKBAFpkQwKRCZFMhjj0tw47wEjKHRHlvzfxQamFcheMuv8v+xeqphEO5V41xRd7R9deOXRlc3R1c2VyY3VybGhvc3Q=\r
mail body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 907@example.com --mail-from 907@example.com -u test:1234 --sasl-ir -T -
+smtp://%HOSTIP:%SMTPPORT/907 --mail-rcpt 907@example.com --mail-from 907@example.com -u test:1234 --sasl-ir -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 907\r
AUTH PLAIN dGVzdAB0ZXN0ADEyMzQ=\r
MAIL FROM:<907@example.com>\r
RCPT TO:<907@example.com>\r
mail body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 908@example.com --mail-from 908@example.com -u test:1234 --sasl-ir -T -
+smtp://%HOSTIP:%SMTPPORT/908 --mail-rcpt 908@example.com --mail-from 908@example.com -u test:1234 --sasl-ir -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 908\r
AUTH LOGIN dGVzdA==\r
MTIzNA==\r
MAIL FROM:<908@example.com>\r
body\r
</file>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 909@example.com --mail-from 909@example.com -T log/test909.eml
+smtp://%HOSTIP:%SMTPPORT/909 --mail-rcpt 909@example.com --mail-from 909@example.com -T log/test909.eml
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 909\r
MAIL FROM:<909@example.com>\r
RCPT TO:<909@example.com>\r
DATA\r
body
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 910@example.com --mail-from 910@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/910 --mail-rcpt 910@example.com --mail-from 910@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 910\r
MAIL FROM:<910@example.com>\r
RCPT TO:<910@example.com>\r
DATA\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 911@example.com --mail-from 911@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/911 --mail-rcpt 911@example.com --mail-from 911@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 911\r
MAIL FROM:<911@example.com>\r
RCPT TO:<911@example.com>\r
DATA\r
body\r
</file>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 912@example.com --mail-from 912@example.com -T log/test912.eml
+smtp://%HOSTIP:%SMTPPORT/912 --mail-rcpt 912@example.com --mail-from 912@example.com -T log/test912.eml
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 912\r
MAIL FROM:<912@example.com> SIZE=38\r
RCPT TO:<912@example.com>\r
DATA\r
body\r
</file>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 913@example.com --mail-from 913@example.com -T log/test913.eml
+smtp://%HOSTIP:%SMTPPORT/913 --mail-rcpt 913@example.com --mail-from 913@example.com -T log/test913.eml
</command>
</client>
55
</errorcode>
<protocol>
-EHLO user\r
+EHLO 913\r
MAIL FROM:<913@example.com> SIZE=38\r
QUIT\r
</protocol>
body\r
</file>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 914@example.com --mail-from invalid -T log/test914.eml
+smtp://%HOSTIP:%SMTPPORT/914 --mail-rcpt 914@example.com --mail-from invalid -T log/test914.eml
</command>
</client>
55
</errorcode>
<protocol>
-EHLO user\r
+EHLO 914\r
MAIL FROM:<invalid>\r
QUIT\r
</protocol>
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 915@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/915 --mail-rcpt 915@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 915\r
MAIL FROM:<>\r
RCPT TO:<915@example.com>\r
DATA\r
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt invalid --mail-from 916@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/916 --mail-rcpt invalid --mail-from 916@example.com -T -
</command>
</client>
55
</errorcode>
<protocol>
-EHLO user\r
+EHLO 916\r
MAIL FROM:<916@example.com>\r
RCPT TO:<invalid>\r
QUIT\r
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 917@example.com --mail-rcpt 917@foo.example.com --mail-rcpt 917@bar.example.com --mail-rcpt 917@foobar.example.com --mail-rcpt 917@another.example.com --mail-from 917@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/917 --mail-rcpt 917@example.com --mail-rcpt 917@foo.example.com --mail-rcpt 917@bar.example.com --mail-rcpt 917@foobar.example.com --mail-rcpt 917@another.example.com --mail-from 917@example.com -T -
</command>
</client>
# Verify data after the test has been "shot"
<verify>
<protocol>
-EHLO user\r
+EHLO 917\r
MAIL FROM:<917@example.com>\r
RCPT TO:<917@example.com>\r
RCPT TO:<917@foo.example.com>\r
body\r
</stdin>
<command>
-smtp://%HOSTIP:%SMTPPORT/user --mail-rcpt 918@example.com --mail-rcpt invalid --mail-rcpt 918@bar.example.com --mail-rcpt sTrAnGe --mail-rcpt 918@another.example.com --mail-from 918@example.com -T -
+smtp://%HOSTIP:%SMTPPORT/918 --mail-rcpt 918@example.com --mail-rcpt invalid --mail-rcpt 918@bar.example.com --mail-rcpt sTrAnGe --mail-rcpt 918@another.example.com --mail-from 918@example.com -T -
</command>
</client>
55\r
</errorcode>\r
<protocol>
-EHLO user\r
+EHLO 918\r
MAIL FROM:<918@example.com>\r
RCPT TO:<918@example.com>\r
RCPT TO:<invalid>\r
################ SMTP commands
################
-# what set by "RCPT"
-my $smtp_rcpt;
-
# The type of server (SMTP or ESMTP)
my $smtp_type;
+# The client (which normally contains the test number)
+my $smtp_client;
+
sub EHLO_smtp {
my ($client) = @_;
sendcontrol "250 $d\r\n";
}
}
+
+ # Store the client (as it may contain the test number)
+ $smtp_client = $client;
}
return 0;
# Send the HELO response
sendcontrol "250 $smtp_type pingpong test server Hello $client\r\n";
+
+ # Store the client (as it may contain the test number)
+ $smtp_client = $client;
}
return 0;
sendcontrol "501 Unrecognized parameter\r\n";
}
else {
- $smtp_rcpt = $1;
+ my $to = $1;
# Validate the to address (only a valid email address inside <> is
# allowed, such as <user@example.com>)
- if ($smtp_rcpt !~
+ if ($to !~
/^<([a-zA-Z0-9._%+-]+)\@([a-zA-Z0-9.-]+).([a-zA-Z]{2,4})>$/) {
sendcontrol "501 Invalid address\r\n";
}
sub DATA_smtp {
my ($args) = @_;
- my $testno = $smtp_rcpt;
if ($args) {
sendcontrol "501 Unrecognized parameter\r\n";
}
+ elsif ($smtp_client !~ /^(\d*)$/)
+ sendcontrol "501 Invalid arguments\r\n";
+ }
else {
- $testno =~ s/^([^0-9]*)([0-9]+).*/$2/;
sendcontrol "354 Show me the mail\r\n";
- logmsg "===> rcpt $testno was $smtp_rcpt\n";
-
+ my $testno = $smtp_client;
my $filename = "log/upload.$testno";
logmsg "Store test number $testno in $filename\n";