Mercurial > trustbridge
diff ui/installwrapper.cpp @ 1084:b8fb6bf7f980
(issue118) Add signature check for cinst.exe and mozilla.exe
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 11 Sep 2014 15:17:39 +0200 |
parents | a12e6172d82c |
children | a7a72353d6d2 |
line wrap: on
line diff
--- a/ui/installwrapper.cpp Thu Sep 11 15:24:02 2014 +0200 +++ b/ui/installwrapper.cpp Thu Sep 11 15:17:39 2014 +0200 @@ -16,6 +16,7 @@ #include "logging.h" #include "util.h" +#include "binverify.h" #define INSTALL_TIMEOUT 3600000 /* Wait up to an hour */ @@ -79,6 +80,15 @@ } #ifdef WIN32 + bin_verify_result vres = verify_binary(cinstFileName.toUtf8().constData(), + cinstFileName.toUtf8().size()); + + if (vres.result != VerifyValid) { + emit error(tr("Integrity check of the certificate installation process failed. ") + + "\n" + tr("Please reinstall the Software.")); + return; + } + /* QProcess on Windows uses CreateProcess but we have to * use the runas shell command to get the UAC prompt if necessary. * So we have to handle the process ourself. Starting with @@ -116,6 +126,7 @@ QString qerrmsg = QString::fromUtf8(errmsg); free(errmsg); emit error(tr("Error executing process: %1").arg(qerrmsg)); + fclose(vres.fptr); return; } @@ -127,9 +138,11 @@ QString qerrmsg = QString::fromUtf8(errmsg); free(errmsg); emit error (tr("Error monitoring process: %1").arg(qerrmsg)); + fclose(vres.fptr); return; } else { emit error (tr("Certificate installation timed out.")); + fclose(vres.fptr); return; } } @@ -144,9 +157,11 @@ free(errmsg); emit error (tr("Failed to check process status: %1").arg(qerrmsg)); CloseHandle(shExecInfo.hProcess); + fclose(vres.fptr); return; } CloseHandle(shExecInfo.hProcess); + fclose(vres.fptr); if (retval != 0) { /* TODO make this nicer */