VirtualBox

Changeset 42210 in vbox


Ignore:
Timestamp:
Jul 18, 2012 2:11:35 PM (13 years ago)
Author:
vboxsync
Message:

Main: propagate error during medium settings decryption

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/VirtualBoxImpl.h

    r42177 r42210  
    316316                                 bool aSaveRegistry = true);
    317317
    318     void decryptSettings();
    319     void decryptMediumSettings(Medium *pMedium);
     318    int decryptSettings();
     319    int decryptMediumSettings(Medium *pMedium);
    320320    int  decryptSettingBytes(uint8_t *aPlaintext, const uint8_t *aCiphertext,
    321321                             size_t aCiphertextSize) const;
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r42208 r42210  
    20412041{
    20422042    storeSettingsKey(aValue);
    2043     decryptSettings();
    2044     return S_OK;
    2045 }
    2046 
    2047 void VirtualBox::decryptMediumSettings(Medium *pMedium)
     2043    int vrc = decryptSettings();
     2044    return RT_SUCCESS(vrc) ? S_OK : E_FAIL;
     2045}
     2046
     2047int VirtualBox::decryptMediumSettings(Medium *pMedium)
    20482048{
    20492049    Bstr bstrCipher;
     
    20582058        if (RT_SUCCESS(rc))
    20592059            pMedium->setPropertyDirect("InitiatorSecret", strPlaintext);
    2060     }
     2060        else
     2061            return rc;
     2062    }
     2063    return VINF_SUCCESS;
    20612064}
    20622065
     
    20692072 * properties need to be null-terminated strings.
    20702073 */
    2071 void VirtualBox::decryptSettings()
    2072 {
     2074int VirtualBox::decryptSettings()
     2075{
     2076    bool fFailure = false;
    20732077    AutoReadLock al(m->allHardDisks.getLockHandle() COMMA_LOCKVAL_SRC_POS);
    20742078    for (MediaList::const_iterator mt = m->allHardDisks.begin();
     
    20812085            continue;
    20822086        AutoWriteLock mlock(pMedium COMMA_LOCKVAL_SRC_POS);
    2083         decryptMediumSettings(pMedium);
    2084     }
     2087        int vrc = decryptMediumSettings(pMedium);
     2088        if (RT_FAILURE(vrc))
     2089            fFailure = true;
     2090    }
     2091    return fFailure ? VERR_INVALID_PARAMETER : VINF_SUCCESS;
    20852092}
    20862093
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