Changeset 65279 in vbox
- Timestamp:
- Jan 13, 2017 11:45:20 AM (8 years ago)
- svn:sync-xref-src-repo-rev:
- 112837
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/SharedFolders/vbsf.cpp
r65168 r65279 147 147 * 148 148 * @returns iprt status code 149 * @param fWritable whether the shared folder is writable 149 150 * @param fShflFlags shared folder create flags 150 151 * @param fMode file attributes … … 152 153 * @retval pfOpen iprt create flags 153 154 */ 154 static int vbsfConvertFileOpenFlags( unsigned fShflFlags, RTFMODE fMode, SHFLHANDLE handleInitial, uint32_t *pfOpen)155 static int vbsfConvertFileOpenFlags(bool fWritable, unsigned fShflFlags, RTFMODE fMode, SHFLHANDLE handleInitial, uint32_t *pfOpen) 155 156 { 156 157 uint32_t fOpen = 0; … … 368 369 if (RT_SUCCESS(rc)) 369 370 { 371 if (!fWritable) 372 fOpen &= ~RTFILE_O_WRITE; 373 370 374 *pfOpen = fOpen; 371 375 } … … 378 382 * @returns IPRT status code 379 383 * @param pClient Data structure describing the client accessing the shared folder 384 * @param root The index of the shared folder in the table of mappings. 380 385 * @param pszPath Path to the file or folder on the host. 381 386 * @param pParms @a CreateFlags Creation or open parameters, see include/VBox/shflsvc.h … … 388 393 * @retval pParms @a Info On success the parameters of the file opened or created 389 394 */ 390 static int vbsfOpenFile(SHFLCLIENTDATA *pClient, const char *pszPath, SHFLCREATEPARMS *pParms)395 static int vbsfOpenFile(SHFLCLIENTDATA *pClient, SHFLROOT root, const char *pszPath, SHFLCREATEPARMS *pParms) 391 396 { 392 397 LogFlow(("vbsfOpenFile: pszPath = %s, pParms = %p\n", pszPath, pParms)); … … 400 405 static int cErrors; 401 406 402 int rc = vbsfConvertFileOpenFlags(pParms->CreateFlags, pParms->Info.Attr.fMode, pParms->Handle, &fOpen); 407 /* is the guest allowed to write to this share? */ 408 bool fWritable; 409 int rc = vbsfMappingsQueryWritable(pClient, root, &fWritable); 410 if (RT_FAILURE(rc)) 411 fWritable = false; 412 413 rc = vbsfConvertFileOpenFlags(fWritable, pParms->CreateFlags, pParms->Info.Attr.fMode, pParms->Handle, &fOpen); 403 414 if (RT_SUCCESS(rc)) 404 415 { … … 878 889 else 879 890 { 880 rc = vbsfOpenFile(pClient, pszFullPath, pParms);891 rc = vbsfOpenFile(pClient, root, pszFullPath, pParms); 881 892 } 882 893 }
Note:
See TracChangeset
for help on using the changeset viewer.