VirtualBox

Ignore:
Timestamp:
Jul 12, 2019 4:11:19 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
132104
Message:

Changes per #5899 / Comment #14

File:
1 edited

Legend:

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

    r79479 r79742  
    847847    m->vdIfConfig.pfnQuerySize = i_vdConfigQuerySize;
    848848    m->vdIfConfig.pfnQuery = i_vdConfigQuery;
     849    m->vdIfConfig.pfnUpdate = i_vdConfigUpdate;
    849850    m->vdIfConfig.pfnQueryBytes = NULL;
    850851
     
    46744675            const Utf8Str &name = it->first;
    46754676            const Utf8Str &value = it->second;
    4676             /* do NOT store the plain InitiatorSecret */
    4677             if (   !fHaveInitiatorSecretEncrypted
    4678                 || !name.equals("InitiatorSecret"))
    4679                 data.properties[name] = value;
    4680         }
     4677            bool fCreateOnly = false;
     4678            for (MediumFormat::PropertyArray::const_iterator itf = m->formatObj->i_getProperties().begin();
     4679                 itf != m->formatObj->i_getProperties().end();
     4680                 ++itf)
     4681             {
     4682                if (itf->strName.equals(name) &&
     4683                    (itf->flags & VD_CFGKEY_CREATEONLY))
     4684                {
     4685                        fCreateOnly = true;
     4686                        break;
     4687                }
     4688            }
     4689            if (!fCreateOnly)
     4690                /* do NOT store the plain InitiatorSecret */
     4691                if (   !fHaveInitiatorSecretEncrypted
     4692                    || !name.equals("InitiatorSecret"))
     4693                            data.properties[name] = value;        }
    46814694    }
    46824695    if (fHaveInitiatorSecretEncrypted)
     
    80188031    memcpy(pszValue, psz, cch + 1);
    80198032    return VINF_SUCCESS;
     8033}
     8034
     8035DECLCALLBACK(int) Medium::i_vdConfigUpdate(void *pvUser,
     8036                                                bool fCreate,
     8037                                                const char *pszName,
     8038                                                const char *pszValue)
     8039{
     8040    int rv = VINF_SUCCESS;
     8041    Utf8Str pName = Utf8Str(pszName);
     8042    Medium *that = (Medium *)pvUser;
     8043    AutoWriteLock mlock(that COMMA_LOCKVAL_SRC_POS);
     8044    settings::StringsMap::const_iterator it = that->m->mapProperties.find(pName);
     8045    if (it == that->m->mapProperties.end() && !fCreate)
     8046        rv = VERR_CFGM_VALUE_NOT_FOUND;
     8047    else
     8048        that->m->mapProperties[pName] = Utf8Str(pszValue);
     8049    mlock.release();
     8050    return rv;
    80208051}
    80218052
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette