Skip to content

Commit

Permalink
[jan] Detect unsupported GnuPG versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed May 3, 2017
1 parent 34bfab9 commit a0d76ad
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
21 changes: 15 additions & 6 deletions framework/Crypt/lib/Horde/Crypt/Pgp/Backend/Binary.php
Expand Up @@ -81,12 +81,21 @@ public function __construct($gnupg, $temp = null)
/* GnuPG 2 requires specifying the pinentry-mode. */
$result = $this->_callGpg(array('--version'), 'r');
if (preg_match('/gpg \(GnuPG\) (\d+\.\d+\.\d+)/', $result->stdout, $version) &&
version_compare($version[1], '2.1.12', 'ge') ) {
$this->_gnupg[] = '--pinentry-mode loopback';
file_put_contents(
$this->_tempdir . '/gpg-agent.conf',
'allow-loopback-pinentry'
);
version_compare($version[1], '2.1.0', '>')) {
if (version_compare($version[1], '2.1.12', '>=')) {
$this->_gnupg[] = '--pinentry-mode loopback';
file_put_contents(
$this->_tempdir . '/gpg-agent.conf',
'allow-loopback-pinentry'
);
} else {
throw new Horde_Crypt_Exception(
sprintf(
Horde_Crypt_Translation::t("Unsupported GnuPG version %s detected. Only versions < 2.1 and > 2.1.11 are supported."),
$version[1]
)
);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions framework/Crypt/package.xml
Expand Up @@ -27,6 +27,7 @@
</stability>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [jan] Detect unsupported GnuPG versions.
* [jan] Fix detection of new GnuPG API (Remi Collet &lt;remi@remirepo.net&gt;, PR #220).
</notes>
<contents>
Expand Down Expand Up @@ -1227,6 +1228,7 @@ Initial release as a PEAR package
<date>2017-05-03</date>
<license uri="http://www.horde.org/licenses/lgpl21">LGPL-2.1</license>
<notes>
* [jan] Detect unsupported GnuPG versions.
* [jan] Fix detection of new GnuPG API (Remi Collet &lt;remi@remirepo.net&gt;, PR #220).
</notes>
</release>
Expand Down

0 comments on commit a0d76ad

Please sign in to comment.