fixes bug with smtp header order

SMTP servers that support pipelining will not accept any
commands other than MAILFROM and RCPTTO before the DATA
command. We were sending Date and Subject before Data
which would cause some mailservers to suddenly drop
the connection refusing to send the mail.

MSP-12133
bug/bundler_fix
David Maloney 2015-02-12 14:13:39 -06:00
parent 309159d876
commit 72878e0c14
No known key found for this signature in database
GPG Key ID: DEDBA9DC3A913DB2
1 changed files with 2 additions and 2 deletions

View File

@ -141,6 +141,8 @@ module Exploit::Remote::SMTPDeliver
raw_send_recv("MAIL FROM: <#{datastore['MAILFROM']}>\r\n", nsock)
raw_send_recv("RCPT TO: <#{datastore['MAILTO']}>\r\n", nsock)
resp = raw_send_recv("DATA\r\n", nsock)
# If the user supplied a Date field, use that, else use the current
# DateTime in the proper RFC2822 format.
if datastore['DATE'].present?
@ -154,8 +156,6 @@ module Exploit::Remote::SMTPDeliver
raw_send_recv("Subject: #{datastore['SUBJECT']}\r\n", nsock)
end
resp = raw_send_recv("DATA\r\n", nsock)
# Avoid sending tons of data and killing the connection if the server
# didn't like us.
if not resp or not resp[0,3] == '354'