Changeset 46980 in vbox
- Timestamp:
- Jul 4, 2013 11:38:28 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/manifest.h
r45227 r46980 61 61 typedef enum RTDIGESTTYPE 62 62 { 63 /** unknown digest*/64 RTDIGESTTYPE_ UNKNOWN,65 /** CRC32 checksum */66 RTDIGESTTYPE_CRC32 = 1,67 /** CRC64 checksum */63 /** Invalid digest value. */ 64 RTDIGESTTYPE_INVALID = 0, 65 /** CRC32 checksum. */ 66 RTDIGESTTYPE_CRC32, 67 /** CRC64 checksum. */ 68 68 RTDIGESTTYPE_CRC64, 69 /** MD5 checksum (unsafe!) */69 /** MD5 checksum (unsafe!). */ 70 70 RTDIGESTTYPE_MD5, 71 /** SHA1 checksum (unsafe!) */71 /** SHA1 checksum (unsafe!). */ 72 72 RTDIGESTTYPE_SHA1, 73 /** SHA256 checksum */73 /** SHA256 checksum. */ 74 74 RTDIGESTTYPE_SHA256, 75 /** SHA512 checksum */ 76 RTDIGESTTYPE_SHA512 75 /** SHA512 checksum. */ 76 RTDIGESTTYPE_SHA512, 77 /** Usual 32-bit type blowup. */ 78 RTDIGESTTYPE_32BIT_HACK = 0x7fffffff 77 79 } RTDIGESTTYPE; 78 80 /** @} */ … … 448 450 * VERR_MANIFEST_DIGEST_MISMATCH error case 449 451 * (optional). 452 * @deprecated Use the RTMANIFEST based API instead. 450 453 */ 451 454 RTR3DECL(int) RTManifestVerify(const char *pszManifestFile, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed); … … 465 468 * @param pfnProgressCallback optional callback for the progress indication 466 469 * @param pvUser user defined pointer for the callback 470 * @deprecated Use the RTMANIFEST based API instead. 467 471 */ 468 472 RTR3DECL(int) RTManifestVerifyFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles, size_t *piFailed, … … 482 486 * @param pfnProgressCallback optional callback for the progress indication 483 487 * @param pvUser user defined pointer for the callback 488 * @deprecated Use the RTMANIFEST based API instead. 484 489 */ 485 490 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, RTDIGESTTYPE enmDigestType, … … 488 493 489 494 /** 490 * Verify the type of digest in the manifest file in memory.495 * Queries the first digest type found in the given manifest. 491 496 * 492 497 * @returns iprt status code. … … 494 499 * @param pvBuf Pointer to memory buffer of the manifest file. 495 500 * @param cbSize Size of the memory buffer. 496 * VERR_MANIFEST_DIGEST_MISMATCH error case497 * (optional).498 * @ param digestType digest type499 */ 500 RTR3DECL(int) RTManifestVerifyDigestType(void *pvBuf, size_t cbSize, RTDIGESTTYPE &digestType);501 * @param penmDigestType Where to return the first digest type found in 502 * the manifest. 503 * @deprecated Use the RTMANIFEST based API instead. 504 */ 505 RTR3DECL(int) RTManifestVerifyDigestType(void const *pvBuf, size_t cbSize, RTDIGESTTYPE *penmDigestType); 501 506 502 507 /** … … 513 518 * VERR_MANIFEST_DIGEST_MISMATCH error case 514 519 * (optional). 520 * @deprecated Use the RTMANIFEST based API instead. 515 521 */ 516 522 RTR3DECL(int) RTManifestVerifyFilesBuf(void *pvBuf, size_t cbSize, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed); … … 528 534 * @param paFiles Array of file names and digests. 529 535 * @param cFiles Number of entries in paFiles. 536 * @deprecated Use the RTMANIFEST based API instead. 530 537 */ 531 538 RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, RTDIGESTTYPE enmDigestType, PRTMANIFESTTEST paFiles, size_t cFiles); -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r46972 r46980 965 965 uint64_t maxFileSize = _1M; 966 966 size_t cbRead = 0; 967 void *pBuf; 967 void *pBuf; /** @todo r=bird: You leak this buffer! throwing stuff is evil. */ 968 968 969 969 vrc = RTFileGetSize(pFile, &cbFile); … … 993 993 RTFileClose(pFile); 994 994 995 RTDIGESTTYPE digestType = RTDIGESTTYPE_UNKNOWN;996 vrc = RTManifestVerifyDigestType(pBuf, cbRead, digestType);995 RTDIGESTTYPE digestType; 996 vrc = RTManifestVerifyDigestType(pBuf, cbRead, &digestType); 997 997 998 998 if (RT_FAILURE(vrc)) -
trunk/src/VBox/Runtime/common/checksum/manifest.cpp
r46972 r46980 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Manifest file handling .3 * IPRT - Manifest file handling, old style - deprecated. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009-201 2Oracle Corporation7 * Copyright (C) 2009-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 67 67 typedef RTMANIFESTCALLBACKDATA* PRTMANIFESTCALLBACKDATA; 68 68 69 69 70 /******************************************************************************* 70 71 * Private functions … … 96 97 pData->pvUser); 97 98 } 99 98 100 99 101 /******************************************************************************* … … 269 271 270 272 271 RTR3DECL(int) RTManifestVerifyDigestType(void *pvBuf, size_t cbSize, RTDIGESTTYPE &digestType)273 RTR3DECL(int) RTManifestVerifyDigestType(void *pvBuf, size_t cbSize, RTDIGESTTYPE *penmDigestType) 272 274 { 273 275 /* Validate input */ 274 276 AssertPtrReturn(pvBuf, VERR_INVALID_POINTER); 275 277 AssertReturn(cbSize > 0, VERR_INVALID_PARAMETER); 278 AssertPtrRetrn(penmDigestType, VERR_INVALID_POINTER) 276 279 277 280 int rc = VINF_SUCCESS; 278 281 279 char *pcBuf = (char*)pvBuf;282 char const *pcBuf = (char *)pvBuf; 280 283 size_t cbRead = 0; 281 284 /* Parse the manifest file line by line */ … … 283 286 { 284 287 if (cbRead >= cbSize) 285 { 286 digestType = RTDIGESTTYPE_UNKNOWN; 287 rc = VERR_MANIFEST_UNSUPPORTED_DIGEST_TYPE; 288 break; 289 } 288 return VERR_MANIFEST_UNSUPPORTED_DIGEST_TYPE; 290 289 291 290 size_t cch = rtManifestIndexOfCharInBuf(pcBuf, cbSize - cbRead, '\n') + 1; … … 303 302 } 304 303 304 /** @todo r=bird: Missing space check here. */ 305 305 /* Check for the digest algorithm */ 306 if ( pcBuf[0] == 'S'307 308 309 310 { 311 digestType = RTDIGESTTYPE_SHA1;312 break; 313 } 314 else if (pcBuf[0] == 'S'315 316 317 318 319 320 { 321 digestType = RTDIGESTTYPE_SHA256;306 if ( pcBuf[0] == 'S' 307 && pcBuf[1] == 'H' 308 && pcBuf[2] == 'A' 309 && pcBuf[3] == '1') 310 { 311 *penmDigestType = RTDIGESTTYPE_SHA1; 312 break; 313 } 314 if ( pcBuf[0] == 'S' 315 && pcBuf[1] == 'H' 316 && pcBuf[2] == 'A' 317 && pcBuf[3] == '2' 318 && pcBuf[4] == '5' 319 && pcBuf[5] == '6') 320 { 321 *penmDigestType = RTDIGESTTYPE_SHA256; 322 322 break; 323 323 } … … 329 329 return rc; 330 330 } 331 331 332 332 333 RTR3DECL(int) RTManifestVerifyFilesBuf(void *pvBuf, size_t cbSize, PRTMANIFESTTEST paTests, size_t cTests, size_t *piFailed) … … 373 374 /** @todo r=bird: 374 375 * -# Better deal with this EOF line platform dependency 375 * -# The SHA1 testshould probably include a blank space check.376 * -# The SHA1 and SHA256 tests should probably include a blank space check. 376 377 * -# If there is a specific order to the elements in the string, it would be 377 378 * good if the delimiter searching checked for it. … … 380 381 381 382 /* Check for the digest algorithm */ 382 if ( cch < 4 ||383 (!( pcBuf[0] == 'S'384 && pcBuf[1] == 'H'385 && pcBuf[2] == 'A'386 && pcBuf[3] == '1')387 388 !( pcBuf[0] == 'S'389 && pcBuf[1] == 'H'390 && pcBuf[2] == 'A'391 && pcBuf[3] == '2'392 && pcBuf[4] == '5'393 && pcBuf[5] == '6'))383 if ( cch < 4 384 || ( !( pcBuf[0] == 'S' 385 && pcBuf[1] == 'H' 386 && pcBuf[2] == 'A' 387 && pcBuf[3] == '1') 388 && 389 !( pcBuf[0] == 'S' 390 && pcBuf[1] == 'H' 391 && pcBuf[2] == 'A' 392 && pcBuf[3] == '2' 393 && pcBuf[4] == '5' 394 && pcBuf[5] == '6') 394 395 ) 396 ) 395 397 { 396 398 /* Digest unsupported */ … … 455 457 for (size_t i = 0; i < cTests; ++i) 456 458 { 459 /** @todo r=bird: Using RTStrStr here looks bogus. */ 457 460 if (RTStrStr(paFiles[i].pTestPattern->pszTestFile, RTStrStrip(pszName)) != NULL) 458 461 { … … 578 581 } 579 582 583 -
trunk/src/VBox/Runtime/common/zip/tar.cpp
r46971 r46980 5 5 6 6 /* 7 * Copyright (C) 2009-201 2Oracle Corporation7 * Copyright (C) 2009-2013 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 336 336 /* Fill the header record */ 337 337 // RT_ZERO(pRecord); - done by the caller. 338 /** @todo use RTStrCopy */ 338 339 size_t cb = RTStrPrintf(pRecord->h.name, sizeof(pRecord->h.name), "%s", pszSrcName); 339 340 if (cb < strlen(pszSrcName)) … … 1669 1670 pInt->pFileCache = NULL; 1670 1671 } 1671 else/* Are we still direct behind that header? */1672 else/* Are we still directly behind that header? */ 1672 1673 { 1673 1674 /* Yes, so the streaming can start. Just return the cached file … … 1678 1679 if (pInt->pFileCache->linkflag == LF_DIR) 1679 1680 return VINF_TAR_DIR_PATH; 1680 else 1681 return VINF_SUCCESS; 1681 return VINF_SUCCESS; 1682 1682 } 1683 1683 … … 1722 1722 1723 1723 if (pFileInt->linkflag == LF_DIR) 1724 {1725 1724 rc = VINF_TAR_DIR_PATH; 1726 }1727 1725 } 1728 1726 } while (0);
Note:
See TracChangeset
for help on using the changeset viewer.