Changeset 70727 in vbox for trunk/src/VBox/HostServices
- Timestamp:
- Jan 24, 2018 2:01:03 PM (7 years ago)
- Location:
- trunk/src/VBox/HostServices/GuestProperties
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostServices/GuestProperties/service.cpp
r70221 r70727 268 268 269 269 /** 270 * Check whether the property name is reserved for host changes only. 271 * 272 * @returns Boolean true (host reserved) or false (available to guest). 273 * 274 * @param pszName The property name to check. 275 */ 276 bool checkHostReserved(const char *pszName) 277 { 278 if (RTStrStartsWith(pszName, "/VirtualBox/GuestAdd/")) 279 return true; 280 if (RTStrStartsWith(pszName, "/VirtualBox/HostInfo/")) 281 return true; 282 return false; 283 } 284 285 /** 270 286 * Gets a property. 271 287 * … … 539 555 rc = GuestPropValidateFlags(papszFlags[i], &fFlags); 540 556 AssertRCBreak(rc); 557 /* 558 * Handle names which are read-only for the guest. 559 */ 560 if (checkHostReserved(papszNames[i])) 561 fFlags |= GUEST_PROP_F_RDONLYGUEST; 541 562 542 563 Property *pProp = getPropertyInternal(papszNames[i]); … … 715 736 Property *pProp = getPropertyInternal(pcszName); 716 737 rc = checkPermission(pProp ? pProp->mFlags : GUEST_PROP_F_NILFLAG, isGuest); 738 /* 739 * Handle names which are read-only for the guest. 740 */ 741 if (rc == VINF_SUCCESS && checkHostReserved(pcszName)) 742 { 743 if (isGuest) 744 rc = VERR_PERMISSION_DENIED; 745 else 746 fFlags |= GUEST_PROP_F_RDONLYGUEST; 747 } 717 748 if (rc == VINF_SUCCESS) 718 749 { -
trunk/src/VBox/HostServices/GuestProperties/testcase/tstGuestPropSvc.cpp
r70221 r70727 464 464 { "Green", "gone out...", "", false, false, false }, 465 465 { "Green", "gone out...", "", true, false, false }, 466 { "/VirtualBox/GuestAdd/SharedFolders/MountDir", "test", "", false, true, false }, 467 { "/VirtualBox/HostInfo/VRDP/Client/1/Name", "test", "", false, false, false }, 468 { "/VirtualBox/GuestAdd/SharedFolders/MountDir", "test", "", true, true, true }, 469 { "/VirtualBox/HostInfo/VRDP/Client/1/Name", "test", "TRANSRESET", true, true, true }, 466 470 }; 467 471 … … 662 666 { "Green\0Go!\0READONLY", sizeof("Green\0Go!\0READONLY") }, 663 667 { "Blue\0What on earth...?\0", sizeof("Blue\0What on earth...?\0") }, 668 { "/VirtualBox/GuestAdd/SharedFolders/MountDir\0test\0RDONLYGUEST", 669 sizeof("/VirtualBox/GuestAdd/SharedFolders/MountDir\0test\0RDONLYGUEST") }, 670 { "/VirtualBox/HostInfo/VRDP/Client/1/Name\0test\0TRANSIENT, RDONLYGUEST, TRANSRESET", 671 sizeof("/VirtualBox/HostInfo/VRDP/Client/1/Name\0test\0TRANSIENT, RDONLYGUEST, TRANSRESET") }, 664 672 { "Red\0\0", sizeof("Red\0\0") }, 665 673 { "Amber\0\0", sizeof("Amber\0\0") },
Note:
See TracChangeset
for help on using the changeset viewer.