Skip to content
Snippets Groups Projects
Commit e3df92a1 authored by Peter Rotich's avatar Peter Rotich
Browse files

Require email match to thread incoming email when ticket number on subject

line is used.
parent fd40f882
No related branches found
No related tags found
No related merge requests found
......@@ -674,11 +674,16 @@ Class ThreadEntry {
}
// Search for ticket by the [#123456] in the subject line
// This is the last resort - emails must match to avoid message
// injection by third-party.
$subject = $mailinfo['subject'];
$match = array();
if ($subject && preg_match("/\[#([0-9]{1,10})\]/", $subject, $match))
if ($subject && $mailinfo['email']
&& preg_match("/\[#([0-9]{1,10})\]/", $subject, $match)
&& ($tid = Ticket::getIdByExtId((int)$match[1], $mailinfo['email']))
)
// Return last message for the thread
return Message::lastByExtTicketId((int)$match[1]);
return Message::lastByTicketId($tid);
return null;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment