Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/network/ssl/qsslcertificate.cpp

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation (qt-info@nokia.com)
     
    260260/*!
    261261    Returns the certificate's serial number string in decimal format.
     262    In case the serial number cannot be converted to decimal format
     263    (i.e. if it is bigger than 4294967295, which means it does not fit into 4 bytes),
     264    its hexadecimal version is returned.
    262265*/
    263266QByteArray QSslCertificate::serialNumber() const
    264267{
    265     if (d->serialNumberString.isEmpty() && d->x509)
    266         d->serialNumberString =
    267             QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)));
    268 
     268    if (d->serialNumberString.isEmpty() && d->x509) {
     269        ASN1_INTEGER *serialNumber = d->x509->cert_info->serialNumber;
     270        // if we cannot convert to a long, just output the hexadecimal number
     271        if (serialNumber->length > 4) {
     272            QByteArray hexString;
     273            hexString.reserve(serialNumber->length * 3);
     274            for (int a = 0; a < serialNumber->length; ++a) {
     275                hexString += QByteArray::number(serialNumber->data[a], 16).rightJustified(2, '0');
     276                hexString += ':';
     277            }
     278            hexString.chop(1);
     279            d->serialNumberString = hexString;
     280        } else {
     281            d->serialNumberString = QByteArray::number(qlonglong(q_ASN1_INTEGER_get(serialNumber)));
     282        }
     283    }
    269284    return d->serialNumberString;
    270285}
     
    534549    int startIndex = 0;
    535550    if (pathPrefix.trimmed().isEmpty()) {
    536         startIndex = 2;
    537         pathPrefix = QLatin1String(".");
     551        if(path.startsWith(QLatin1Char('/'))) {
     552            pathPrefix = path.left(path.indexOf(QRegExp(QLatin1String("[\\*\\?\\[]"))));
     553            pathPrefix = path.left(path.lastIndexOf(QLatin1Char('/')));
     554        } else {
     555            startIndex = 2;
     556            pathPrefix = QLatin1String(".");
     557        }
    538558    }
    539559
     
    697717static bool matchLineFeed(const QByteArray &pem, int *offset)
    698718{
    699     char ch;
     719    char ch = 0;
    700720
    701721    // ignore extra whitespace at the end of the line
Note: See TracChangeset for help on using the changeset viewer.