mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'pull-request/1360' into PHP-7.0
* pull-request/1360: Fixed bug #69582 session not readable by root in CLI news entry for PR #1360
This commit is contained in:
commit
b0ff9ee688
2 changed files with 11 additions and 2 deletions
3
NEWS
3
NEWS
|
@ -8,6 +8,9 @@ PHP NEWS
|
||||||
- ZIP:
|
- ZIP:
|
||||||
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb)
|
. Fixed bug #70103 (ZipArchive::addGlob ignores remove_all_path option). (cmb)
|
||||||
|
|
||||||
|
- Session:
|
||||||
|
. Fixed bug #69582 (session not readable by root in CLI). (EvgeniySpinov)
|
||||||
|
|
||||||
19 Jan 2017 PHP 7.0.15
|
19 Jan 2017 PHP 7.0.15
|
||||||
|
|
||||||
- Core:
|
- Core:
|
||||||
|
|
|
@ -196,8 +196,14 @@ static void ps_files_open(ps_files *data, const char *key)
|
||||||
if (data->fd != -1) {
|
if (data->fd != -1) {
|
||||||
#ifndef PHP_WIN32
|
#ifndef PHP_WIN32
|
||||||
/* check that this session file was created by us or root – we
|
/* check that this session file was created by us or root – we
|
||||||
don't want to end up accepting the sessions of another webapp */
|
don't want to end up accepting the sessions of another webapp
|
||||||
if (fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteuid())) {
|
|
||||||
|
If the process is ran by root, we ignore session file ownership
|
||||||
|
Use case: session is initiated by Apache under non-root and then
|
||||||
|
accessed by backend with root permissions to execute some system tasks.
|
||||||
|
|
||||||
|
*/
|
||||||
|
if (zend_fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteuid() && getuid() != 0)) {
|
||||||
close(data->fd);
|
close(data->fd);
|
||||||
data->fd = -1;
|
data->fd = -1;
|
||||||
php_error_docref(NULL, E_WARNING, "Session data file is not created by your uid");
|
php_error_docref(NULL, E_WARNING, "Session data file is not created by your uid");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue