VirtualBox

Changeset 57616 in vbox


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

IPRT,UINetworkReply: Build & bug fixes.

Location:
trunk/src/VBox
Files:
5 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                        }
  • trunk/src/VBox/Runtime/common/crypto/RTCrStoreCertAddWantedFromFishingExpedition.cpp

    r57613 r57616  
    146146#endif
    147147#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",
    153153            "${SystemDrive}/BitNami/*/git/bin/curl-ca-bundle.crt",
    154154            "${SystemDrive}/BitNami/*/heroku/data/cacert.pem",
     
    187187#endif
    188188#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/",
    193193            "${SystemDrive}/Bitname/*/git/ssl/certs/",
    194194            "${SystemDrive}/Bitnami/*/git/ssl/certs/expired/",
     
    220220    {
    221221        size_t cFound = rtCrStoreCountFound(pafFound, cWanted);
    222         Assert(cFound == cWanted || fAllFound);
     222        Assert(cFound == cWanted || !fAllFound);
    223223        if (cFound == cWanted)
    224224            rc = VINF_SUCCESS;
  • trunk/src/VBox/Runtime/common/crypto/store-cert-add-basic.cpp

    r57614 r57616  
    281281                RTSha1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha1);
    282282                uint8_t abSha512[RTSHA512_HASH_SIZE];
    283                 RTSha1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512);
     283                RTSha512(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512);
    284284                if (rtCrStoreIsCertWanted(paWanted, cWanted, pafFound, pCertCtx->cbEncoded, abSha1, abSha512, pCertCtx->pCert))
    285285                {
     
    373373                RTSha1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha1);
    374374                uint8_t abSha512[RTSHA512_HASH_SIZE];
    375                 RTSha1(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512);
     375                RTSha512(pCertCtx->pabEncoded, pCertCtx->cbEncoded, abSha512);
    376376                if (rtCrStoreMarkCertFound(pafFound, paWanted, cWanted, pCertCtx->cbEncoded, abSha1, abSha512, pCertCtx->pCert))
    377377                {
     
    528528                    RTSha1(pCurSec->pbData, pCurSec->cbData, abSha1);
    529529                    uint8_t abSha512[RTSHA512_HASH_SIZE];
    530                     RTSha1(pCurSec->pbData, pCurSec->cbData, abSha512);
     530                    RTSha512(pCurSec->pbData, pCurSec->cbData, abSha512);
    531531                    if (!rtCrStoreIsCertWanted(paWanted, cWanted, pafFound, pCurSec->cbData, abSha1, abSha512, NULL))
    532532                        continue;
  • trunk/src/VBox/Runtime/common/misc/http.cpp

    r57613 r57616  
    559559                rc = VERR_HTTP_PROXY_NOT_FOUND;
    560560                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
    561566            default:
    562567                break;
     
    672677            pThis->Output.Mem.cb = cbNewSize;
    673678            pThis->Output.Mem.pb[cbNewSize] = '\0';
    674             return VINF_SUCCESS;
     679            return cbToAppend;
    675680        }
    676681
     
    693698            pThis->Output.Mem.pb = pbNew;
    694699            pThis->Output.Mem.cb = cbNewSize;
    695             return VINF_SUCCESS;
     700            return cbToAppend;
    696701        }
    697702
     
    699704    }
    700705    else
    701         pThis->rcOutput      = VERR_TOO_MUCH_DATA;
     706        pThis->rcOutput = VERR_TOO_MUCH_DATA;
    702707
    703708    /*
     
    743748     */
    744749    bool fBusy = ASMAtomicXchgBool(&pThis->fBusy, true);
    745     AssertReturn(fBusy, VERR_WRONG_ORDER);
     750    AssertReturn(!fBusy, VERR_WRONG_ORDER);
    746751
    747752    /*
     
    846851     */
    847852    bool fBusy = ASMAtomicXchgBool(&pThis->fBusy, true);
    848     AssertReturn(fBusy, VERR_WRONG_ORDER);
     853    AssertReturn(!fBusy, VERR_WRONG_ORDER);
    849854
    850855    /*
  • trunk/src/VBox/Runtime/common/path/RTPathGlob.cpp

    r57615 r57616  
    4949# define INCL_BASE
    5050# include <os2.h>
     51# undef RT_MAX /* collision */
    5152
    5253#endif
     
    510511                pszBuf[1] = ':';
    511512                pszBuf[2] = '\0';
     513                *pcchValue = 2;
    512514                return VINF_EOF;
    513515            }
     
    523525            pszBuf[1] = ':';
    524526            pszBuf[2] = '\0';
     527            *pcchValue = 2;
    525528            return VINF_EOF;
    526529        }
     
    547550        UINT cchSystemRoot = GetSystemWindowsDirectoryW(wszSystemRoot, MAX_PATH);
    548551        if (cchSystemRoot > 0)
    549             return RTUtf16ToUtf8Ex(wszSystemRoot, cchSystemRoot, &pszBuf, cbBuf, NULL);
     552            return RTUtf16ToUtf8Ex(wszSystemRoot, cchSystemRoot, &pszBuf, cbBuf, pcchValue);
    550553        return RTErrConvertFromWin32(GetLastError());
    551554    }
     
    10291032        if (pAllocator->iNext >= pAllocator->cAllocated)
    10301033        {
    1031             uint32_t cNew = RT_MAX(pAllocator->cAllocated, 1) * 2;
     1034            uint32_t cNew = pAllocator->cAllocated ? pAllocator->cAllocated * 2 : 2;
    10321035            void *pvNew = RTMemRealloc(pAllocator->paInstructions, cNew * sizeof(pAllocator->paInstructions[0]));
    10331036            AssertReturn(pvNew, VERR_NO_MEMORY);
     
    10581061             * Zero or more characters wildcard.
    10591062             */
    1060             /** @todo bitmap optimziation (index = ch).   */
    10611063            if (ch == '*')
    10621064            {
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