pajoye Wed, 26 Aug 2009 20:44:05 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=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.c 2009-08-26 20:03:49 UTC (rev 287780) +++ php/php-src/branches/PHP_5_3/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 = 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 = 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]);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
