From 3087c25cb6eb413f99012a27f8d6275f36e19e51 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 9 Aug 2018 15:50:23 +0200 Subject: [PATCH] Enigma: Fix deleting keys with authentication subkeys (#6381) --- CHANGELOG | 1 + plugins/enigma/lib/enigma_driver_gnupg.php | 11 ++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index bb6e1782d63..737ce3a1efc 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -3,6 +3,7 @@ CHANGELOG Roundcube Webmail - Fix PHP warnings on dummy QUOTA responses in Courier-IMAP 4.17.1 (#6374) - Fix so fallback from BINARY to BODY FETCH is used also on [PARSE] errors in dovecot 2.3 (#6383) +- Enigma: Fix deleting keys with authentication subkeys (#6381) RELEASE 1.3.7 ------------- diff --git a/plugins/enigma/lib/enigma_driver_gnupg.php b/plugins/enigma/lib/enigma_driver_gnupg.php index 09c2c8582da..2bbf533475b 100644 --- a/plugins/enigma/lib/enigma_driver_gnupg.php +++ b/plugins/enigma/lib/enigma_driver_gnupg.php @@ -374,13 +374,10 @@ public function delete_key($keyid) } // need to delete private key first else if ($code == enigma_error::DELKEY) { - $key = $this->get_key($keyid); - for ($i = count($key->subkeys) - 1; $i >= 0; $i--) { - $type = ($key->subkeys[$i]->usage & enigma_key::CAN_ENCRYPT) ? 'priv' : 'pub'; - $result = $this->{'delete_' . $type . 'key'}($key->subkeys[$i]->id); - if ($result !== true) { - return $result; - } + $result = $this->delete_privkey($keyid); + + if ($result === true) { + $result = $this->delete_pubkey($keyid); } } }