diff options
author | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-19 17:41:58 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2020-10-26 11:21:14 +0100 |
commit | 848e24f24d7c05db04fe1ba87e6566a5c30323fd (patch) | |
tree | 80961f0f3bef0e88bfbd630f1b02f4fd3468eadd /Zend | |
parent | 2be27074b6e165d8d3e282150d02aa8abfcfec5e (diff) | |
download | php-git-848e24f24d7c05db04fe1ba87e6566a5c30323fd.tar.gz |
Fix #80258: Windows Deduplication Enabled, randon permission errors
A recent bug fix regarding symlinks claimed:
> After resolving reparse points, the path still may be a reparse
> point; in that case we have to resolve that reparse point as well.
While that is basically correct, some reparse points may point to
inaccessible system folders (e.g. `IO_REPARSE_TAG_DEDUP` points to
"\System Volume Information"). Since we don't know details about
arbitrary reparse points, and are mainly interested in nested symlinks,
we take a step back, and only resolve `IO_REPARSE_TAG_SYMLINK` for now.
Close GH-6354.
Diffstat (limited to 'Zend')
-rw-r--r-- | Zend/zend_virtual_cwd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 7c5ac825c5..b74313d3a5 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -741,7 +741,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void) static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, time_t *t, int use_realpath, int is_dir, int *link_is_dir) /* {{{ */ { size_t i, j; - int directory = 0, save; + int directory = 0, save, may_retry_reparse_point; #ifdef ZEND_WIN32 WIN32_FIND_DATAW dataw; HANDLE hFind = INVALID_HANDLE_VALUE; @@ -846,6 +846,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim #ifdef ZEND_WIN32 retry_reparse_point: + may_retry_reparse_point = 0; if (save) { pathw = php_win32_ioutil_any_to_w(path); if (!pathw) { @@ -940,6 +941,7 @@ retry_reparse_tag_cloud: CloseHandle(hLink); if(pbuffer->ReparseTag == IO_REPARSE_TAG_SYMLINK) { + may_retry_reparse_point = 1; reparsetarget = pbuffer->SymbolicLinkReparseBuffer.ReparseTarget; isabsolute = (pbuffer->SymbolicLinkReparseBuffer.Flags == 0) ? 1 : 0; #if VIRTUAL_CWD_DEBUG @@ -1076,7 +1078,7 @@ retry_reparse_tag_cloud: free_alloca(pbuffer, use_heap_large); free(substitutename); - { + if (may_retry_reparse_point) { DWORD attrs; FREE_PATHW() |