VirtualBox

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


Ignore:
Timestamp:
Sep 4, 2015 3:39:39 AM (9 years ago)
Author:
vboxsync
Message:

IPRT,UINetworkReply: Build & bug fixes.

File:
1 edited

Legend:

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

    r57613 r57616  
    107107    static unsigned countCertsFound(bool const *pafFoundCerts);
    108108    static bool areAllCertsFound(bool const *pafFoundCerts, bool fOnlyMandatory);
     109    static int  adjustCertsFound(int rc, bool *pafFoundCerts);
    109110    static void refreshCertificates(RTHTTP hHttp, RTCRSTORE hOldStore, bool *pafFoundCerts, const char *pszCaCertFile);
    110111    static void downloadMissingCertificates(RTCRSTORE hNewStore, bool *pafNewFoundCerts, RTHTTP hHttp,
     
    342343             */
    343344            rc = RTCrStoreCertCheckWanted(hCurStore, s_aCerts, RT_ELEMENTS(s_aCerts), afCertsFound);
     345            rc = adjustCertsFound(rc, afCertsFound);
    344346            AssertRC(rc);
    345347            RTTIMESPEC RefreshAge;
     
    485487    /* Apply HTTP headers: */
    486488    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
     501UINetworkReplyPrivateThread::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;
    487524}
    488525
     
    559596
    560597            rc = RTCrStoreCertCheckWanted(hNewStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts);
     598            rc = adjustCertsFound(rc, afNewFoundCerts);
    561599            AssertLogRelRC(rc);
    562600            Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     
    566604                                                     RTCRCERTCTX_F_ADD_IF_NOT_FOUND | RTCRCERTCTX_F_ADD_CONTINUE_ON_ERROR,
    567605                                                     hOldStore, s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts);
     606                rc = adjustCertsFound(rc, afNewFoundCerts);
    568607                AssertLogRelRC(rc);
    569608                Assert(rc != VINF_SUCCESS || areAllCertsFound(afNewFoundCerts, false /*fOnlyMandatory*/));
     
    581620                                                                 s_aCerts, RT_ELEMENTS(s_aCerts), afNewFoundCerts,
    582621                                                                 RTErrInfoInitStatic(&StaticErrInfo));
     622                rc = adjustCertsFound(rc, afNewFoundCerts);
    583623                if (RTErrInfoIsSet(&StaticErrInfo.Core))
    584624                    LogRel(("refreshCertificates/#2: %s\n", StaticErrInfo.Core.pszMsg));
     
    652692                                 */
    653693                                pafNewFoundCerts[i] = true;
    654                                 if (areAllCertsFound(pafNewFoundCerts, false /* fOnlyMandatory */))
     694                                if (adjustCertsFound(VWRN_NOT_FOUND, pafNewFoundCerts) == VINF_SUCCESS)
    655695                                {
    656696                                    RTHttpFreeResponse(pvRootsZip);
     
    685725                        {
    686726                            pafNewFoundCerts[i] = true;
     727                            adjustCertsFound(VWRN_NOT_FOUND, pafNewFoundCerts);
    687728                            break;
    688729                        }
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