VirtualBox

Ignore:
Timestamp:
Dec 15, 2011 11:44:19 AM (13 years ago)
Author:
vboxsync
Message:

backed out previous changeset

Location:
trunk/src/VBox/HostServices/SharedFolders
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedFolders/service.cpp

    r39626 r39627  
    244244            else
    245245            {
    246                 pszFolderName = (char*)RTStrAlloc(cbFolderName + 1);
     246                pszFolderName = (char*)RTStrAlloc(cbFolderName);
    247247                AssertReturn(pszFolderName, VERR_NO_MEMORY);
    248248
    249                 rc = SSMR3GetStrZ(pSSM, pszFolderName, cbFolderName + 1);
     249                rc = SSMR3GetStrZ(pSSM, mapping.pszFolderName, cbFolderName);
    250250                AssertRCReturn(rc, rc);
    251251                mapping.pszFolderName = pszFolderName;
  • trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp

    r39626 r39627  
    4242#endif
    4343
     44// never follow symbolic links */
     45//#define SHFL_RT_LINK(pClient) ((pClient)->fu32Flags & SHFL_CF_SYMLINKS ? RTPATH_F_ON_LINK : RTPATH_F_FOLLOW_LINK)
     46#define SHFL_RT_LINK(pClient) (RTPATH_F_ON_LINK)
     47
    4448/**
    4549 * @todo find a better solution for supporting the execute bit for non-windows
     
    135139    strcat(pDirEntry->szName, szWildCard);
    136140
    137     rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT, RTDIROPEN_FLAGS_NO_SYMLINKS);
     141    rc = RTDirOpenFiltered(&hSearch, pDirEntry->szName, RTDIRFILTER_WINNT, RTDIROPENFILTERED_FLAGS_NO_SYMLINKS);
    138142    *(pszStartComponent-1) = RTPATH_DELIMITER;
    139143    if (RT_FAILURE(rc))
     
    144148        size_t cbDirEntrySize = cbDirEntry;
    145149
    146         rc = RTDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING,
    147                          RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     150        rc = RTDirReadEx(hSearch, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    148151        if (rc == VERR_NO_MORE_FILES)
    149152            break;
     
    423426    if (RT_SUCCESS(rc))
    424427    {
    425         /* When the host file system is case sensitive and the guest expects
    426          * a case insensitive fs, then problems can occur */
     428        /* When the host file system is case sensitive and the guest expects a case insensitive fs, then problems can occur */
    427429        if (     vbsfIsHostMappingCaseSensitive(root)
    428430            &&  !vbsfIsGuestMappingCaseSensitive(root))
     
    433435            if (fWildCard || fPreserveLastComponent)
    434436            {
    435                 /* strip off the last path component, that has to be preserved:
    436                  * contains the wildcard(s) or a 'rename' target. */
     437                /* strip off the last path component, that has to be preserved: contains the wildcard(s) or a 'rename' target. */
    437438                size_t cb = strlen(pszFullPath);
    438439                char *pszSrc = pszFullPath + cb - 1;
     
    469470
    470471            /** @todo don't check when creating files or directories; waste of time */
    471             rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING,
    472                                    RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     472            rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    473473            if (rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND)
    474474            {
     
    484484                    {
    485485                        *pszSrc = 0;
    486                         rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING,
    487                                                RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     486                        rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    488487                        *pszSrc = RTPATH_DELIMITER;
    489488                        if (rc == VINF_SUCCESS)
     
    521520                            fEndOfString = false;
    522521                            *pszEnd = 0;
    523                             rc = RTPathQueryInfoEx(pszSrc, &info, RTFSOBJATTRADD_NOTHING,
    524                                                    RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     522                            rc = RTPathQueryInfoEx(pszSrc, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    525523                            Assert(rc == VINF_SUCCESS || rc == VERR_FILE_NOT_FOUND || rc == VERR_PATH_NOT_FOUND);
    526524                        }
     
    862860
    863861            /** @todo Possible race left here. */
    864             if (RT_SUCCESS(RTPathQueryInfoEx(pszPath, &info, RTFSOBJATTRADD_NOTHING,
    865                                              RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS)))
     862            if (RT_SUCCESS(RTPathQueryInfoEx(pszPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient))))
    866863            {
    867864#ifdef RT_OS_WINDOWS
     
    10351032            /* Open the directory now */
    10361033            rc = RTDirOpenFiltered(&pHandle->dir.Handle, pszPath,
    1037                                    RTDIRFILTER_NONE, RTDIROPEN_FLAGS_NO_SYMLINKS);
     1034                                   RTDIRFILTER_NONE, RTDIROPENFILTERED_FLAGS_NO_SYMLINKS);
    10381035            if (RT_SUCCESS(rc))
    10391036            {
     
    11331130 * @retval  pParms->Info   On success, information returned about the file
    11341131 */
    1135 static int vbsfLookupFile(SHFLCLIENTDATA *pClient, SHFLROOT root, char *pszPath, SHFLCREATEPARMS *pParms)
     1132static int vbsfLookupFile(SHFLCLIENTDATA *pClient, char *pszPath, SHFLCREATEPARMS *pParms)
    11361133{
    11371134    RTFSOBJINFO info;
    11381135    int rc;
    11391136
    1140     char szRealPath[RTPATH_MAX + 1];
    1141     const char *pszRoot = vbsfMappingsQueryHostRoot(root);
    1142     AssertReturn(pszRoot, VERR_INVALID_PARAMETER);
    1143     rc = RTPathReal(pszPath, szRealPath, sizeof(szRealPath));
    1144     AssertRCReturn(rc, rc);
    1145     if (!RTPathStartsWith(szRealPath, pszRoot))
    1146         return VERR_TOO_MANY_SYMLINKS;
    1147 
    1148     rc = RTPathQueryInfoEx(pszPath, &info, RTFSOBJATTRADD_NOTHING,
    1149                            RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     1137    rc = RTPathQueryInfoEx(pszPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    11501138    LogFlow(("SHFL_CF_LOOKUP\n"));
    11511139    /* Client just wants to know if the object exists. */
     
    12461234        if (BIT_FLAG(pParms->CreateFlags, SHFL_CF_LOOKUP))
    12471235        {
    1248             rc = vbsfLookupFile(pClient, root, pszFullPath, pParms);
     1236            rc = vbsfLookupFile(pClient, pszFullPath, pParms);
    12491237        }
    12501238        else
     
    12531241            RTFSOBJINFO info;
    12541242
    1255             rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING,
    1256                                    RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     1243            rc = RTPathQueryInfoEx(pszFullPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    12571244            LogFlow(("RTPathQueryInfoEx returned %Rrc\n", rc));
    12581245
     
    13081295            {
    13091296                if (BIT_FLAG(pParms->CreateFlags, SHFL_CF_DIRECTORY))
     1297                {
    13101298                    rc = vbsfOpenDir(pClient, pszFullPath, pParms);
     1299                }
    13111300                else
     1301                {
    13121302                    rc = vbsfOpenFile(pClient, pszFullPath, pParms);
     1303                }
    13131304            }
    13141305            else
     
    15141505    PRTDIR         DirHandle;
    15151506    bool           fUtf8;
    1516    
     1507
    15171508    fUtf8 = BIT_FLAG(pClient->fu32Flags, SHFL_CF_UTF8) != 0;
    15181509
     
    15551546            if (RT_SUCCESS(rc))
    15561547            {
    1557 #if 0
    1558                 const char *pszRoot = vbsfMappingsQueryHostRoot(root);
    1559                 if (!pszRoot)
    1560                 {
    1561                     rc = VERR_INVALID_PARAMETER;
    1562                     goto end;
    1563                 }
    1564                 char szRealPath[RTPATH_MAX + 1];
    1565                 rc = RTPathReal(pszFullPath, szRealPath, sizeof(szRealPath));
     1548                rc = RTDirOpenFiltered(&pHandle->dir.SearchHandle, pszFullPath,
     1549                                       RTDIRFILTER_WINNT, RTDIROPENFILTERED_FLAGS_NO_SYMLINKS);
     1550
     1551                /* free the path string */
     1552                vbsfFreeFullPath(pszFullPath);
     1553
    15661554                if (RT_FAILURE(rc))
    15671555                    goto end;
    1568                 if (!RTPathStartsWith(szRealPath, pszRoot))
    1569                 {
    1570                     rc = VERR_TOO_MANY_SYMLINKS;
    1571                     goto end;
    1572                 }
    1573 #endif
    1574                 rc = RTDirOpenFiltered(&pHandle->dir.SearchHandle, pszFullPath,
    1575                                        RTDIRFILTER_WINNT, RTDIROPEN_FLAGS_NO_SYMLINKS);
    1576 
    1577                 /* free the path string */
    1578                 vbsfFreeFullPath(pszFullPath);
    1579 
    1580                 if (RT_FAILURE(rc))
    1581                     goto end;
    15821556            }
    15831557            else
     
    16021576            pDirEntry = pDirEntryOrg;
    16031577
    1604             rc = RTDirReadEx(DirHandle, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING,
    1605                              RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     1578            rc = RTDirReadEx(DirHandle, pDirEntry, &cbDirEntrySize, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    16061579            if (rc == VERR_NO_MORE_FILES)
    16071580            {
     
    23222295    {
    23232296        RTFSOBJINFO info;
    2324         rc = RTPathQueryInfoEx(pszFullNewPath, &info, RTFSOBJATTRADD_NOTHING,
    2325                                RTPATH_F_ON_LINK | RTPATH_F_NO_SYMLINKS);
     2297        rc = RTPathQueryInfoEx(pszFullNewPath, &info, RTFSOBJATTRADD_NOTHING, SHFL_RT_LINK(pClient));
    23262298        if (RT_SUCCESS(rc))
    23272299            vbfsCopyFsObjInfoFromIprt(pInfo, &info);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette