VirtualBox

Changeset 54854 in vbox


Ignore:
Timestamp:
Mar 19, 2015 7:45:09 PM (10 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
99059
Message:

Main: Rearrange and rename parameters of IMedium::ChangeEncryption

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageDisk.cpp

    r54846 r54854  
    18211821
    18221822    ComPtr<IProgress> progress;
    1823     CHECK_ERROR(hardDisk, ChangeEncryption(Bstr(strPasswordNew).raw(), Bstr(strPasswordOld).raw(),
    1824                                            Bstr(pszCipher).raw(), Bstr(pszNewPasswordId).raw(),
     1823    CHECK_ERROR(hardDisk, ChangeEncryption(Bstr(strPasswordOld).raw(), Bstr(pszCipher).raw(),
     1824                                           Bstr(strPasswordNew).raw(), Bstr(pszNewPasswordId).raw(),
    18251825                                           progress.asOutParam()));
    18261826    if (SUCCEEDED(rc))
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r54848 r54854  
    1348913489  <interface
    1349013490    name="IMedium" extends="$unknown"
    13491     uuid="41e09c4f-97bf-4a1a-bf5c-c5b87f58464b"
     13491    uuid="9fae9ea1-c57c-4a3d-8992-cbb2b9b4b4a3"
    1349213492    wsmap="managed"
    1349313493    >
     
    1475414754        </result>
    1475514755      </desc>
     14756      <param name="currentPassword" type="wstring" dir="in">
     14757        <desc>
     14758          The olcurrentd password the medium is protected with. Use an empty string to indicate
     14759          that the medium isn't encrypted.
     14760        </desc>
     14761      </param>
     14762      <param name="cipher" type="wstring" dir="in">
     14763        <desc>
     14764          The cipher to use for encryption. An empty string indicates no encryption for the
     14765          result.
     14766        </desc>
     14767      </param>
    1475614768      <param name="newPassword" type="wstring" dir="in">
    1475714769        <desc>
     
    1475914771          to indicate that the result should not be encrypted.
    1476014772        </desc>
    14761       </param>
    14762       <param name="oldPassword" type="wstring" dir="in">
    14763         <desc>
    14764           The old password the medium is protected with. Use an empty string to indicate
    14765           that the medium wasn't encrypted before.
    14766         </desc>
    14767       </param>
    14768       <param name="cipher" type="wstring" dir="in">
    14769         <desc>The cipher to use for encryption.</desc>
    1477014773      </param>
    1477114774      <param name="newPasswordId" type="wstring" dir="in">
  • trunk/src/VBox/Main/include/MediumImpl.h

    r54835 r54854  
    276276                   ComPtr<IProgress> &aProgress);
    277277    HRESULT reset(ComPtr<IProgress> &aProgress);
    278     HRESULT changeEncryption(const com::Utf8Str &aNewPassword, const com::Utf8Str &aOldPassword,
    279                              const com::Utf8Str &aCipher, const com::Utf8Str &aNewPasswordId, ComPtr<IProgress> &aProgress);
     278    HRESULT changeEncryption(const com::Utf8Str &aCurrentPassword, const com::Utf8Str &aCipher,
     279                             const com::Utf8Str &aNewPassword, const com::Utf8Str &aNewPasswordId,
     280                             ComPtr<IProgress> &aProgress);
    280281    HRESULT getEncryptionSettings(com::Utf8Str &aCipher, com::Utf8Str &aPasswordId);
    281282
  • trunk/src/VBox/Main/src-server/MediumImpl.cpp

    r54847 r54854  
    676676    EncryptTask(Medium *aMedium,
    677677                const com::Utf8Str &strNewPassword,
    678                 const com::Utf8Str &strOldPassword,
     678                const com::Utf8Str &strCurrentPassword,
    679679                const com::Utf8Str &strCipher,
    680680                const com::Utf8Str &strNewPasswordId,
     
    683683        : Medium::Task(aMedium, aProgress),
    684684          mstrNewPassword(strNewPassword),
    685           mstrOldPassword(strOldPassword),
     685          mstrCurrentPassword(strCurrentPassword),
    686686          mstrCipher(strCipher),
    687687          mstrNewPasswordId(strNewPasswordId),
     
    701701        if (mstrNewPassword.length())
    702702            RTMemWipeThoroughly(mstrNewPassword.mutableRaw(), mstrNewPassword.length(), 10 /* cPasses */);
    703         if (mstrOldPassword.length())
    704             RTMemWipeThoroughly(mstrOldPassword.mutableRaw(), mstrOldPassword.length(), 10 /* cPasses */);
     703        if (mstrCurrentPassword.length())
     704            RTMemWipeThoroughly(mstrCurrentPassword.mutableRaw(), mstrCurrentPassword.length(), 10 /* cPasses */);
    705705        delete mpMediumLockList;
    706706    }
    707707
    708708    Utf8Str mstrNewPassword;
    709     Utf8Str mstrOldPassword;
     709    Utf8Str mstrCurrentPassword;
    710710    Utf8Str mstrCipher;
    711711    Utf8Str mstrNewPasswordId;
     
    30393039}
    30403040
    3041 HRESULT Medium::changeEncryption(const com::Utf8Str &aNewPassword, const com::Utf8Str &aOldPassword,
    3042                                  const com::Utf8Str &aCipher, const com::Utf8Str &aNewPasswordId,
     3041HRESULT Medium::changeEncryption(const com::Utf8Str &aCurrentPassword, const com::Utf8Str &aCipher,
     3042                                 const com::Utf8Str &aNewPassword, const com::Utf8Str &aNewPasswordId,
    30433043                                 ComPtr<IProgress> &aProgress)
    30443044{
     
    31463146
    31473147        /* setup task object to carry out the operation asynchronously */
    3148         pTask = new Medium::EncryptTask(this, aNewPassword, aOldPassword,
     3148        pTask = new Medium::EncryptTask(this, aNewPassword, aCurrentPassword,
    31493149                                        aCipher, aNewPasswordId, pProgress, pMediumLockList);
    31503150        rc = pTask->rc();
     
    89408940        {
    89418941            /* Set up disk encryption filters. */
    8942             if (task.mstrOldPassword.isEmpty())
     8942            if (task.mstrCurrentPassword.isEmpty())
    89438943            {
    89448944                /*
     
    89588958                                   tr("The image is not configured for encryption"));
    89598959
    8960                 i_taskEncryptSettingsSetup(&CryptoSettingsRead, NULL, it->second.c_str(), task.mstrOldPassword.c_str(),
     8960                i_taskEncryptSettingsSetup(&CryptoSettingsRead, NULL, it->second.c_str(), task.mstrCurrentPassword.c_str(),
    89618961                                           false /* fCreateKeyStore */);
    89628962                vrc = VDFilterAdd(pDisk, "CRYPT", VD_FILTER_FLAGS_READ, CryptoSettingsRead.vdFilterIfaces);
     
    89708970            }
    89718971
    8972             if (task.mstrNewPassword.isNotEmpty())
     8972            if (task.mstrCipher.isNotEmpty())
    89738973            {
    8974                 if (task.mstrCipher.isEmpty())
     8974                if (task.mstrNewPassword.isEmpty())
    89758975                    throw setError(VBOX_E_OBJECT_NOT_FOUND,
    8976                                    tr("No valid cipher identifier was given for encryption"));
     8976                                   tr("A password must be given for the image encryption"));
    89778977
    89788978                if (task.mstrNewPasswordId.isEmpty())
    89798979                    throw setError(VBOX_E_INVALID_OBJECT_STATE,
    8980                                    tr("A new password must always have a valid identifier"));
     8980                                   tr("A valid identifier for the password must be given"));
    89818981
    89828982                i_taskEncryptSettingsSetup(&CryptoSettingsWrite, task.mstrCipher.c_str(), NULL,
     
    89888988                                   i_vdError(vrc).c_str());
    89898989            }
    8990             else if (task.mstrNewPasswordId.isNotEmpty())
     8990            else if (task.mstrNewPasswordId.isNotEmpty() || task.mstrNewPassword.isNotEmpty())
    89918991                throw setError(VBOX_E_INVALID_OBJECT_STATE,
    8992                                tr("The password identifier must be empty if there is no new password set for encryption"));
     8992                               tr("The password and password identifier must be empty if there is the output shuld be unencrypted"));
    89938993
    89948994            /* Open all media in the chain. */
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