Skip to content
Snippets Groups Projects
Commit d429b5d7 authored by Jared Hancock's avatar Jared Hancock
Browse files

oops: Fix incorrect matching of messages to threads

parent 0f2b53b3
No related branches found
No related tags found
No related merge requests found
......@@ -961,6 +961,8 @@ class ThreadEntry extends VerySimpleModel {
* *DEPRECATED* use Mailer::decodeMessageId() instead
*/
function lookupByRefMessageId($mid, $from) {
global $ost;
$mid = trim($mid, '<>');
list($ver, $ids, $mails) = explode('$', $mid, 3);
......@@ -972,11 +974,26 @@ class ThreadEntry extends VerySimpleModel {
if (!$ids || !$ids['thread'])
return false;
$thread = ThreadEntry::lookup($ids['thread']);
if (!$thread)
$entry = ThreadEntry::lookup($ids['thread']);
if (!$entry)
return false;
return $thread;
// Compute the value to be compared from $mails (which used to be in
// ThreadEntry::asMessageId()
$domain = md5($ost->getConfig()->getURL());
$ticket = $entry->getThread()->getObject();
if (!$ticket instanceof Ticket)
return false;
$check = sprintf('%s@%s',
substr(md5($to . $ticket->getNumber() . $ticket->getId()), -10),
substr($domain, -10)
);
if ($check != $mails)
return false;
return $entry;
}
//new entry ... we're trusting the caller to check validity of the data.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment