mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +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
|
@ -196,8 +196,14 @@ static void ps_files_open(ps_files *data, const char *key)
|
|||
if (data->fd != -1) {
|
||||
#ifndef PHP_WIN32
|
||||
/* check that this session file was created by us or root – we
|
||||
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())) {
|
||||
don't want to end up accepting the sessions of another webapp
|
||||
|
||||
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);
|
||||
data->fd = -1;
|
||||
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