Changeset 105018 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jun 25, 2024 11:06:29 AM (9 months ago)
- svn:sync-xref-src-repo-rev:
- 163636
- Location:
- trunk/src/VBox/Main
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/idl/VirtualBox.xidl
r105016 r105018 657 657 <desc>Settings version "1.20", written by VirtualBox 7.1.x.</desc> 658 658 <!-- 659 - Machine changes: 660 + Adds VM platform support: Non-platform-specific 661 settings were moved to the new Platform element, which now contains 662 the platform architecture for this VM. x86-specific 663 settings were moved from Machine to a new, dedicated Platform/x86 element. 664 BIOSSettings were renamed to FirmwareSettings. ARM-specific settings 665 were added to a new, dedicated Platform/ARM element. This settings 666 version only will be written if the ARM platform architecture is being 667 selected. Only affects the machine settings (not main configuration 668 settings). 669 + Adds support for Shared Folder symbolic link configuration. (Machine 670 settings only). 659 Adds VM platform support: Non-platform-specific 660 settings were moved to the new Platform element, which now contains 661 the platform architecture for this VM. x86-specific 662 settings were moved from Machine to a new, dedicated Platform/x86 element. 663 BIOSSettings were renamed to FirmwareSettings. ARM-specific settings 664 were added to a new, dedicated Platform/ARM element. This settings 665 version only will be written if the ARM platform architecture is being 666 selected. Only affects the machine settings (not main configuration 667 settings). 671 668 --> 672 669 </const> … … 24432 24429 <interface 24433 24430 name="ISharedFolder" extends="$unknown" 24434 uuid=" 0b108b8c-62e0-4e06-9dfa-2f1a2ad70774"24431 uuid="9622225a-5409-414b-bd16-77df7ba3451e" 24435 24432 wsmap="managed" 24436 24433 rest="managed" … … 24543 24540 failure and should normally describe a reason of the failure (for 24544 24541 example, a file read error). 24545 </desc>24546 </attribute>24547 24548 <attribute name="symlinkPolicy" type="SymlinkPolicy">24549 <desc>24550 The security policy for allowing guest VMs to create symbolic links24551 within a Shared Folder.24552 24542 </desc> 24553 24543 </attribute> … … 30215 30205 </enum> 30216 30206 30217 <enum30218 name="SymlinkPolicy"30219 uuid="a818472e-215d-4279-8af8-eac4c0517bcc"30220 >30221 <desc>Shared Folder Symbolic Link Security Policies</desc>30222 <const name="None" value="0">30223 <desc>No symlink policy set (never used by the API).</desc>30224 </const>30225 <const name="Forbidden" value="1">30226 <desc>Users in the guest VM are not able to create symbolic links inside the Shared Folder.</desc>30227 </const>30228 <const name="AllowedInShareSubtree" value="2">30229 <desc>Users in the guest VM are allowed to create symbolic links within the Shared Folder so long30230 as the target remains in the Shared Folder or within the subtree of the Shared Folder.30231 </desc>30232 </const>30233 <const name="AllowedToRelativeTargets" value="3">30234 <desc>Users in the guest VM are allowed to create symbolic links within the Shared Folder to30235 targets within the Shared Folder and its subtree as well as to relative targets (../) outside of30236 the Shared Folder.30237 </desc>30238 </const>30239 <const name="AllowedToAnyTarget" value="4">30240 <desc>Users in the guest VM are allowed to create symbolic links within the Shared Folder and30241 its subtree as well as to other targets via either relative pathnames or absolute pathnames.30242 </desc>30243 </const>30244 </enum>30245 30207 30246 30208 <interface name="ICloudNetworkGatewayInfo" extends="$unknown" -
trunk/src/VBox/Main/include/ConsoleSharedFolderImpl.h
r105016 r105018 89 89 const Utf8Str &i_getAutoMountPoint() const; 90 90 91 /**92 * Public internal method for getting the symlink policy.93 */94 const SymlinkPolicy_T i_getSymlinkPolicy() const;95 96 91 protected: 97 92 … … 105 100 private: 106 101 107 // wrapped ISharedFolder proper ties.102 // wrapped ISharedFolder properies. 108 103 HRESULT getName(com::Utf8Str &aName); 109 104 HRESULT getHostPath(com::Utf8Str &aHostPath); … … 116 111 HRESULT setAutoMountPoint(com::Utf8Str const &aAutoMountPoint); 117 112 HRESULT getLastAccessError(com::Utf8Str &aLastAccessError); 118 HRESULT getSymlinkPolicy(SymlinkPolicy_T *aSymlinkPolicy);119 HRESULT setSymlinkPolicy(SymlinkPolicy_T aSymlinkPolicy);120 113 121 114 VirtualBoxBase * const mParent; -
trunk/src/VBox/Main/include/MachineImpl.h
r105016 r105018 911 911 friend class RecordingScreenSettings; 912 912 friend class SessionMachine; 913 friend class SharedFolder;914 913 friend class SnapshotMachine; 915 914 friend class VirtualBox; -
trunk/src/VBox/Main/include/SharedFolderImpl.h
r105016 r105018 49 49 // public initializer/uninitializer for internal purposes only 50 50 HRESULT init(Machine *aMachine, const com::Utf8Str &aName, const com::Utf8Str &aHostPath, 51 bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError, 52 SymlinkPolicy_T enmSymlinkPolicy); 51 bool aWritable, bool aAutoMount, const com::Utf8Str &aAutoMountPoint, bool fFailOnError); 53 52 HRESULT initCopy(Machine *aMachine, SharedFolder *aThat); 54 53 // HRESULT init(Console *aConsole, const com::Utf8Str &aName, const com::Utf8Str &aHostPath, … … 90 89 const Utf8Str &i_getAutoMountPoint() const; 91 90 92 /**93 * Public internal method for getting the symlink policy.94 */95 const SymlinkPolicy_T i_getSymlinkPolicy() const;96 97 91 protected: 98 92 … … 103 97 bool aAutoMount, 104 98 const com::Utf8Str &aAutoMountPoint, 105 bool fFailOnError, 106 SymlinkPolicy_T enmSymlinkPolicy); 99 bool fFailOnError); 107 100 private: 108 101 109 // wrapped ISharedFolder proper ties.102 // wrapped ISharedFolder properies. 110 103 HRESULT getName(com::Utf8Str &aName); 111 104 HRESULT getHostPath(com::Utf8Str &aHostPath); … … 118 111 HRESULT setAutoMountPoint(com::Utf8Str const &aAutoMountPoint); 119 112 HRESULT getLastAccessError(com::Utf8Str &aLastAccessError); 120 HRESULT getSymlinkPolicy(SymlinkPolicy_T *aSymlinkPolicy);121 HRESULT setSymlinkPolicy(SymlinkPolicy_T aSymlinkPolicy);122 113 123 114 VirtualBoxBase * const mParent; -
trunk/src/VBox/Main/src-all/ConsoleSharedFolderImpl.cpp
r105016 r105018 44 44 Data() 45 45 : fWritable(false), 46 fAutoMount(false), 47 enmSymlinkPolicy(SymlinkPolicy_None) 46 fAutoMount(false) 48 47 { } 49 48 … … 54 53 const Utf8Str strAutoMountPoint; 55 54 Utf8Str strLastAccessError; 56 SymlinkPolicy_T enmSymlinkPolicy;57 55 }; 58 56 … … 307 305 } 308 306 309 HRESULT ConsoleSharedFolder::getSymlinkPolicy(SymlinkPolicy_T *aSymlinkPolicy)310 {311 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);312 *aSymlinkPolicy = m->enmSymlinkPolicy;313 return S_OK;314 }315 316 HRESULT ConsoleSharedFolder::setSymlinkPolicy(SymlinkPolicy_T aSymlinkPolicy)317 {318 RT_NOREF(aSymlinkPolicy);319 return E_NOTIMPL;320 }321 307 322 308 const Utf8Str& ConsoleSharedFolder::i_getName() const … … 345 331 } 346 332 347 const SymlinkPolicy_T ConsoleSharedFolder::i_getSymlinkPolicy() const348 {349 return m->enmSymlinkPolicy;350 }351 352 333 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-all/SharedFolderImpl.cpp
r105016 r105018 46 46 Data() 47 47 : fWritable(false), 48 fAutoMount(false), 49 enmSymlinkPolicy(SymlinkPolicy_None) 48 fAutoMount(false) 50 49 { } 51 50 … … 56 55 const Utf8Str strAutoMountPoint; 57 56 Utf8Str strLastAccessError; 58 SymlinkPolicy_T enmSymlinkPolicy;59 57 }; 60 58 … … 111 109 bool aAutoMount, 112 110 const Utf8Str &aAutoMountPoint, 113 bool fFailOnError, 114 SymlinkPolicy_T enmSymlinkPolicy) 111 bool fFailOnError) 115 112 { 116 113 /* Enclose the state transition NotReady->InInit->Ready */ … … 120 117 unconst(mMachine) = aMachine; 121 118 122 HRESULT hrc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError, 123 enmSymlinkPolicy); 119 HRESULT hrc = i_protectedInit(aMachine, aName, aHostPath, aWritable, aAutoMount, aAutoMountPoint, fFailOnError); 124 120 125 121 /* Confirm a successful initialization when it's the case */ … … 156 152 aThat->m->fAutoMount, 157 153 aThat->m->strAutoMountPoint, 158 false /* fFailOnError */, 159 aThat->m->enmSymlinkPolicy); 154 false /* fFailOnError */ ); 160 155 161 156 /* Confirm a successful initialization when it's the case */ … … 219 214 bool aAutoMount, 220 215 const Utf8Str &aAutoMountPoint, 221 bool fFailOnError, 222 SymlinkPolicy_T enmSymlinkPolicy) 223 { 224 LogFlowThisFunc(("aName={%s}, aHostPath={%s}, aWritable={%d}, aAutoMount={%d} enmSymlinkPolicy={%d}\n", 225 aName.c_str(), aHostPath.c_str(), aWritable, aAutoMount, enmSymlinkPolicy)); 216 bool fFailOnError) 217 { 218 LogFlowThisFunc(("aName={%s}, aHostPath={%s}, aWritable={%d}, aAutoMount={%d}\n", 219 aName.c_str(), aHostPath.c_str(), aWritable, aAutoMount)); 226 220 227 221 ComAssertRet(aParent && aName.isNotEmpty() && aHostPath.isNotEmpty(), E_INVALIDARG); … … 277 271 m->fAutoMount = aAutoMount; 278 272 unconst(m->strAutoMountPoint) = aAutoMountPoint; 279 m->enmSymlinkPolicy = enmSymlinkPolicy;280 273 281 274 return S_OK; … … 392 385 } 393 386 394 HRESULT SharedFolder::getSymlinkPolicy(SymlinkPolicy_T *aSymlinkPolicy)395 {396 AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);397 *aSymlinkPolicy = m->enmSymlinkPolicy;398 return S_OK;399 }400 401 HRESULT SharedFolder::setSymlinkPolicy(SymlinkPolicy_T aSymlinkPolicy)402 {403 switch (aSymlinkPolicy)404 {405 case SymlinkPolicy_AllowedToAnyTarget:406 case SymlinkPolicy_AllowedInShareSubtree:407 case SymlinkPolicy_AllowedToRelativeTargets:408 case SymlinkPolicy_Forbidden:409 break;410 default:411 return setError(E_INVALIDARG, tr("The symbolic link policy specified (%d) is invalid."), aSymlinkPolicy);412 }413 414 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);415 m->enmSymlinkPolicy = aSymlinkPolicy;416 return S_OK;417 }418 387 419 388 const Utf8Str& SharedFolder::i_getName() const … … 442 411 } 443 412 444 const SymlinkPolicy_T SharedFolder::i_getSymlinkPolicy() const445 {446 return m->enmSymlinkPolicy;447 }448 449 413 /* vi: set tabstop=4 shiftwidth=4 expandtab: */ -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r105016 r105018 9541 9541 | (fMissing ? SHFL_ADD_MAPPING_F_MISSING : 0)); 9542 9542 SHFLSTRING_TO_HGMC_PARAM(&aParams[3], pAutoMountPoint); 9543 HGCMSvcSetU32(&aParams[4], SymlinkPolicy_None); 9544 AssertCompile(SHFL_CPARMS_ADD_MAPPING == 5); 9543 AssertCompile(SHFL_CPARMS_ADD_MAPPING == 4); 9545 9544 9546 9545 vrc = m_pVMMDev->hgcmHostCall("VBoxSharedFolders", SHFL_FN_ADD_MAPPING, SHFL_CPARMS_ADD_MAPPING, aParams); -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r105016 r105018 5032 5032 aName.c_str()); 5033 5033 5034 SymlinkPolicy_T enmSymlinkPolicy = SymlinkPolicy_None;5035 5034 sharedFolder.createObject(); 5036 5035 hrc = sharedFolder->init(i_getMachine(), … … 5040 5039 !!aAutomount, 5041 5040 aAutoMountPoint, 5042 true /* fFailOnError */, 5043 enmSymlinkPolicy); 5041 true /* fFailOnError */); 5044 5042 if (FAILED(hrc)) return hrc; 5045 5043 … … 8820 8818 RT_BOOL(sf.fAutoMount), 8821 8819 sf.strAutoMountPoint, 8822 false /* fFailOnError */, 8823 sf.enmSymlinkPolicy); 8820 false /* fFailOnError */); 8824 8821 if (FAILED(hrc)) return hrc; 8825 8822 mHWData->mSharedFolders.push_back(sharedFolder); … … 10196 10193 sf.fAutoMount = !!pSF->i_isAutoMounted(); 10197 10194 sf.strAutoMountPoint = pSF->i_getAutoMountPoint(); 10198 sf.enmSymlinkPolicy = pSF->i_getSymlinkPolicy();10199 10195 10200 10196 data.llSharedFolders.push_back(sf); -
trunk/src/VBox/Main/xml/Settings.cpp
r105016 r105018 3793 3793 SharedFolder::SharedFolder() : 3794 3794 fWritable(false), 3795 fAutoMount(false), 3796 enmSymlinkPolicy(SymlinkPolicy_None) 3795 fAutoMount(false) 3797 3796 { 3798 3797 } … … 3810 3809 && fWritable == g.fWritable 3811 3810 && fAutoMount == g.fAutoMount 3812 && strAutoMountPoint == g.strAutoMountPoint 3813 && enmSymlinkPolicy == g.enmSymlinkPolicy); 3811 && strAutoMountPoint == g.strAutoMountPoint); 3814 3812 } 3815 3813 … … 5994 5992 pelmFolder->getAttributeValue("autoMount", sf.fAutoMount); 5995 5993 pelmFolder->getAttributeValue("autoMountPoint", sf.strAutoMountPoint); 5996 5997 Utf8Str strTemp;5998 if (pelmFolder->getAttributeValue("symlinkPolicy", strTemp))5999 {6000 if (strTemp == "forbidden")6001 sf.enmSymlinkPolicy = SymlinkPolicy_Forbidden;6002 else if (strTemp == "subtree")6003 sf.enmSymlinkPolicy = SymlinkPolicy_AllowedInShareSubtree;6004 else if (strTemp == "relative")6005 sf.enmSymlinkPolicy = SymlinkPolicy_AllowedToRelativeTargets;6006 else if (strTemp == "any")6007 sf.enmSymlinkPolicy = SymlinkPolicy_AllowedToAnyTarget;6008 else6009 throw ConfigFileError(this,6010 pelmHwChild,6011 N_("Invalid value '%s' in SharedFolder/@symlinkPolicy attribute"),6012 strTemp.c_str());6013 }6014 5994 hw.llSharedFolders.push_back(sf); 6015 5995 } … … 8329 8309 if (sf.strAutoMountPoint.isNotEmpty()) 8330 8310 pelmThis->setAttribute("autoMountPoint", sf.strAutoMountPoint); 8331 const char *pcszSymlinkPolicy;8332 if (sf.enmSymlinkPolicy != SymlinkPolicy_None)8333 {8334 switch (sf.enmSymlinkPolicy)8335 {8336 default: /*case SymlinkPolicy_Forbidden:*/ pcszSymlinkPolicy = "forbidden"; break;8337 case SymlinkPolicy_AllowedInShareSubtree: pcszSymlinkPolicy = "subtree"; break;8338 case SymlinkPolicy_AllowedToRelativeTargets: pcszSymlinkPolicy = "relative"; break;8339 case SymlinkPolicy_AllowedToAnyTarget: pcszSymlinkPolicy = "any"; break;8340 }8341 pelmThis->setAttribute("symlinkPolicy", pcszSymlinkPolicy);8342 }8343 8311 } 8344 8312 } … … 9563 9531 return; 9564 9532 } 9565 9566 // VirtualBox 7.1 (settings v1.20) adds support for customizable control over Shared Folders symlink creation.9567 if (hardwareMachine.llSharedFolders.size())9568 {9569 for (SharedFoldersList::const_iterator it = hardwareMachine.llSharedFolders.begin();9570 it != hardwareMachine.llSharedFolders.end();9571 ++it)9572 {9573 if (it->enmSymlinkPolicy != SymlinkPolicy_None)9574 {9575 m->sv = SettingsVersion_v1_20;9576 return;9577 }9578 }9579 }9580 9533 } 9581 9534 -
trunk/src/VBox/Main/xml/VirtualBox-settings.xsd
r105016 r105018 301 301 <xsd:enumeration value="VBoxSVGA"/> 302 302 <xsd:enumeration value="QemuRamFB"/> 303 </xsd:restriction>304 </xsd:simpleType>305 306 <xsd:simpleType name="TSymlinkPolicy"> <!-- new since v1.20. -->307 <xsd:restriction base="xsd:token">308 <xsd:enumeration value="forbidden"/>309 <xsd:enumeration value="subtree"/>310 <xsd:enumeration value="relative"/>311 <xsd:enumeration value="any"/>312 303 </xsd:restriction> 313 304 </xsd:simpleType> … … 1314 1305 <xsd:attribute name="autoMount" type="xsd:boolean" default="false"/> 1315 1306 <xsd:attribute name="autoMountPoint" type="xsd:string"/> 1316 <xsd:attribute name="symlinkPolicy" type="TSymlinkPolicy" default="forbidden"/> <!-- new since v1.20. -->1317 1307 </xsd:complexType> 1318 1308
Note:
See TracChangeset
for help on using the changeset viewer.