Enigma: Fix malformed signed messages with force_7bit=true (#5292)

pull/5303/head
Aleksander Machniak 9 years ago
parent d61d33a12a
commit 96102e2052

@ -19,6 +19,7 @@ CHANGELOG Roundcube Webmail
- Fix bug where multi-folder search didn't work for unsubscribed INBOX (#5259)
- Fix bug where "no body" alert could be displayed when sending mailvelope email
- Enigma: Fix keys import from inside of an encrypted message (#5285)
- Enigma: Fix malformed signed messages with force_7bit=true (#5292)
- Fix searching by email address in contacts with multiple addresses (#5291)
- Fix handling of --delete argument in moduserprefs.sh script (#5296)

@ -3,7 +3,7 @@
"type": "roundcube-plugin",
"description": "PGP Encryption for Roundcube",
"license": "GPLv3+",
"version": "0.5",
"version": "0.6",
"authors": [
{
"name": "Aleksander Machniak",

@ -126,7 +126,9 @@ class enigma_mime_message extends Mail_mime
$_headers = $this->message->headers();
$headers = array();
if ($_headers['Content-Transfer-Encoding']) {
if ($_headers['Content-Transfer-Encoding']
&& stripos($_headers['Content-Type'], 'multipart') === false
) {
$headers[] = 'Content-Transfer-Encoding: ' . $_headers['Content-Transfer-Encoding'];
}
$headers[] = 'Content-Type: ' . $_headers['Content-Type'];
@ -142,8 +144,10 @@ class enigma_mime_message extends Mail_mime
public function addPGPSignature($body)
{
$this->signature = $body;
// Reset Content-Type to be overwritten with valid boundary
unset($this->headers['Content-Type']);
unset($this->headers['Content-Transfer-Encoding']);
}
/**
@ -154,8 +158,10 @@ class enigma_mime_message extends Mail_mime
public function setPGPEncryptedBody($body)
{
$this->encrypted = $body;
// Reset Content-Type to be overwritten with valid boundary
unset($this->headers['Content-Type']);
unset($this->headers['Content-Transfer-Encoding']);
}
/**
@ -193,7 +199,9 @@ class enigma_mime_message extends Mail_mime
$headers = $this->message->headers();
$params = array('content_type' => $headers['Content-Type']);
if ($headers['Content-Transfer-Encoding']) {
if ($headers['Content-Transfer-Encoding']
&& stripos($headers['Content-Type'], 'multipart') === false
) {
$params['encoding'] = $headers['Content-Transfer-Encoding'];
}
@ -243,18 +251,24 @@ class enigma_mime_message extends Mail_mime
if ($filename) {
// Append mimePart message headers and body into file
$headers = $message->encodeToFile($filename, $boundary, $skip_head);
if ($this->isError($headers)) {
return $headers;
}
$this->headers = array_merge($this->headers, $headers);
return null;
return;
}
else {
$output = $message->encode($boundary, $skip_head);
if ($this->isError($output)) {
return $output;
}
$this->headers = array_merge($this->headers, $output['headers']);
return $output['body'];
}
}

@ -968,19 +968,19 @@ class enigma_ui
}
if (!$savedraft && $pubkey_enable) {
$this->enigma->load_engine();
$this->enigma->engine->attach_public_key($p['message']);
$engine = $this->enigma->load_engine();
$engine->attach_public_key($p['message']);
}
if (!$savedraft && $sign_enable) {
$this->enigma->load_engine();
$status = $this->enigma->engine->sign_message($p['message']);
$engine = $this->enigma->load_engine();
$status = $engine->sign_message($p['message']);
$mode = 'sign';
}
if ((!$status instanceof enigma_error) && $encrypt_enable) {
$this->enigma->load_engine();
$status = $this->enigma->engine->encrypt_message($p['message'], null, $savedraft);
$engine = $this->enigma->load_engine();
$status = $engine->encrypt_message($p['message'], null, $savedraft);
$mode = 'encrypt';
}

Loading…
Cancel
Save