Skip to content

Commit

Permalink
Update diagnostics (open-eid#1192)
Browse files Browse the repository at this point in the history
IB-7697

Signed-off-by: Raul Metsma <[email protected]>
  • Loading branch information
metsma authored May 19, 2023
1 parent b08eff0 commit c3c7332
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
22 changes: 11 additions & 11 deletions client/Diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,27 @@

void Diagnostics::generalInfo(QTextStream &s)
{
s << "<b>" << tr("Arguments:") << "</b> " << qApp->arguments().join(' ') << "<br />"
s << "<b>" << tr("Arguments:") << "</b> " << Application::arguments().join(' ') << "<br />"
<< "<b>" << tr("Library paths:") << "</b> " << QCoreApplication::libraryPaths().join(';') << "<br />"
<< "<b>" << "URLs:" << "</b>"
#ifdef CONFIG_URL
<< "<br />CONFIG_URL: " << CONFIG_URL
#endif
<< "<br />SID-PROXY-URL: " << qApp->confValue(QLatin1String("SID-PROXY-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SIDV2-PROXY-URL: " << qApp->confValue(QLatin1String("SIDV2-PROXY-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SID-SK-URL: " << qApp->confValue(QLatin1String("SID-SK-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SIDV2-SK-URL: " << qApp->confValue(QLatin1String("SIDV2-SK-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SID-PROXY-URL: " << Application::confValue(QLatin1String("SID-PROXY-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SIDV2-PROXY-URL: " << Application::confValue(QLatin1String("SIDV2-PROXY-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SID-SK-URL: " << Application::confValue(QLatin1String("SID-SK-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />SIDV2-SK-URL: " << Application::confValue(QLatin1String("SIDV2-SK-URL")).toString(QStringLiteral(SMARTID_URL))
<< "<br />MID-PROXY-URL: " << Settings::MID_PROXY_URL
<< "<br />MID-SK-URL: " << Settings::MID_SK_URL
<< "<br />RPUUID: " << (Settings::MID_UUID_CUSTOM ? tr("is set manually") : tr("is set by default"))
<< "<br />TSL_URL: " << qApp->confValue(Application::TSLUrl).toString()
<< "<br />TSA_URL: " << qApp->confValue(Application::TSAUrl).toString()
<< "<br />SIVA_URL: " << qApp->confValue(Application::SiVaUrl).toString()
<< "<br />TSL_URL: " << Application::confValue(Application::TSLUrl).toString()
<< "<br />TSA_URL: " << Application::confValue(Application::TSAUrl).toString()
<< "<br />SIVA_URL: " << Application::confValue(Application::SiVaUrl).toString()
<< "<br /><br /><b>" << tr("TSL signing certs") << ":</b>";
for(const QSslCertificate &cert: qApp->confValue(Application::TSLCerts).value<QList<QSslCertificate>>())
for(const QSslCertificate &cert: Application::confValue(Application::TSLCerts).value<QList<QSslCertificate>>())
s << "<br />" << cert.subjectInfo("CN").value(0);
s << "<br /><br /><b>" << tr("TSL cache") << ":</b>";
QString cache = qApp->confValue(Application::TSLCache).toString();
QString cache = Application::confValue(Application::TSLCache).toString();
const QStringList tsllist = QDir(cache).entryList({QStringLiteral("*.xml")});
for(const QString &file: tsllist)
{
Expand All @@ -61,7 +61,7 @@ void Diagnostics::generalInfo(QTextStream &s)

#ifdef CONFIG_URL
s << "<b>" << tr("Central Configuration") << ":</b>";
QJsonObject metainf = qApp->confValue(QLatin1String("META-INF")).toObject();
QJsonObject metainf = Application::confValue(QLatin1String("META-INF")).toObject();
for(QJsonObject::const_iterator i = metainf.constBegin(), end = metainf.constEnd(); i != end; ++i)
{
if(i.value().type() == QJsonValue::Double)
Expand Down
23 changes: 12 additions & 11 deletions client/Diagnostics_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

static QString getUserRights()
{
HANDLE hToken = nullptr;
HANDLE hToken {};
if ( !OpenThreadToken( GetCurrentThread(), TOKEN_QUERY, TRUE, &hToken ) )
{
if ( GetLastError() != ERROR_NO_TOKEN )
Expand All @@ -41,7 +41,7 @@ static QString getUserRights()
return Diagnostics::tr( "Unknown - error %1" ).arg( GetLastError() );
}

DWORD dwLength = 0;
DWORD dwLength {};
if(!GetTokenInformation(hToken, TokenGroups, nullptr, dwLength, &dwLength))
{
if( GetLastError() != ERROR_INSUFFICIENT_BUFFER )
Expand All @@ -55,7 +55,7 @@ static QString getUserRights()

QString rights = Diagnostics::tr( "User" );
SID_IDENTIFIER_AUTHORITY NtAuthority = SECURITY_NT_AUTHORITY;
PSID AdministratorsGroup = nullptr;
PSID AdministratorsGroup {};
if( AllocateAndInitializeSid( &NtAuthority, 2, SECURITY_BUILTIN_DOMAIN_RID,
DOMAIN_ALIAS_RID_ADMINS, 0, 0, 0, 0, 0, 0, &AdministratorsGroup ) )
{
Expand Down Expand Up @@ -96,7 +96,7 @@ QStringList Diagnostics::packages(const QStringList &names, bool withName)
if(!type.contains(QStringLiteral("Update"), Qt::CaseInsensitive) &&
!name.contains(QStringLiteral("Update"), Qt::CaseInsensitive) &&
name.contains(QRegularExpression(names.join('|').prepend('^'), QRegularExpression::CaseInsensitiveOption)))
packages << packageName(name, version, withName);
packages.append(packageName(name, version, withName));
s.endGroup();
}
}
Expand All @@ -112,7 +112,7 @@ void Diagnostics::run()
s << "<b>" << tr("Locale:") << "</b> ";
QLocale::Language language = QLocale::system().language();
QString locale = (language == QLocale::C ? "English/United States" : QLocale::languageToString( language ) );
CPINFOEX CPInfoEx;
CPINFOEX CPInfoEx {};
if( GetCPInfoEx( GetConsoleCP(), 0, &CPInfoEx ) != 0 )
locale.append(" / ").append(QString::fromWCharArray(CPInfoEx.CodePageName));
s << locale << "<br />";
Expand Down Expand Up @@ -152,19 +152,20 @@ void Diagnostics::run()
"digidoc", "digidocpp", "qdigidoc4.exe", "qdigidocclient.exe", "qesteidutil.exe", "id-updater.exe", "qdigidoc_tera_gui.exe",
"esteidcm", "esteidcm64", "EstIDMinidriver", "EstIDMinidriver64", "onepin-opensc-pkcs11", "EsteidShellExtension",
"esteid-plugin-ie", "esteid-plugin-ie64", "chrome-token-signing.exe", "web-eid.exe",
"zlib1", "libeay32", "ssleay32", "libcrypto-1_1", "libssl-1_1", "libcrypto-1_1-x64", "libssl-1_1-x64", "xerces-c_3_1", "xerces-c_3_2", "xsec_1_7", "xsec_2_0", "libxml2",
"libcrypto-3", "libssl-3", "libcrypto-3-x64", "libssl-3-x64", "libcrypto-1_1", "libssl-1_1", "libcrypto-1_1-x64", "libssl-1_1-x64",
"zlib1", "xerces-c_3_1", "xerces-c_3_2", "xalan-c_1_12", "xalanmessages_1_12", "xsec_1_7", "xsec_2_0", "libxml2",
"advapi32", "crypt32", "winscard"};
for(const QString &lib: dlls)
{
DWORD infoHandle = 0;
DWORD infoHandle {};
DWORD sz = GetFileVersionInfoSize(LPCWSTR(lib.utf16()), &infoHandle);
if( !sz )
continue;
QByteArray data(int(sz * 2), 0);
if( !GetFileVersionInfoW( LPCWSTR(lib.utf16()), 0, sz, data.data() ) )
continue;
VS_FIXEDFILEINFO *info = nullptr;
UINT len = 0;
VS_FIXEDFILEINFO *info {};
UINT len {};
if( !VerQueryValueW( data.constData(), L"\\", (LPVOID*)&info, &len ) )
continue;
s << QStringLiteral("%1 (%2.%3.%4.%5)").arg(lib)
Expand All @@ -189,14 +190,14 @@ void Diagnostics::run()
{
if( SC_HANDLE s = OpenService( h, L"atrfiltr", SERVICE_QUERY_STATUS ) )
{
SERVICE_STATUS status;
SERVICE_STATUS status {};
QueryServiceStatus( s, &status );
atrfiltr = (status.dwCurrentState == SERVICE_RUNNING) ? Running : Stopped;
CloseServiceHandle( s );
}
if( SC_HANDLE s = OpenService( h, L"CertPropSvc", SERVICE_QUERY_STATUS ))
{
SERVICE_STATUS status;
SERVICE_STATUS status {};
QueryServiceStatus( s, &status );
certprop = (status.dwCurrentState == SERVICE_RUNNING) ? Running : Stopped;
CloseServiceHandle( s );
Expand Down
2 changes: 1 addition & 1 deletion cmake

0 comments on commit c3c7332

Please sign in to comment.