Changeset 6402 in vbox
- Timestamp:
- Jan 21, 2008 11:09:00 AM (17 years ago)
- svn:sync-xref-src-repo-rev:
- 27354
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r6384 r6402 1019 1019 } 1020 1020 1021 rc = VINF_SUCCESS; 1022 1021 1023 /* write access requested? */ 1022 1024 if (pParms->CreateFlags & ( SHFL_CF_ACT_REPLACE_IF_EXISTS … … 1029 1031 rc = vbsfMappingsQueryWritable (pClient, root, &fWritable); 1030 1032 if (RT_FAILURE(rc) || !fWritable) 1031 return VERR_WRITE_PROTECT; 1032 } 1033 1034 if (BIT_FLAG(pParms->CreateFlags, SHFL_CF_DIRECTORY)) 1035 { 1036 rc = vbsfOpenDir (pszFullPath, pParms); 1037 } 1038 else 1039 { 1040 rc = vbsfOpenFile (pszFullPath, pParms); 1033 rc = VERR_WRITE_PROTECT; 1034 } 1035 1036 if (RT_SUCCESS(rc)) 1037 { 1038 if (BIT_FLAG(pParms->CreateFlags, SHFL_CF_DIRECTORY)) 1039 rc = vbsfOpenDir (pszFullPath, pParms); 1040 else 1041 rc = vbsfOpenFile (pszFullPath, pParms); 1041 1042 } 1042 1043 } … … 1388 1389 } 1389 1390 1391 /* is the guest allowed to write to this share? */ 1392 bool fWritable; 1393 rc = vbsfMappingsQueryWritable (pClient, root, &fWritable); 1394 if (RT_FAILURE(rc) || !fWritable) 1395 return VERR_WRITE_PROTECT; 1396 1390 1397 *pcbBuffer = 0; 1391 1398 pSFDEntry = (RTFSOBJINFO *)pBuffer; … … 1687 1694 1688 1695 rc = vbsfBuildFullPath (pClient, root, pPath, cbPath, &pszFullPath, NULL); 1689 1690 1696 if (VBOX_SUCCESS (rc)) 1691 1697 { 1692 if (flags & SHFL_REMOVE_FILE) 1693 rc = RTFileDelete(pszFullPath); 1694 else 1695 rc = RTDirRemove(pszFullPath); 1698 /* is the guest allowed to write to this share? */ 1699 bool fWritable; 1700 rc = vbsfMappingsQueryWritable (pClient, root, &fWritable); 1701 if (RT_FAILURE(rc) || !fWritable) 1702 rc = VERR_WRITE_PROTECT; 1703 1704 if (VBOX_SUCCESS (rc)) 1705 { 1706 if (flags & SHFL_REMOVE_FILE) 1707 rc = RTFileDelete(pszFullPath); 1708 else 1709 rc = RTDirRemove(pszFullPath); 1710 } 1696 1711 1697 1712 #ifndef DEBUG_dmik … … 1733 1748 { 1734 1749 Log(("Rename %s to %s\n", pszFullPathSrc, pszFullPathDest)); 1735 if (flags & SHFL_RENAME_FILE) 1736 { 1737 rc = RTFileMove(pszFullPathSrc, pszFullPathDest, (flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTFILEMOVE_FLAGS_REPLACE : 0); 1738 } 1739 else 1740 { 1741 /* NT ignores the REPLACE flag and simply return and already exists error. */ 1742 rc = RTDirRename(pszFullPathSrc, pszFullPathDest, (flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTPATHRENAME_FLAGS_REPLACE : 0); 1750 1751 /* is the guest allowed to write to this share? */ 1752 bool fWritable; 1753 rc = vbsfMappingsQueryWritable (pClient, root, &fWritable); 1754 if (RT_FAILURE(rc) || !fWritable) 1755 rc = VERR_WRITE_PROTECT; 1756 1757 if (VBOX_SUCCESS (rc)) 1758 { 1759 if (flags & SHFL_RENAME_FILE) 1760 { 1761 rc = RTFileMove(pszFullPathSrc, pszFullPathDest, (flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTFILEMOVE_FLAGS_REPLACE : 0); 1762 } 1763 else 1764 { 1765 /* NT ignores the REPLACE flag and simply return and already exists error. */ 1766 rc = RTDirRename(pszFullPathSrc, pszFullPathDest, (flags & SHFL_RENAME_REPLACE_IF_EXISTS) ? RTPATHRENAME_FLAGS_REPLACE : 0); 1767 } 1743 1768 } 1744 1769
Note:
See TracChangeset
for help on using the changeset viewer.