mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
*[Sessions]: Now session is accessible if process is ran by root. Fixing bug: https://bugs.php.net/bug.php?id=69582
This commit is contained in:
parent
2424b349ad
commit
a2c461d58a
1 changed files with 8 additions and 2 deletions
|
@ -195,8 +195,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 (fstat(data->fd, &sbuf) || (sbuf.st_uid != 0 && sbuf.st_uid != getuid() && sbuf.st_uid != geteuid() && getuid() != 0)) {
|
||||
close(data->fd);
|
||||
data->fd = -1;
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue