VirtualBox

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


Ignore:
Timestamp:
Apr 16, 2013 2:11:17 PM (12 years ago)
Author:
vboxsync
Message:

FE/Qt: Network-manager: Avoid using Qt Ssl networking stuff. Build-fix for r85060.

File:
1 edited

Legend:

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

    r45570 r45573  
    2222#include <QFile>
    2323#include <QThread>
    24 #include <QSslCertificate>
     24#include <QRegExp>
    2525
    2626/* GUI includes: */
     
    289289    {
    290290        /* Parse the file content: */
    291         QByteArray data(file.readAll());
    292         QList<QSslCertificate> certificates = QSslCertificate::fromData(data);
    293         if (certificates.size() != 2)
     291        QString strData(file.readAll());
     292        QRegExp regExp("(-{5}BEGIN CERTIFICATE-{5}[\\s\\S\\n]+-{5}END CERTIFICATE-{5})\\n"
     293                       "(-{5}BEGIN CERTIFICATE-{5}[\\s\\S\\n]+-{5}END CERTIFICATE-{5})");
     294        regExp.setMinimal(true);
     295        int iIndex = regExp.indexIn(strData);
     296        if (iIndex == -1)
    294297            rc = VERR_FILE_IO_ERROR;
    295298
     
    297300        if (RT_SUCCESS(rc))
    298301        {
    299             QByteArray certificate = certificates.first().toPem();
     302            QByteArray certificate = regExp.cap(1).toAscii();
    300303            rc = verifyCertificatePca3G5(pHttp, certificate);
    301304        }
    302305        if (RT_SUCCESS(rc))
    303306        {
    304             QByteArray certificate = certificates.last().toPem();
     307            QByteArray certificate = regExp.cap(2).toAscii();
    305308            rc = verifyCertificatePca3(pHttp, certificate);
    306309        }
     
    479482{
    480483    /* Save certificate: */
    481     QSslCertificate formattedCertificate = QSslCertificate::fromData(certificate).first();
    482     int rc = file.write(formattedCertificate.toPem()) != -1 ? VINF_SUCCESS : VERR_WRITE_ERROR;
     484    int rc = VINF_SUCCESS;
     485    if (RT_SUCCESS(rc))
     486        rc = file.write(certificate) != -1 ? VINF_SUCCESS : VERR_WRITE_ERROR;
     487
     488    /* Add 'new-line' character: */
     489    if (RT_SUCCESS(rc))
     490        rc = file.write("\n") != -1 ? VINF_SUCCESS : VERR_WRITE_ERROR;
     491
     492    /* Return result-code: */
    483493    return rc;
    484494}
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