Changeset 59621 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Feb 10, 2016 12:51:35 AM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 105460
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ApplianceImpl.h
r59586 r59621 157 157 HRESULT i_readFSOVF(TaskOVF *pTask); 158 158 HRESULT i_readFSOVA(TaskOVF *pTask); 159 HRESULT i_readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage); 159 HRESULT i_readOVFFile(TaskOVF *pTask, RTVFSIOSTREAM hIosOvf, const char *pszManifestEntry); 160 HRESULT i_readManifestFile(TaskOVF *pTask, RTVFSIOSTREAM hIosMf, const char *pszSubFileNm); 161 HRESULT i_readSignatureFile(TaskOVF *pTask, RTVFSIOSTREAM hIosCert, const char *pszSubFileNm); 162 HRESULT i_readTailProcessing(TaskOVF *pTask); 160 163 /** @} */ 161 164 … … 166 169 167 170 HRESULT i_importFS(TaskOVF *pTask); 168 HRESULT i_importFSOVF(TaskOVF *pTask, AutoWriteLockBase& writeLock); 169 HRESULT i_importFSOVA(TaskOVF *pTask, AutoWriteLockBase& writeLock); 170 171 HRESULT i_readFileToBuf(const Utf8Str &strFile, 172 void **ppvBuf, 173 size_t *pcbSize, 174 bool fCreateDigest, 175 PVDINTERFACEIO pCallbacks, 176 PSHASTORAGE pStorage); 177 HRESULT i_readTarFileToBuf(struct FSSRDONLYINTERFACEIO *pTarIo, 178 const Utf8Str &strFile, 179 void **ppvBuf, 180 size_t *pcbSize, 181 bool fCreateDigest, 182 PVDINTERFACEIO pCallbacks, 183 PSHASTORAGE pStorage); 184 HRESULT i_verifyManifestFile(const Utf8Str &strFile, ImportStack &stack, 185 RTVFSFILE hManifestVfsFile, const char *pszOvfEntry); 186 187 HRESULT i_verifyCertificateFile(void *pvBuf, size_t cbSize, PSHASTORAGE pStorage); 171 HRESULT i_importFSOVF(TaskOVF *pTask, AutoWriteLockBase &rWriteLock); 172 HRESULT i_importFSOVA(TaskOVF *pTask, AutoWriteLockBase &rWriteLock); 173 HRESULT i_importDoIt(TaskOVF *pTask, AutoWriteLockBase &rWriteLock, RTVFSFSSTREAM hVfsFssOva = NIL_RTVFSFSSTREAM); 174 175 HRESULT i_verifyManifestFile(ImportStack &stack); 188 176 189 177 void i_convertDiskAttachmentValues(const ovf::HardDiskController &hdc, … … 196 184 Utf8Str *strTargetPath, 197 185 ComObjPtr<Medium> &pTargetHD, 198 ImportStack &stack, 199 PVDINTERFACEIO pCallbacks, 200 PSHASTORAGE pStorage); 186 ImportStack &stack); 201 187 202 188 void i_importMachineGeneric(const ovf::VirtualSystem &vsysThis, 203 189 ComObjPtr<VirtualSystemDescription> &vsdescThis, 204 190 ComPtr<IMachine> &pNewMachine, 205 ImportStack &stack, 206 PVDINTERFACEIO pCallbacks, 207 PSHASTORAGE pStorage); 191 ImportStack &stack); 208 192 void i_importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis, 209 193 ComPtr<IMachine> &pNewMachine, 210 ImportStack &stack, 211 PVDINTERFACEIO pCallbacks, 212 PSHASTORAGE pStorage); 213 void i_importMachines(ImportStack &stack, 214 PVDINTERFACEIO pCallbacks, 215 PSHASTORAGE pStorage); 216 217 HRESULT i_preCheckImageAvailability(PSHASTORAGE pSHAStorage, 218 RTCString &availableImage); 194 ImportStack &stack); 195 void i_importMachines(ImportStack &stack); 196 197 HRESULT i_preCheckImageAvailability(ImportStack &stack); 198 bool i_importEnsureOvaLookAhead(ImportStack &stack); 199 RTVFSIOSTREAM i_importSetupDigestCalculationForGivenIoStream(RTVFSIOSTREAM hVfsIos, const char *pszManifestEntry); 200 RTVFSIOSTREAM i_importOpenSourceFile(ImportStack &stack, Utf8Str const &rstrSrcPath, const char *pszManifestEntry); 201 HRESULT i_importCreateAndWriteDestinationFile(Utf8Str const &rstrDstPath, 202 RTVFSIOSTREAM hVfsIosSrc, Utf8Str const &rstrSrcLogNm); 203 204 void i_importCopyFile(ImportStack &stack, Utf8Str const &rstrSrcPath, Utf8Str const &rstrDstPath, 205 const char *pszManifestEntry); 206 void i_importDecompressFile(ImportStack &stack, Utf8Str const &rstrSrcPath, Utf8Str const &rstrDstPath, 207 const char *pszManifestEntry); 219 208 /** @} */ 220 209 -
trunk/src/VBox/Main/include/ApplianceImplPrivate.h
r59555 r59621 28 28 #include <iprt/manifest.h> 29 29 #include <iprt/vfs.h> 30 #include <iprt/crypto/x509.h> 30 31 31 32 //////////////////////////////////////////////////////////////////////////////// … … 60 61 Data() 61 62 : state(ApplianceIdle) 63 , fDigestTypes(0) 64 , hOurManifest(NIL_RTMANIFEST) 62 65 , fManifest(true) 63 66 , fSha256(false) 67 , fDeterminedDigestTypes(false) 68 , hTheirManifest(NIL_RTMANIFEST) 69 , hMemFileTheirManifest(NIL_RTVFSFILE) 70 , fSignerCertLoaded(false) 71 , fSignatureValid(false) 72 , pbSignedDigest(NULL) 73 , cbSignedDigest(0) 74 , enmSignedDigestType(RTDIGESTTYPE_INVALID) 64 75 , fExportISOImages(false) 65 76 , pReader(NULL) … … 79 90 pReader = NULL; 80 91 } 92 resetReadData(); 93 } 94 95 /** 96 * Resets data used by read. 97 */ 98 void resetReadData(void) 99 { 100 strOvfManifestEntry.setNull(); 101 if (hOurManifest != NIL_RTMANIFEST) 102 { 103 RTManifestRelease(hOurManifest); 104 hOurManifest = NIL_RTMANIFEST; 105 } 106 if (hTheirManifest != NIL_RTMANIFEST) 107 { 108 RTManifestRelease(hTheirManifest); 109 hTheirManifest = NIL_RTMANIFEST; 110 } 111 if (hMemFileTheirManifest) 112 { 113 RTVfsFileRelease(hMemFileTheirManifest); 114 hMemFileTheirManifest = NIL_RTVFSFILE; 115 } 116 if (pbSignedDigest) 117 { 118 RTMemFree(pbSignedDigest); 119 pbSignedDigest = NULL; 120 cbSignedDigest = 0; 121 } 122 if (fSignerCertLoaded) 123 { 124 RTCrX509Certificate_Delete(&SignerCert); 125 fSignerCertLoaded = false; 126 } 127 enmSignedDigestType = RTDIGESTTYPE_INVALID; 128 fSignatureValid = false; 129 fDeterminedDigestTypes = false; 130 fDigestTypes = RTMANIFEST_ATTR_SHA1 | RTMANIFEST_ATTR_SHA256; 81 131 } 82 132 … … 84 134 85 135 LocationInfo locInfo; // location info for the currently processed OVF 136 /** The digests types to calculate (RTMANIFEST_ATTR_XXX) for the manifest. 137 * This will be a single value when exporting. Zero, one or two. */ 138 uint32_t fDigestTypes; 139 /** Manifest created while importing or exporting. */ 140 RTMANIFEST hOurManifest; 141 142 /** @name Write data 143 * @{ */ 86 144 bool fManifest; // Create a manifest file on export 87 145 bool fSha256; // true = SHA256 (OVF 2.0), false = SHA1 (OVF 1.0) 88 Utf8Str strOVFSHADigest;//SHA digest of OVf file. It is stored here after reading OVF file (before import) 146 /** @} */ 147 148 /** @name Read data 149 * @{ */ 150 /** The manifest entry name of the OVF-file. */ 151 Utf8Str strOvfManifestEntry; 152 153 /** Set if we've parsed the manifest and determined the digest types. */ 154 bool fDeterminedDigestTypes; 155 156 /** Manifest read in during read() and kept around for later verification. */ 157 RTMANIFEST hTheirManifest; 158 /** Memorized copy of the manifest file for signature checking purposes. */ 159 RTVFSFILE hMemFileTheirManifest; 160 161 /** The signer certificate from the signature fiel (.cert). 162 * This will be used in the future provide information about the signer via 163 * the API. */ 164 RTCRX509CERTIFICATE SignerCert; 165 /** Set if the SignerCert member contains usable data. */ 166 bool fSignerCertLoaded; 167 /** Set by read() if it found a certificate and the signature is fine. */ 168 bool fSignatureValid; 169 /** The signed digest of the manifest. */ 170 uint8_t *pbSignedDigest; 171 /** The size of the signed digest. */ 172 size_t cbSignedDigest; 173 /** The digest type used to sign the manifest. */ 174 RTDIGESTTYPE enmSignedDigestType; 175 /** @} */ 89 176 90 177 bool fExportISOImages;// when 1 the ISO images are exported 91 bool fX509;// wether X509 is used or not92 178 93 179 RTCList<ImportOptions_T> optListImport; … … 211 297 bool fSessionOpen; // true if the pSession is currently open and needs closing 212 298 299 /** @name File access related stuff (TAR stream) 300 * @{ */ 301 /** OVA file system stream handle. NIL if not OVA. */ 302 RTVFSFSSTREAM hVfsFssOva; 303 /** OVA lookahead I/O stream object. */ 304 RTVFSIOSTREAM hVfsIosOvaLookAhead; 305 /** OVA lookahead I/O stream object name. */ 306 char *pszOvaLookAheadName; 307 /** @} */ 308 213 309 // a list of images that we created/imported; this is initially empty 214 310 // and will be cleaned up on errors 215 311 std::list<MyHardDiskAttachment> llHardDiskAttachments; // disks that were attached 216 RTMANIFEST hSrcDisksManifest; /**< Manifest we build while processing/reading the source disks. */ 217 std::map<Utf8Str , Utf8Str> mapNewUUIDsToOriginalUUIDs; 312 std::map<Utf8Str , Utf8Str> mapNewUUIDsToOriginalUUIDs; 218 313 219 314 ImportStack(const LocationInfo &aLocInfo, 220 315 const ovf::DiskImagesMap &aMapDisks, 221 ComObjPtr<Progress> &aProgress) 316 ComObjPtr<Progress> &aProgress, 317 RTVFSFSSTREAM aVfsFssOva) 222 318 : locInfo(aLocInfo), 223 319 mapDisks(aMapDisks), … … 228 324 ulMemorySizeMB(0), 229 325 fSessionOpen(false), 230 hSrcDisksManifest(NIL_RTMANIFEST) 231 { 326 hVfsFssOva(aVfsFssOva), 327 hVfsIosOvaLookAhead(NIL_RTVFSIOSTREAM), 328 pszOvaLookAheadName(NULL) 329 { 330 if (hVfsFssOva != NIL_RTVFSFSSTREAM) 331 RTVfsFsStrmRetain(hVfsFssOva); 332 232 333 // disk images have to be on the same place as the OVF file. So 233 334 // strip the filename out of the full file path … … 238 339 ~ImportStack() 239 340 { 240 if (hSrcDisksManifest != NIL_RTMANIFEST) 241 { 242 RTManifestRelease(hSrcDisksManifest); 243 hSrcDisksManifest = NIL_RTMANIFEST; 341 if (hVfsFssOva != NIL_RTVFSFSSTREAM) 342 { 343 RTVfsFsStrmRelease(hVfsFssOva); 344 hVfsFssOva = NIL_RTVFSFSSTREAM; 345 } 346 if (hVfsIosOvaLookAhead != NIL_RTVFSIOSTREAM) 347 { 348 RTVfsIoStrmRelease(hVfsIosOvaLookAhead); 349 hVfsIosOvaLookAhead = NIL_RTVFSIOSTREAM; 350 } 351 if (pszOvaLookAheadName) 352 { 353 RTStrFree(pszOvaLookAheadName); 354 pszOvaLookAheadName = NULL; 244 355 } 245 356 } … … 248 359 HRESULT saveOriginalUUIDOfAttachedDevice(settings::AttachedDevice &device, 249 360 const Utf8Str &newlyUuid); 361 RTVFSIOSTREAM claimOvaLookAHead(void); 362 250 363 }; 251 364 … … 292 405 PVDINTERFACEIO tarWriterCreateInterface(void); 293 406 294 /** Pointer to the instance data for the fssRdOnly_ methods. */295 typedef struct FSSRDONLYINTERFACEIO *PFSSRDONLYINTERFACEIO;296 297 int fssRdOnlyCreateInterfaceForTarFile(const char *pszFilename, PFSSRDONLYINTERFACEIO *pTarIo);298 void fssRdOnlyDestroyInterface(PFSSRDONLYINTERFACEIO pFssIo);299 int fssRdOnlyGetCurrentName(PFSSRDONLYINTERFACEIO pFssIo, const char **ppszName);300 bool fssRdOnlyEqualsCurrentFilename(PFSSRDONLYINTERFACEIO pFssIo, com::Utf8Str const &rstrFilename);301 int fssRdOnlyMemorizeCurrentAsFile(PFSSRDONLYINTERFACEIO pFssIo, PRTVFSFILE phVfsFile);302 int fssRdOnlySkipCurrent(PFSSRDONLYINTERFACEIO pFssIo);303 bool fssRdOnlyIsCurrentDirectory(PFSSRDONLYINTERFACEIO pFssIo);304 305 int readFileIntoBuffer(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser);306 407 int writeBufferToFile(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser); 307 int decompressImageAndSave(const char *pcszFullFilenameIn, const char *pcszFullFilenameOut, PVDINTERFACEIO pIfIo, void *pvUser); 308 int copyFileAndCalcShaDigest(const char *pcszSourceFilename, const char *pcszTargetFilename, PVDINTERFACEIO pIfIo, void *pvUser); 408 309 409 #endif // !____H_APPLIANCEIMPLPRIVATE 310 410 -
trunk/src/VBox/Main/include/MediumImpl.h
r58484 r59621 212 212 const ComObjPtr<MediumFormat> &aFormat, 213 213 MediumVariant_T aVariant, 214 PVDINTERFACEIO aVDImageIOIf, void *aVDImageIOUser,214 RTVFSIOSTREAM hVfsIosSrc, 215 215 const ComObjPtr<Medium> &aParent, 216 216 const ComObjPtr<Progress> &aProgress);
Note:
See TracChangeset
for help on using the changeset viewer.