mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Hopefully resolve #231
This commit is contained in:
parent
938fd36a9b
commit
3fd4cd5d33
2 changed files with 7 additions and 13 deletions
|
|
@ -28,6 +28,7 @@ trait Pgp
|
|||
* BSD 4.4 max length = 104
|
||||
*/
|
||||
if (80 < \strlen($homedir)) {
|
||||
\clearstatcache();
|
||||
// First try a symbolic link
|
||||
$tmpdir = \sys_get_temp_dir() . '/snappymail';
|
||||
// if (\RainLoop\Utils::inOpenBasedir($tmpdir) &&
|
||||
|
|
@ -39,7 +40,7 @@ trait Pgp
|
|||
}
|
||||
// Else try ~/.gnupg/ + hash(email address)
|
||||
if (80 < \strlen($homedir)) {
|
||||
$tmpdir = ($_SERVER['HOME'] ?: \exec('echo ~') ?: \dirname(getcwd())) . '/.gnupg/';
|
||||
$tmpdir = ($_SERVER['HOME'] ?: \exec('echo ~') ?: \dirname(\getcwd())) . '/.gnupg/';
|
||||
if ($oAccount instanceof \RainLoop\Model\AdditionalAccount) {
|
||||
$tmpdir .= \sha1($oAccount->ParentEmail());
|
||||
} else {
|
||||
|
|
@ -50,6 +51,10 @@ trait Pgp
|
|||
$homedir = $link;
|
||||
}
|
||||
}
|
||||
|
||||
if (104 <= \strlen($homedir . '/S.gpg-agent.extra')) {
|
||||
throw new \Exception("socket name for '{$homedir}/S.gpg-agent.extra' is too long");
|
||||
}
|
||||
}
|
||||
|
||||
return \SnappyMail\PGP\GnuPG::getInstance($homedir);
|
||||
|
|
|
|||
|
|
@ -81,18 +81,7 @@ class GPG
|
|||
|
||||
function __construct(string $homedir)
|
||||
{
|
||||
$homedir = \rtrim($homedir, '/\\');
|
||||
// BSD 4.4 max length
|
||||
if (104 <= \strlen($homedir . '/S.gpg-agent.extra')) {
|
||||
throw new \Exception("socket name for '{$homedir}/S.gpg-agent.extra' is too long");
|
||||
}
|
||||
|
||||
\clearstatcache();
|
||||
if ($homedir && !\is_dir($homedir) && !\mkdir($homedir, 0700, true)) {
|
||||
throw new \Exception("mkdir({$homedir}) failed");
|
||||
}
|
||||
|
||||
$this->options['homedir'] = $homedir;
|
||||
$this->options['homedir'] = \rtrim($homedir, '/\\');
|
||||
|
||||
// the random seed file makes subsequent actions faster so only disable it if we have to.
|
||||
if ($this->options['homedir'] && !\is_writeable($this->options['homedir'])) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue