Changeset 57666 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Sep 9, 2015 1:21:56 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp
r57665 r57666 83 83 void run(); 84 84 85 /** Info about wanted certificate. */85 /** Additinoal download nfo about wanted certificate. */ 86 86 typedef struct CERTINFO 87 87 { 88 /** Set if mandatory. */89 bool fMandatory;90 88 /** Filename in the zip file we download (PEM). */ 91 89 const char *pszZipFile; … … 100 98 static int applyRawHeaders(RTHTTP hHttp, const QList<QByteArray> &headers, const QNetworkRequest &request); 101 99 static unsigned countCertsFound(bool const *pafFoundCerts); 102 static bool areAllCertsFound(bool const *pafFoundCerts , bool fOnlyMandatory);100 static bool areAllCertsFound(bool const *pafFoundCerts); 103 101 static void refreshCertificates(RTHTTP hHttp, RTCRSTORE hOldStore, bool *pafFoundCerts, const char *pszCaCertFile); 104 102 static void downloadMissingCertificates(RTCRSTORE hNewStore, bool *pafNewFoundCerts, RTHTTP hHttp, … … 125 123 /*static*/ const UINetworkReplyPrivateThread::CERTINFO UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen5 = 126 124 { 127 /*.fMandatory =*/ true,128 125 /*.pszZipFile =*/ 129 126 "VeriSign Root Certificates/Generation 5 (G5) PCA/VeriSign Class 3 Public Primary Certification Authority - G5.pem", … … 293 290 * Final verdict. 294 291 */ 295 if (areAllCertsFound(afCertsFound , true /*fOnlyMandatory*/))292 if (areAllCertsFound(afCertsFound)) 296 293 rc = VINF_SUCCESS; 297 294 else … … 429 426 * @param pafFoundCerts Array parallel to s_aCerts with the status of 430 427 * each wanted certificate. 431 * @param fOnlyMandatory Only require mandatory certificates to be432 * present. If false, all certificates must be433 * found before we return true.434 428 */ 435 429 /*static*/ bool 436 UINetworkReplyPrivateThread::areAllCertsFound(bool const *pafFoundCerts, bool fOnlyMandatory) 437 { 438 if (fOnlyMandatory) 439 { 440 for (uint32_t i = 0; i < RT_ELEMENTS(s_aCerts); i++) 441 if ( !pafFoundCerts[i] 442 && ((const CERTINFO *)s_aCerts[i].pvUser)->fMandatory) 443 return false; 444 } 445 else 446 for (uint32_t i = 0; i < RT_ELEMENTS(s_aCerts); i++) 447 if (!pafFoundCerts[i]) 448 return false; 430 UINetworkReplyPrivateThread::areAllCertsFound(bool const *pafFoundCerts) 431 { 432 for (uint32_t i = 0; i < RT_ELEMENTS(s_aCerts); i++) 433 if (!pafFoundCerts[i]) 434 return false; 449 435 return true; 450 436 } … … 481 467 rc = RTCrStoreCertCheckWanted(hNewStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts); 482 468 AssertLogRelRC(rc); 483 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts , false /*fOnlyMandatory*/));469 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts)); 484 470 if (rc != VINF_SUCCESS) 485 471 { … … 488 474 hOldStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts); 489 475 AssertLogRelRC(rc); 490 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts , false /*fOnlyMandatory*/));476 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts)); 491 477 } 492 478 … … 504 490 if (RTErrInfoIsSet(&StaticErrInfo.Core)) 505 491 LogRel(("refreshCertificates/#2: %s\n", StaticErrInfo.Core.pszMsg)); 506 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts , false /*fOnlyMandatory*/));492 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts)); 507 493 } 508 494 … … 517 503 * replace the CA certs file. 518 504 */ 519 if ( areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/) 520 || ( countCertsFound(afNewFoundCerts) >= countCertsFound(pafOldFoundCerts) 521 && areAllCertsFound(afNewFoundCerts, true /*fOnlyMandatory*/) 522 >= areAllCertsFound(pafOldFoundCerts, true /*fOnlyMandatory*/) ) ) 505 if ( areAllCertsFound(afNewFoundCerts) 506 || countCertsFound(afNewFoundCerts) >= countCertsFound(pafOldFoundCerts) ) 523 507 { 524 508 rc = RTCrStoreCertExportAsPem(hNewStore, 0 /*fFlags*/, pszCaCertFile); … … 583 567 */ 584 568 pafNewFoundCerts[i] = true; 585 if (areAllCertsFound(pafNewFoundCerts , false /*fOnlyMandator*/) == VINF_SUCCESS)569 if (areAllCertsFound(pafNewFoundCerts)) 586 570 { 587 571 RTHttpFreeResponse(pvRootsZip);
Note:
See TracChangeset
for help on using the changeset viewer.