• Mike Kaganski's avatar
    tdf#98343: ensure PathRemoveFileSpec does not remove UNC's "\\" · 12e878d3
    Mike Kaganski yazdı
    PathRemoveFileSpec is used exclusively in GetCaseCorrectPathName(Ex).
    The GetCaseCorrectPathName function is only called for absolute or
    relative paths, not some arbitrary that chunks. So initial double
    backslashes are only possible for UNC paths.
    
    This change fixes handling of UNC paths by the functions. Previously,
    the UNC path was recursively shortened until it only consisted of a
    single "\"; then, if bCheckExistence was requested, testing this path
    failed, which resulted in the whole recursion to return empty result;
    else when returning from the recursion, original path components were
    appended, but initial double backslashes were never restored. This led
    to transformation "\\SERVER\Path\file.ext" to "\SERVER\Path\file.ext".
    
    The GetCaseCorrectPathName itself is only used in two places:
    osl_getSystemPathFromFileURL_() and osl_getFileStatus().
    
    osl_getSystemPathFromFileURL_ only calls GetCaseCorrectPathName for
    paths longer than 248 characters; bCheckExistence is false. In that
    case, the resulting wrong path (missing one initial backslash) was then
    processed in /* it should be an UNC path, use the according prefix */
    branch, where two initial characters of it were stripped, one of which
    being the first character of SERVER name. So, all the following
    manipulations with resulting path were incorrect. This code path was
    the reason for the bug.
    
    osl_getFileStatus calls GetCaseCorrectPathName always; it requires
    to check existence. This led to 0 returned from GetCaseCorrectPathName,
    then osl_getFileStatus continued with copying the original string, thus
    ignoring the error.
    
    Change-Id: If7409afa2c0dd6dd001c79e719acbfd271a6ab72
    Reviewed-on: https://gerrit.libreoffice.org/65158
    Tested-by: Jenkins
    Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
    12e878d3
Adı
Son kayıt (commit)
Son güncelleme
..
android Loading commit data...
cppunittester Loading commit data...
inc Loading commit data...
osl Loading commit data...
qa Loading commit data...
rtl Loading commit data...
test Loading commit data...
textenc Loading commit data...
util Loading commit data...
CppunitTest_Module_DLL.mk Loading commit data...
CppunitTest_sal_osl.mk Loading commit data...
CppunitTest_sal_osl_security.mk Loading commit data...
CppunitTest_sal_rtl.mk Loading commit data...
CppunitTest_sal_types.mk Loading commit data...
Executable_cppunittester.mk Loading commit data...
Executable_osl_process_child.mk Loading commit data...
Library_lo-bootstrap.mk Loading commit data...
Library_sal.mk Loading commit data...
Library_sal_textenc.mk Loading commit data...
Makefile Loading commit data...
Module_sal.mk Loading commit data...
README Loading commit data...