VirtualBox

Ignore:
Timestamp:
Sep 9, 2015 3:42:22 PM (9 years ago)
Author:
vboxsync
Message:

UINetworkReply: Fixed s_aCerts size and added a testcase for checking the URL. This testcase replaces the deliberate 404 URLs against the update ping server.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r57480 r57671  
    7777# the VirtualBox setup below.
    7878#
     79# This is a bit messy.  We boldly ASSUME that LANGUAGE, IMAGES, FORMS
     80# and TRANSLATIONS are all unused by kBuild and the host toolchain.
     81#
    7982SAVED_TEMPLATE := $(TEMPLATE)
    8083include $(PATH_SUB_CURRENT)/VBoxUI.pro
     84TEMPLATE       := $(SAVED_TEMPLATE)
     85SAVED_TEMPLATE :=
     86LANGUAGE       :=
     87IMAGES         :=
     88# FORMS and TRANSLATIONS are reset further down.
    8189
    8290
     
    10021010
    10031011
     1012#
     1013# Unset everything that was loaded from VBoxUI.pro.
     1014#
     1015FORMS :=
     1016TRANSLATIONS :=
     1017
     1018
    10041019ifeq ($(KBUILD_TARGET),darwin)
    10051020#
     
    11141129endif
    11151130
     1131
    11161132#
    11171133# Testcase for the darwin keyboard routines.
    11181134#
    11191135ifdef VBOX_WITH_TESTCASES
    1120 PROGRAMS.darwin += tstDarwinKeyboard
    1121 tstDarwinKeyboard_NAME = tstDarwinKeyboard
    1122 tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
    1123 tstDarwinKeyboard_DEFS.x86 = USE_HID_FOR_MODIFIERS
    1124 tstDarwinKeyboard_INCS = include
    1125 tstDarwinKeyboard_SOURCES = \
    1126         src/platform/darwin/tstDarwinKeyboard.cpp \
    1127         src/platform/darwin/DarwinKeyboard.cpp
    1128 tstDarwinKeyboard_SOURCES.amd64 = \
    1129         src/platform/darwin/CocoaEventHelper.mm
    1130 tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon -framework AppKit
    1131 tstDarwinKeyboard_LIBS = \
    1132         $(LIB_RUNTIME)
    1133 endif
    1134 
    1135 
    1136 # Unset everything that was loaded from VBoxUI.pro.
    1137 TEMPLATE := $(SAVED_TEMPLATE)
    1138 SAVED_TEMPLATE :=
    1139 LANGUAGE :=
    1140 FORMS :=
    1141 TRANSLATIONS :=
    1142 IMAGES :=
     1136 PROGRAMS.darwin += tstDarwinKeyboard
     1137 tstDarwinKeyboard_TEMPLATE = VBOXR3TSTEXE
     1138 tstDarwinKeyboard_DEFS.x86 = USE_HID_FOR_MODIFIERS
     1139 tstDarwinKeyboard_INCS = include
     1140 tstDarwinKeyboard_SOURCES = \
     1141        src/platform/darwin/tstDarwinKeyboard.cpp \
     1142        src/platform/darwin/DarwinKeyboard.cpp
     1143 tstDarwinKeyboard_SOURCES.amd64 = \
     1144        src/platform/darwin/CocoaEventHelper.mm
     1145 tstDarwinKeyboard_LDFLAGS = -framework IOKit -framework Carbon -framework AppKit
     1146 tstDarwinKeyboard_LIBS = \
     1147        $(LIB_RUNTIME)
     1148endif
     1149
     1150
     1151#
     1152# Testcase for SSL certificate downloading.
     1153#
     1154if defined(VBOX_WITH_TESTCASES) && defined(VBOX_GUI_WITH_NETWORK_MANAGER)
     1155 PROGRAMS += tstSSLCertDownloads
     1156 tstSSLCertDownloads_TEMPLATE = VBOXQT4GUIEXE
     1157 tstSSLCertDownloads_DEFS = VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS
     1158 tstSSLCertDownloads_INCS = \
     1159        $(VBOX_GUI_INC_DIRS) \
     1160        $(VirtualBox_0_OUTDIR)/include
     1161 tstSSLCertDownloads_SOURCES = \
     1162        src/net/tstSSLCertDownloads.cpp
     1163 tstSSLCertDownloads_QT_MOCSRCS += \
     1164        src/net/UINetworkReply.cpp
     1165 tstSSLCertDownloads_QT_MODULES = Core GUI Network
     1166endif
    11431167
    11441168
  • trunk/src/VBox/Frontends/VirtualBox/src/net/UINetworkReply.cpp

    r57666 r57671  
    2525# include <QThread>
    2626# include <QRegExp>
     27# include <QVector>
    2728
    2829/* GUI includes: */
    2930# include "UINetworkReply.h"
    3031# include "UINetworkManager.h"
    31 # include "VBoxGlobal.h"
    32 # include "VBoxUtils.h"
     32# ifndef VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS
     33#  include "VBoxGlobal.h"
     34#  include "VBoxUtils.h"
     35# else
     36#  include <VBox/log.h>
     37# endif
    3338
    3439/* Other VBox includes; */
     
    116121    QByteArray m_reply;
    117122
     123    static const char * const s_apszRootsZipUrls[];
     124    static const CERTINFO s_CertInfoPcaCls3Gen5;
     125    static const RTCRCERTWANTED s_aCerts[];
    118126    static const QString s_strCertificateFileName;
    119     static const RTCRCERTWANTED s_aCerts[3];
    120     static const CERTINFO s_CertInfoPcaCls3Gen5;
     127
     128#ifdef VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS
     129    friend UINetworkReplyPrivateThreadTestcase;
     130#endif
    121131};
    122132
     133
     134/**
     135 * URLs to root zip files containing certificates we want.
     136 */
     137/*static*/ const char * const UINetworkReplyPrivateThread::s_apszRootsZipUrls[] =
     138{
     139    "http://www.symantec.com/content/en/us/enterprise/verisign/roots/roots.zip"
     140};
     141
     142
     143/**
     144 * Download details for
     145 */
    123146/*static*/ const UINetworkReplyPrivateThread::CERTINFO UINetworkReplyPrivateThread::s_CertInfoPcaCls3Gen5 =
    124147{
    125148    /*.pszZipFile     =*/
    126149    "VeriSign Root Certificates/Generation 5 (G5) PCA/VeriSign Class 3 Public Primary Certification Authority - G5.pem",
    127     /*.apszUrls[3]    =*/
     150    /*.apszUrls[]     =*/
    128151    {
    129152        "http://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem",
    130153        "http://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class-3-Public-Primary-Certification-Authority-G5.pem", /* (in case they correct above typo) */
    131154        "http://www.verisign.com/repository/roots/root-certificates/PCA-3G5.pem", /* dead */
    132         "http://update.virtualbox.org/cacerts-symantec-PCA-3G5-pem-has-gone-missing-again" /* attention getter */
     155        NULL,
    133156    }
    134157};
     
    139162 * The pvUser member points to a UINetworkReplyPrivateThread::CERTINFO.
    140163 */
    141 /* static */ const RTCRCERTWANTED UINetworkReplyPrivateThread::s_aCerts[3] =
     164/* static */ const RTCRCERTWANTED UINetworkReplyPrivateThread::s_aCerts[] =
    142165{
    143166    /*[0] =*/
     
    193216    m_strContext = tr("During proxy configuration");
    194217
     218#ifndef VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS
    195219    /* Get the proxymanager: */
    196220    UIProxyManager proxyManager(vboxGlobal().settings().proxySettings());
     
    198222    /* If the specific proxy settings aren't enabled, we'll use the
    199223       system default proxy.  Otherwise assume it's configured. */
    200     int rc;
    201     if (!proxyManager.proxyEnabled())
    202         rc = RTHttpUseSystemProxySettings(m_hHttp);
    203     else
    204         rc = RTHttpSetProxy(m_hHttp,
    205                             proxyManager.proxyHost().toUtf8().constData(),
    206                             proxyManager.proxyPort().toUInt(),
    207                             NULL /* pszProxyUser */, NULL /* pszProxyPwd */);
     224    if (proxyManager.proxyEnabled())
     225        return RTHttpSetProxy(m_hHttp,
     226                              proxyManager.proxyHost().toUtf8().constData(),
     227                              proxyManager.proxyPort().toUInt(),
     228                              NULL /* pszProxyUser */, NULL /* pszProxyPwd */);
    208229
    209230    /** @todo This should be some kind of tristate:
     
    216237     * that would require no real changes to the visible GUI... Just a thought.
    217238     */
    218     return rc;
     239#endif
     240    return RTHttpUseSystemProxySettings(m_hHttp);
    219241}
    220242
     
    377399QString UINetworkReplyPrivateThread::fullCertificateFileName()
    378400{
     401#ifndef VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS
    379402    const QDir homeDir(QDir::toNativeSeparators(vboxGlobal().homeFolder()));
    380403    return QDir::toNativeSeparators(homeDir.absoluteFilePath(s_strCertificateFileName));
     404#else
     405    return QString("/not/such/agency/non-existing-file.cer");
     406#endif
    381407}
    382408
     
    536562     * Try get the roots.zip from symantec (or virtualbox.org) first.
    537563     */
    538     static const char * const a_apszRootsZipUrls[] =
    539     {
    540         "http://www.symantec.com/content/en/us/enterprise/verisign/roots/roots.zip",
    541         "http://update.virtualbox.org/cacerts-symantec-roots-zip-has-gone-missing-again" /* Just to try grab our attention. */
    542     };
    543     for (uint32_t iUrl = 0; iUrl < RT_ELEMENTS(a_apszRootsZipUrls); iUrl++)
     564    for (uint32_t iUrl = 0; iUrl < RT_ELEMENTS(s_apszRootsZipUrls); iUrl++)
    544565    {
    545566        void   *pvRootsZip;
    546567        size_t  cbRootsZip;
    547         rc = RTHttpGetBinary(hHttp, a_apszRootsZipUrls[iUrl], &pvRootsZip, &cbRootsZip);
     568        rc = RTHttpGetBinary(hHttp, s_apszRootsZipUrls[iUrl], &pvRootsZip, &cbRootsZip);
    548569        if (RT_SUCCESS(rc))
    549570        {
     
    778799};
    779800
     801
     802
     803/*
     804 *
     805 * Class UINetworkReply implementation.
     806 * Class UINetworkReply implementation.
     807 * Class UINetworkReply implementation.
     808 *
     809 */
     810
     811#ifndef VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS
     812
    780813UINetworkReply::UINetworkReply(const QNetworkRequest &request, UINetworkRequestType requestType)
    781814    : m_replyType(UINetworkReplyType_Qt)
     
    892925}
    893926
     927#endif /* !VBOX_GUI_IN_TST_SSL_CERT_DOWNLOADS */
     928
    894929#include "UINetworkReply.moc"
    895930
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