summaryrefslogtreecommitdiff
path: root/ext/session/mod_files.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2014-04-14 13:35:00 -0700
committerStanislav Malyshev <stas@php.net>2014-04-14 13:35:24 -0700
commit8bc82718aecf60696d2d0a9517403f8a282e3573 (patch)
tree8717a2312856a4b2ed2edf5ea1df0c6fe5042f42 /ext/session/mod_files.c
parent22acea99ff3456abf316e838bfdabe37628e36f8 (diff)
parenta186312832207437e4783024dcdece5232ac6c39 (diff)
downloadphp-git-8bc82718aecf60696d2d0a9517403f8a282e3573.tar.gz
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Fix #66942: openssl_seal() memory leak ws fix Conflicts: ext/openssl/openssl.c
Diffstat (limited to 'ext/session/mod_files.c')
-rw-r--r--ext/session/mod_files.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c
index 76f5d4c7c6..e435246eb9 100644
--- a/ext/session/mod_files.c
+++ b/ext/session/mod_files.c
@@ -136,27 +136,27 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
data->lastkey = estrdup(key);
- /* O_NOFOLLOW to prevent us from following evil symlinks */
+ /* O_NOFOLLOW to prevent us from following evil symlinks */
#ifdef O_NOFOLLOW
- data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode);
+ data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW, data->filemode);
#else
- /* Check to make sure that the opened file is not outside of allowable dirs.
- This is not 100% safe but it's hard to do something better without O_NOFOLLOW */
- if(PG(open_basedir) && lstat(buf, &sbuf) == 0 && S_ISLNK(sbuf.st_mode) && php_check_open_basedir(buf TSRMLS_CC)) {
- return;
- }
- data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode);
+ /* Check to make sure that the opened file is not outside of allowable dirs.
+ This is not 100% safe but it's hard to do something better without O_NOFOLLOW */
+ if(PG(open_basedir) && lstat(buf, &sbuf) == 0 && S_ISLNK(sbuf.st_mode) && php_check_open_basedir(buf TSRMLS_CC)) {
+ return;
+ }
+ data->fd = VCWD_OPEN_MODE(buf, O_CREAT | O_RDWR | O_BINARY, data->filemode);
#endif
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())) {
+ /* 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())) {
close(data->fd);
data->fd = -1;
return;
- }
+ }
#endif
flock(data->fd, LOCK_EX);