Mercurial > trustbridge
changeset 204:825b42da1855
Avoid printing an error when an empty certificate ist constructed
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Wed, 26 Mar 2014 13:32:47 +0100 |
parents | 60c5df8e7980 |
children | e35983a322d6 |
files | ui/certificate.cpp ui/tests/certlistparsertest.cpp |
diffstat | 2 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/ui/certificate.cpp Wed Mar 26 13:29:09 2014 +0100 +++ b/ui/certificate.cpp Wed Mar 26 13:32:47 2014 +0100 @@ -15,6 +15,10 @@ x509_crt x509cert; + if (b64Line.isEmpty()) { + return; + } + /* Cut of the first two chars (e.g. I: and decode) */ QByteArray asn1data = QByteArray::fromBase64( b64Line.right(b64Line.size() - 2).toLatin1()); @@ -25,6 +29,7 @@ asn1data.size()); if (ret != 0) { qDebug() << "Parsing certificate failed with error: " << ret; + qDebug() << "Failed cert: " << asn1data.toBase64(); x509_crt_free(&x509cert); return; }
--- a/ui/tests/certlistparsertest.cpp Wed Mar 26 13:29:09 2014 +0100 +++ b/ui/tests/certlistparsertest.cpp Wed Mar 26 13:32:47 2014 +0100 @@ -51,6 +51,7 @@ QVERIFY(instLines.size() == instList.size()); QVERIFY(remoLines.size() == remoList.size()); + /* Check that a default certificate is invalid */ Certificate cert; QVERIFY(!cert.isValid()); @@ -96,7 +97,6 @@ { const char *fname = "empty_file"; CertificateList *certList = testWithFile(fname); - printf("Status :%i\n ",certList->getStatus()); QCOMPARE (certList->getStatus(), SeekFailed); delete certList; }