fix crash in SSL config
authorKonrad Rosenbaum <konrad@silmor.de>
Mon, 23 Jul 2012 19:54:02 +0000 (21:54 +0200)
committerKonrad Rosenbaum <konrad@silmor.de>
Mon, 23 Jul 2012 19:54:02 +0000 (21:54 +0200)
src/dialogs/configdialog.cpp
src/dialogs/configdialog.h
src/misc/debug.cpp

index da7bf54..8e8121f 100644 (file)
@@ -547,7 +547,7 @@ void MConfigDialog::serverProbe()
        QNetworkAccessManager man;
        connect(&man,SIGNAL(finished(QNetworkReply*)),&loop,SLOT(quit()));
        QTimer::singleShot(30000,&loop,SLOT(quit()));
-       connect(&man,SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)), this,SLOT(sslErrors(QNetworkReply*,const QList<QSslError>&)));
+    connect(&man,SIGNAL(sslErrors(QNetworkReply*,const QList<QSslError>&)), this,SLOT(sslErrors(QNetworkReply*,QList<QSslError>)));
        if(useproxy->isChecked())
                man.setProxy(QNetworkProxy(QNetworkProxy::HttpProxy,proxyname->text(),proxyport->value(),proxyuser->text(),proxypass->text()));
        //query server
@@ -568,17 +568,26 @@ void MConfigDialog::serverProbe()
        sslexcept->savesslexcept();
 }
 
-void MConfigDialog::sslErrors(QNetworkReply*rp,const QList<QSslError>&errs)
+void MConfigDialog::sslErrors(QNetworkReply*rp,QList<QSslError>errs)
 {
        if(!sslexcept)return;
        //check/record/clear
-       if(sslexcept->checksslexcept(errs))rp->ignoreSslErrors();
+    if(sslexcept->checksslexcept(errs)){
+        rp->ignoreSslErrors();
+        return;
+    }
        //convert to string
        QString err=tr("SSL Errors encountered:\n");
        for(int i=0;i<errs.size();i++){
+        qDebug()<<"err type"<<(int)errs[i].error();
+        qDebug()<<"err stri"<<errs[i].errorString();
                QSslCertificate c=errs[i].certificate();
                err+=tr("Certificate \"%1\"\n  Fingerprint (sha1): %2\n  Error: %3\n")
-                       .arg(c.subjectInfo(QSslCertificate::CommonName).at(0))
+            .arg(c.subjectInfo(QSslCertificate::CommonName)
+#if QT_VERSION >= 0x50000
+                 .value(0)
+#endif
+                 )
                        .arg(QString::fromAscii(c.digest(QCryptographicHash::Sha1).toHex()))
                        .arg(errs[i].errorString());
        }
index 8f5d864..43fbb93 100644 (file)
@@ -71,7 +71,7 @@ class MConfigDialog:public QDialog
                void setAppStyle();
                //ssl server probe
                void serverProbe();
-               void sslErrors(QNetworkReply*,const QList<QSslError>&);
+        void sslErrors(QNetworkReply*,QList<QSslError>);
                void clearSslExceptions();
                void sslFillModel();
 };
index 6308617..562ba9d 100644 (file)
@@ -15,6 +15,7 @@
 
 #include <QCoreApplication>
 #include <QDateTime>
+#include <QDebug>
 #include <QDir>
 #include <QFile>
 
@@ -34,6 +35,9 @@ static void mymsghandler(QtMsgType, const char *msg)
 
 void initDebug()
 {
+    if(QCoreApplication::instance()->arguments().contains("-nolog")){
+        qDebug()<<"-nolog argument was given, will not create a log file";
+    }
        //create new log file
        QDir(dataDir).mkpath("debuglog");
         mylogFile=new QFile(dataDir+"/debuglog/log-"+QDateTime::currentDateTime().toString("yyyy-MM-dd_hh.mm.ss.zzz")+".txt");