diff options
author | Joe Watkins <krakjoe@php.net> | 2017-01-06 06:05:38 +0000 |
---|---|---|
committer | Joe Watkins <krakjoe@php.net> | 2017-01-06 06:07:17 +0000 |
commit | 811dfaa57b914630e1805c96f3fed83ecc97cc45 (patch) | |
tree | 383418a8b90d7d078470508c1f0835d7ced1a449 | |
parent | de3649e2a360dc51f703106d10bc84e9ab0f3aa8 (diff) | |
parent | b0ff9ee6886f852c458bd877414a9b51e2acb0e9 (diff) | |
download | php-git-811dfaa57b914630e1805c96f3fed83ecc97cc45.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
Fixed bug #69582 session not readable by root in CLI
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | ext/session/mod_files.c | 10 |
2 files changed, 11 insertions, 2 deletions
@@ -8,6 +8,9 @@ PHP NEWS - ZIP: . 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.1.1 - Core: diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index d26a27db18..38cc80236e 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -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"); |