* Mail: fix not working sending and receiving smime signed messages where certificates have more than 1 domain registered (subjectAltName)

This commit is contained in:
Hadi Nategh 2019-02-06 13:49:11 +01:00
parent f1295cce1c
commit 2405d8f2d3
2 changed files with 13 additions and 5 deletions

View File

@ -303,10 +303,10 @@ class addressbook_bo extends Api\Contacts
}
else
{
$criteria['contact_email'][] = $recipient = strtolower($recipient);
$criteria['contact_email_home'][] = $criteria['contact_email'][] = $recipient = strtolower($recipient);
}
}
foreach($this->search($criteria, array('account_id', 'contact_email', 'contact_pubkey', 'contact_id'),
foreach($this->search($criteria, array('account_id', 'contact_email', 'contact_email_home', 'contact_pubkey', 'contact_id'),
'', '', '', false, 'OR', false, null) as $contact)
{
// first check for file and second for pubkey field (LDAP, AD or old SQL)
@ -315,7 +315,14 @@ class addressbook_bo extends Api\Contacts
$contact['email'] = strtolower($contact['email']);
if (empty($criteria['account_id']) || in_array($contact['email'], $recipients))
{
$result[$contact['email']] = $content;
if (in_array($contact['email_home'], $recipients))
{
$result[$contact['email_home']] = $content;
}
else
{
$result[$contact['email']] = $content;
}
}
else
{

View File

@ -7552,8 +7552,9 @@ class Mail
'signed' => true
));
// check for email address if both signer email address and
// email address of sender are the same.
if (is_array($from) && strcasecmp($from[0], $cert->email) != 0)
// email address of sender are the same. It also takes subjectAltName emails into account.
if (is_array($from) && strcasecmp($from[0], $cert->email) != 0
&& stripos($metadata['certDetails']['extensions']['subjectAltName'],$from[0]) === false)
{
$metadata['unknownemail'] = true;
$metadata['msg'] .= ' '.lang('Email address of signer is different from the email address of sender!');