mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-10-24 22:25:09 +03:00
Resolve #1990
This commit is contained in:
parent
343ef172d1
commit
870df2d861
3 changed files with 3 additions and 3 deletions
|
|
@ -487,7 +487,7 @@ abstract class Base
|
||||||
|
|
||||||
protected static function findBinary($name) : ?string
|
protected static function findBinary($name) : ?string
|
||||||
{
|
{
|
||||||
$binary = \function_exists('shell_exec') ? \trim((string) \shell_exec('which $name')) : '';
|
$binary = \function_exists('shell_exec') ? \trim((string) \shell_exec('which ' . \escapeshellarg($name))) : '';
|
||||||
if ($binary && \RainLoop\Utils::inOpenBasedir($binary) && \is_executable($binary)) {
|
if ($binary && \RainLoop\Utils::inOpenBasedir($binary) && \is_executable($binary)) {
|
||||||
return $binary;
|
return $binary;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ class PGP extends Base implements \SnappyMail\PGP\PGPInterface
|
||||||
// How to use gpgme-json ?
|
// How to use gpgme-json ?
|
||||||
$this->binary = static::findBinary('gpg');
|
$this->binary = static::findBinary('gpg');
|
||||||
|
|
||||||
$info = \preg_replace('/\R +/', ' ', `$this->binary --with-colons --list-config`);
|
$info = \preg_replace('/\R +/', ' ', \shell_exec(\escapeshellcmd($this->binary) . ' --with-colons --list-config'));
|
||||||
if (\preg_match('/cfg:version:([0-9]+\\.[0-9]+\\.[0-9]+)/', $info, $match)) {
|
if (\preg_match('/cfg:version:([0-9]+\\.[0-9]+\\.[0-9]+)/', $info, $match)) {
|
||||||
$this->version = $match[1];
|
$this->version = $match[1];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class SMIME extends Base
|
||||||
// How to use gpgme-json ?
|
// How to use gpgme-json ?
|
||||||
$this->binary = static::findBinary('gpgsm');
|
$this->binary = static::findBinary('gpgsm');
|
||||||
|
|
||||||
$info = \preg_replace('/\R +/', ' ', \shell_exec("{$this->binary} --version"));
|
$info = \preg_replace('/\R +/', ' ', \shell_exec(\escapeshellcmd($this->binary) . ' --version') );
|
||||||
if (\preg_match('/gpgsm.+([0-9]+\\.[0-9]+\\.[0-9]+)/', $info, $match)) {
|
if (\preg_match('/gpgsm.+([0-9]+\\.[0-9]+\\.[0-9]+)/', $info, $match)) {
|
||||||
$this->version = $match[1];
|
$this->version = $match[1];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue