mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved GPGP homedir detection for #208
This commit is contained in:
parent
3aa319b230
commit
7fec4e849b
1 changed files with 8 additions and 3 deletions
|
|
@ -30,6 +30,7 @@ trait Pgp
|
||||||
if (80 < \strlen($homedir)) {
|
if (80 < \strlen($homedir)) {
|
||||||
// First try a symbolic link
|
// First try a symbolic link
|
||||||
$tmpdir = \sys_get_temp_dir() . '/snappymail';
|
$tmpdir = \sys_get_temp_dir() . '/snappymail';
|
||||||
|
// if (\RainLoop\Utils::inOpenBasedir($tmpdir) &&
|
||||||
if (\is_dir($tmpdir) || \mkdir($tmpdir, 0700, true)) {
|
if (\is_dir($tmpdir) || \mkdir($tmpdir, 0700, true)) {
|
||||||
$link = $tmpdir . '/' . \md5($homedir);
|
$link = $tmpdir . '/' . \md5($homedir);
|
||||||
if (\is_link($link) || \symlink($homedir, $link)) {
|
if (\is_link($link) || \symlink($homedir, $link)) {
|
||||||
|
|
@ -38,11 +39,15 @@ trait Pgp
|
||||||
}
|
}
|
||||||
// Else try ~/.gnupg/ + hash(email address)
|
// Else try ~/.gnupg/ + hash(email address)
|
||||||
if (80 < \strlen($homedir)) {
|
if (80 < \strlen($homedir)) {
|
||||||
$homedir = ($_SERVER['HOME'] ?: \exec('echo ~')) . '/.gnupg/';
|
$tmpdir = ($_SERVER['HOME'] ?: \exec('echo ~') ?: \dirname(getcwd())) . '/.gnupg/';
|
||||||
if ($oAccount instanceof \RainLoop\Model\AdditionalAccount) {
|
if ($oAccount instanceof \RainLoop\Model\AdditionalAccount) {
|
||||||
$homedir .= \sha1($oAccount->ParentEmail());
|
$tmpdir .= \sha1($oAccount->ParentEmail());
|
||||||
} else {
|
} else {
|
||||||
$homedir .= \sha1($oAccount->Email());
|
$tmpdir .= \sha1($oAccount->Email());
|
||||||
|
}
|
||||||
|
// if (\RainLoop\Utils::inOpenBasedir($tmpdir) &&
|
||||||
|
if (\is_dir($tmpdir) || \mkdir($tmpdir, 0700, true)) {
|
||||||
|
$homedir = $link;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue