VirtualBox

Changeset 60805 in vbox for trunk/src


Ignore:
Timestamp:
May 3, 2016 3:16:13 PM (9 years ago)
Author:
vboxsync
Message:

Main/NATNetwork: fix regression from settings cleanup, have to allow empty name for init and check in a few strategic places

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/NATNetworkImpl.cpp

    r60786 r60805  
    115115HRESULT NATNetwork::init(VirtualBox *aVirtualBox, com::Utf8Str aName)
    116116{
    117     AssertReturn(!aName.isEmpty(), E_INVALIDARG);
    118 
    119117    AutoInitSpan autoInitSpan(this);
    120118    AssertReturn(autoInitSpan.isOk(), E_FAIL);
     
    170168
    171169    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     170    AssertReturn(!m->s.strNetworkName.isEmpty(), E_FAIL);
    172171    data = m->s;
    173     alock.release();
    174172
    175173    m->pVirtualBox->i_onNATNetworkSetting(Bstr(m->s.strNetworkName).raw(),
     
    201199HRESULT NATNetwork::getNetworkName(com::Utf8Str &aNetworkName)
    202200{
     201    AssertReturn(!m->s.strNetworkName.isEmpty(), E_FAIL);
    203202    aNetworkName = m->s.strNetworkName;
    204203    return S_OK;
     
    207206HRESULT NATNetwork::setNetworkName(const com::Utf8Str &aNetworkName)
    208207{
     208    if (m->s.strNetworkName.isEmpty())
     209        return setError(E_INVALIDARG,
     210                        tr("Network name cannot be empty"));
    209211    {
    210212        AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
     
    645647#ifdef VBOX_WITH_NAT_SERVICE
    646648    if (!m->s.fEnabled) return S_OK;
     649    AssertReturn(!m->s.strNetworkName.isEmpty(), E_FAIL);
    647650
    648651    m->NATRunner.setOption(NetworkServiceRunner::kNsrKeyNetwork, Utf8Str(m->s.strNetworkName).c_str());
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