Changeset 93466 in vbox for trunk/src/VBox/Additions
- Timestamp:
- Jan 27, 2022 8:26:16 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/lib/VBoxGuestR3LibDrmClient.cpp
r93331 r93466 36 36 37 37 #if defined(RT_OS_LINUX) 38 # include <VBox/HostServices/GuestPropertySvc.h> 38 39 39 40 /** Defines the DRM client executable (image). */ … … 46 47 47 48 /** 48 * Returns if the DRM resizing client is needed. 49 * Check if specified guest property exist. 50 * 51 * @returns \c true if the property exists and its flags do match, \c false otherwise. 52 * @param pszPropName Guest property name. 53 * @param fPropFlags Guest property flags mask to verify if property exist. 54 * If \p fPropFlags is 0, flags verification is omitted. 55 */ 56 static bool vbglR3DrmClientCheckProp(const char *pszPropName, uint32_t fPropFlags) 57 { 58 bool fExist = false; 59 #if defined(RT_OS_LINUX) && defined(VBOX_WITH_GUEST_PROPS) 60 uint32_t idClient; 61 62 int rc = VbglR3GuestPropConnect(&idClient); 63 if (RT_SUCCESS(rc)) 64 { 65 char *pcszFlags = NULL; 66 67 rc = VbglR3GuestPropReadEx(idClient, pszPropName, NULL /* ppszValue */, &pcszFlags, NULL); 68 if (RT_SUCCESS(rc)) 69 { 70 /* Check property flags match. */ 71 if (fPropFlags) 72 { 73 uint32_t fFlags = 0; 74 75 rc = GuestPropValidateFlags(pcszFlags, &fFlags); 76 fExist = RT_SUCCESS(rc) && (fFlags & fPropFlags); 77 } 78 else 79 fExist = true; 80 81 RTStrFree(pcszFlags); 82 } 83 84 VbglR3GuestPropDisconnect(idClient); 85 } 86 #endif /* RT_OS_LINUX */ 87 return fExist; 88 } 89 90 /** 91 * Returns true if the DRM resizing client is needed. 49 92 * This is achieved by querying existence of a guest property. 50 93 * … … 53 96 VBGLR3DECL(bool) VbglR3DrmClientIsNeeded(void) 54 97 { 55 #if defined(RT_OS_LINUX) 56 bool fStartClient = false; 57 58 # ifdef VBOX_WITH_GUEST_PROPS 59 uint32_t idClient; 60 int rc = VbglR3GuestPropConnect(&idClient); 61 if (RT_SUCCESS(rc)) 62 { 63 fStartClient = VbglR3GuestPropExist(idClient, VBOX_DRMCLIENT_GUEST_PROP_RESIZE /*pszPropName*/); 64 VbglR3GuestPropDisconnect(idClient); 65 } 66 # endif 67 return fStartClient; 68 69 #else /* !RT_OS_LINUX */ 70 return false; 71 #endif 98 return vbglR3DrmClientCheckProp(VBOX_DRMCLIENT_GUEST_PROP_RESIZE, 0); 72 99 } 73 100 74 101 /** 75 * Returns if the DRM resizing client already is running. 102 * Returns true if the DRM IPC server socket access should be restricted. 103 * 104 * Restricted access means that only users from a certain group should 105 * be granted with read and write access permission to IPC socket. Check 106 * is done by examining \c VBGLR3DRMIPCPROPRESTRICT guest property. Property 107 * is only considered valid if is read-only for guest. I.e., the following 108 * property should be set on the host side: 109 * 110 * VBoxManage guestproperty set <VM> /VirtualBox/GuestAdd/DRMIpcRestricted 1 --flags RDONLYGUEST 111 * 112 * @returns \c true if restricted socket access is required, \c false otherwise. 113 */ 114 VBGLR3DECL(bool) VbglR3DrmRestrictedIpcAccessIsNeeded(void) 115 { 116 return vbglR3DrmClientCheckProp(VBGLR3DRMIPCPROPRESTRICT, GUEST_PROP_F_RDONLYGUEST); 117 } 118 119 /** 120 * Returns true if the DRM resizing client already is running. 76 121 * This is achieved by querying existence of a guest property. 77 122 *
Note:
See TracChangeset
for help on using the changeset viewer.