* 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 b9292aad18
commit 7c9c115296
2 changed files with 13 additions and 5 deletions

View File

@ -303,10 +303,10 @@ class addressbook_bo extends Api\Contacts
} }
else 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) '', '', '', false, 'OR', false, null) as $contact)
{ {
// first check for file and second for pubkey field (LDAP, AD or old SQL) // first check for file and second for pubkey field (LDAP, AD or old SQL)
@ -314,9 +314,16 @@ class addressbook_bo extends Api\Contacts
{ {
$contact['email'] = strtolower($contact['email']); $contact['email'] = strtolower($contact['email']);
if (empty($criteria['account_id']) || in_array($contact['email'], $recipients)) if (empty($criteria['account_id']) || in_array($contact['email'], $recipients))
{
if (in_array($contact['email_home'], $recipients))
{
$result[$contact['email_home']] = $content;
}
else
{ {
$result[$contact['email']] = $content; $result[$contact['email']] = $content;
} }
}
else else
{ {
$result[$contact['account_id']] = $content; $result[$contact['account_id']] = $content;

View File

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