[PATCH] Improve debug output for list verification and no installed list

Wald Commits scm-commit at wald.intevation.org
Fri Jan 23 15:25:54 CET 2015


# HG changeset patch
# User Andre Heinecke <andre.heinecke at intevation.de>
# Date 1422023150 -3600
# Node ID 8d27c6d226cd3a9ab49c010c963c9e3faf2f3cfc
# Parent  a9dcf6c86d19e4cbfe744a64a31a57070af19a1b
Improve debug output for list verification and no installed list

diff -r a9dcf6c86d19 -r 8d27c6d226cd common/listutil.c
--- a/common/listutil.c	Mon Jan 19 15:45:28 2015 +0100
+++ b/common/listutil.c	Fri Jan 23 15:25:50 2015 +0100
@@ -135,6 +135,7 @@
 
   if (!data || !size)
     {
+      ERRORPRINTF ("Invalid call.\n");
       return -1;
     }
 
@@ -142,7 +143,8 @@
   p = strchr(data, '\r');
   if (p == 0 || (unsigned int)(p - (data + 2)) != sig_b64_size)
     {
-      /*        printf("Invalid data. Signature might be too long.\n"); */
+      DEBUGPRINTF("Invalid data. Signature might be too long.\n");
+      DEBUGPRINTF("Should: %u is: %u\n", sig_b64_size, (unsigned int)(p - (data + 2)));
       return -1;
     }
   strncpy(signature_b64, data + 2, sig_b64_size);
@@ -153,7 +155,7 @@
 
   if (ret != 0 || sig_size != TRUSTBRIDGE_RSA_KEY_SIZE / 8)
     {
-      /*        printf("failed to decode signature\n"); */
+      DEBUGPRINTF("failed to decode signature\n");
       return -1;
     }
 
diff -r a9dcf6c86d19 -r 8d27c6d226cd ui/main.cpp
--- a/ui/main.cpp	Mon Jan 19 15:45:28 2015 +0100
+++ b/ui/main.cpp	Fri Jan 23 15:25:50 2015 +0100
@@ -122,7 +122,7 @@
         printf (APPNAME " Version: %s \n",
                 QApplication::applicationVersion().toLocal8Bit().constData());
 #ifndef RELEASE_BUILD
-        printf ("Test Version! - Not for productive use!\n";
+        printf ("Test Version! - Not for productive use!\n");
 #endif
         printf (COPYRIGHT);
         return 0;
diff -r a9dcf6c86d19 -r 8d27c6d226cd ui/mainwindow.cpp
--- a/ui/mainwindow.cpp	Mon Jan 19 15:45:28 2015 +0100
+++ b/ui/mainwindow.cpp	Fri Jan 23 15:25:50 2015 +0100
@@ -234,6 +234,8 @@
         if (!mListToInstall.isValid()) {
             handleLTE(lteInvalidList);
             mCurState = TransferError;
+            qDebug() << "Failed to validate certificate list. Removing: " << availableFileName;
+            qDebug() << "State: " << mListToInstall.getStatus();
             QFile::remove(availableFileName);
             mSettings.remove("List/available");
             mSettings.remove("List/availableDate");
@@ -318,13 +320,14 @@
         qDebug() << "List already handled";
         return;
     } else {
-        qDebug() << "Handling list";
+        qDebug() << "Handling list: " << fileName << " Date: " << modDate;
     }
     mSettings.setValue("List/available", fileName);
     mSettings.setValue("List/availableDate", modDate);
 
     verifyListData();
-    if (!mListToInstall.isValid() || mListToInstall.date() <= mInstalledList.date()) {
+    if (!mListToInstall.isValid() || (mInstalledList.isValid() &&
+                mListToInstall.date() <= mInstalledList.date()) ) {
         if ( mListToInstall.date() <= mInstalledList.date()) {
             qDebug() << "Newest list on the server is older then the installed list. ";
             qDebug() << "Installed: " << mInstalledList.date();


More information about the Trustbridge-commits mailing list