Skip to content

Commit

Permalink
Fix GPG Publkey import when also provided by Hook
Browse files Browse the repository at this point in the history
If a GPG Publickey happens to be provided by a gpg_key Hook in IMP it
was not possible for a user to import said key into his keyring.

This Patch skips gpg_key hook when getPublicKey is called to determine if
a user already has the PublicKey in his keyring.
  • Loading branch information
o authored and slusarz committed Dec 20, 2014
1 parent 073a20f commit 7d6ee2a
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions imp/lib/Crypt/Pgp.php
Expand Up @@ -160,7 +160,7 @@ public function addPublicKey($public_key)
* address book and remove the id from the key_info for a correct
* output. */
try {
$result = $this->getPublicKey($sig['email'], array('nocache' => true, 'noserver' => true));
$result = $this->getPublicKey($sig['email'], array('nocache' => true, 'noserver' => true, 'nohooks' => true));
if (!empty($result)) {
unset($key_info['signature'][$id]);
continue;
Expand Down Expand Up @@ -213,16 +213,18 @@ public function getPublicKey($address, $options = array())
}
}

try {
$key = $injector->getInstance('Horde_Core_Hooks')->callHook(
'pgp_key',
'imp',
array($address, $keyid)
);
if ($key) {
return $key;
}
} catch (Horde_Exception_HookNotSet $e) {}
if (empty($options['nohooks'])) {
try {
$key = $injector->getInstance('Horde_Core_Hooks')->callHook(
'pgp_key',
'imp',
array($address, $keyid)
);
if ($key) {
return $key;
}
} catch (Horde_Exception_HookNotSet $e) {}
}

/* Try retrieving by e-mail only first. */
$result = null;
Expand Down

0 comments on commit 7d6ee2a

Please sign in to comment.