Fix so temp_dir misconfiguration prints an error to the log (#6045)

pull/6043/head
Aleksander Machniak 7 years ago
parent 9ce8948294
commit 39e0b0e456

@ -55,6 +55,7 @@ CHANGELOG Roundcube Webmail
- Fix so links over images are not removed in plain text signatures converted from HTML (#4473)
- Fix various issues when downloading files with names containing non-ascii chars, use RFC 2231 (#5772)
- Fix broken long filenames when using imap4d server - workaround server bug (#6048)
- Fix so temp_dir misconfiguration prints an error to the log (#6045)
RELEASE 1.3.3
-------------

@ -210,8 +210,20 @@ class filesystem_attachments extends rcube_plugin
$file_path = pathinfo($path, PATHINFO_DIRNAME);
if ($temp_dir !== $file_path) {
// When the configured directory is not writable, or out of open_basedir path
// tempnam() fallbacks to system temp without a warning.
// We allow that, but we'll let to know the user about the misconfiguration.
if ($file_path == sys_get_temp_dir()) {
rcube::raise_error(array(
'file' => __FILE__,
'line' => __LINE__,
'message' => "Detected 'temp_dir' change. Access to '$temp_dir' restricted by filesystem permissions or open_basedir",
), true, false);
return true;
}
rcube::raise_error(array(
'code' => 403,
'file' => __FILE__,
'line' => __LINE__,
'message' => sprintf("%s can't read %s (not in temp_dir)",

Loading…
Cancel
Save