VirtualBox

Changeset 57666 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Sep 9, 2015 1:21:56 PM (9 years ago)
Author:
vboxsync
Message:

UINetworkReply: Bugfix from previous commit and jettisoning the fMandatory mess.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp

    r57665 r57666  
    8383    void run();
    8484
    85     /** Info about wanted certificate. */
     85    /** Additinoal download nfo about wanted certificate. */
    8686    typedef struct CERTINFO
    8787    {
    88         /** Set if mandatory. */
    89         bool        fMandatory;
    9088        /** Filename in the zip file we download (PEM). */
    9189        const char *pszZipFile;
     
    10098    static int applyRawHeaders(RTHTTP hHttp, const QList<QByteArray> &headers, const QNetworkRequest &request);
    10199    static unsigned countCertsFound(bool const *pafFoundCerts);
    102     static bool areAllCertsFound(bool const *pafFoundCerts, bool fOnlyMandatory);
     100    static bool areAllCertsFound(bool const *pafFoundCerts);
    103101    static void refreshCertificates(RTHTTP hHttp, RTCRSTORE hOldStore, bool *pafFoundCerts, const char *pszCaCertFile);
    104102    static void downloadMissingCertificates(RTCRSTORE hNewStore, bool *pafNewFoundCerts, RTHTTP hHttp,
     
    125123/*static*/ const UINetworkReplyPrivateThread::CERTINFO UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen5 =
    126124{
    127     /*.fMandatory     =*/   true,
    128125    /*.pszZipFile     =*/
    129126    "VeriSign Root Certificates/Generation 5 (G5) PCA/VeriSign Class 3 Public Primary Certification Authority - G5.pem",
     
    293290         * Final verdict.
    294291         */
    295         if (areAllCertsFound(afCertsFound, true /*fOnlyMandatory*/))
     292        if (areAllCertsFound(afCertsFound))
    296293            rc = VINF_SUCCESS;
    297294        else
     
    429426 * @param   pafFoundCerts       Array parallel to s_aCerts with the status of
    430427 *                              each wanted certificate.
    431  * @param   fOnlyMandatory      Only require mandatory certificates to be
    432  *                              present.  If false, all certificates must be
    433  *                              found before we return true.
    434428 */
    435429/*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;
     430UINetworkReplyPrivateThread::areAllCertsFound(bool const *pafFoundCerts)
     431{
     432    for (uint32_t i = 0; i < RT_ELEMENTS(s_aCerts); i++)
     433        if (!pafFoundCerts[i])
     434            return false;
    449435    return true;
    450436}
     
    481467            rc = RTCrStoreCertCheckWanted(hNewStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts);
    482468            AssertLogRelRC(rc);
    483             Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     469            Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts));
    484470            if (rc != VINF_SUCCESS)
    485471            {
     
    488474                                                     hOldStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts);
    489475                AssertLogRelRC(rc);
    490                 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     476                Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts));
    491477            }
    492478
     
    504490                if (RTErrInfoIsSet(&StaticErrInfo.Core))
    505491                    LogRel(("refreshCertificates/#2: %s\n", StaticErrInfo.Core.pszMsg));
    506                 Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     492                Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts));
    507493            }
    508494
     
    517503             * replace the CA certs file.
    518504             */
    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) )
    523507            {
    524508                rc = RTCrStoreCertExportAsPem(hNewStore, 0 /*fFlags*/, pszCaCertFile);
     
    583567                                 */
    584568                                pafNewFoundCerts[i] = true;
    585                                 if (areAllCertsFound(pafNewFoundCerts, false /*fOnlyMandator*/) == VINF_SUCCESS)
     569                                if (areAllCertsFound(pafNewFoundCerts))
    586570                                {
    587571                                    RTHttpFreeResponse(pvRootsZip);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette