VirtualBox

Changeset 84031 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 28, 2020 9:55:27 AM (5 years ago)
Author:
vboxsync
Message:

bugre:9699. Added the function getManifest() into the IAppliance interface. Saving manifest name and manifest data in the string form after reading an appliance.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/idl/VirtualBox.xidl

    r83973 r84031  
    35103510      addresses, if the import options are used to keep them.</desc>
    35113511    </const>
    3512 
    35133512  </enum>
    35143513
     
    36343633    uuid="86a98347-7619-41aa-aece-b21ac5c1a7e6"
    36353634    wsmap="managed"
    3636     reservedMethods="7" reservedAttributes="8"
     3635    reservedMethods="6" reservedAttributes="8"
    36373636    >
    36383637    <desc>
     
    37813780      </desc>
    37823781    </attribute>
     3782
     3783    <method name="getManifest">
     3784      <desc>
     3785        Return manifest represented in the OVF and type of digest used there.
     3786      </desc>
     3787      <param name="manifest" type="wstring" dir="out">
     3788        <desc>
     3789          The manifest represented in the OVF. Empty if not exist.
     3790          This is available after calling <link to="#read"/>.
     3791        </desc>
     3792      </param>
     3793      <param name="manifestName" type="wstring" dir="out">
     3794        <desc>
     3795          The manifest file name. Empty if not exist.
     3796        </desc>
     3797      </param>
     3798
     3799    </method>
    37833800
    37843801    <method name="read">
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r82968 r84031  
    9393    HRESULT getVirtualSystemDescriptions(std::vector<ComPtr<IVirtualSystemDescription> > &aVirtualSystemDescriptions);
    9494    HRESULT getMachines(std::vector<com::Utf8Str> &aMachines);
     95
     96    HRESULT getManifest(com::Utf8Str &aManifest, com::Utf8Str &aManifestName);
    9597
    9698    // wrapped IAppliance methods
  • trunk/src/VBox/Main/include/ApplianceImplPrivate.h

    r82968 r84031  
    133133            cbSignedDigest = 0;
    134134        }
     135
    135136        if (fSignerCertLoaded)
    136137        {
     
    148149        ptrCertificateInfo.setNull();
    149150        strCertError.setNull();
     151        strManifest.setNull();
     152        strManifestName.setNull();
    150153    }
    151154
     
    161164    /** @name Write data
    162165     * @{ */
    163     bool                fManifest;      // Create a manifest file on export
     166    bool                fManifest;     // Create a manifest file on export
    164167    /** @} */
    165168
     
    176179    /** Memorized copy of the manifest file for signature checking purposes. */
    177180    RTVFSFILE           hMemFileTheirManifest;
     181    /** The string contains manifest data. */
     182    Utf8Str            strManifest;
     183    /** The string contains manifest file name after reading appliance. */
     184    Utf8Str            strManifestName;
    178185
    179186    /** The signer certificate from the signature file (.cert).
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r82968 r84031  
    505505 * Public method implementation.
    506506 */
     507HRESULT Appliance::getManifest(com::Utf8Str &aManifest, com::Utf8Str &aManifestName)
     508{
     509    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
     510
     511    aManifest = m->strManifest;
     512    aManifestName = m->strManifestName;
     513    return S_OK;
     514}
     515
     516/**
     517 * Public method implementation.
     518 */
    507519HRESULT Appliance::getDisks(std::vector<com::Utf8Str> &aDisks)
    508520{
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r82968 r84031  
    25692569    LogFlowFunc(("%s[%s]\n", pTask->locInfo.strPath.c_str(), pszSubFileNm));
    25702570
     2571    /* Remember the manifet file name */
     2572    m->strManifestName.assign(pszSubFileNm);
     2573
    25712574    /*
    25722575     * Copy the manifest into a memory backed file so we can later do signature
     
    25782581        return setErrorVrc(vrc, tr("Error reading the manifest file '%s' for '%s' (%Rrc)"),
    25792582                           pszSubFileNm, pTask->locInfo.strPath.c_str(), vrc);
     2583
     2584    /*
     2585     * Store the manifest as a string in the m->strManifest
     2586     */
     2587    {
     2588        char   abBuf[_16K];
     2589        size_t cbRead;
     2590
     2591        vrc = RTVfsFileRead(m->hMemFileTheirManifest, &abBuf, sizeof(abBuf), &cbRead);
     2592        if (RT_SUCCESS(vrc))
     2593            m->strManifest.assignEx((const char*)abBuf, cbRead);
     2594
     2595        /* Rewind to the beginning, because the manifest will be read later again */
     2596        RTVfsFileSeek(m->hMemFileTheirManifest, 0, RTFILE_SEEK_BEGIN, NULL);
     2597    }
    25802598
    25812599    /*
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