VirtualBox

Changeset 105087 in vbox for trunk/src/VBox/Main/xml


Ignore:
Timestamp:
Jul 1, 2024 11:27:59 PM (7 months ago)
Author:
vboxsync
Message:

doc/manual,include/VBox,Frontends/VBoxManage,HostServices/SharedFolders,
Main/{include,SharedFolder,Console,Machine,VirtualBox.xidl}: Add a
new attribute to ISharedFolder for specifying a symbolic link creation
policy to restrict the source pathname when creating symbolic links
within a guest. The symbolic link policies are represented by a new
enumeration of type SymlinkPolicy_T which includes values for no
restrictions ('any'), symlink sources only within the subtree of the
share ('subtree'), symlink sources as any relative path ('relative'),
and no symlinks allowed ('forbidden'). The symlink policy can only be
applied to permanent shared folders at this stage. bugref:10619

Location:
trunk/src/VBox/Main/xml
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r105018 r105087  
    37933793SharedFolder::SharedFolder() :
    37943794    fWritable(false),
    3795     fAutoMount(false)
     3795    fAutoMount(false),
     3796    enmSymlinkPolicy(SymlinkPolicy_None)
    37963797{
    37973798}
     
    38093810            && fWritable         == g.fWritable
    38103811            && fAutoMount        == g.fAutoMount
    3811             && strAutoMountPoint == g.strAutoMountPoint);
     3812            && strAutoMountPoint == g.strAutoMountPoint
     3813            && enmSymlinkPolicy  == g.enmSymlinkPolicy);
    38123814}
    38133815
     
    59925994                pelmFolder->getAttributeValue("autoMount", sf.fAutoMount);
    59935995                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                    else
     6009                        throw ConfigFileError(this,
     6010                                              pelmHwChild,
     6011                                              N_("Invalid value '%s' in SharedFolder/@symlinkPolicy attribute"),
     6012                                              strTemp.c_str());
     6013                }
    59946014                hw.llSharedFolders.push_back(sf);
    59956015            }
     
    83098329            if (sf.strAutoMountPoint.isNotEmpty())
    83108330                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            }
    83118343        }
    83128344    }
     
    95319563            return;
    95329564        }
     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        }
    95339580    }
    95349581
  • trunk/src/VBox/Main/xml/VirtualBox-settings.xsd

    r105018 r105087  
    301301    <xsd:enumeration value="VBoxSVGA"/>
    302302    <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"/>
    303312  </xsd:restriction>
    304313</xsd:simpleType>
     
    13051314  <xsd:attribute name="autoMount" type="xsd:boolean" default="false"/>
    13061315  <xsd:attribute name="autoMountPoint" type="xsd:string"/>
     1316  <xsd:attribute name="symlinkPolicy" type="TSymlinkPolicy" default="forbidden"/> <!-- new since v1.20. -->
    13071317</xsd:complexType>
    13081318
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