@@ -97,7 +97,11 @@ static QList<QString> savedPaymentRequests;
97
97
98
98
static void ReportInvalidCertificate (const QSslCertificate& cert)
99
99
{
100
- qDebug () << " ReportInvalidCertificate: Payment server found an invalid certificate: " << cert.subjectInfo (QSslCertificate::CommonName);
100
+ #if QT_VERSION < 0x050000
101
+ qDebug () << QString (" %1: Payment server found an invalid certificate: " ).arg (__func__) << cert.serialNumber () << cert.subjectInfo (QSslCertificate::CommonName) << cert.subjectInfo (QSslCertificate::OrganizationalUnitName);
102
+ #else
103
+ qDebug () << QString (" %1: Payment server found an invalid certificate: " ).arg (__func__) << cert.serialNumber () << cert.subjectInfo (QSslCertificate::CommonName) << cert.subjectInfo (QSslCertificate::DistinguishedNameQualifier) << cert.subjectInfo (QSslCertificate::OrganizationalUnitName);
104
+ #endif
101
105
}
102
106
103
107
//
@@ -143,13 +147,20 @@ void PaymentServer::LoadRootCAs(X509_STORE* _store)
143
147
144
148
int nRootCerts = 0 ;
145
149
const QDateTime currentTime = QDateTime::currentDateTime ();
146
- foreach (const QSslCertificate& cert, certList)
147
- {
150
+
151
+ foreach (const QSslCertificate& cert, certList) {
152
+ // Don't log NULL certificates
153
+ if (cert.isNull ())
154
+ continue ;
155
+
156
+ // Not yet active/valid, or expired certificate
148
157
if (currentTime < cert.effectiveDate () || currentTime > cert.expiryDate ()) {
149
158
ReportInvalidCertificate (cert);
150
159
continue ;
151
160
}
161
+
152
162
#if QT_VERSION >= 0x050000
163
+ // Blacklisted certificate
153
164
if (cert.isBlacklisted ()) {
154
165
ReportInvalidCertificate (cert);
155
166
continue ;
@@ -301,7 +312,7 @@ PaymentServer::PaymentServer(QObject* parent, bool startLocalServer) :
301
312
302
313
// Install global event filter to catch QFileOpenEvents
303
314
// on Mac: sent when you click bitcoin: links
304
- // other OSes: helpful when dealing with payment request files (in the future)
315
+ // other OSes: helpful when dealing with payment request files
305
316
if (parent)
306
317
parent->installEventFilter (this );
307
318
@@ -332,14 +343,13 @@ PaymentServer::~PaymentServer()
332
343
}
333
344
334
345
//
335
- // OSX-specific way of handling bitcoin: URIs and
336
- // PaymentRequest mime types
346
+ // OSX-specific way of handling bitcoin: URIs and PaymentRequest mime types.
347
+ // Also used by paymentservertests.cpp and when opening a payment request file
348
+ // via "Open URI..." menu entry.
337
349
//
338
350
bool PaymentServer::eventFilter (QObject *object, QEvent *event)
339
351
{
340
- // clicking on bitcoin: URIs creates FileOpen events on the Mac
341
- if (event->type () == QEvent::FileOpen)
342
- {
352
+ if (event->type () == QEvent::FileOpen) {
343
353
QFileOpenEvent *fileEvent = static_cast <QFileOpenEvent*>(event);
344
354
if (!fileEvent->file ().isEmpty ())
345
355
handleURIOrFile (fileEvent->file ());
@@ -515,7 +525,7 @@ bool PaymentServer::readPaymentRequestFromFile(const QString& filename, PaymentR
515
525
return request.parse (data);
516
526
}
517
527
518
- bool PaymentServer::processPaymentRequest (PaymentRequestPlus& request, SendCoinsRecipient& recipient)
528
+ bool PaymentServer::processPaymentRequest (const PaymentRequestPlus& request, SendCoinsRecipient& recipient)
519
529
{
520
530
if (!optionsModel)
521
531
return false ;
@@ -560,9 +570,9 @@ bool PaymentServer::processPaymentRequest(PaymentRequestPlus& request, SendCoins
560
570
addresses.append (QString::fromStdString (CBitcoinAddress (dest).ToString ()));
561
571
}
562
572
else if (!recipient.authenticatedMerchant .isEmpty ()) {
563
- // Insecure payments to custom bitcoin addresses are not supported
564
- // (there is no good way to tell the user where they are paying in a way
565
- // they'd have a chance of understanding).
573
+ // Unauthenticated payment requests to custom bitcoin addresses are not supported
574
+ // (there is no good way to tell the user where they are paying in a way they'd
575
+ // have a chance of understanding).
566
576
emit message (tr (" Payment request rejected" ),
567
577
tr (" Unverified payment requests to custom payment scripts are unsupported." ),
568
578
CClientUIInterface::MSG_ERROR);
0 commit comments