Changeset 57616 in vbox
- Timestamp:
- Sep 4, 2015 3:39:39 AM (9 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 5 edited
-
Frontends/VirtualBox/src/net/UINetworkReply.cpp (modified) (8 diffs)
-
Runtime/common/crypto/RTCrStoreCertAddWantedFromFishingExpedition.cpp (modified) (3 diffs)
-
Runtime/common/crypto/store-cert-add-basic.cpp (modified) (3 diffs)
-
Runtime/common/misc/http.cpp (modified) (6 diffs)
-
Runtime/common/path/RTPathGlob.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
r57613 r57616 107 107 static unsigned countCertsFound(bool const *pafFoundCerts); 108 108 static bool areAllCertsFound(bool const *pafFoundCerts, bool fOnlyMandatory); 109 static int adjustCertsFound(int rc, bool *pafFoundCerts); 109 110 static void refreshCertificates(RTHTTP hHttp, RTCRSTORE hOldStore, bool *pafFoundCerts, const char *pszCaCertFile); 110 111 static void downloadMissingCertificates(RTCRSTORE hNewStore, bool *pafNewFoundCerts, RTHTTP hHttp, … … 342 343 */ 343 344 rc = RTCrStoreCertCheckWanted(hCurStore, s_aCerts, RT_ELEMENTS(s_aCerts), afCertsFound); 345 rc = adjustCertsFound(rc, afCertsFound); 344 346 AssertRC(rc); 345 347 RTTIMESPEC RefreshAge; … … 485 487 /* Apply HTTP headers: */ 486 488 return RTHttpSetHeaders(hHttp, formattedHeaderPointers.size(), ppFormattedHeaders); 489 } 490 491 /** 492 * Adjusts the set of found certificates by marking all alternatives found if 493 * one is. 494 * 495 * @returns Adjusted rc (VINF_SUCCESS instead of VWRN_NOT_FOUND if all found). 496 * @param rc The status code. 497 * @param pafFoundCerts Array parallel to s_aCerts with the status of 498 * each wanted certificate. 499 */ 500 /*static*/ int 501 UINetworkReplyPrivateThread::adjustCertsFound(int rc, bool *pafFoundCerts) 502 { 503 for (uint32_t i = 0; i < RT_ELEMENTS(s_aCerts); i++) 504 if (pafFoundCerts[i]) 505 { 506 uint8_t iAlt = i; 507 for (;;) 508 { 509 const CERTINFO *pCertInfo = (const CERTINFO *)s_aCerts[iAlt].pvUser; 510 iAlt = pCertInfo->iAlternativeTo; 511 if (iAlt >= RT_ELEMENTS(s_aCerts) || iAlt == i) 512 { 513 Assert(iAlt == UINT8_MAX || iAlt < RT_ELEMENTS(s_aCerts)); 514 break; 515 } 516 if (!pafFoundCerts[iAlt]) 517 pafFoundCerts[iAlt] = true; 518 } 519 } 520 521 if (rc == VINF_SUCCESS || rc == VWRN_NOT_FOUND) 522 rc = countCertsFound(pafFoundCerts) == RT_ELEMENTS(s_aCerts) ? VINF_SUCCESS : VWRN_NOT_FOUND; 523 return rc; 487 524 } 488 525 … … 559 596 560 597 rc = RTCrStoreCertCheckWanted(hNewStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts); 598 rc = adjustCertsFound(rc, afNewFoundCerts); 561 599 AssertLogRelRC(rc); 562 600 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/)); … … 566 604 RTCRCERTCTX_F_ADD_IF_NOT_FOUND | RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR, 567 605 hOldStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts); 606 rc = adjustCertsFound(rc, afNewFoundCerts); 568 607 AssertLogRelRC(rc); 569 608 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/)); … … 581 620 s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts, 582 621 RTErrInfoInitStatic(&StaticErrInfo)); 622 rc = adjustCertsFound(rc, afNewFoundCerts); 583 623 if (RTErrInfoIsSet(&StaticErrInfo.Core)) 584 624 LogRel(("refreshCertificates/#2: %s\n", StaticErrInfo.Core.pszMsg)); … … 652 692 */ 653 693 pafNewFoundCerts[i] = true; 654 if (a reAllCertsFound(pafNewFoundCerts, false /* fOnlyMandatory */))694 if (adjustCertsFound(VWRN_NOT_FOUND, pafNewFoundCerts) == VINF_SUCCESS) 655 695 { 656 696 RTHttpFreeResponse(pvRootsZip); … … 685 725 { 686 726 pafNewFoundCerts[i] = true; 727 adjustCertsFound(VWRN_NOT_FOUND, pafNewFoundCerts); 687 728 break; 688 729 } -
trunk/src/VBox/Runtime/common/crypto/RTCrStoreCertAddWantedFromFishingExpedition.cpp
r57613 r57616 146 146 #endif 147 147 #ifdef RT_OS_WINDOWS 148 "${ BothProgramFiles}/Git/bin/curl-ca-bundle.crt",149 "${ BothProgramFiles}/Mercurial/hgrc.d/cacert.pem",150 "${ BothProgramFiles}/Java/jre*/lib/security/cacerts",151 "${ BothProgramFiles}/Java/jdk*/jre/lib/security/cacerts",152 "${ BothProgramFiles}/HexChat/cert.pem",148 "${AllProgramFiles}/Git/bin/curl-ca-bundle.crt", 149 "${AllProgramFiles}/Mercurial/hgrc.d/cacert.pem", 150 "${AllProgramFiles}/Java/jre*/lib/security/cacerts", 151 "${AllProgramFiles}/Java/jdk*/jre/lib/security/cacerts", 152 "${AllProgramFiles}/HexChat/cert.pem", 153 153 "${SystemDrive}/BitNami/*/git/bin/curl-ca-bundle.crt", 154 154 "${SystemDrive}/BitNami/*/heroku/data/cacert.pem", … … 187 187 #endif 188 188 #ifdef RT_OS_WINDOWS 189 "${ BothProgramFiles}/Git/ssl/certs/",190 "${ BothProgramFiles}/Git/ssl/certs/expired/",191 "${ BothProgramFiles}/Common Files/Apple/Internet Services/security.resources/roots/",192 "${ BothProgramFiles}/Raptr/ca-certs/",189 "${AllProgramFiles}/Git/ssl/certs/", 190 "${AllProgramFiles}/Git/ssl/certs/expired/", 191 "${AllProgramFiles}/Common Files/Apple/Internet Services/security.resources/roots/", 192 "${AllProgramFiles}/Raptr/ca-certs/", 193 193 "${SystemDrive}/Bitname/*/git/ssl/certs/", 194 194 "${SystemDrive}/Bitnami/*/git/ssl/certs/expired/", … … 220 220 { 221 221 size_t cFound = rtCrStoreCountFound(pafFound, cWanted); 222 Assert(cFound == cWanted || fAllFound);222 Assert(cFound == cWanted || !fAllFound); 223 223 if (cFound == cWanted) 224 224 rc = VINF_SUCCESS; -
trunk/src/VBox/Runtime/common/crypto/store-cert-add-basic.cpp
r57614 r57616 281 281 RTSha1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha1); 282 282 uint8_t abSha512[RTSHA512_HASH_SIZE]; 283 RTSha 1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512);283 RTSha512(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512); 284 284 if (rtCrStoreIsCertWanted(paWanted, cWanted, pafFound, pCertCtx->cbEncoded, abSha1, abSha512, pCertCtx->pCert)) 285 285 { … … 373 373 RTSha1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha1); 374 374 uint8_t abSha512[RTSHA512_HASH_SIZE]; 375 RTSha 1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512);375 RTSha512(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512); 376 376 if (rtCrStoreMarkCertFound(pafFound, paWanted, cWanted, pCertCtx->cbEncoded, abSha1, abSha512, pCertCtx->pCert)) 377 377 { … … 528 528 RTSha1(pCurSec->pbData, pCurSec->cbData, abSha1); 529 529 uint8_t abSha512[RTSHA512_HASH_SIZE]; 530 RTSha 1(pCurSec->pbData, pCurSec->cbData, abSha512);530 RTSha512(pCurSec->pbData, pCurSec->cbData, abSha512); 531 531 if (!rtCrStoreIsCertWanted(paWanted, cWanted, pafFound, pCurSec->cbData, abSha1, abSha512, NULL)) 532 532 continue; -
trunk/src/VBox/Runtime/common/misc/http.cpp
r57613 r57616 559 559 rc = VERR_HTTP_PROXY_NOT_FOUND; 560 560 break; 561 case CURLE_WRITE_ERROR: 562 rc = RT_FAILURE_NP(pThis->rcOutput) ? pThis->rcOutput : VERR_WRITE_ERROR; 563 break; 564 //case CURLE_READ_ERROR 565 561 566 default: 562 567 break; … … 672 677 pThis->Output.Mem.cb = cbNewSize; 673 678 pThis->Output.Mem.pb[cbNewSize] = '\0'; 674 return VINF_SUCCESS;679 return cbToAppend; 675 680 } 676 681 … … 693 698 pThis->Output.Mem.pb = pbNew; 694 699 pThis->Output.Mem.cb = cbNewSize; 695 return VINF_SUCCESS;700 return cbToAppend; 696 701 } 697 702 … … 699 704 } 700 705 else 701 pThis->rcOutput = VERR_TOO_MUCH_DATA;706 pThis->rcOutput = VERR_TOO_MUCH_DATA; 702 707 703 708 /* … … 743 748 */ 744 749 bool fBusy = ASMAtomicXchgBool(&pThis->fBusy, true); 745 AssertReturn( fBusy, VERR_WRONG_ORDER);750 AssertReturn(!fBusy, VERR_WRONG_ORDER); 746 751 747 752 /* … … 846 851 */ 847 852 bool fBusy = ASMAtomicXchgBool(&pThis->fBusy, true); 848 AssertReturn( fBusy, VERR_WRONG_ORDER);853 AssertReturn(!fBusy, VERR_WRONG_ORDER); 849 854 850 855 /* -
trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp
r57615 r57616 49 49 # define INCL_BASE 50 50 # include <os2.h> 51 # undef RT_MAX /* collision */ 51 52 52 53 #endif … … 510 511 pszBuf[1] = ':'; 511 512 pszBuf[2] = '\0'; 513 *pcchValue = 2; 512 514 return VINF_EOF; 513 515 } … … 523 525 pszBuf[1] = ':'; 524 526 pszBuf[2] = '\0'; 527 *pcchValue = 2; 525 528 return VINF_EOF; 526 529 } … … 547 550 UINT cchSystemRoot = GetSystemWindowsDirectoryW(wszSystemRoot, MAX_PATH); 548 551 if (cchSystemRoot > 0) 549 return RTUtf16ToUtf8Ex(wszSystemRoot, cchSystemRoot, &pszBuf, cbBuf, NULL);552 return RTUtf16ToUtf8Ex(wszSystemRoot, cchSystemRoot, &pszBuf, cbBuf, pcchValue); 550 553 return RTErrConvertFromWin32(GetLastError()); 551 554 } … … 1029 1032 if (pAllocator->iNext >= pAllocator->cAllocated) 1030 1033 { 1031 uint32_t cNew = RT_MAX(pAllocator->cAllocated, 1) *2;1034 uint32_t cNew = pAllocator->cAllocated ? pAllocator->cAllocated * 2 : 2; 1032 1035 void *pvNew = RTMemRealloc(pAllocator->paInstructions, cNew * sizeof(pAllocator->paInstructions[0])); 1033 1036 AssertReturn(pvNew, VERR_NO_MEMORY); … … 1058 1061 * Zero or more characters wildcard. 1059 1062 */ 1060 /** @todo bitmap optimziation (index = ch). */1061 1063 if (ch == '*') 1062 1064 {
Note:
See TracChangeset
for help on using the changeset viewer.

