From 69189ed21ac29f9f0ee1166caa52c1870f617982 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 9 Dec 2016 10:43:31 +0100 Subject: [PATCH] Enigma: Fix PHP fatal error when decrypting a message with invalid signature (#5555) --- CHANGELOG | 1 + plugins/enigma/lib/enigma_driver_gnupg.php | 13 ++++++++----- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 4cff69da8..370ce7cac 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ CHANGELOG Roundcube Webmail - Managesieve: Fix handling of scripts with nested rules (#5540) - Fix variable substitution in ldap host for some use-cases, e.g. new_user_identity (#5544) +- Enigma: Fix PHP fatal error when decrypting a message with invalid signature (#5555) RELEASE 1.2.3 ------------- diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php index 07ca00322..afa54ed2e 100644 --- a/plugins/enigma/lib/enigma_driver_gnupg.php +++ b/plugins/enigma/lib/enigma_driver_gnupg.php @@ -409,17 +409,20 @@ class enigma_driver_gnupg extends enigma_driver */ protected function parse_signature($sig) { - $user = $sig->getUserId(); - $data = new enigma_signature(); + $data->id = $sig->getId(); $data->valid = $sig->isValid(); $data->fingerprint = $sig->getKeyFingerprint(); $data->created = $sig->getCreationDate(); $data->expires = $sig->getExpirationDate(); - $data->name = $user->getName(); - $data->comment = $user->getComment(); - $data->email = $user->getEmail(); + + // In case of ERRSIG user may not be set + if ($user = $sig->getUserId()) { + $data->name = $user->getName(); + $data->comment = $user->getComment(); + $data->email = $user->getEmail(); + } return $data; }