Commit 28a8e536 authored by Sebastian Kummer's avatar Sebastian Kummer

Merge pull request #69 in ZP/z-push from...

Merge pull request #69 in ZP/z-push from bugfix/ZP-656-warnings-for-signed-emails-in-sent to develop

* commit '8139b02b':
  ZP-656 Only prepend transport headers if they are available. Do not include the newlines to separate the headers from the body, as the data already contains headers and the separating lines. If no transport headers are available in the case of a signed message do not use the signed attachment but let imtoinet() generate the email as it generates the headers by default. See ZP-725 for more information.

(cherry picked from commit 81ad5685)
parent 16800140
...@@ -795,10 +795,13 @@ class MAPIProvider { ...@@ -795,10 +795,13 @@ class MAPIProvider {
// OL 2013 doesn't show sender and subject for signed emails because the headers are missing // OL 2013 doesn't show sender and subject for signed emails because the headers are missing
if(isset($message->messageclass) && strpos($message->messageclass, "IPM.Note.SMIME.MultipartSigned") === 0 && if(isset($message->messageclass) && strpos($message->messageclass, "IPM.Note.SMIME.MultipartSigned") === 0 &&
isset($message->asbody->type) && $message->asbody->type == SYNC_BODYPREFERENCE_MIME) { isset($message->asbody->type) && $message->asbody->type == SYNC_BODYPREFERENCE_MIME) {
ZLog::Write(LOGLEVEL_DEBUG, "Attach the transport message headers to a signed message");
$transportHeaders = array(PR_TRANSPORT_MESSAGE_HEADERS_W); $transportHeaders = array(PR_TRANSPORT_MESSAGE_HEADERS_W);
$messageHeaders = $this->getProps($mapimessage, $transportHeaders); $messageHeaders = $this->getProps($mapimessage, $transportHeaders);
$message->asbody->data = $messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS] ."\r\n\r\n" . $message->asbody->data; if (isset($messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS]) && $messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS]) {
ZLog::Write(LOGLEVEL_DEBUG, "Prepend the transport message headers to a signed message");
// the retrieved data already contains headers, so we just prepend the transport headers here
$message->asbody->data = $messageHeaders[PR_TRANSPORT_MESSAGE_HEADERS] . $message->asbody->data;
}
} }
return $message; return $message;
...@@ -2376,8 +2379,9 @@ class MAPIProvider { ...@@ -2376,8 +2379,9 @@ class MAPIProvider {
*/ */
private function imtoinet($mapimessage, &$message) { private function imtoinet($mapimessage, &$message) {
// if it is a signed message get a full attachment generated by ZCP // if it is a signed message get a full attachment generated by ZCP
$props = mapi_getprops($mapimessage, array(PR_MESSAGE_CLASS)); $props = mapi_getprops($mapimessage, array(PR_MESSAGE_CLASS, PR_TRANSPORT_MESSAGE_HEADERS_W));
if (isset($props[PR_MESSAGE_CLASS]) && $props[PR_MESSAGE_CLASS] && strpos(strtolower($props[PR_MESSAGE_CLASS]), 'multipartsigned')) { if (isset($props[PR_MESSAGE_CLASS]) && $props[PR_MESSAGE_CLASS] && strpos(strtolower($props[PR_MESSAGE_CLASS]), 'multipartsigned') &&
isset($props[PR_TRANSPORT_MESSAGE_HEADERS]) && $props[PR_TRANSPORT_MESSAGE_HEADERS]) {
// find the required attachment // find the required attachment
$attachtable = mapi_message_getattachmenttable($mapimessage); $attachtable = mapi_message_getattachmenttable($mapimessage);
mapi_table_restrict($attachtable, MAPIUtils::GetSignedAttachmentRestriction()); mapi_table_restrict($attachtable, MAPIUtils::GetSignedAttachmentRestriction());
...@@ -2681,4 +2685,4 @@ class MAPIProvider { ...@@ -2681,4 +2685,4 @@ class MAPIProvider {
} }
} }
?> ?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment