Changeset 57616 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 4, 2015 3:39:39 AM (9 years ago)
- File:
-
- 1 edited
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 }
Note:
See TracChangeset
for help on using the changeset viewer.