@@ -136,27 +136,27 @@ static void ps_files_open(ps_files *data, const char *key TSRMLS_DC)
136
136
137
137
data -> lastkey = estrdup (key );
138
138
139
- /* O_NOFOLLOW to prevent us from following evil symlinks */
139
+ /* O_NOFOLLOW to prevent us from following evil symlinks */
140
140
#ifdef O_NOFOLLOW
141
- data -> fd = VCWD_OPEN_MODE (buf , O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW , data -> filemode );
141
+ data -> fd = VCWD_OPEN_MODE (buf , O_CREAT | O_RDWR | O_BINARY | O_NOFOLLOW , data -> filemode );
142
142
#else
143
- /* Check to make sure that the opened file is not outside of allowable dirs.
144
- This is not 100% safe but it's hard to do something better without O_NOFOLLOW */
145
- if (PG (open_basedir ) && lstat (buf , & sbuf ) == 0 && S_ISLNK (sbuf .st_mode ) && php_check_open_basedir (buf TSRMLS_CC )) {
146
- return ;
147
- }
148
- data -> fd = VCWD_OPEN_MODE (buf , O_CREAT | O_RDWR | O_BINARY , data -> filemode );
143
+ /* Check to make sure that the opened file is not outside of allowable dirs.
144
+ This is not 100% safe but it's hard to do something better without O_NOFOLLOW */
145
+ if (PG (open_basedir ) && lstat (buf , & sbuf ) == 0 && S_ISLNK (sbuf .st_mode ) && php_check_open_basedir (buf TSRMLS_CC )) {
146
+ return ;
147
+ }
148
+ data -> fd = VCWD_OPEN_MODE (buf , O_CREAT | O_RDWR | O_BINARY , data -> filemode );
149
149
#endif
150
150
151
151
if (data -> fd != -1 ) {
152
152
#ifndef PHP_WIN32
153
- /* check that this session file was created by us or root – we
154
- don't want to end up accepting the sessions of another webapp */
155
- if (fstat (data -> fd , & sbuf ) || (sbuf .st_uid != 0 && sbuf .st_uid != getuid () && sbuf .st_uid != geteuid ())) {
153
+ /* check that this session file was created by us or root – we
154
+ don't want to end up accepting the sessions of another webapp */
155
+ if (fstat (data -> fd , & sbuf ) || (sbuf .st_uid != 0 && sbuf .st_uid != getuid () && sbuf .st_uid != geteuid ())) {
156
156
close (data -> fd );
157
157
data -> fd = -1 ;
158
158
return ;
159
- }
159
+ }
160
160
#endif
161
161
flock (data -> fd , LOCK_EX );
162
162
0 commit comments