Changeset 50193 in vbox for trunk/src/VBox/Main
- Timestamp:
- Jan 23, 2014 5:50:07 PM (11 years ago)
- Location:
- trunk/src/VBox/Main/src-server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/ApplianceImplIO.cpp
r48955 r50193 305 305 for (;;) 306 306 { 307 char *pszFilename = 0;307 char *pszFilename; 308 308 rc = RTTarCurrentFile(tar, &pszFilename); 309 309 if (RT_SUCCESS(rc)) … … 311 311 if (rc == VINF_TAR_DIR_PATH) 312 312 { 313 RTStrFree(pszFilename); 313 314 break; 314 315 } … … 319 320 if (fFound) 320 321 break; 321 else 322 { 323 rc = RTTarSeekNextFile(tar); 324 if (RT_FAILURE(rc)) 325 { 326 break; 327 } 328 } 322 rc = RTTarSeekNextFile(tar); 323 if (RT_FAILURE(rc)) 324 break; 329 325 } 330 326 else -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r50182 r50193 792 792 793 793 int vrc = RTTarCurrentFile(tar, &pszFilename); 794 795 794 if (RT_FAILURE(vrc)) 796 {797 795 throw setError(VBOX_E_FILE_ERROR, 798 tr("Could not open the current file in the OVA package (%Rrc)"), vrc); 799 } 800 else 801 { 802 if (vrc == VINF_TAR_DIR_PATH) 803 { 804 throw setError(VBOX_E_FILE_ERROR, 805 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 806 pszFilename, 807 vrc); 808 } 796 tr("Could not open the current file in the OVA package (%Rrc)"), vrc); 797 if (vrc == VINF_TAR_DIR_PATH) 798 { 799 HRESULT hrc = setError(VBOX_E_FILE_ERROR, 800 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 801 pszFilename, vrc); 802 RTStrFree(pszFilename); 803 throw hrc; 809 804 } 810 805 … … 1127 1122 /* Cleanup */ 1128 1123 if (pszFilename) 1129 RT MemFree(pszFilename);1124 RTStrFree(pszFilename); 1130 1125 if (pShaIo) 1131 1126 RTMemFree(pShaIo); … … 1666 1661 pShaIo->Core.pNext = NULL; 1667 1662 1668 /* Read the file name of the first file (need to be the ovf file). This 1669 * is how all internal files are named. */ 1663 /* 1664 * File #1 - the .ova file. 1665 * 1666 * Read the name of the first file. This is how all internal files 1667 * are named. 1668 */ 1670 1669 vrc = RTTarCurrentFile(tar, &pszFilename); 1671 1670 if (RT_FAILURE(vrc)) 1672 1671 throw setError(VBOX_E_IPRT_ERROR, 1673 1672 tr("Getting the OVF file within the archive failed (%Rrc)"), vrc); 1674 else 1675 { 1676 if (vrc == VINF_TAR_DIR_PATH) 1677 { 1678 throw setError(VBOX_E_FILE_ERROR, 1679 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 1680 pszFilename, 1681 vrc); 1682 } 1683 } 1673 if (vrc == VINF_TAR_DIR_PATH) 1674 throw setError(VBOX_E_FILE_ERROR, 1675 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 1676 pszFilename, vrc); 1684 1677 1685 1678 /* save original OVF filename */ … … 1696 1689 throw setError(VBOX_E_IPRT_ERROR, 1697 1690 tr("Seeking within the archive failed (%Rrc)"), vrc); 1698 else 1699 { 1700 RTTarCurrentFile(tar, &pszFilename); 1701 if (vrc == VINF_TAR_DIR_PATH) 1702 { 1703 throw setError(VBOX_E_FILE_ERROR, 1704 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 1705 pszFilename, 1706 vrc); 1707 } 1708 } 1691 RTStrFree(pszFilename); 1692 pszFilename = NULL; 1693 RTTarCurrentFile(tar, &pszFilename); 1694 if (vrc == VINF_TAR_DIR_PATH) 1695 throw setError(VBOX_E_FILE_ERROR, 1696 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 1697 pszFilename, vrc); 1709 1698 1710 1699 PVDINTERFACEIO pCallbacks = pShaIo; 1711 1700 PSHASTORAGE pStorage = &storage; 1712 1701 1713 /* We always need to create the digest, cause we d idn't know if there1702 /* We always need to create the digest, cause we don't know if there 1714 1703 * is a manifest file in the stream. */ 1715 1704 pStorage->fCreateDigest = true; 1716 1705 1717 1706 /* 1718 * Try to read the manifest file. First try.1707 * File #2 - the manifest file (.mf), optional. 1719 1708 * 1720 1709 * Note: This isn't fatal if the file is not found. The standard 1721 * defines 3 cases. 1722 * 1. no manifest file 1723 * 2. manifest file after the OVF file 1724 * 3. manifest file after all disk files 1710 * defines 3 cases: 1711 * 1. no manifest file 1712 * 2. manifest file after the OVF file 1713 * 3. manifest file after all disk files 1714 * 1725 1715 * If we want streaming capabilities, we can't check if it is there by 1726 1716 * searching for it. We have to try to open it on all possible places. … … 1728 1718 */ 1729 1719 rc = i_readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage); 1730 if (FAILED(rc)) throw rc; 1720 if (FAILED(rc)) 1721 throw rc; 1731 1722 1732 1723 /* 1733 * Try to read the certificate file. First try. 1734 * Logic is the same as with manifest file 1735 * Only if the manifest file had been read successfully before 1724 * File #3 - certificate file (.cer), optional. 1725 * 1726 * Logic is the same as with manifest file. This only makes sense if 1727 * there is a manifest file. 1736 1728 */ 1737 1729 vrc = RTTarCurrentFile(tar, &pszFilename); … … 1753 1745 } 1754 1746 1755 /* Now import the appliance. */ 1747 /* 1748 * Now import the appliance. 1749 */ 1756 1750 i_importMachines(stack, pCallbacks, pStorage); 1757 /* Try to read the manifest file. Second try. */ 1751 1752 /* 1753 * The certificate and mainifest files may alternatively be stored 1754 * after the disk files, so look again if we didn't find them already. 1755 */ 1758 1756 if (!pvMfBuf) 1759 1757 { 1758 /* 1759 * File #N-1 - The manifest file, optional. 1760 */ 1760 1761 rc = i_readTarFileToBuf(tar, strMfFile, &pvMfBuf, &cbMfSize, true, pCallbacks, pStorage); 1761 1762 if (FAILED(rc)) throw rc; … … 1770 1771 1771 1772 /* 1772 * Try to read the certificate file. Second try.1773 * Only if the manifest file had been read successfully before1773 * File #N - The certificate file, optional. 1774 * (Requires mainfest, as mention before.) 1774 1775 */ 1775 1776 RTStrFree(pszFilename); 1777 pszFilename = NULL; 1776 1778 vrc = RTTarCurrentFile(tar, &pszFilename); 1777 1779 if (RT_SUCCESS(vrc)) … … 1823 1825 /* Cleanup */ 1824 1826 if (pszFilename) 1825 RT MemFree(pszFilename);1827 RTStrFree(pszFilename); 1826 1828 if (pvMfBuf) 1827 1829 RTMemFree(pvMfBuf); … … 2071 2073 if (RT_SUCCESS(vrc)) 2072 2074 { 2073 if (vrc == VINF_TAR_DIR_PATH) 2074 { 2075 rc = setError(VBOX_E_FILE_ERROR, 2076 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 2077 pszCurFile, 2078 vrc); 2079 } 2080 else 2075 if (vrc != VINF_TAR_DIR_PATH) 2081 2076 { 2082 2077 if (!strcmp(pszCurFile, RTPathFilename(strFile.c_str()))) 2083 2078 rc = i_readFileToBuf(strFile, ppvBuf, pcbSize, fCreateDigest, pCallbacks, pStorage); 2084 RTStrFree(pszCurFile);2085 2079 } 2080 else 2081 rc = setError(VBOX_E_FILE_ERROR, 2082 tr("Empty directory folder (%s) isn't allowed in the OVA package (%Rrc)"), 2083 pszCurFile, vrc); 2084 RTStrFree(pszCurFile); 2086 2085 } 2087 2086 else if (vrc != VERR_TAR_END_OF_FILE) … … 3012 3011 size_t i = 0; 3013 3012 for (list<VirtualSystemDescriptionEntry*>::const_iterator itHD = avsdeHDs.begin(); itHD != avsdeHDs.end(); ++itHD, i++) 3014 Log(("avsdeHDs[%zu]: strRef=%s\n", i, (*itHD)->strRef.c_str())); 3013 Log(("avsdeHDs[%zu]: strRef=%s strOvf=%s\n", i, (*itHD)->strRef.c_str(), (*itHD)->strOvf.c_str())); 3014 i = 0; 3015 for (ovf::DiskImagesMap::const_iterator itDisk = stack.mapDisks.begin(); itDisk != stack.mapDisks.end(); ++itDisk) 3016 Log(("mapDisks[%zu]: strDiskId=%s strHref=%s\n", i, itDisk->second.strDiskId.c_str(), itDisk->second.strHref.c_str())); 3017 3015 3018 } 3016 3019 #endif … … 3038 3041 3039 3042 VirtualSystemDescriptionEntry *vsdeTargetHD = 0; 3040 Log(("diCurrent.strDiskId=%s \n", diCurrent.strDiskId.c_str()));3043 Log(("diCurrent.strDiskId=%s diCurrent.strHref=%s\n", diCurrent.strDiskId.c_str(), diCurrent.strHref.c_str())); 3041 3044 3042 3045 /*
Note:
See TracChangeset
for help on using the changeset viewer.