VirtualBox

Changeset 20346 in vbox


Ignore:
Timestamp:
Jun 5, 2009 4:22:03 PM (16 years ago)
Author:
vboxsync
Message:

Shared folders Host: don't allow to clear the READ access bit from a shared folder, otherwise the guest wouldn't be able to access this file any longer as the access is only done through a file handle

File:
1 edited

Legend:

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

    r20329 r20346  
    3333#include <iprt/string.h>
    3434#include <iprt/uni.h>
     35#include <iprt/stream.h>
    3536#ifdef RT_OS_DARWIN
    3637#include <Carbon/Carbon.h>
     
    17391740        if (pSFDEntry->Attr.fMode)
    17401741        {
    1741             rc = RTFileSetMode((RTFILE)pHandle->file.Handle, pSFDEntry->Attr.fMode);
     1742            RTFMODE fMode = pSFDEntry->Attr.fMode;
     1743
     1744#ifndef RT_OS_WINDOWS
     1745            /* don't allow to clear the own bit, otherwise the guest wouldn't be
     1746             * able to access this file anymore */
     1747            if (fMode)
     1748                fMode |= RTFS_UNIX_IRUSR;
     1749#endif
     1750
     1751            rc = RTFileSetMode((RTFILE)pHandle->file.Handle, fMode);
    17421752            if (rc != VINF_SUCCESS)
    17431753            {
    1744                 Log(("RTFileSetMode %x failed with %Rrc\n", pSFDEntry->Attr.fMode, rc));
     1754                Log(("RTFileSetMode %x failed with %Rrc\n", fMode, rc));
    17451755                /* silent failure, because this tends to fail with e.g. windows guest & linux host */
    17461756                rc = VINF_SUCCESS;
     
    17481758        }
    17491759    }
     1760    /* TODO: mode for directories */
    17501761
    17511762    if (rc == VINF_SUCCESS)
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