[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 10 Jan 2011 00:30:07 + Revision: http://svn.php.net/viewvc?view=revisionrevision=307315 Log: - fix possible NULL deref Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2011-01-10 00:06:29 UTC (rev 307314) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2011-01-10 00:30:07 UTC (rev 307315) @@ -1887,6 +1887,9 @@ /* realpath() returns CWD */ if (!*path) { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + return NULL; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; if (VCWD_GETCWD(cwd, MAXPATHLEN)) { @@ -1898,6 +1901,9 @@ new_state.cwd_length = strlen(cwd); } else { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + return NULL; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; } Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:06:29 UTC (rev 307314) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:30:07 UTC (rev 307315) @@ -1874,6 +1874,9 @@ /* realpath() returns CWD */ if (!*path) { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + return NULL; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; if (VCWD_GETCWD(cwd, MAXPATHLEN)) { @@ -1885,6 +1888,9 @@ new_state.cwd_length = strlen(cwd); } else { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + return NULL; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 10 Jan 2011 00:43:08 + Revision: http://svn.php.net/viewvc?view=revisionrevision=307316 Log: - some more possible NULL deref Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2011-01-10 00:30:07 UTC (rev 307315) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2011-01-10 00:43:08 UTC (rev 307316) @@ -509,6 +509,9 @@ *length = 1; retval = (char *) malloc(2); + if (retval == NULL) { + return NULL; + } retval[0] = DEFAULT_SLASH; retval[1] = '\0'; return retval; @@ -521,6 +524,9 @@ *length = state-cwd_length+1; retval = (char *) malloc(*length+1); + if (retval == NULL) { + return NULL; + } memcpy(retval, state-cwd, *length); retval[0] = toupper(retval[0]); retval[*length-1] = DEFAULT_SLASH; @@ -648,6 +654,10 @@ realpath_cache_bucket *bucket = malloc(size); unsigned long n; + if (bucket == NULL) { + return; + } + #ifdef PHP_WIN32 bucket-key = realpath_cache_key(path, path_len TSRMLS_CC); #else @@ -866,6 +876,9 @@ } pbuffer = (REPARSE_DATA_BUFFER *)tsrm_do_alloca(MAXIMUM_REPARSE_DATA_BUFFER_SIZE, use_heap_large); + if (pbuffer == NULL) { + return -1; + } if(!DeviceIoControl(hLink, FSCTL_GET_REPARSE_POINT, NULL, 0, pbuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, retlength, NULL)) { tsrm_free_alloca(pbuffer, use_heap_large); CloseHandle(hLink); @@ -952,9 +965,9 @@ } if (!isVolume) { - char * tmp = substitutename + substitutename_off; + char * tmp2 = substitutename + substitutename_off; for(bufindex = 0; bufindex (substitutename_len - substitutename_off); bufindex++) { - *(path + bufindex) = *(tmp + bufindex); + *(path + bufindex) = *(tmp2 + bufindex); } *(path + bufindex) = 0; @@ -1370,6 +1383,10 @@ /* realpath() returns CWD */ if (!*path) { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + retval = NULL; + goto end; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; if (VCWD_GETCWD(cwd, MAXPATHLEN)) { @@ -1379,6 +1396,10 @@ CWD_STATE_COPY(new_state, CWDG(cwd)); } else { new_state.cwd = (char*)malloc(1); + if (new_state.cwd == NULL) { + retval = NULL; + goto end; + } new_state.cwd[0] = '\0'; new_state.cwd_length = 0; } @@ -1394,7 +1415,7 @@ } CWD_STATE_FREE(new_state); - +end: return retval; } /* }}} */ Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:30:07 UTC (rev 307315) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2011-01-10 00:43:08 UTC (rev 307316) @@ -497,6 +497,9 @@ *length = 1; retval = (char *) malloc(2); + if (retval == NULL) { + return NULL; + } retval[0] = DEFAULT_SLASH; retval[1] = '\0'; return retval; @@ -509,6 +512,9 @@ *length = state-cwd_length+1; retval = (char *) malloc(*length+1); + if (retval == NULL) { + return NULL; + } memcpy(retval, state-cwd, *length); retval[0] = toupper(retval[0]); retval[*length-1] = DEFAULT_SLASH; @@ -636,6 +642,10 @@ realpath_cache_bucket *bucket = malloc(size); unsigned long n; + if (bucket == NULL) { + return; + } + #ifdef PHP_WIN32 bucket-key = realpath_cache_key(path, path_len TSRMLS_CC); #else @@ -854,6 +864,9 @@ }
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Fri, 17 Sep 2010 11:34:49 + Revision: http://svn.php.net/viewvc?view=revisionrevision=303461 Log: - restore VOLUME_NAME_NT and VOLUME_NAME_DOS definition, thx Andrey for the headup Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-09-17 10:51:53 UTC (rev 303460) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-09-17 11:34:49 UTC (rev 303461) @@ -39,6 +39,14 @@ # ifndef IO_REPARSE_TAG_SYMLINK # define IO_REPARSE_TAG_SYMLINK 0xA00C # endif + +# ifndef VOLUME_NAME_NT +# define VOLUME_NAME_NT 0x2 +# endif + +# ifndef VOLUME_NAME_DOS +# define VOLUME_NAME_DOS 0x0 +# endif #endif #ifndef S_IFLNK Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-09-17 10:51:53 UTC (rev 303460) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-09-17 11:34:49 UTC (rev 303461) @@ -39,6 +39,14 @@ # ifndef IO_REPARSE_TAG_SYMLINK # define IO_REPARSE_TAG_SYMLINK 0xA00C # endif + +# ifndef VOLUME_NAME_NT +# define VOLUME_NAME_NT 0x2 +# endif + +# ifndef VOLUME_NAME_DOS +# define VOLUME_NAME_DOS 0x0 +# endif #endif #ifndef S_IFLNK -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 13 Sep 2010 10:58:18 + Revision: http://svn.php.net/viewvc?view=revisionrevision=303315 Log: - sanity check for the path length and don't treat UNC as local path (no functional change, only less ops) Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-09-13 10:47:32 UTC (rev 303314) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-09-13 10:58:18 UTC (rev 303315) @@ -273,17 +273,20 @@ { WIN32_FILE_ATTRIBUTE_DATA data; __int64 t; + const size_t path_len = strlen(path); if (!GetFileAttributesEx(path, GetFileExInfoStandard, data)) { return stat(path, buf); } - if (path[1] == ':') { + if (path_len = 1 path[1] == ':') { if (path[0] = 'A' path[0] = 'Z') { buf-st_dev = buf-st_rdev = path[0] - 'A'; } else { buf-st_dev = buf-st_rdev = path[0] - 'a'; } + } else if (IS_UNC_PATH(path, path_len)) { + buf-st_dev = buf-st_rdev = 0; } else { char cur_path[MAXPATHLEN+1]; DWORD len = sizeof(cur_path); Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-09-13 10:47:32 UTC (rev 303314) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-09-13 10:58:18 UTC (rev 303315) @@ -273,17 +273,20 @@ { WIN32_FILE_ATTRIBUTE_DATA data; __int64 t; + const size_t path_len = strlen(path); if (!GetFileAttributesEx(path, GetFileExInfoStandard, data)) { return stat(path, buf); } - if (path[1] == ':') { + if (path_len = 1 path[1] == ':') { if (path[0] = 'A' path[0] = 'Z') { buf-st_dev = buf-st_rdev = path[0] - 'A'; } else { buf-st_dev = buf-st_rdev = path[0] - 'a'; } + } else if (IS_UNC_PATH(path, path_len)) { + buf-st_dev = buf-st_rdev = 0; } else { char cur_path[MAXPATHLEN+1]; DWORD len = sizeof(cur_path); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Fri, 10 Sep 2010 19:21:02 + Revision: http://svn.php.net/viewvc?view=revisionrevision=303262 Log: - remove 'UNC' from the target Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-09-10 18:20:43 UTC (rev 303261) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-09-10 19:21:02 UTC (rev 303262) @@ -249,9 +249,17 @@ /* Skip first 4 characters if they are \??\ */ if(target[0] == '\\' target[1] == '\\' target[2] == '?' target[3] == '\\') { char tmp[MAXPATHLEN]; - + unsigned int offset = 4; dwRet -= 4; - memcpy(tmp, target + 4, dwRet); + + /* \??\UNC\ */ + if (dwRet 7 target[4] == 'U' target[5] == 'N' target[6] == 'C') { + offset += 2; + dwRet -= 2; + target[offset] = '\\'; + } + + memcpy(tmp, target + offset, dwRet); memcpy(target, tmp, dwRet); } } Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-09-10 18:20:43 UTC (rev 303261) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-09-10 19:21:02 UTC (rev 303262) @@ -249,9 +249,17 @@ /* Skip first 4 characters if they are \??\ */ if(target[0] == '\\' target[1] == '\\' target[2] == '?' target[3] == '\\') { char tmp[MAXPATHLEN]; + unsigned int offset = 4; + dwRet -= 4; - dwRet -= 4; - memcpy(tmp, target + 4, dwRet); + /* \??\UNC\ */ + if (dwRet 7 target[4] == 'U' target[5] == 'N' target[6] == 'C') { + offset += 2; + dwRet -= 2; + target[offset] = '\\'; + } + + memcpy(tmp, target + offset, dwRet); memcpy(target, tmp, dwRet); } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Fri, 27 Aug 2010 10:09:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=302847 Log: - WS Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2010-08-27 09:07:36 UTC (rev 302846) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c 2010-08-27 10:09:52 UTC (rev 302847) @@ -245,7 +245,7 @@ } if (tmp != cur_path) { free(tmp); - } + } } buf-st_uid = buf-st_gid = buf-st_ino = 0; buf-st_mode = (data.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY) ? (S_IFDIR|S_IEXEC|(S_IEXEC3)|(S_IEXEC6)) : S_IFREG; @@ -255,9 +255,9 @@ if (path[len-4] == '.') { if (_memicmp(path+len-3, exe, 3) == 0 || - _memicmp(path+len-3, com, 3) == 0 || - _memicmp(path+len-3, bat, 3) == 0 || - _memicmp(path+len-3, cmd, 3) == 0) { +_memicmp(path+len-3, com, 3) == 0 || +_memicmp(path+len-3, bat, 3) == 0 || +_memicmp(path+len-3, cmd, 3) == 0) { buf-st_mode |= (S_IEXEC|(S_IEXEC3)|(S_IEXEC6)); } } @@ -493,7 +493,7 @@ while (*bucket != NULL) { if (key == (*bucket)-key path_len == (*bucket)-path_len - memcmp(path, (*bucket)-path, path_len) == 0) { + memcmp(path, (*bucket)-path, path_len) == 0) { realpath_cache_bucket *r = *bucket; *bucket = (*bucket)-next; CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r-path_len + 1 + r-realpath_len + 1; @@ -512,7 +512,7 @@ int same = 1; if (realpath_len != path_len || - memcmp(path, realpath, path_len) != 0) { + memcmp(path, realpath, path_len) != 0) { size += realpath_len + 1; same = 0; } @@ -570,7 +570,7 @@ CWDG(realpath_cache_size) -= sizeof(realpath_cache_bucket) + r-path_len + 1 + r-realpath_len + 1; free(r); } else if (key == (*bucket)-key path_len == (*bucket)-path_len - memcmp(path, (*bucket)-path, path_len) == 0) { + memcmp(path, (*bucket)-path, path_len) == 0) { return *bucket; } else { bucket = (*bucket)-next; @@ -582,7 +582,7 @@ CWD_API realpath_cache_bucket* realpath_cache_lookup(const char *path, int path_len, time_t t TSRMLS_DC) /* {{{ */ { -return realpath_cache_find(path, path_len, t TSRMLS_CC); + return realpath_cache_find(path, path_len, t TSRMLS_CC); } /* }}} */ @@ -650,14 +650,14 @@ if (!start) { /* leading '..' must not be removed in case of relative path */ if (j == 0 path[0] == '.' path[1] == '.' - IS_SLASH(path[2])) { + IS_SLASH(path[2])) { path[3] = '.'; path[4] = '.'; path[5] = DEFAULT_SLASH; j = 5; } else if (j 0 - path[j+1] == '.' path[j+2] == '.' - IS_SLASH(path[j+3])) { + path[j+1] == '.' path[j+2] == '.' + IS_SLASH(path[j+3])) { j += 4; path[j++] = '.'; path[j++] = '.'; @@ -683,18 +683,18 @@ if (!*t) { *t = time(0); } - if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) { - if (is_dir !bucket-is_dir) { + if ((bucket = realpath_cache_find(path, len, *t TSRMLS_CC)) != NULL) { +if (is_dir !bucket-is_dir) { /* not a directory */ return -1; - } else { - if (link_is_dir) { - *link_is_dir = bucket-is_dir; - } +} else { + if (link_is_dir) { + *link_is_dir = bucket-is_dir; + } memcpy(path, bucket-realpath, bucket-realpath_len + 1); -return bucket-realpath_len; + return bucket-realpath_len; } - } + } } #ifdef TSRM_WIN32 @@ -903,7 +903,7 @@ if (save S_ISLNK(st.st_mode)) { if (++(*ll) LINK_MAX || (j = readlink(tmp, path, MAXPATHLEN)) 0) { - /* too many links or broken symlinks */ +/* too many links or broken symlinks */ tsrm_free_alloca(tmp, use_heap); return -1; } @@ -915,10 +915,10 @@ return -1; } } else { - if (i + j = MAXPATHLEN-1) { +if (i + j = MAXPATHLEN-1) { tsrm_free_alloca(tmp, use_heap); return -1; /* buffer overflow */ - } +} memmove(path+i, path, j+1); memcpy(path, tmp, i-1); path[i-1] = DEFAULT_SLASH; @@ -1042,14 +1042,14 @@ state_cwd_length++; } while (state-cwd[state_cwd_length] - !IS_SLASH(state-cwd[state_cwd_length])) { + !IS_SLASH(state-cwd[state_cwd_length])) { state_cwd_length++; } while (IS_SLASH(state-cwd[state_cwd_length])) { state_cwd_length++; } while (state-cwd[state_cwd_length] - !IS_SLASH(state-cwd[state_cwd_length])) { + !IS_SLASH(state-cwd[state_cwd_length])) { state_cwd_length++; } } @@ -1078,7 +1078,7 @@ #ifdef TSRM_WIN32 if (memchr(resolved_path, '*', path_length) || -
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Wed, 03 Feb 2010 16:11:56 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294418 Log: - vc6 does not expose it Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-02-03 15:59:32 UTC (rev 294417) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-02-03 16:11:56 UTC (rev 294418) @@ -1002,7 +1002,11 @@ if (path_length == 0 || path_length = MAXPATHLEN-1) { #ifdef TSRM_WIN32 +# if _MSC_VER 1300 + errno = EINVAL; +# else _set_errno(EINVAL); +# endif #else errno = EINVAL; #endif Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-02-03 15:59:32 UTC (rev 294417) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-02-03 16:11:56 UTC (rev 294418) @@ -1002,7 +1002,11 @@ if (path_length == 0 || path_length = MAXPATHLEN-1) { #ifdef TSRM_WIN32 +# if _MSC_VER 1300 + errno = EINVAL; +# else _set_errno(EINVAL); +# endif #else errno = EINVAL; #endif -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 01 Feb 2010 15:22:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294310 Log: - set errno on failure so that the caller can still rely on strerror (reporting wrong error w/o this change) Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-02-01 15:19:30 UTC (rev 294309) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-02-01 15:22:31 UTC (rev 294310) @@ -1001,6 +1001,11 @@ TSRMLS_FETCH(); if (path_length == 0 || path_length = MAXPATHLEN-1) { +#ifdef TSRM_WIN32 + _set_errno(EINVAL); +#else + errno = EINVAL +#endif return 1; } Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-02-01 15:19:30 UTC (rev 294309) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-02-01 15:22:31 UTC (rev 294310) @@ -1001,6 +1001,11 @@ TSRMLS_FETCH(); if (path_length == 0 || path_length = MAXPATHLEN-1) { +#ifdef TSRM_WIN32 + _set_errno(EINVAL); +#else + errno = EINVAL +#endif return 1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 01 Feb 2010 15:31:58 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294312 Log: - oops, wrong one applied, fix build. Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-02-01 15:24:10 UTC (rev 294311) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-02-01 15:31:58 UTC (rev 294312) @@ -1004,7 +1004,7 @@ #ifdef TSRM_WIN32 _set_errno(EINVAL); #else - errno = EINVAL + errno = EINVAL; #endif return 1; } Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-02-01 15:24:10 UTC (rev 294311) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-02-01 15:31:58 UTC (rev 294312) @@ -1004,7 +1004,7 @@ #ifdef TSRM_WIN32 _set_errno(EINVAL); #else - errno = EINVAL + errno = EINVAL; #endif return 1; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Wed, 27 Jan 2010 16:43:16 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294100 Log: - fix leak, win only Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-01-27 16:14:53 UTC (rev 294099) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-01-27 16:43:16 UTC (rev 294100) @@ -432,8 +432,8 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ { register unsigned long h; - char *bucket_key = tsrm_win32_get_path_sid_key(path TSRMLS_CC); - char *bucket_key_start = (char *)bucket_key; + char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); + char *bucket_key = (char *)bucket_key_start; const char *e = bucket_key + strlen(bucket_key); if (!bucket_key) { @@ -444,11 +444,7 @@ h *= 16777619; h ^= *bucket_key++; } - /* if no SID were present the path is returned. Otherwise a Heap - allocated string is returned. */ - if (bucket_key_start != path) { - LocalFree(bucket_key_start); - } + HeapFree(GetProcessHeap(), 0, (LPVOID)bucket_key_start); return h; } /* }}} */ Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-01-27 16:14:53 UTC (rev 294099) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-01-27 16:43:16 UTC (rev 294100) @@ -432,8 +432,8 @@ static inline unsigned long realpath_cache_key(const char *path, int path_len TSRMLS_DC) /* {{{ */ { register unsigned long h; - char *bucket_key = tsrm_win32_get_path_sid_key(path TSRMLS_CC); - char *bucket_key_start = (char *)bucket_key; + char *bucket_key_start = tsrm_win32_get_path_sid_key(path TSRMLS_CC); + char *bucket_key = (char *)bucket_key_start; const char *e = bucket_key + strlen(bucket_key); if (!bucket_key) { @@ -444,11 +444,7 @@ h *= 16777619; h ^= *bucket_key++; } - /* if no SID were present the path is returned. Otherwise a Heap - allocated string is returned. */ - if (bucket_key_start != path) { - LocalFree(bucket_key_start); - } + HeapFree(GetProcessHeap(), 0, (LPVOID)bucket_key_start); return h; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Wed, 27 Jan 2010 16:44:48 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294101 Log: - little comment to avoid undesired changes in this section Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-01-27 16:43:16 UTC (rev 294100) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-01-27 16:44:48 UTC (rev 294101) @@ -1514,6 +1514,7 @@ /* rename on windows will fail if newname already exists. MoveFileEx has to be used */ #ifdef TSRM_WIN32 + /* MoveFileEx returns 0 on failure, other way 'round for this function */ retval = (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0) ? -1 : 0; #else retval = rename(oldname, newname); Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-01-27 16:43:16 UTC (rev 294100) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-01-27 16:44:48 UTC (rev 294101) @@ -1514,6 +1514,7 @@ /* rename on windows will fail if newname already exists. MoveFileEx has to be used */ #ifdef TSRM_WIN32 + /* MoveFileEx returns 0 on failure, other way 'round for this function */ retval = (MoveFileEx(oldname, newname, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED) == 0) ? -1 : 0; #else retval = rename(oldname, newname); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Wed, 27 Jan 2010 16:46:43 + Revision: http://svn.php.net/viewvc?view=revisionrevision=294102 Log: - don't go through the reparse code when we have a share or DFS path (should fix #50542) Bug: http://bugs.php.net/50542 (Feedback) scandir() cannot open UNC paths since PHP 5.3.1 Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-01-27 16:44:48 UTC (rev 294101) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2010-01-27 16:46:43 UTC (rev 294102) @@ -714,7 +714,9 @@ tmp = tsrm_do_alloca(len+1, use_heap); memcpy(tmp, path, len+1); - if(save (data.dwFileAttributes FILE_ATTRIBUTE_REPARSE_POINT)) { + if(save + !(IS_UNC_PATH(path, len) len = 3 path[2] != '?') + (data.dwFileAttributes FILE_ATTRIBUTE_REPARSE_POINT)) { /* File is a reparse point. Get the target */ HANDLE hLink = NULL; REPARSE_DATA_BUFFER * pbuffer; Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-01-27 16:44:48 UTC (rev 294101) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2010-01-27 16:46:43 UTC (rev 294102) @@ -714,7 +714,9 @@ tmp = tsrm_do_alloca(len+1, use_heap); memcpy(tmp, path, len+1); - if(save (data.dwFileAttributes FILE_ATTRIBUTE_REPARSE_POINT)) { + if(save + !(IS_UNC_PATH(path, len) len = 3 path[2] != '?') + (data.dwFileAttributes FILE_ATTRIBUTE_REPARSE_POINT)) { /* File is a reparse point. Get the target */ HANDLE hLink = NULL; REPARSE_DATA_BUFFER * pbuffer; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 14 Sep 2009 18:46:56 + Revision: http://svn.php.net/viewvc?view=revisionrevision=288339 Log: - Fix #48746, improve fix to support all possible cases (see latest comment in the report) Bug: http://bugs.php.net/48746 (Assigned) Unable to browse directories within Junction Points Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-09-14 18:12:51 UTC (rev 288338) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-09-14 18:46:56 UTC (rev 288339) @@ -667,11 +667,14 @@ /* File is a reparse point. Get the target */ HANDLE hLink = NULL; REPARSE_DATA_BUFFER * pbuffer; - unsigned int retlength = 0, rname_off = 0; - int bufindex = 0, rname_len = 0, isabsolute = 0; + unsigned int retlength = 0; + int bufindex = 0, isabsolute = 0; wchar_t * reparsetarget; - WCHAR szVolumePathNames[MAX_PATH]; BOOL isVolume = FALSE; + char printname[MAX_PATH]; + char substitutename[MAX_PATH]; + int printname_len, substitutename_len; + int substitutename_off = 0; if(++(*ll) LINK_MAX) { return -1; @@ -692,33 +695,61 @@ CloseHandle(hLink); if(pbuffer-ReparseTag == IO_REPARSE_TAG_SYMLINK) { - rname_len = pbuffer-SymbolicLinkReparseBuffer.PrintNameLength/2; - rname_off = pbuffer-SymbolicLinkReparseBuffer.PrintNameOffset/2; - if(rname_len = 0) { - rname_len = pbuffer-SymbolicLinkReparseBuffer.SubstituteNameLength/2; - rname_off = pbuffer-SymbolicLinkReparseBuffer.SubstituteNameOffset/2; - } - reparsetarget = pbuffer-SymbolicLinkReparseBuffer.ReparseTarget; + printname_len = pbuffer-MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR); isabsolute = (pbuffer-SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0; + if (!WideCharToMultiByte(CP_THREAD_ACP, 0, + reparsetarget + pbuffer-MountPointReparseBuffer.PrintNameOffset / sizeof(WCHAR), + printname_len + 1, + printname, MAX_PATH, NULL, NULL + )) { + tsrm_free_alloca(pbuffer, use_heap_large); + return -1; + }; + printname_len = pbuffer-MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR); + printname[printname_len] = 0; + + substitutename_len = pbuffer-MountPointReparseBuffer.SubstituteNameLength / sizeof(WCHAR); + if (!WideCharToMultiByte(CP_THREAD_ACP, 0, + reparsetarget + pbuffer-MountPointReparseBuffer.SubstituteNameOffset / sizeof(WCHAR), + substitutename_len + 1, + substitutename, MAX_PATH, NULL, NULL + )) { + tsrm_free_alloca(pbuffer, use_heap_large); + return -1; + }; + substitutename[substitutename_len] = 0; } else if(pbuffer-ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { - rname_len = pbuffer-MountPointReparseBuffer.PrintNameLength/2; - rname_off = pbuffer-MountPointReparseBuffer.PrintNameOffset/2; - if(rname_len = 0) { - rname_len = pbuffer-MountPointReparseBuffer.SubstituteNameLength/2; - rname_off = pbuffer-MountPointReparseBuffer.SubstituteNameOffset/2; - } + isabsolute = 1; + reparsetarget = pbuffer-MountPointReparseBuffer.ReparseTarget; + printname_len = pbuffer-MountPointReparseBuffer.PrintNameLength / sizeof(WCHAR);
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Tue, 01 Sep 2009 17:50:59 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287950 Log: - #48746, revert previous about volume. Fix volume support to allow all mounted points (with or without drives) Bug: http://bugs.php.net/48746 (Feedback) Unable to browse directories within Junction Points Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-09-01 17:46:17 UTC (rev 287949) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-09-01 17:50:59 UTC (rev 287950) @@ -671,6 +671,7 @@ int bufindex = 0, rname_len = 0, isabsolute = 0; wchar_t * reparsetarget; WCHAR szVolumePathNames[MAX_PATH]; + BOOL isVolume = FALSE; if(++(*ll) LINK_MAX) { return -1; @@ -718,35 +719,36 @@ } if(isabsolute rname_len 4) { - /* Skip first 4 characters if they are \\?\ and fetch the drive name */ - if ((reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'\\' - reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\')) { - BOOL res; - - res = GetVolumePathNameW(reparsetarget, szVolumePathNames, MAX_PATH); - if (!res) { - return -1; - } - reparsetarget = szVolumePathNames; - rname_off = 0; - rname_len = wcslen(szVolumePathNames); + /* Do not resolve volumes (for now). A mounted point can + target a volume without a drive, it is not certain that + all IO functions we use in php and its deps support + path with volume GUID instead of the DOS way, like: + d:\test\mnt\foo + \\?\Volume{62d1c3f8-83b9-11de-b108-806e6f6e6963}\foo + */ + if (wcsncmp(reparsetarget, L\\??\\Volume{,11) == 0 + || wcsncmp(reparsetarget, L?\\Volume{,11) == 0) { + isVolume = TRUE; } else - /* Skip first 4 characters if they are \??\*/ - if (reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'?' - reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\') { + /* do not use the \??\ and \\?\ prefix*/ + if (wcsncmp(reparsetarget, L\\??\\, 4) == 0 + || wcsncmp(reparsetarget, L?\\, 4) == 0) { rname_off += 4; rname_len -= 4; } } + if (!isVolume) { + /* Convert wide string to narrow string */ + for(bufindex = 0; bufindex rname_len; bufindex++) { + *(path + bufindex) = (char)(reparsetarget[rname_off + bufindex]); + } - /* Convert wide string to narrow string */ - for(bufindex = 0; bufindex rname_len; bufindex++) { - *(path + bufindex) = (char)(reparsetarget[rname_off + bufindex]); + *(path + bufindex) = 0; + j = bufindex; + } else { + j = rname_len + 1; } - - *(path + bufindex) = 0; tsrm_free_alloca(pbuffer, use_heap_large); - j = bufindex; if(isabsolute == 1) { if (!((j == 3) (path[1] == ':') (path[2] == '\\'))) { Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-09-01 17:46:17 UTC (rev 287949) +++
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Sat, 29 Aug 2009 12:21:47 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287877 Log: - Fix #48746, mounted volume support resolution Bug: http://bugs.php.net/48746 (Assigned) Unable to browse directories within Junction Points Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-29 10:24:56 UTC (rev 287876) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-29 12:21:47 UTC (rev 287877) @@ -670,6 +670,7 @@ unsigned int retlength = 0, rname_off = 0; int bufindex = 0, rname_len = 0, isabsolute = 0; wchar_t * reparsetarget; + WCHAR szVolumePathNames[MAX_PATH]; if(++(*ll) LINK_MAX) { return -1; @@ -717,17 +718,25 @@ } if(isabsolute rname_len 4) { - /* Skip first 4 characters if they are \\?\ */ - if(reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'\\' + /* Skip first 4 characters if they are \\?\ and fetch the drive name */ + if ((reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'\\' + reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\')) { + BOOL res; + + res = GetVolumePathNameW(reparsetarget, szVolumePathNames, MAX_PATH); + if (!res) { + return -1; + } + reparsetarget = szVolumePathNames; + rname_off = 0; + rname_len = wcslen(szVolumePathNames); + } else + /* Skip first 4 characters if they are \??\*/ + if (reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'?' reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\') { rname_off += 4; rname_len -= 4; } - if(reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'?' - reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\') { - rname_off += 4; - rname_len -= 4; - } } /* Convert wide string to narrow string */ @@ -740,11 +749,13 @@ j = bufindex; if(isabsolute == 1) { - /* use_realpath is 0 in the call below coz path is absolute*/ - j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, directory TSRMLS_CC); - if(j 0) { - tsrm_free_alloca(tmp, use_heap); - return -1; + if (!((j == 3) (path[1] == ':') (path[2] == '\\'))) { + /* use_realpath is 0 in the call below coz path is absolute*/ + j = tsrm_realpath_r(path, 0, j, ll, t, 0, is_dir, directory TSRMLS_CC); + if(j 0) { + tsrm_free_alloca(tmp, use_heap); + return -1; + } } } else { @@ -1010,7 +1021,6 @@ add_slash = (use_realpath != CWD_REALPATH) path_length 0 IS_SLASH(resolved_path[path_length-1]); t = CWDG(realpath_cache_ttl) ? 0 : -1; - path_length = tsrm_realpath_r(resolved_path, start, path_length, ll, t, use_realpath, 0, NULL TSRMLS_CC); if (path_length 0) { Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-29 10:24:56 UTC (rev 287876) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-29 12:21:47 UTC (rev 287877) @@ -670,6 +670,7 @@
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Thu, 27 Aug 2009 09:39:01 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287800 Log: - Fix for #48746, fix mounted volume and junctions when used from vista or later, they are actually prepended with \??\ Bug: http://bugs.php.net/48746 (Assigned) Unable to browse directories within Junction Points Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-27 08:50:07 UTC (rev 287799) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-27 09:39:01 UTC (rev 287800) @@ -723,6 +723,11 @@ rname_off += 4; rname_len -= 4; } + if(reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'?' + reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\') { + rname_off += 4; + rname_len -= 4; + } } /* Convert wide string to narrow string */ Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-27 08:50:07 UTC (rev 287799) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-27 09:39:01 UTC (rev 287800) @@ -723,6 +723,11 @@ rname_off += 4; rname_len -= 4; } + if(reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'?' + reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\') { + rname_off += 4; + rname_len -= 4; + } } /* Convert wide string to narrow string */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Wed, 26 Aug 2009 20:44:05 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287781 Log: - fix #48746, regression with file operaiton on path with junctions Bug: http://bugs.php.net/48746 (Assigned) Unable to browse directories within Junction Points Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-26 20:03:49 UTC (rev 287780) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-26 20:44:05 UTC (rev 287781) @@ -692,12 +692,22 @@ if(pbuffer-ReparseTag == IO_REPARSE_TAG_SYMLINK) { rname_len = pbuffer-SymbolicLinkReparseBuffer.PrintNameLength/2; rname_off = pbuffer-SymbolicLinkReparseBuffer.PrintNameOffset/2; + if(rname_len = 0) { + rname_len = pbuffer-SymbolicLinkReparseBuffer.SubstituteNameLength/2; + rname_off = pbuffer-SymbolicLinkReparseBuffer.SubstituteNameOffset/2; + } + reparsetarget = pbuffer-SymbolicLinkReparseBuffer.ReparseTarget; isabsolute = (pbuffer-SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0; } else if(pbuffer-ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { rname_len = pbuffer-MountPointReparseBuffer.PrintNameLength/2; rname_off = pbuffer-MountPointReparseBuffer.PrintNameOffset/2; + if(rname_len = 0) { + rname_len = pbuffer-MountPointReparseBuffer.SubstituteNameLength/2; + rname_off = pbuffer-MountPointReparseBuffer.SubstituteNameOffset/2; + } + reparsetarget = pbuffer-MountPointReparseBuffer.ReparseTarget; isabsolute = 1; } @@ -706,6 +716,15 @@ return -1; } + if(isabsolute rname_len 4) { + /* Skip first 4 characters if they are \\?\ */ + if(reparsetarget[rname_off] == L'\\' reparsetarget[rname_off + 1] == L'\\' + reparsetarget[rname_off + 2] == L'?' reparsetarget[rname_off + 3] == L'\\') { + rname_off += 4; + rname_len -= 4; + } + } + /* Convert wide string to narrow string */ for(bufindex = 0; bufindex rname_len; bufindex++) { *(path + bufindex) = (char)(reparsetarget[rname_off + bufindex]); Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-26 20:03:49 UTC (rev 287780) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-26 20:44:05 UTC (rev 287781) @@ -692,12 +692,22 @@ if(pbuffer-ReparseTag == IO_REPARSE_TAG_SYMLINK) { rname_len = pbuffer-SymbolicLinkReparseBuffer.PrintNameLength/2; rname_off = pbuffer-SymbolicLinkReparseBuffer.PrintNameOffset/2; + if(rname_len = 0) { + rname_len = pbuffer-SymbolicLinkReparseBuffer.SubstituteNameLength/2; + rname_off = pbuffer-SymbolicLinkReparseBuffer.SubstituteNameOffset/2; + } + reparsetarget = pbuffer-SymbolicLinkReparseBuffer.ReparseTarget; isabsolute = (pbuffer-SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0; } else if(pbuffer-ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { rname_len = pbuffer-MountPointReparseBuffer.PrintNameLength/2; rname_off = pbuffer-MountPointReparseBuffer.PrintNameOffset/2; + if(rname_len = 0) { + rname_len = pbuffer-MountPointReparseBuffer.SubstituteNameLength/2; + rname_off = pbuffer-MountPointReparseBuffer.SubstituteNameOffset/2; + } + reparsetarget =
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Tue, 25 Aug 2009 09:32:31 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287676 Log: - be sure that the directory flag is set when we save a path in the cache Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-25 09:23:40 UTC (rev 287675) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-25 09:32:31 UTC (rev 287676) @@ -738,6 +738,7 @@ return -1; } } + directory = (data.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY); if(link_is_dir) { *link_is_dir = directory; Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-25 09:23:40 UTC (rev 287675) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-25 09:32:31 UTC (rev 287676) @@ -738,6 +738,7 @@ return -1; } } + directory = (data.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY); if(link_is_dir) { *link_is_dir = directory; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 24 Aug 2009 20:27:52 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287654 Log: - split atime and mtime Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-24 20:03:26 UTC (rev 287653) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-24 20:27:52 UTC (rev 287654) @@ -271,9 +271,6 @@ buf-st_atime = FileTimeToUnixTime(data.ftLastAccessTime); buf-st_ctime = FileTimeToUnixTime(data.ftCreationTime); buf-st_mtime = FileTimeToUnixTime(data.ftLastWriteTime); - if (buf-st_mtime != buf-st_atime) { - buf-st_atime = buf-st_mtime; - } return 0; } /* }}} */ @@ -741,6 +738,7 @@ return -1; } } + directory = (data.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY) != 0; if(link_is_dir) { *link_is_dir = directory; @@ -988,6 +986,7 @@ add_slash = (use_realpath != CWD_REALPATH) path_length 0 IS_SLASH(resolved_path[path_length-1]); t = CWDG(realpath_cache_ttl) ? 0 : -1; + path_length = tsrm_realpath_r(resolved_path, start, path_length, ll, t, use_realpath, 0, NULL TSRMLS_CC); if (path_length 0) { Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-24 20:03:26 UTC (rev 287653) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-24 20:27:52 UTC (rev 287654) @@ -271,9 +271,6 @@ buf-st_atime = FileTimeToUnixTime(data.ftLastAccessTime); buf-st_ctime = FileTimeToUnixTime(data.ftCreationTime); buf-st_mtime = FileTimeToUnixTime(data.ftLastWriteTime); - if (buf-st_mtime != buf-st_atime) { - buf-st_atime = buf-st_mtime; - } return 0; } /* }}} */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 24 Aug 2009 20:32:11 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287655 Log: - that part was for a separate fix Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-24 20:27:52 UTC (rev 287654) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-24 20:32:11 UTC (rev 287655) @@ -738,7 +738,6 @@ return -1; } } - directory = (data.dwFileAttributes FILE_ATTRIBUTE_DIRECTORY) != 0; if(link_is_dir) { *link_is_dir = directory; @@ -1194,7 +1193,7 @@ } /* }}} */ -static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ +TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ { FILETIME mtime, atime; HANDLE hFile; Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-24 20:27:52 UTC (rev 287654) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-24 20:32:11 UTC (rev 287655) @@ -1192,7 +1192,7 @@ } /* }}} */ -static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ +TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ { FILETIME mtime, atime; HANDLE hFile; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c trunk/TSRM/tsrm_virtual_cwd.c
pajoye Mon, 24 Aug 2009 20:33:36 + Revision: http://svn.php.net/viewvc?view=revisionrevision=287656 Log: - sigh. that too (separate fix). Changed paths: U php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c U php/php-src/trunk/TSRM/tsrm_virtual_cwd.c Modified: php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c === --- php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-24 20:32:11 UTC (rev 287655) +++ php/php-src/branches/PHP_5_3/TSRM/tsrm_virtual_cwd.c2009-08-24 20:33:36 UTC (rev 287656) @@ -1193,7 +1193,7 @@ } /* }}} */ -TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ +static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ { FILETIME mtime, atime; HANDLE hFile; Modified: php/php-src/trunk/TSRM/tsrm_virtual_cwd.c === --- php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-24 20:32:11 UTC (rev 287655) +++ php/php-src/trunk/TSRM/tsrm_virtual_cwd.c 2009-08-24 20:33:36 UTC (rev 287656) @@ -1192,7 +1192,7 @@ } /* }}} */ -TSRM_API int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ +static int win32_utime(const char *filename, struct utimbuf *buf) /* {{{ */ { FILETIME mtime, atime; HANDLE hFile; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php