https://git.reactos.org/?p=reactos.git;a=commitdiff;h=07f3691cd82df5ba4b951fdcfa956dad6578c5b9

commit 07f3691cd82df5ba4b951fdcfa956dad6578c5b9
Author:     Mark Jansen <mark.jan...@reactos.org>
AuthorDate: Sun Feb 18 15:27:08 2018 +0100
Commit:     Mark Jansen <mark.jan...@reactos.org>
CommitDate: Mon Feb 19 11:54:33 2018 +0100

    [RAPPS] Various fixes
    - Ask the user if they want to continue on cab certificate problems
    - Fix memory leaks in failure paths
    - Properly disable caching
---
 base/applications/rapps/include/resource.h |   3 +-
 base/applications/rapps/lang/bg-BG.rc      |   3 +-
 base/applications/rapps/lang/cs-CZ.rc      |   3 +-
 base/applications/rapps/lang/de-DE.rc      |   3 +-
 base/applications/rapps/lang/en-US.rc      |   3 +-
 base/applications/rapps/lang/es-ES.rc      |   3 +-
 base/applications/rapps/lang/fr-FR.rc      |   3 +-
 base/applications/rapps/lang/he-IL.rc      |   3 +-
 base/applications/rapps/lang/it-IT.rc      |   3 +-
 base/applications/rapps/lang/ja-JP.rc      |   3 +-
 base/applications/rapps/lang/no-NO.rc      |   3 +-
 base/applications/rapps/lang/pl-PL.rc      |   3 +-
 base/applications/rapps/lang/pt-BR.rc      |   3 +-
 base/applications/rapps/lang/ro-RO.rc      |   3 +-
 base/applications/rapps/lang/ru-RU.rc      |   3 +-
 base/applications/rapps/lang/sk-SK.rc      |   3 +-
 base/applications/rapps/lang/sq-AL.rc      |   3 +-
 base/applications/rapps/lang/sv-SE.rc      |   3 +-
 base/applications/rapps/lang/tr-TR.rc      |   3 +-
 base/applications/rapps/lang/uk-UA.rc      |   3 +-
 base/applications/rapps/lang/zh-CN.rc      |   3 +-
 base/applications/rapps/lang/zh-TW.rc      |   3 +-
 base/applications/rapps/loaddlg.cpp        | 107 ++++++++++++++++++-----------
 23 files changed, 111 insertions(+), 62 deletions(-)

diff --git a/base/applications/rapps/include/resource.h 
b/base/applications/rapps/include/resource.h
index 6e768227fa..9f4c4b15de 100644
--- a/base/applications/rapps/include/resource.h
+++ b/base/applications/rapps/include/resource.h
@@ -101,7 +101,7 @@
 #define IDS_UNABLE_TO_REMOVE     118
 #define IDS_UNABLE_TO_DOWNLOAD   119
 #define IDS_UNABLE_TO_DOWNLOAD2  120
-#define IDS_CERT_DOES_NOT_MATCH  121
+#define IDS_UNABLE_TO_QUERY_CERT 121
 #define IDS_INTEG_CHECK_TITLE    122
 #define IDS_INTEG_CHECK_FAIL     123
 #define IDS_INTERRUPTED_DOWNLOAD 124
@@ -110,6 +110,7 @@
 #define IDS_INSTALL_SELECTED     127
 #define IDS_UNABLE_TO_INSTALL    128
 #define IDS_SELECTEDFORINST      129
+#define IDS_MISMATCH_CERT_INFO   130
 
 /* Tooltips */
 #define IDS_TOOLTIP_INSTALL      200
diff --git a/base/applications/rapps/lang/bg-BG.rc 
b/base/applications/rapps/lang/bg-BG.rc
index e23799f519..3fbb5f420b 100644
--- a/base/applications/rapps/lang/bg-BG.rc
+++ b/base/applications/rapps/lang/bg-BG.rc
@@ -207,7 +207,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Премахването на данните за приложението от регистъра 
е невъзможно!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -215,6 +215,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/cs-CZ.rc 
b/base/applications/rapps/lang/cs-CZ.rc
index 19945538c3..21eef64d9a 100644
--- a/base/applications/rapps/lang/cs-CZ.rc
+++ b/base/applications/rapps/lang/cs-CZ.rc
@@ -208,7 +208,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Nepodařilo se odstranit data programu z registru!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -216,6 +216,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/de-DE.rc 
b/base/applications/rapps/lang/de-DE.rc
index 923787d607..749f3eb64b 100644
--- a/base/applications/rapps/lang/de-DE.rc
+++ b/base/applications/rapps/lang/de-DE.rc
@@ -203,7 +203,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Paket konnte nicht geladen werden! Prüfen Sie 
Ihre Internetverbindung!"
     IDS_UNABLE_TO_REMOVE "Konnte die Daten nicht aus der Registry löschen!"
     IDS_UNABLE_TO_INSTALL "Paket konnte nicht installiert werden!"
-    IDS_CERT_DOES_NOT_MATCH "Überprüfung des SSL-Zertifikats fehlgeschlagen."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Integritätsprüfung…"
     IDS_INTEG_CHECK_FAIL "Das Paket hat die Integritätsprüfung nicht 
bestanden. Mögliche Ursachen sind Übertragungsfehler, Datenbankfehler oder 
Manipulation durch einen Angreifer. Sie sollten die Software nicht ausführen."
     IDS_INTERRUPTED_DOWNLOAD "Übertragung unterbrochen. Prüfen Sie Ihre 
Internetverbindung!"
@@ -211,6 +211,7 @@ BEGIN
     IDS_SELECT_ALL "Alle/Keine"
     IDS_INSTALL_SELECTED "Ausgewählte Installieren"
     IDS_SELECTEDFORINST "Zur Installation ausgewählt"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/en-US.rc 
b/base/applications/rapps/lang/en-US.rc
index 3ecbc2c081..50f2ab1e95 100644
--- a/base/applications/rapps/lang/en-US.rc
+++ b/base/applications/rapps/lang/en-US.rc
@@ -203,7 +203,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the 
registry!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -211,6 +211,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/es-ES.rc 
b/base/applications/rapps/lang/es-ES.rc
index 015ad42745..1a2e5e0b7b 100644
--- a/base/applications/rapps/lang/es-ES.rc
+++ b/base/applications/rapps/lang/es-ES.rc
@@ -206,7 +206,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "No se pudieron borrar del Registro los datos de 
instalación del programa."
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "Ha fallado la comprobación del certificado SSL."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verificando integridad del paquete…"
     IDS_INTEG_CHECK_FAIL "El paquete no ha pasado la comprobación de 
integridad, puede haber sido alterado o estar corrupto. No se recomienda 
ejecutarlo."
     IDS_INTERRUPTED_DOWNLOAD "Se ha interrumpido la descarga por un error de 
red. Comprueba la conexión a Internet."
@@ -214,6 +214,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/fr-FR.rc 
b/base/applications/rapps/lang/fr-FR.rc
index 9c0b5777f4..6ed35f5836 100644
--- a/base/applications/rapps/lang/fr-FR.rc
+++ b/base/applications/rapps/lang/fr-FR.rc
@@ -203,7 +203,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Impossible de télécharger le paquet : vérifiez 
votre connexion à Internet !"
     IDS_UNABLE_TO_REMOVE "Impossible de supprimer du registre les données du 
programme !"
     IDS_UNABLE_TO_INSTALL "Impossible d'ouvrir l'installeur !"
-    IDS_CERT_DOES_NOT_MATCH "La vérification du certificat SSL a échoué."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Vérification de l'intégrité du paquet…"
     IDS_INTEG_CHECK_FAIL "Le contrôle d'intégrité du paquet a échoué, il se 
peut qu'il ait été corrompu ou altéré au cours du téléchargement. L'exécution 
du programme n'est pas recommandée."
     IDS_INTERRUPTED_DOWNLOAD "Le téléchargement a été interrompu. Vérifiez 
votre connexion à Internet."
@@ -211,6 +211,7 @@ BEGIN
     IDS_SELECT_ALL "Sélectionner/Désélectionner tout"
     IDS_INSTALL_SELECTED "Installer la sélection"
     IDS_SELECTEDFORINST "Sélectionnées pour installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/he-IL.rc 
b/base/applications/rapps/lang/he-IL.rc
index 3b09f0931e..6eb11e73b1 100644
--- a/base/applications/rapps/lang/he-IL.rc
+++ b/base/applications/rapps/lang/he-IL.rc
@@ -209,7 +209,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the 
registry!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -217,6 +217,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/it-IT.rc 
b/base/applications/rapps/lang/it-IT.rc
index 316d1c90a5..69f58d715a 100644
--- a/base/applications/rapps/lang/it-IT.rc
+++ b/base/applications/rapps/lang/it-IT.rc
@@ -203,7 +203,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Impossibile scaricare il pacchetto! Controlla la 
tua connessione internet!"
     IDS_UNABLE_TO_REMOVE "Impossibile cancellare i dati dal registro!"
     IDS_UNABLE_TO_INSTALL "Impossibile aprire l'installer!"
-    IDS_CERT_DOES_NOT_MATCH "Verifica del certificato SSL fallita."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifica integrità pacchetto…"
     IDS_INTEG_CHECK_FAIL "Il pacchetto non ha superato il controllo di 
integrità, potrebbe essere stato danneggiato o manomesso durante lo 
scaricamento. L'esecuzione del software non è raccomandata."
     IDS_INTERRUPTED_DOWNLOAD "Lo scaricamento è stato interrotto. Verificare 
la connessione a Internet."
@@ -211,6 +211,7 @@ BEGIN
     IDS_SELECT_ALL "Seleziona/Deseleziona Tutte"
     IDS_INSTALL_SELECTED "Installa le selezionate"
     IDS_SELECTEDFORINST "Selezionate per l'installazione"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/ja-JP.rc 
b/base/applications/rapps/lang/ja-JP.rc
index 75459912d7..227e07f5e0 100644
--- a/base/applications/rapps/lang/ja-JP.rc
+++ b/base/applications/rapps/lang/ja-JP.rc
@@ -203,7 +203,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "レジストリからこのプログラムに関するデータを削除できません!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -211,6 +211,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/no-NO.rc 
b/base/applications/rapps/lang/no-NO.rc
index 2799009115..c2d7a4835e 100644
--- a/base/applications/rapps/lang/no-NO.rc
+++ b/base/applications/rapps/lang/no-NO.rc
@@ -202,7 +202,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Unable to remove data on the program from the 
registry!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -210,6 +210,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/pl-PL.rc 
b/base/applications/rapps/lang/pl-PL.rc
index 2852d4b3c0..54549b0589 100644
--- a/base/applications/rapps/lang/pl-PL.rc
+++ b/base/applications/rapps/lang/pl-PL.rc
@@ -211,7 +211,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Nie można pobrać pakietu! Sprawdź połączenie z 
siecią!"
     IDS_UNABLE_TO_REMOVE "Nie można było usunąć wpisu z rejestru!"
     IDS_UNABLE_TO_INSTALL "Nie można uruchomić instalatora!"
-    IDS_CERT_DOES_NOT_MATCH "Weryfikacja certyfikatu SSL nieudana."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Weryfikowanie integralności pakietu…"
     IDS_INTEG_CHECK_FAIL "Pakiet nie przeszedł kontroli integralności, mógł 
zostać uszkodzony lub naruszony podczas pobierania. Uruchamianie tego programu 
nie jest zalecane."
     IDS_INTERRUPTED_DOWNLOAD "Pobieranie zostało przerwane. Sprawdź połączenie 
z siecią"
@@ -219,6 +219,7 @@ BEGIN
     IDS_SELECT_ALL "Zaznacz/Odznacz Wszystko"
     IDS_INSTALL_SELECTED "Instaluj Zaznaczone"
     IDS_SELECTEDFORINST "Wybrane do instalacji"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/pt-BR.rc 
b/base/applications/rapps/lang/pt-BR.rc
index 3e40ea0377..f4f1ffde91 100644
--- a/base/applications/rapps/lang/pt-BR.rc
+++ b/base/applications/rapps/lang/pt-BR.rc
@@ -205,7 +205,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Não foi possível remover as informações do programa 
do registro!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -213,6 +213,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/ro-RO.rc 
b/base/applications/rapps/lang/ro-RO.rc
index 8d2d4f55e1..0bb9498618 100644
--- a/base/applications/rapps/lang/ro-RO.rc
+++ b/base/applications/rapps/lang/ro-RO.rc
@@ -212,7 +212,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Pachetul nu poate fi descărcat! Verificați 
conexiunea de Internet!"
     IDS_UNABLE_TO_REMOVE "Datele de registru pentru acest program nu au putut 
fi eliminate!"
     IDS_UNABLE_TO_INSTALL "Programul de instalare nu poate fi executat!"
-    IDS_CERT_DOES_NOT_MATCH "Verificarea certificatului SSL a eșuat."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Integritatea pachetului în verificare…"
     IDS_INTEG_CHECK_FAIL "Pachetul nu a trecut de verificarea de integritate. 
Utilizarea programului nu este recomandată."
     IDS_INTERRUPTED_DOWNLOAD "Descărcarea a fost întreruptă. Verificați 
conexiunea la Internet."
@@ -220,6 +220,7 @@ BEGIN
     IDS_SELECT_ALL "Selectează/Deselectează Toate"
     IDS_INSTALL_SELECTED "Instalează selecționate"
     IDS_SELECTEDFORINST "Selectate pentru instalare"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/ru-RU.rc 
b/base/applications/rapps/lang/ru-RU.rc
index 85f31871a8..9a631a39d3 100644
--- a/base/applications/rapps/lang/ru-RU.rc
+++ b/base/applications/rapps/lang/ru-RU.rc
@@ -203,7 +203,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Не удалось скачать приложение! Проверьте 
подключение к сети Интернет!"
     IDS_UNABLE_TO_REMOVE "Не удалось удалить данные о программе из реестра!"
     IDS_UNABLE_TO_INSTALL "Не удалось завершить установку!"
-    IDS_CERT_DOES_NOT_MATCH "Ошибка проверки SSL сертификата."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Проверка целостности приложения…"
     IDS_INTEG_CHECK_FAIL "Приложение не прошло проверку целостности, возможно 
оно было повреждено или подменено. Запуск приложения не рекомендуется."
     IDS_INTERRUPTED_DOWNLOAD "Загрузка была прервана. Проверьте подключение к 
сети Интернет."
@@ -211,6 +211,7 @@ BEGIN
     IDS_SELECT_ALL "Выбрать все"
     IDS_INSTALL_SELECTED "Установить выбранное"
     IDS_SELECTEDFORINST "Выбрано для установки"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/sk-SK.rc 
b/base/applications/rapps/lang/sk-SK.rc
index e8233ee617..4eaa41a38b 100644
--- a/base/applications/rapps/lang/sk-SK.rc
+++ b/base/applications/rapps/lang/sk-SK.rc
@@ -208,7 +208,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Nie je možné odstrániť z registrov údaje o programe!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -216,6 +216,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/sq-AL.rc 
b/base/applications/rapps/lang/sq-AL.rc
index 2415b5d685..8e2e338d18 100644
--- a/base/applications/rapps/lang/sq-AL.rc
+++ b/base/applications/rapps/lang/sq-AL.rc
@@ -207,7 +207,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "E pamundur te fshihen informacionet e programit nga 
regjistri!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -215,6 +215,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/sv-SE.rc 
b/base/applications/rapps/lang/sv-SE.rc
index df91a696f0..56f06fe7e6 100644
--- a/base/applications/rapps/lang/sv-SE.rc
+++ b/base/applications/rapps/lang/sv-SE.rc
@@ -210,7 +210,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "Det gick ej att ta bort programmets data från 
registret!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL certificate verification failed."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Verifying package integrity…"
     IDS_INTEG_CHECK_FAIL "The package did not pass the integrity check, it may 
have been corrupted or tampered with during downloading. Running the software 
is not recommended."
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -218,6 +218,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/tr-TR.rc 
b/base/applications/rapps/lang/tr-TR.rc
index b389825f20..a46e0a98e0 100644
--- a/base/applications/rapps/lang/tr-TR.rc
+++ b/base/applications/rapps/lang/tr-TR.rc
@@ -205,7 +205,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Paket indirilemez! Umûmî Ağ bağlantınızı 
yoklayınız!"
     IDS_UNABLE_TO_REMOVE "İzlencenin girişi değer defterinden silinemiyor."
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL onay belgesi doğrulaması başarısız."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Paket bütünlüğü doğrulanıyor…"
     IDS_INTEG_CHECK_FAIL "Paket bütünlük denetimini geçmedi, bozulmuş veyâ 
indirme esnâsında oynanmış olabilir. Yazılımı çalıştırmak önerilmez."
     IDS_INTERRUPTED_DOWNLOAD "İndirme kesildi. Umûmî Ağ bağlantınızı 
denetleyiniz."
@@ -213,6 +213,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/uk-UA.rc 
b/base/applications/rapps/lang/uk-UA.rc
index b75be5cedd..08788f7e8b 100644
--- a/base/applications/rapps/lang/uk-UA.rc
+++ b/base/applications/rapps/lang/uk-UA.rc
@@ -211,7 +211,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Неможливо завантажити додаток! Перевірте 
підключення до мережі Інтернет!"
     IDS_UNABLE_TO_REMOVE "Не вдалося видалити дані про програму з реєстру!"
     IDS_UNABLE_TO_INSTALL "Не вдалося завершити інсталювання!"
-    IDS_CERT_DOES_NOT_MATCH "Помилка перевіки сертифікату SSL."
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "Перевірка цілістності додатку…"
     IDS_INTEG_CHECK_FAIL "Додаток не пройшов перевірку цілістності, його молги 
пошкодити чи замінити. Запуск додатку не рекомендується."
     IDS_INTERRUPTED_DOWNLOAD "Завантаження перервано. Перевірте підключення до 
мережі Інтернет."
@@ -219,6 +219,7 @@ BEGIN
     IDS_SELECT_ALL "Вибрати все"
     IDS_INSTALL_SELECTED "Встановити обране"
     IDS_SELECTEDFORINST "Обрані для встановлення"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/zh-CN.rc 
b/base/applications/rapps/lang/zh-CN.rc
index 88e6b28b14..e7431800c3 100644
--- a/base/applications/rapps/lang/zh-CN.rc
+++ b/base/applications/rapps/lang/zh-CN.rc
@@ -205,7 +205,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "无法下载该软件包!请检查网络连接!"
     IDS_UNABLE_TO_REMOVE "无法从注册表删除该程序的数据!"
     IDS_UNABLE_TO_INSTALL "无法打开安装程序!"
-    IDS_CERT_DOES_NOT_MATCH "SSL 证书验证失败。"
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "正在验证包完整性…"
     IDS_INTEG_CHECK_FAIL "这个包没有通过完整性验证,它可能在下载过程中损坏或被人为篡改了。不推荐运行这个程序。"
     IDS_INTERRUPTED_DOWNLOAD "下载中断。请检查网络连接。"
@@ -213,6 +213,7 @@ BEGIN
     IDS_SELECT_ALL "全选/全反选"
     IDS_INSTALL_SELECTED "安装已选中的"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/lang/zh-TW.rc 
b/base/applications/rapps/lang/zh-TW.rc
index 12bcc373f7..fa7ef74026 100644
--- a/base/applications/rapps/lang/zh-TW.rc
+++ b/base/applications/rapps/lang/zh-TW.rc
@@ -205,7 +205,7 @@ BEGIN
     IDS_UNABLE_TO_DOWNLOAD2 "Unable to download the package! Check Internet 
Connection!"
     IDS_UNABLE_TO_REMOVE "無法從登錄檔刪除該程式的資料!"
     IDS_UNABLE_TO_INSTALL "Unable to open installer!"
-    IDS_CERT_DOES_NOT_MATCH "SSL 憑證驗證失敗。"
+    IDS_UNABLE_TO_QUERY_CERT "Unable to retrieve certificate info.\n\nDo you 
want to continue anyway?"
     IDS_INTEG_CHECK_TITLE "驗證套裝軟體的完整性…"
     IDS_INTEG_CHECK_FAIL "包沒有通過完整性檢查,它可能已損壞,或者在下載過程中篡改。建議您不要運行該軟體。"
     IDS_INTERRUPTED_DOWNLOAD "The download was interrupted. Check connection 
to Internet."
@@ -213,6 +213,7 @@ BEGIN
     IDS_SELECT_ALL "Select/Deselect All"
     IDS_INSTALL_SELECTED "Install Selected"
     IDS_SELECTEDFORINST "Selected for installation"
+    IDS_MISMATCH_CERT_INFO "The certificate used is unknown:\nSubject: 
%s\nIssuer: %s\nDo you want to continue anyway?"
 END
 
 STRINGTABLE
diff --git a/base/applications/rapps/loaddlg.cpp 
b/base/applications/rapps/loaddlg.cpp
index 8e2e76ac44..30aa4a2f3c 100644
--- a/base/applications/rapps/loaddlg.cpp
+++ b/base/applications/rapps/loaddlg.cpp
@@ -331,11 +331,24 @@ HRESULT WINAPI CDownloadDialog_Constructor(HWND Dlg, BOOL 
*pbCancelled, REFIID r
 }
 
 #ifdef USE_CERT_PINNING
-static BOOL CertIsValid(HINTERNET hFile, LPWSTR lpszHostName)
+typedef CHeapPtr<char, CLocalAllocator> CLocalPtr;
+
+static BOOL CertGetSubjectAndIssuer(HINTERNET hFile, CLocalPtr& subjectInfo, 
CLocalPtr& issuerInfo)
 {
     DWORD certInfoLength;
     INTERNET_CERTIFICATE_INFOA certInfo;
-    int ValidFlags = 0;
+    DWORD size, flags;
+
+    size = sizeof(flags);
+    if (!InternetQueryOptionA(hFile, INTERNET_OPTION_SECURITY_FLAGS, &flags, 
&size))
+    {
+        return FALSE;
+    }
+
+    if (!flags & SECURITY_FLAG_SECURE)
+    {
+        return FALSE;
+    }
 
     /* Despite what the header indicates, the implementation of 
INTERNET_CERTIFICATE_INFO is not Unicode-aware. */
     certInfoLength = sizeof(certInfo);
@@ -347,18 +360,9 @@ static BOOL CertIsValid(HINTERNET hFile, LPWSTR 
lpszHostName)
         return FALSE;
     }
 
-    if (certInfo.lpszSubjectInfo)
-    {
-        if (strcmp(certInfo.lpszSubjectInfo, CERT_SUBJECT_INFO) == 0)
-            ValidFlags |= 1;
-        LocalFree(certInfo.lpszSubjectInfo);
-    }
-    if (certInfo.lpszIssuerInfo)
-    {
-        if (strcmp(certInfo.lpszIssuerInfo, CERT_ISSUER_INFO) == 0)
-            ValidFlags |= 2;
-        LocalFree(certInfo.lpszIssuerInfo);
-    }
+    subjectInfo.Attach(certInfo.lpszSubjectInfo);
+    issuerInfo.Attach(certInfo.lpszIssuerInfo);
+
     if (certInfo.lpszProtocolName)
         LocalFree(certInfo.lpszProtocolName);
     if (certInfo.lpszSignatureAlgName)
@@ -366,13 +370,13 @@ static BOOL CertIsValid(HINTERNET hFile, LPWSTR 
lpszHostName)
     if (certInfo.lpszEncryptionAlgName)
         LocalFree(certInfo.lpszEncryptionAlgName);
 
-    return ValidFlags == 3;
+    return certInfo.lpszSubjectInfo && certInfo.lpszIssuerInfo;
 }
 #endif
 
 inline VOID MessageBox_LoadString(HWND hMainWnd, INT StringID)
 {
-    ATL::CString szMsgText;
+    ATL::CStringW szMsgText;
     if (szMsgText.LoadStringW(StringID))
     {
         MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, MB_OK | 
MB_ICONERROR);
@@ -616,6 +620,19 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
             SendMessageW(Item, PBM_SETPOS, 0, 0);
         }
 
+        // is this URL an update package for RAPPS? if so store it in a 
different place
+        if (InfoArray[iAppId].szUrl == APPLICATION_DATABASE_URL)
+        {
+            bCab = TRUE;
+            if (!GetStorageDirectory(Path))
+                goto end;
+        }
+        else
+        {
+            bCab = FALSE;
+            Path = SettingsInfo.szDownloadDir;
+        }
+
         // Change caption to show the currently downloaded app
         if (!bCab)
         {
@@ -644,18 +661,6 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
         if (q && q > p && (q - p) > 0)
             filenameLength -= wcslen(q - 1) * sizeof(WCHAR);
 
-        // is this URL an update package for RAPPS? if so store it in a 
different place
-        if (InfoArray[iAppId].szUrl == APPLICATION_DATABASE_URL)
-        {
-            bCab = TRUE;
-            if (!GetStorageDirectory(Path))
-                goto end;
-        }
-        else
-        {
-            Path = SettingsInfo.szDownloadDir;
-        }
-
         // is the path valid? can we access it?
         if (GetFileAttributesW(Path.GetString()) == INVALID_FILE_ATTRIBUTES)
         {
@@ -690,6 +695,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
         switch (SettingsInfo.Proxy)
         {
         case 0: // preconfig
+        default:
             hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, 
NULL, NULL, 0);
             break;
         case 1: // direct (no proxy)
@@ -698,15 +704,14 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
         case 2: // use proxy
             hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PROXY, 
SettingsInfo.szProxyServer, SettingsInfo.szNoProxyFor, 0);
             break;
-        default: // preconfig
-            hOpen = InternetOpenW(lpszAgent, INTERNET_OPEN_TYPE_PRECONFIG, 
NULL, NULL, 0);
-            break;
         }
 
         if (!hOpen)
             goto end;
 
-        hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), 
NULL, 0, INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_KEEP_CONNECTION, 0);
+        hFile = InternetOpenUrlW(hOpen, InfoArray[iAppId].szUrl.GetString(), 
NULL, 0,
+                                 INTERNET_FLAG_DONT_CACHE | 
INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_KEEP_CONNECTION,
+                                 0);
 
         if (!hFile)
         {
@@ -740,7 +745,7 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
         dwContentLen = 0;
 
         if (urlComponents.nScheme == INTERNET_SCHEME_HTTP || 
urlComponents.nScheme == INTERNET_SCHEME_HTTPS)
-            HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | 
HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatus, 0);
+            HttpQueryInfoW(hFile, HTTP_QUERY_CONTENT_LENGTH | 
HTTP_QUERY_FLAG_NUMBER, &dwContentLen, &dwStatusLen, 0);
 
         if (urlComponents.nScheme == INTERNET_SCHEME_FTP)
             dwContentLen = FtpGetFileSize(hFile, &dwStatus);
@@ -751,20 +756,42 @@ DWORD WINAPI CDownloadManager::ThreadFunc(LPVOID param)
             SetProgressMarquee(Item, TRUE);
         }
 
+        free(urlComponents.lpszScheme);
+        free(urlComponents.lpszHostName);
+
 #ifdef USE_CERT_PINNING
         // are we using HTTPS to download the RAPPS update package? check if 
the certificate is original
         if ((urlComponents.nScheme == INTERNET_SCHEME_HTTPS) &&
-            (wcscmp(InfoArray[iAppId].szUrl, APPLICATION_DATABASE_URL) == 0) &&
-            (!CertIsValid(hFile, urlComponents.lpszHostName)))
+            (wcscmp(InfoArray[iAppId].szUrl, APPLICATION_DATABASE_URL) == 0))
         {
-            MessageBox_LoadString(hMainWnd, IDS_CERT_DOES_NOT_MATCH);
-            goto end;
+            CLocalPtr subjectName, issuerName;
+            CStringW szMsgText;
+            bool bAskQuestion = false;
+            if (!CertGetSubjectAndIssuer(hFile, subjectName, issuerName))
+            {
+                szMsgText.LoadStringW(IDS_UNABLE_TO_QUERY_CERT);
+                bAskQuestion = true;
+            }
+            else
+            {
+                if (strcmp(subjectName, CERT_SUBJECT_INFO) ||
+                    strcmp(issuerName, CERT_ISSUER_INFO))
+                {
+                    szMsgText.Format(IDS_MISMATCH_CERT_INFO, 
(char*)subjectName, (const char*)issuerName);
+                    bAskQuestion = true;
+                }
+            }
+
+            if (bAskQuestion)
+            {
+                if (MessageBoxW(hMainWnd, szMsgText.GetString(), NULL, 
MB_YESNO | MB_ICONERROR) != IDYES)
+                {
+                    goto end;
+                }
+            }
         }
 #endif
 
-        free(urlComponents.lpszScheme);
-        free(urlComponents.lpszHostName);
-
         hOut = CreateFileW(Path.GetString(), GENERIC_WRITE, FILE_SHARE_READ | 
FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, 0, NULL);
 
         if (hOut == INVALID_HANDLE_VALUE)

Reply via email to